summaryrefslogtreecommitdiffstats
path: root/embedding/java/src/org/uscxml/tests/TestValidation.java
blob: f09f678166669a5043cfc92ed836a2a7e2ac48b8 (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
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);
		}

	}

}