diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-21 15:14:55 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-08-21 15:14:55 (GMT) |
commit | f7ad82f972bf46571bb5229205f877f8ab31069d (patch) | |
tree | e83110054a551053a68fb93d7061709808a19a0d /embedding/java/src/org | |
parent | a3fb1daf5b4e58471cc714853636025b6cac9aed (diff) | |
download | uscxml-f7ad82f972bf46571bb5229205f877f8ab31069d.zip uscxml-f7ad82f972bf46571bb5229205f877f8ab31069d.tar.gz uscxml-f7ad82f972bf46571bb5229205f877f8ab31069d.tar.bz2 |
New Interpreter::validate() to identify issues with a document before running it
Diffstat (limited to 'embedding/java/src/org')
-rw-r--r-- | embedding/java/src/org/uscxml/tests/TestValidation.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/embedding/java/src/org/uscxml/tests/TestValidation.java b/embedding/java/src/org/uscxml/tests/TestValidation.java new file mode 100644 index 0000000..f09f678 --- /dev/null +++ b/embedding/java/src/org/uscxml/tests/TestValidation.java @@ -0,0 +1,35 @@ +package org.uscxml.tests; + +import org.uscxml.Interpreter; +import org.uscxml.InterpreterException; +import org.uscxml.IssueList; + +public class TestValidation { + + public static void main(String[] args) { + System.load("/Users/sradomski/Documents/TK/Code/uscxml/build/cli/lib/libuscxmlNativeJava64.jnilib"); + + // invalid expression in transition + try { + String xml = + "<scxml datamodel=\"ecmascript\">" + + " <state id=\"start\">" + + " <transition target=\"done\" cond=\"%sf\" />" + + " </state>" + + " <final id=\"done\" />" + + "</scxml>"; + Interpreter interpreter = Interpreter.fromXML(xml); + IssueList issues = interpreter.validate(); + for (int i = 0; i < issues.size(); i++) { + System.out.println(issues.get(i)); + } + + throw new RuntimeException(""); + + } catch (InterpreterException e) { + System.err.println(e); + } + + } + +} |