blob: e6ad6192ffad68064cfe665860c3ecc651710c4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
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);
}
}
|