summaryrefslogtreecommitdiffstats
path: root/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/bindings/java/org/uscxml/tests/JexlDataModelTest.java')
-rw-r--r--test/bindings/java/org/uscxml/tests/JexlDataModelTest.java35
1 files changed, 24 insertions, 11 deletions
diff --git a/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java b/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java
index 876feb2..da79d37 100644
--- a/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java
+++ b/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java
@@ -3,11 +3,13 @@ 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.dm.jexl.JexlDataModel;
+import org.uscxml.helper.StopWatch;
import org.uscxml.helper.TestMonitor;
public class JexlDataModelTest {
@@ -19,26 +21,37 @@ public class JexlDataModelTest {
}
System.load(uSCXMLLibPath);
- String testUri = "/Users/sradomski/Documents/TK/Code/uscxml/test/w3c/jexl/test144.scxml";
+// 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];
- }
+
+// if (args.length > 0) {
+// testUri = args[0];
+// }
{
- JEXLDataModel jdm = new JEXLDataModel();
- Factory.getInstance().registerDataModel(jdm);
+ JexlDataModel jdm = new JexlDataModel();
+// Factory.getInstance().registerDataModel(jdm);
+
TestMonitor tm = new TestMonitor();
try {
- File testFile = new File(testUri);
- String testName = testFile.toURI().toURL().toString();
+// 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) {
}
@@ -48,7 +61,7 @@ public class JexlDataModelTest {
}
System.out.println("SUCCESS");
- } catch (InterpreterException | MalformedURLException e) {
+ } catch (InterpreterException e) {
e.printStackTrace();
System.exit(-1);
}