diff options
Diffstat (limited to 'test/bindings/java')
20 files changed, 0 insertions, 824 deletions
diff --git a/test/bindings/java/build.properties b/test/bindings/java/build.properties deleted file mode 100644 index dd0fe62..0000000 --- a/test/bindings/java/build.properties +++ /dev/null @@ -1,9 +0,0 @@ -# Default path on Windows (maybe with an '(x86)' in there for good measure) -#umundo.jar=C:\\Program Files\\uMundo\\share\\umundo\\lib\\umundo.jar - -# Default path on MacOSX and Linux -uscxml.library.path=/usr/local/share/uscxml/bindings/java -uscxml.jar=/usr/local/share/uscxml/bindings/uscxml.jar - -jexl.jar=libs/commons-jexl3-3.0.jar -logging.jar=libs/commons-logging-1.2.jar
\ No newline at end of file diff --git a/test/bindings/java/build.xml b/test/bindings/java/build.xml deleted file mode 100644 index 2f1f362..0000000 --- a/test/bindings/java/build.xml +++ /dev/null @@ -1,43 +0,0 @@ -<project name="java-tests" default="test-w3c">
-
- <property environment="env"/>
-
- <property file="build.properties" />
- <property name="src" value="." />
- <property name="bin" value="bin" />
- <!-- <property name="test.file" value="..." /> -->
-
- <!-- Allow to override actual value with environment .. yes ant sucks -->
- <condition property="real.uscxml.jar" value="${env.USCXML_JAVA_JAR}" else="${uscxml.jar}">
- <isset property="env.USCXML_JAVA_JAR" />
- </condition>
-
- <target name="clean">
- <delete dir="${bin}" />
- </target>
-
- <target name="compile">
- <mkdir dir="${bin}" />
- <javac destdir="${bin}" debuglevel="lines,vars,source" debug="on"
- encoding="utf-8" includeantruntime="false">
- <src path="${src}" />
- <classpath>
- <pathelement location="${real.uscxml.jar}" />
- <pathelement location="${jexl.jar}" />
- <pathelement location="${logging.jar}" />
- </classpath>
- <include name="**/*.java" />
- </javac>
- </target>
-
- <target name="test-w3c">
- <antcall target="test-w3c-jexl" />
-
- </target>
-
- <target name="test-w3c-jexl" depends="compile">
- <java classpath="${real.uscxml.jar}:${jexl.jar}:${logging.jar}:${bin}" classname="org.uscxml.tests.JexlDataModelTest">
- <arg value="${test.file}"/>
- </java>
- </target>
-</project>
\ No newline at end of file diff --git a/test/bindings/java/libs/commons-jexl3-3.0.jar b/test/bindings/java/libs/commons-jexl3-3.0.jar Binary files differdeleted file mode 100644 index 94566bf..0000000 --- a/test/bindings/java/libs/commons-jexl3-3.0.jar +++ /dev/null diff --git a/test/bindings/java/libs/commons-logging-1.2.jar b/test/bindings/java/libs/commons-logging-1.2.jar Binary files differdeleted file mode 100644 index 93a3b9f..0000000 --- a/test/bindings/java/libs/commons-logging-1.2.jar +++ /dev/null diff --git a/test/bindings/java/org/uscxml/apache/commons/scxml2/Context.java b/test/bindings/java/org/uscxml/apache/commons/scxml2/Context.java deleted file mode 100644 index a0208c9..0000000 --- a/test/bindings/java/org/uscxml/apache/commons/scxml2/Context.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.uscxml.apache.commons.scxml2; - -import org.uscxml.DataModel; - -public class Context { - public DataModel dm = null; -} diff --git a/test/bindings/java/org/uscxml/apache/commons/scxml2/Evaluator.java b/test/bindings/java/org/uscxml/apache/commons/scxml2/Evaluator.java deleted file mode 100644 index 5bd5642..0000000 --- a/test/bindings/java/org/uscxml/apache/commons/scxml2/Evaluator.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.uscxml.apache.commons.scxml2; - -public abstract class Evaluator { - - public abstract Context newContext(Object object); - -} diff --git a/test/bindings/java/org/uscxml/apache/commons/scxml2/JexlEvaluator.java b/test/bindings/java/org/uscxml/apache/commons/scxml2/JexlEvaluator.java deleted file mode 100644 index 127bed3..0000000 --- a/test/bindings/java/org/uscxml/apache/commons/scxml2/JexlEvaluator.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.uscxml.apache.commons.scxml2; - -import org.uscxml.Factory; -import org.uscxml.dm.jexl.JexlDataModel; - -public class JexlEvaluator extends Evaluator { - - public JexlEvaluator() { - - } - - @Override - public Context newContext(Object object) { - // TODO Auto-generated method stub - Context ctx = new Context(); - ctx.dm = new JexlDataModel(); - return ctx; - } -} diff --git a/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXML.java b/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXML.java deleted file mode 100644 index 67e5b1f..0000000 --- a/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXML.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.uscxml.apache.commons.scxml2; - -import java.net.URL; - -public class SCXML { - public URL url = null; - -} diff --git a/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java b/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java deleted file mode 100644 index 704e897..0000000 --- a/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLExecutor.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.uscxml.apache.commons.scxml2; - -import java.net.URL; - -import org.uscxml.ActionLanguage; -import org.uscxml.Factory; -import org.uscxml.Interpreter; -import org.uscxml.InterpreterException; -import org.uscxml.InterpreterState; -import org.uscxml.helper.TestMonitor; - -public class SCXMLExecutor { - - public Interpreter interpreter = null; - public URL sourceURL = null; - public ActionLanguage al = new ActionLanguage(); - - public SCXMLExecutor(Evaluator evaluator, Object object, SimpleErrorReporter simpleErrorReporter) { - // TODO Auto-generated constructor stub - } - - public void setStateMachine(SCXML scxml) { - sourceURL = scxml.url; - } - - public void setRootContext(Context rootContext) { - al.setDataModel(rootContext.dm); - } - - public void go() { - try { - interpreter = Interpreter.fromURL(sourceURL.toString()); - interpreter.setActionLanguage(al); - - TestMonitor tm = new TestMonitor(); - interpreter.addMonitor(tm); - - InterpreterState state = InterpreterState.USCXML_UNDEF; - while(state != InterpreterState.USCXML_FINISHED) { - interpreter.step(); - } - - } catch (InterpreterException e) { - e.printStackTrace(); - } - - } - -} diff --git a/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLReader.java b/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLReader.java deleted file mode 100644 index 45c2a54..0000000 --- a/test/bindings/java/org/uscxml/apache/commons/scxml2/SCXMLReader.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.uscxml.apache.commons.scxml2; - -import java.net.URL; - -public class SCXMLReader { - - public static SCXML read(URL scxml) { - SCXML foo = new SCXML(); - foo.url = scxml; - return foo; - } - -} diff --git a/test/bindings/java/org/uscxml/apache/commons/scxml2/SimpleErrorReporter.java b/test/bindings/java/org/uscxml/apache/commons/scxml2/SimpleErrorReporter.java deleted file mode 100644 index 06187f8..0000000 --- a/test/bindings/java/org/uscxml/apache/commons/scxml2/SimpleErrorReporter.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.uscxml.apache.commons.scxml2; - -public class SimpleErrorReporter { - -} diff --git a/test/bindings/java/org/uscxml/dm/jexl/JEXLDataModel.java b/test/bindings/java/org/uscxml/dm/jexl/JEXLDataModel.java deleted file mode 100644 index cd9d175..0000000 --- a/test/bindings/java/org/uscxml/dm/jexl/JEXLDataModel.java +++ /dev/null @@ -1,267 +0,0 @@ -package org.uscxml.dm.jexl; - -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.jexl3.JexlBuilder; -import org.apache.commons.jexl3.JexlEngine; -import org.apache.commons.jexl3.JexlException; -import org.apache.commons.jexl3.JexlExpression; -import org.apache.commons.jexl3.MapContext; -import org.uscxml.Data; -import org.uscxml.DataList; -import org.uscxml.DataMap; -import org.uscxml.DataModel; -import org.uscxml.DataModelExtension; -import org.uscxml.ErrorEvent; -import org.uscxml.Event; -import org.uscxml.StringList; -import org.uscxml.StringVector; - -public class JexlDataModel extends DataModel { - - protected static final JexlEngine jexl = new JexlBuilder().cache(512).strict(true).silent(false).create(); - public MapContext ctx = new MapContext(); - - @Override - public void addExtension(DataModelExtension ext) { - throw new UnsupportedOperationException("Cannot add extensions to the jexl datamodel"); - } - - @Override - public StringList getNames() { - StringList names = new StringList(); - names.add("jexl"); - return names; - } - - @Override - public DataModel create() { - JexlDataModel dm = new JexlDataModel(); - return dm; - } - - @Override - public boolean isValidSyntax(String expr) { - try { - jexl.createExpression(expr); - return true; - } catch(JexlException e) { - return false; - } - } - - @Override - public void setEvent(Event event) { - ctx.set("_event", event); - } - - @Override - public Data getAsData(String content) { - try { - JexlExpression ex = jexl.createExpression(content); - return getJexlObjectAsData(ex.evaluate(ctx)); - } catch(Exception e) { - } - return null; - } - - @Override - public Data evalAsData(String content) { - JexlExpression expr = jexl.createExpression(content); - Data d = getJexlObjectAsData(expr.evaluate(ctx)); -// d.setAtom(expr.getParsedText()); -// d.setType(Data.Type.VERBATIM); - return d; - } - - @Override - public boolean evalAsBool(String expr) { - try { - JexlExpression ex = jexl.createExpression("!!" + expr); - Object result = ex.evaluate(ctx); - return (Boolean) result; - } catch(Exception e) { - e.printStackTrace(); - } - return false; - } - - @Override - public long getLength(String expr) { - try { - JexlExpression ex = jexl.createExpression(expr); - Object res = ex.evaluate(ctx); - - return Array.getLength(res); - - } catch(Exception e) { - throw new ErrorEvent("Cannot evaluate '" + expr + "' as an array: " + e.getMessage()); - } - } - - @Override - public void setForeach(String item, String array, String index, long iteration) { - Object res = null; - try { - JexlExpression ex = jexl.createExpression(array); - res = ex.evaluate(ctx); - } catch(Exception e) { - throw new ErrorEvent("Cannot evaluate '" + array + "' as an array: " + e.getMessage()); - } - try { - JexlExpression ex = jexl.createExpression(item + "==" + item + ";"); - ex.evaluate(ctx); - - ctx.set(item, Array.get(res, (int) iteration)); - } catch(Exception e) { - throw new ErrorEvent("Cannot set item '" + item + "' to current item: " + e.getMessage()); - } - try { - if (index.length() > 0) { - ctx.set(index, iteration); - } - } catch(Exception e) { - throw new ErrorEvent("Cannot set index '" + index + "' to current index: " + e.getMessage()); - } - } - - @Override - public void assign(String location, Data data) { - try { - ctx.set(location, getDataAsJexlObject(data)); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void init(String location, Data data) { - ctx.set(location, null); - assign(location, data); - } - - @Override - public boolean isDeclared(String expr) { - try { - JexlExpression ex = jexl.createExpression(expr); - Object result = ex.evaluate(ctx); - return (boolean) result; - } catch(JexlException e) { - } - return false; - } - - protected Object evalAsObject(String expr) { - try { - JexlExpression ex = jexl.createExpression(expr); - return (ex.evaluate(ctx)); - } catch(JexlException e) { - } - return null; - } - - protected Data getJexlObjectAsData(Object obj) { - Data d = new Data(); - if (obj.getClass().isArray()) { - int length = Array.getLength(obj); - for (int i = 0; i < length; i ++) { - d.getArray().add(getJexlObjectAsData(Array.get(obj, i))); - } - } else if (obj.getClass().isPrimitive() || isWrapperType(obj.getClass())) { - String val = obj.toString(); - try { - Integer.parseInt(obj.toString()); - d.setAtom(obj.toString()); - d.setType(Data.Type.INTERPRETED); - return d; - } catch(NumberFormatException e) {} - try { - Double.parseDouble(obj.toString()); - d.setAtom(obj.toString()); - d.setType(Data.Type.INTERPRETED); - return d; - } catch(NumberFormatException e) {} - d.setAtom(obj.toString()); - d.setType(Data.Type.VERBATIM); - return d; - } else { - Field[] fields = obj.getClass().getDeclaredFields(); - for (Field field: fields) { - Object newObj = null; - try { - field.get(newObj); - d.getCompound().set(field.getName(), getJexlObjectAsData(newObj)); - } catch (IllegalArgumentException | IllegalAccessException e) { - } - } - return d; - } - - return d; - } - - protected Object getDataAsJexlObject(Data data) { - if (data.getAtom().length() > 0) { - if (data.getType() == Data.Type.INTERPRETED) { - try { - JexlExpression exp = jexl.createExpression(data.getAtom()); - return exp.evaluate(ctx); - } catch (Exception e) { - e.printStackTrace(); - } - return new String(data.getAtom()); - } - try { - JexlExpression exp = jexl.createExpression(data.getAtom()); - return exp.evaluate(ctx); - } catch (Exception e) { - } - return new String("\"" + data.getAtom() + "\""); - - } else if (data.getCompound().size() > 0) { - StringVector keys = data.getCompoundKeys(); - DataMap dataCompound = data.getCompound(); - Map<String, Object> objCompound = new HashMap<String, Object>(); - for (int i = 0; i < keys.size(); i++) { - objCompound.put(keys.get(i), getDataAsJexlObject(dataCompound.get(keys.get(i)))); - } - return objCompound; - } else if (data.getArray().size() > 0) { - DataList dataList = data.getArray(); - List<Object> objList = new ArrayList<Object>((int) data.getArray().size()); - for (int i = 0; i < dataList.size(); i++) { - objList.add(i, getDataAsJexlObject(dataList.get(i))); - } - return objList; - } - return new Object(); - } - - protected static boolean isWrapperType(Class<?> clazz) { - return WRAPPER_TYPES.contains(clazz); - } - - private static final Set<Class<?>> WRAPPER_TYPES = getWrapperTypes(); - - private static Set<Class<?>> getWrapperTypes() { - Set<Class<?>> ret = new HashSet<Class<?>>(); - ret.add(Boolean.class); - ret.add(Character.class); - ret.add(Byte.class); - ret.add(Short.class); - ret.add(Integer.class); - ret.add(Long.class); - ret.add(Float.class); - ret.add(Double.class); - ret.add(Void.class); - return ret; - } - -} diff --git a/test/bindings/java/org/uscxml/examples/ApacheCommonsAPI.java b/test/bindings/java/org/uscxml/examples/ApacheCommonsAPI.java deleted file mode 100644 index 4cf3de4..0000000 --- a/test/bindings/java/org/uscxml/examples/ApacheCommonsAPI.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.uscxml.examples; - -import java.net.URL; - -//import org.uscxml.apache.commons.scxml2.*; -import org.apache.commons.scxml2.*; -import org.apache.commons.scxml2.env.SimpleErrorReporter; -import org.apache.commons.scxml2.env.jexl.JexlEvaluator; -import org.apache.commons.scxml2.io.SCXMLReader; -import org.apache.commons.scxml2.model.SCXML; - -public class ApacheCommonsAPI { - - // SCXML model source URL - private static final URL SCXML = ApacheCommonsAPI.class.getResource("hello-world.xml"); - - public static void main(String [] args) throws Exception { - String uSCXMLLibPath = "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava.jnilib"; - if (System.getenv().containsKey("USCXML_JAVA_LIB")) { - uSCXMLLibPath = System.getenv("USCXML_JAVA_LIB"); - } - - System.load(uSCXMLLibPath); - - - // evaluator instance which is used by SCXML engine to evaluate expressions in SCXML - Evaluator evaluator = new JexlEvaluator(); - // engine to execute the scxml instance - SCXMLExecutor executor = new SCXMLExecutor(evaluator, null, new SimpleErrorReporter()); - - // parse SCXML URL into SCXML model - SCXML scxml = SCXMLReader.read(SCXML); - // set state machine (scxml instance) to execute - executor.setStateMachine(scxml); - - // create root context storing variables and being used by evaluator - Context rootContext = evaluator.newContext(null); - // set the root context for the engine - executor.setRootContext(rootContext); - - // initiate the execution of the state machine - executor.go(); - } - -} diff --git a/test/bindings/java/org/uscxml/examples/BasicExample.java b/test/bindings/java/org/uscxml/examples/BasicExample.java deleted file mode 100644 index 129a116..0000000 --- a/test/bindings/java/org/uscxml/examples/BasicExample.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.uscxml.examples; - -import org.uscxml.Interpreter; -import org.uscxml.InterpreterException; -import org.uscxml.InterpreterState; - -public class BasicExample { - - public static void main(String[] args) { - - String uSCXMLLibPath = "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava.jnilib"; - if (System.getenv().containsKey("USCXML_JAVA_LIB")) { - uSCXMLLibPath = System.getenv("USCXML_JAVA_LIB"); - } - - System.load(uSCXMLLibPath); - - try { - Interpreter scxml = Interpreter.fromURL("https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/w3c/null/test436.scxml"); - InterpreterState state = InterpreterState.USCXML_UNDEF; - while((state = scxml.step()) != InterpreterState.USCXML_FINISHED) { - switch (state) { - case USCXML_FINISHED: - case USCXML_UNDEF: - case USCXML_IDLE: - case USCXML_INITIALIZED: - case USCXML_INSTANTIATED: - case USCXML_MICROSTEPPED: - case USCXML_MACROSTEPPED: - case USCXML_CANCELLED: - break; - default: - break; - } - } - System.out.println("Machine finished"); - - } catch (InterpreterException e) { - e.printStackTrace(); - System.exit(-1); - } - System.exit(0); - - } - -} diff --git a/test/bindings/java/org/uscxml/examples/DataModelExample.java b/test/bindings/java/org/uscxml/examples/DataModelExample.java deleted file mode 100644 index bba64eb..0000000 --- a/test/bindings/java/org/uscxml/examples/DataModelExample.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.uscxml.examples; - -import java.io.File; -import java.net.MalformedURLException; - -import org.uscxml.Factory; -import org.uscxml.Interpreter; -import org.uscxml.InterpreterException; -import org.uscxml.InterpreterState; -import org.uscxml.dm.jexl.JexlDataModel; -import org.uscxml.helper.TestMonitor; - -public class DataModelExample { - - public static void main(String[] args) { - String uSCXMLLibPath = "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava.jnilib"; - if (System.getenv().containsKey("USCXML_JAVA_LIB")) { - uSCXMLLibPath = System.getenv("USCXML_JAVA_LIB"); - } - - System.load(uSCXMLLibPath); - - JexlDataModel jdm = new JexlDataModel(); - Factory.getInstance().registerDataModel(jdm);; - - TestMonitor tm = new TestMonitor(); - - File folder = new File("/Users/sradomski/Documents/TK/Code/uscxml/test/w3c/jexl"); - File[] listOfFiles = folder.listFiles(); - - try { - for (File file : listOfFiles) { - if (!file.getName().endsWith(".scxml")) - continue; - String testName = file.toURI().toURL().toString(); - System.out.println(testName); - - Interpreter scxml = Interpreter.fromURL(testName); -// scxml.setMonitor(tm); - - while(scxml.step() != InterpreterState.USCXML_FINISHED) {} - - if (!scxml.isInState("pass")) { - System.out.println("FAIL: " + testName); - - throw new RuntimeException(); - } - System.out.println("SUCCESS"); - - } - - } catch (InterpreterException | MalformedURLException e) { - e.printStackTrace(); - System.exit(-1); - } - System.exit(0); - - } - -} diff --git a/test/bindings/java/org/uscxml/examples/MonitorExample.java b/test/bindings/java/org/uscxml/examples/MonitorExample.java deleted file mode 100644 index dc4cffa..0000000 --- a/test/bindings/java/org/uscxml/examples/MonitorExample.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.uscxml.examples; - -import org.uscxml.Interpreter; -import org.uscxml.InterpreterException; -import org.uscxml.InterpreterState; -import org.uscxml.StringVector; -import org.uscxml.helper.TestMonitor; - - -public class MonitorExample { - - public static void main(String[] args) { - - String uSCXMLLibPath = "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava.jnilib"; - if (System.getenv().containsKey("USCXML_JAVA_LIB")) { - uSCXMLLibPath = System.getenv("USCXML_JAVA_LIB"); - } - - System.load(uSCXMLLibPath); - - try { - TestMonitor tm = new TestMonitor(); - Interpreter scxml = Interpreter.fromURL("https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/w3c/null/test436.scxml"); - scxml.addMonitor(tm); - InterpreterState state = InterpreterState.USCXML_UNDEF; - while((state = scxml.step()) != InterpreterState.USCXML_FINISHED) { - switch (state) { - case USCXML_FINISHED: - case USCXML_UNDEF: - case USCXML_IDLE: - case USCXML_INITIALIZED: - case USCXML_INSTANTIATED: - break; - case USCXML_MICROSTEPPED: - case USCXML_MACROSTEPPED: - StringVector states = scxml.getConfiguration(); - for (int i = 0; i < states.size(); i++) { - System.out.print(states.get(i) + " "); - } - System.out.println(); - case USCXML_CANCELLED: - break; - default: - break; - } - } - - } catch (InterpreterException e) { - e.printStackTrace(); - System.exit(-1); - } - System.exit(0); - } - -} diff --git a/test/bindings/java/org/uscxml/examples/hello-world.xml b/test/bindings/java/org/uscxml/examples/hello-world.xml deleted file mode 100644 index 3ac168c..0000000 --- a/test/bindings/java/org/uscxml/examples/hello-world.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" ?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with this - work for additional information regarding copyright ownership. The ASF - licenses this file to You under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law - or agreed to in writing, software distributed under the License is - distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the specific language - governing permissions and limitations under the License. ---> -<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" - initial="hello"> - - <final id="hello"> - <onentry> - <log expr="'Hello, World!'" /> - </onentry> - </final> - -</scxml>
\ No newline at end of file diff --git a/test/bindings/java/org/uscxml/helper/StopWatch.java b/test/bindings/java/org/uscxml/helper/StopWatch.java deleted file mode 100644 index 4123ba1..0000000 --- a/test/bindings/java/org/uscxml/helper/StopWatch.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.uscxml.helper; - -import org.uscxml.Data; -import org.uscxml.DataModelExtension; - -public class StopWatch { - - public StopWatch() { - } - - public void reset() { - System.out.println("RESET"); - } - - public void start() { - System.out.println("START"); - } - public void stop() { - System.out.println("STOP"); - } - -} diff --git a/test/bindings/java/org/uscxml/helper/TestMonitor.java b/test/bindings/java/org/uscxml/helper/TestMonitor.java deleted file mode 100644 index 2b71d82..0000000 --- a/test/bindings/java/org/uscxml/helper/TestMonitor.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.uscxml.helper; - -import org.uscxml.InterpreterMonitor; -import org.uscxml.StringList; - -public class TestMonitor extends InterpreterMonitor { - - public TestMonitor() {} - - @Override - public void beforeExitingState(String stateId, String xpath, String stateXML) { - System.out.println("beforeExitingState: " + stateId + " " + xpath); - } - - @Override - public void afterExitingState(String stateId, String xpath, String stateXML) { - System.out.println("afterExitingState: " + stateId + " " + xpath); - } - - @Override - public void beforeExecutingContent(String tagName, String xpath, String contentXML) { - System.out.println("afterExecutingContent: " + tagName + " " + xpath); - } - - @Override - public void afterExecutingContent(String tagName, String xpath, String contentXML) { - System.out.println("afterExecutingContent: " + tagName + " " + xpath); - } - - @Override - public void beforeUninvoking(String xpath, String invokeid, String invokerXML) { - System.out.println("beforeUninvoking: " + xpath + " " + invokeid); - } - - @Override - public void afterUninvoking(String xpath, String invokeid, String invokerXML) { - System.out.println("beforeUninvoking: " + xpath + " " + invokeid); - } - - @Override - public void beforeTakingTransition(String xpath, String source, StringList targets, String transitionXML) { - System.out.println("beforeTakingTransition: " + xpath + " " + source + " " + targets); - } - - @Override - public void afterTakingTransition(String xpath, String source, StringList targets, String transitionXML) { - System.out.println("afterTakingTransition: " + xpath + " " + source + " " + targets); - } - - @Override - public void beforeEnteringState(String stateId, String xpath, String stateXML) { - System.out.println("beforeEnteringState: " + stateId + " " + xpath); - } - - @Override - public void afterEnteringState(String stateId, String xpath, String stateXML) { - System.out.println("afterEnteringState: " + stateId + " " + xpath); - } - - @Override - public void beforeInvoking(String xpath, String invokeid, String invokerXML) { - System.out.println("beforeInvoking: " + xpath + " " + invokeid); - } - - @Override - public void afterInvoking(String xpath, String invokeid, String invokerXML) { - System.out.println("afterInvoking: " + xpath + " " + invokeid); - } - - -} diff --git a/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java b/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java deleted file mode 100644 index da79d37..0000000 --- a/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.uscxml.tests; - -import java.io.File; -import java.net.MalformedURLException; - -import org.uscxml.ActionLanguage; -import org.uscxml.Factory; -import org.uscxml.Interpreter; -import org.uscxml.InterpreterException; -import org.uscxml.InterpreterState; -import org.uscxml.dm.jexl.JexlDataModel; -import org.uscxml.helper.StopWatch; -import org.uscxml.helper.TestMonitor; - -public class JexlDataModelTest { - - public static void main(String[] args) { - String uSCXMLLibPath = "/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava.jnilib"; - if (System.getenv().containsKey("USCXML_JAVA_LIB")) { - uSCXMLLibPath = System.getenv("USCXML_JAVA_LIB"); - } - - System.load(uSCXMLLibPath); -// String testUri = "/Users/sradomski/Documents/TK/Code/uscxml/test/w3c/jexl/test144.scxml"; -// String testUri = "/Users/sradomski/Desktop/stopwatch.xml"; - - -// if (args.length > 0) { -// testUri = args[0]; -// } - - { - JexlDataModel jdm = new JexlDataModel(); -// Factory.getInstance().registerDataModel(jdm); - - - TestMonitor tm = new TestMonitor(); - - try { -// File testFile = new File(testUri); -// String testName = testFile.toURI().toURL().toString(); - String testName = "https://raw.githubusercontent.com/woonsan/commons-scxml-examples/master/stopwatch/src/main/resources/com/github/woonsan/commons/scxml/examples/stopwatch/stopwatch.xml"; - System.out.println(testName); - - Interpreter scxml = Interpreter.fromURL(testName); - - jdm.ctx.set("stopWatch", new StopWatch()); - - ActionLanguage al = new ActionLanguage(); - al.setDataModel(jdm); - scxml.setActionLanguage(al); - - scxml.addMonitor(tm); - - while (scxml.step() != InterpreterState.USCXML_FINISHED) { - } - - if (!scxml.isInState("pass")) { - System.out.println("FAIL: " + testName); - throw new RuntimeException(); - } - System.out.println("SUCCESS"); - - } catch (InterpreterException e) { - e.printStackTrace(); - System.exit(-1); - } - } - - System.exit(0); - } - -} |