diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-01-23 12:09:30 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-01-23 12:09:30 +0100 |
| commit | 8256917551c259df2b7e69e32cd74497e5394786 (patch) | |
| tree | 068ec6e5acf41aabeb1538c6731c8e8f70d1ddb1 /src/test | |
| parent | 428d828ca640d1348979f9982d1c0bc0a489a3b4 (diff) | |
Refactored Resource into a new ResourceLoader interface, which allows
CRISTAL processes in other enviroments with complex class loading (e.g.
OSGi) to supply their own resource and class loader to the kernel and
its modules. Fixes #149
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/java/MainTest.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/test/java/MainTest.java b/src/test/java/MainTest.java index 309f0cf..2029dc2 100644 --- a/src/test/java/MainTest.java +++ b/src/test/java/MainTest.java @@ -13,7 +13,6 @@ import com.c2kernel.process.Gateway; import com.c2kernel.scripting.Script;
import com.c2kernel.utils.FileStringUtility;
import com.c2kernel.utils.Logger;
-import com.c2kernel.utils.Resource;
public class MainTest {
@@ -28,7 +27,6 @@ public class MainTest { Logger.addLogStream(System.out, 1);
Properties props = FileStringUtility.loadConfigFile(MainTest.class.getResource("properties.conf").getPath());
Gateway.init(props);
- Resource.initKernelBaseURL();
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreComments(true);
}
@@ -41,7 +39,7 @@ public class MainTest { 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"));
+ String bootItems = FileStringUtility.url2String(Gateway.getResource().getKernelResourceURL("boot/allbootitems.txt"));
StringTokenizer str = new StringTokenizer(bootItems, "\n\r");
long castorTime=0;
while (str.hasMoreTokens()) {
@@ -50,7 +48,7 @@ public class MainTest { int delim = thisItem.indexOf('/');
String itemType = thisItem.substring(0,delim);
OutcomeValidator validator = validators.get(itemType);
- String data = Resource.getTextResource(null, "boot/"+thisItem+(itemType.equals("OD")?".xsd":".xml"));
+ String data = Gateway.getResource().getTextResource(null, "boot/"+thisItem+(itemType.equals("OD")?".xsd":".xml"));
assert data!=null;
String errors = validator.validate(data);
if (errors.length() > 0) {
@@ -86,7 +84,7 @@ public class MainTest { }
private static Schema getSchema(String name, int version, String resPath) throws ObjectNotFoundException {
- return new Schema(name, version, Resource.getTextResource(null, resPath));
+ return new Schema(name, version, Gateway.getResource().getTextResource(null, resPath));
}
public void testScriptParsing() throws Exception {
|
