diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-07-28 12:23:52 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-07-28 12:23:52 +0200 |
| commit | 7234fd04b63e69756670e3605a4e778cbe6cf871 (patch) | |
| tree | c1a37a9b40378c041bcba4b39db57e06be10f94f /src/test | |
| parent | 7b3b3c6d26742fc6c2bd9ce4f9b0df1c19686e66 (diff) | |
Support pre-compilation of scripts if supported by the engine. Also does
this during testing to catch script syntax errors during build. Client
shell detects these error and declares them pre-execution.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/java/MainTest.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/test/java/MainTest.java b/src/test/java/MainTest.java index 0d35cd6..7809c25 100644 --- a/src/test/java/MainTest.java +++ b/src/test/java/MainTest.java @@ -10,6 +10,7 @@ import com.c2kernel.persistency.outcome.Schema; import com.c2kernel.persistency.outcome.SchemaValidator;
import com.c2kernel.process.Gateway;
import com.c2kernel.scripting.Script;
+import com.c2kernel.scripting.ScriptParsingException;
import com.c2kernel.utils.FileStringUtility;
import com.c2kernel.utils.Logger;
import com.c2kernel.utils.Resource;
@@ -36,7 +37,6 @@ public class MainTest { String bootItems = FileStringUtility.url2String(Resource.getKernelResourceURL("boot/allbootitems.txt"));
StringTokenizer str = new StringTokenizer(bootItems, "\n\r");
- long castorTime=0;
while (str.hasMoreTokens()) {
String thisItem = str.nextToken();
Logger.msg(1, "Validating "+thisItem);
@@ -59,7 +59,6 @@ public class MainTest { String remarshalled = Gateway.getMarshaller().marshall(unmarshalled);
long now = System.currentTimeMillis();
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);
@@ -74,8 +73,12 @@ public class MainTest { // }
// assert xmlDiff.identical();
}
- }
- Logger.msg("Total Castor marshall time: "+castorTime+"ms");
+
+ if (itemType.equals("SC")) {
+ Logger.msg(1, "Parsing script "+thisItem);
+ new Script(thisItem, 0, data);
+ }
+ }
}
private static Schema getSchema(String name, int version, String resPath) throws ObjectNotFoundException {
@@ -91,7 +94,7 @@ public class MainTest { }
assert errors.length()==0;
- Script testScript = new Script(testScriptString);
+ Script testScript = new Script("TestScript", 0, testScriptString);
assert testScript.getInputParams().size()==1;
assert testScript.getInputParams().get("test")!=null;
|
