diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/MainTest.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/test/java/MainTest.java b/src/test/java/MainTest.java index c292df9..309f0cf 100644 --- a/src/test/java/MainTest.java +++ b/src/test/java/MainTest.java @@ -5,6 +5,7 @@ import java.util.StringTokenizer; import org.custommonkey.xmlunit.XMLUnit;
import com.c2kernel.common.ObjectNotFoundException;
+import com.c2kernel.lifecycle.instance.stateMachine.StateMachine;
import com.c2kernel.persistency.outcome.OutcomeValidator;
import com.c2kernel.persistency.outcome.Schema;
import com.c2kernel.persistency.outcome.SchemaValidator;
@@ -16,7 +17,12 @@ import com.c2kernel.utils.Resource; public class MainTest {
-
+ public static void main(String[] args) throws Exception {
+ MainTest me = new MainTest();
+ me.testBootItems();
+ me.testScriptParsing();
+ me.testStateMachine();
+ }
public MainTest() throws Exception {
Logger.addLogStream(System.out, 1);
@@ -32,6 +38,7 @@ public class MainTest { validators.put("CA", new OutcomeValidator(getSchema("CompositeActivityDef", 0, "boot/OD/CompositeActivityDef.xsd")));
validators.put("EA", new OutcomeValidator(getSchema("ElementaryActivityDef", 0, "boot/OD/ElementaryActivityDef.xsd")));
validators.put("SC", new OutcomeValidator(getSchema("Script", 0, "boot/OD/Script.xsd")));
+ validators.put("SM", new OutcomeValidator(getSchema("StateMachine", 0, "boot/OD/StateMachine.xsd")));
validators.put("OD", new SchemaValidator());
String bootItems = FileStringUtility.url2String(Resource.getKernelResourceURL("boot/allbootitems.txt"));
@@ -51,7 +58,7 @@ public class MainTest { }
assert errors.length()==0;
- if (itemType.equals("CA") || itemType.equals("EA")) {
+ if (itemType.equals("CA") || itemType.equals("EA") || itemType.equals("SM")) {
Logger.msg(1, "Remarshalling "+thisItem);
long then = System.currentTimeMillis();
Object unmarshalled = Gateway.getMarshaller().unmarshall(data);
@@ -62,7 +69,7 @@ public class MainTest { castorTime+=(now-then);
errors = validator.validate(remarshalled);
if (errors.length() > 0) {
- Logger.error("Remarshalled resource "+thisItem+" has errors :"+errors);
+ Logger.error("Remarshalled resource "+thisItem+" has errors :"+errors+"\nRemarshalled form:\n"+remarshalled);
}
assert errors.length()==0;
@@ -103,4 +110,12 @@ public class MainTest { assert result instanceof String;
assert ((String)result).equals("TestTest");
}
+
+ public void testStateMachine() throws Exception {
+ Logger.msg("Validating test state machine");
+ String smXml = FileStringUtility.url2String(MainTest.class.getResource("TestStateMachine.xml"));
+ StateMachine sm = (StateMachine)Gateway.getMarshaller().unmarshall(smXml);
+ sm.validate();
+ assert sm.isCoherent();
+ }
}
|
