diff options
Diffstat (limited to 'src/test/java/MainTest.java')
| -rw-r--r-- | src/test/java/MainTest.java | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/test/java/MainTest.java b/src/test/java/MainTest.java index 2029dc2..4c70579 100644 --- a/src/test/java/MainTest.java +++ b/src/test/java/MainTest.java @@ -25,7 +25,7 @@ public class MainTest { public MainTest() throws Exception {
Logger.addLogStream(System.out, 1);
- Properties props = FileStringUtility.loadConfigFile(MainTest.class.getResource("properties.conf").getPath());
+ Properties props = FileStringUtility.loadConfigFile(MainTest.class.getResource("server.conf").getPath());
Gateway.init(props);
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreComments(true);
@@ -49,12 +49,10 @@ public class MainTest { String itemType = thisItem.substring(0,delim);
OutcomeValidator validator = validators.get(itemType);
String data = Gateway.getResource().getTextResource(null, "boot/"+thisItem+(itemType.equals("OD")?".xsd":".xml"));
- assert data!=null;
+ assert data!=null : "Boot "+itemType+" data item "+thisItem+" not found";
String errors = validator.validate(data);
- if (errors.length() > 0) {
- Logger.error("Kernel resource "+thisItem+" has errors :"+errors);
- }
- assert errors.length()==0;
+
+ assert errors.length()==0 : "Kernel resource "+thisItem+" has errors :"+errors;
if (itemType.equals("CA") || itemType.equals("EA") || itemType.equals("SM")) {
Logger.msg(1, "Remarshalling "+thisItem);
@@ -66,10 +64,7 @@ public class MainTest { Logger.msg("Marshall/remarshall of "+thisItem+" took "+(now-then)+"ms");
castorTime+=(now-then);
errors = validator.validate(remarshalled);
- if (errors.length() > 0) {
- Logger.error("Remarshalled resource "+thisItem+" has errors :"+errors+"\nRemarshalled form:\n"+remarshalled);
- }
- assert errors.length()==0;
+ assert errors.length()==0 : "Remarshalled resource "+thisItem+" has errors :"+errors+"\nRemarshalled form:\n"+remarshalled;
// Diff xmlDiff = new Diff(data, remarshalled);
// if (!xmlDiff.identical()) {
@@ -91,29 +86,26 @@ public class MainTest { OutcomeValidator valid = new OutcomeValidator(getSchema("Script", 0, "boot/OD/Script.xsd"));
String testScriptString = FileStringUtility.url2String(MainTest.class.getResource("TestScript.xml"));
String errors = valid.validate(testScriptString);
- if (errors.length()>0) {
- Logger.error("Test script not valid to schema: "+errors);
- }
- assert errors.length()==0;
+ assert errors.length()==0 : "Test script not valid to schema: "+errors;
Script testScript = new Script(testScriptString);
- assert testScript.getInputParams().size()==1;
- assert testScript.getInputParams().get("test")!=null;
+ assert testScript.getInputParams().size()==1 : "Script input param count wrong";
+ assert testScript.getInputParams().get("test")!=null : "Could not retrieve script input param value";
testScript.setInputParamValue("test", "Test");
- assert testScript.getInputParams().get("test").getInitialised();
+ assert testScript.getInputParams().get("test").getInitialised() : "Script is not initialized when it should be";
Object result = testScript.execute();
- assert result!=null;
- assert result instanceof String;
- assert ((String)result).equals("TestTest");
- }
+ assert result!=null : "Script returned null result";
+ assert result instanceof String : "Script failed to return a String";
+ assert ((String)result).equals("TestTest") : "Script failed to produce correct result: "+result;
+ } 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();
+ assert sm.isCoherent() : "Test StateMachine is reporting that it is not coherent";
}
}
|
