summaryrefslogtreecommitdiffstats
path: root/test/bindings
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2016-06-13 08:52:55 (GMT)
committerStefan Radomski <github@mintwerk.de>2016-06-13 08:52:55 (GMT)
commit053e9bc973fbe88fc41a34064ffadc0deabac58d (patch)
tree6aeee286577159ffcb612d41972a9d18ab685c6d /test/bindings
parent6e13c7b6e0888323223afd5d2e36e86243df57af (diff)
downloaduscxml-053e9bc973fbe88fc41a34064ffadc0deabac58d.zip
uscxml-053e9bc973fbe88fc41a34064ffadc0deabac58d.tar.gz
uscxml-053e9bc973fbe88fc41a34064ffadc0deabac58d.tar.bz2
Fixed dozens of memory leaks
Diffstat (limited to 'test/bindings')
-rw-r--r--test/bindings/java/build.properties9
-rw-r--r--test/bindings/java/build.xml43
-rw-r--r--test/bindings/java/libs/commons-jexl3-3.0.jarbin0 -> 383861 bytes
-rw-r--r--test/bindings/java/libs/commons-logging-1.2.jarbin0 -> 61829 bytes
-rw-r--r--test/bindings/java/org/uscxml/examples/BasicExample.java (renamed from test/bindings/java/org/uscxml/tests/BasicExample.java)5
-rw-r--r--test/bindings/java/org/uscxml/examples/DataModelExample.java (renamed from test/bindings/java/org/uscxml/tests/DataModelExample.java)6
-rw-r--r--test/bindings/java/org/uscxml/examples/MonitorExample.java (renamed from test/bindings/java/org/uscxml/tests/MonitorExample.java)6
-rw-r--r--test/bindings/java/org/uscxml/helper/TestMonitor.java (renamed from test/bindings/java/org/uscxml/tests/helper/TestMonitor.java)26
-rw-r--r--test/bindings/java/org/uscxml/tests/JexlDataModelTest.java60
9 files changed, 137 insertions, 18 deletions
diff --git a/test/bindings/java/build.properties b/test/bindings/java/build.properties
new file mode 100644
index 0000000..dd0fe62
--- /dev/null
+++ b/test/bindings/java/build.properties
@@ -0,0 +1,9 @@
+# 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
new file mode 100644
index 0000000..2f1f362
--- /dev/null
+++ b/test/bindings/java/build.xml
@@ -0,0 +1,43 @@
+<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
new file mode 100644
index 0000000..94566bf
--- /dev/null
+++ b/test/bindings/java/libs/commons-jexl3-3.0.jar
Binary files differ
diff --git a/test/bindings/java/libs/commons-logging-1.2.jar b/test/bindings/java/libs/commons-logging-1.2.jar
new file mode 100644
index 0000000..93a3b9f
--- /dev/null
+++ b/test/bindings/java/libs/commons-logging-1.2.jar
Binary files differ
diff --git a/test/bindings/java/org/uscxml/tests/BasicExample.java b/test/bindings/java/org/uscxml/examples/BasicExample.java
index 32899e5..129a116 100644
--- a/test/bindings/java/org/uscxml/tests/BasicExample.java
+++ b/test/bindings/java/org/uscxml/examples/BasicExample.java
@@ -1,4 +1,4 @@
-package org.uscxml.tests;
+package org.uscxml.examples;
import org.uscxml.Interpreter;
import org.uscxml.InterpreterException;
@@ -37,7 +37,10 @@ public class BasicExample {
} catch (InterpreterException e) {
e.printStackTrace();
+ System.exit(-1);
}
+ System.exit(0);
+
}
}
diff --git a/test/bindings/java/org/uscxml/tests/DataModelExample.java b/test/bindings/java/org/uscxml/examples/DataModelExample.java
index db46a18..e6ad619 100644
--- a/test/bindings/java/org/uscxml/tests/DataModelExample.java
+++ b/test/bindings/java/org/uscxml/examples/DataModelExample.java
@@ -1,4 +1,4 @@
-package org.uscxml.tests;
+package org.uscxml.examples;
import java.io.File;
import java.net.MalformedURLException;
@@ -8,7 +8,7 @@ import org.uscxml.Interpreter;
import org.uscxml.InterpreterException;
import org.uscxml.InterpreterState;
import org.uscxml.dm.jexl.JEXLDataModel;
-import org.uscxml.tests.helper.TestMonitor;
+import org.uscxml.helper.TestMonitor;
public class DataModelExample {
@@ -51,7 +51,9 @@ public class DataModelExample {
} catch (InterpreterException | MalformedURLException e) {
e.printStackTrace();
+ System.exit(-1);
}
+ System.exit(0);
}
diff --git a/test/bindings/java/org/uscxml/tests/MonitorExample.java b/test/bindings/java/org/uscxml/examples/MonitorExample.java
index 2f0689a..3e3781c 100644
--- a/test/bindings/java/org/uscxml/tests/MonitorExample.java
+++ b/test/bindings/java/org/uscxml/examples/MonitorExample.java
@@ -1,9 +1,9 @@
-package org.uscxml.tests;
+package org.uscxml.examples;
import org.uscxml.Interpreter;
import org.uscxml.InterpreterException;
import org.uscxml.InterpreterState;
-import org.uscxml.tests.helper.TestMonitor;
+import org.uscxml.helper.TestMonitor;
public class MonitorExample {
@@ -40,7 +40,9 @@ public class MonitorExample {
} catch (InterpreterException e) {
e.printStackTrace();
+ System.exit(-1);
}
+ System.exit(0);
}
}
diff --git a/test/bindings/java/org/uscxml/tests/helper/TestMonitor.java b/test/bindings/java/org/uscxml/helper/TestMonitor.java
index 9266847..f8289bd 100644
--- a/test/bindings/java/org/uscxml/tests/helper/TestMonitor.java
+++ b/test/bindings/java/org/uscxml/helper/TestMonitor.java
@@ -1,4 +1,4 @@
-package org.uscxml.tests.helper;
+package org.uscxml.helper;
import org.uscxml.InterpreterIssue;
import org.uscxml.InterpreterMonitor;
@@ -10,62 +10,62 @@ public class TestMonitor extends InterpreterMonitor {
@Override
public void beforeExitingState(String stateId, String xpath, String stateXML) {
- System.out.println("beforeExitingState: " + stateId + " " + xpath + " " + stateXML);
+ System.out.println("beforeExitingState: " + stateId + " " + xpath);
}
@Override
public void afterExitingState(String stateId, String xpath, String stateXML) {
- System.out.println("afterExitingState: " + stateId + " " + xpath + " " + stateXML);
+ System.out.println("afterExitingState: " + stateId + " " + xpath);
}
@Override
public void beforeExecutingContent(String tagName, String xpath, String contentXML) {
- System.out.println("afterExecutingContent: " + tagName + " " + xpath + " " + contentXML);
+ System.out.println("afterExecutingContent: " + tagName + " " + xpath);
}
@Override
public void afterExecutingContent(String tagName, String xpath, String contentXML) {
- System.out.println("afterExecutingContent: " + tagName + " " + xpath + " " + contentXML);
+ System.out.println("afterExecutingContent: " + tagName + " " + xpath);
}
@Override
public void beforeUninvoking(String xpath, String invokeid, String invokerXML) {
- System.out.println("beforeUninvoking: " + xpath + " " + invokeid + " " + invokerXML);
+ System.out.println("beforeUninvoking: " + xpath + " " + invokeid);
}
@Override
public void afterUninvoking(String xpath, String invokeid, String invokerXML) {
- System.out.println("beforeUninvoking: " + xpath + " " + invokeid + " " + 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 + " " + 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 + " " + transitionXML);
+ System.out.println("afterTakingTransition: " + xpath + " " + source + " " + targets);
}
@Override
public void beforeEnteringState(String stateId, String xpath, String stateXML) {
- System.out.println("beforeEnteringState: " + stateId + " " + xpath + " " + stateXML);
+ System.out.println("beforeEnteringState: " + stateId + " " + xpath);
}
@Override
public void afterEnteringState(String stateId, String xpath, String stateXML) {
- System.out.println("afterEnteringState: " + stateId + " " + xpath + " " + stateXML);
+ System.out.println("afterEnteringState: " + stateId + " " + xpath);
}
@Override
public void beforeInvoking(String xpath, String invokeid, String invokerXML) {
- System.out.println("beforeInvoking: " + xpath + " " + invokeid + " " + invokerXML);
+ System.out.println("beforeInvoking: " + xpath + " " + invokeid);
}
@Override
public void afterInvoking(String xpath, String invokeid, String invokerXML) {
- System.out.println("afterInvoking: " + xpath + " " + invokeid + " " + invokerXML);
+ System.out.println("afterInvoking: " + xpath + " " + invokeid);
}
@Override
diff --git a/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java b/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java
new file mode 100644
index 0000000..bb681b0
--- /dev/null
+++ b/test/bindings/java/org/uscxml/tests/JexlDataModelTest.java
@@ -0,0 +1,60 @@
+package org.uscxml.tests;
+
+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 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";
+
+ 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();
+ 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);
+ }
+
+}