Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.2
-
None
-
None
Description
With the capacity to provide module descriptors as strings, it's a lot easier to write tests using plain JUnit without extending HivemindTestCase:
public class TestRegistryBuilderUsingStrings extends TestCase
{
...
public void testCreateInstance() throws Exception
{
String module1 = "<?xml version=\"1.0\"?>"
+ "<module id=\"com.myco.mypackage\" version=\"1.0.0\">"
+ " <service-point id=\"Adder\"
interface=\"org.apache.hivemind.Adder\"/>"
+ "</module>";
String module2 = "<?xml version=\"1.0\"?>"
+ "<module id=\"com.myco.mypackage.impl\" version=\"1.0.0\">"
+ " <implementation service-id=\"com.myco.mypackage.Adder\">"
+ " <create-instance class=\"org.apache.hivemind.AdderImpl\"/>"
+ " </implementation>" + "</module>";
setupRegistry(new String[]
);
Adder adder = (Adder) registry.getService("com.myco.mypackage.Adder",
Adder.class);
assertNotNull(adder);
assertEquals(adder.add(4, 5), 9);
}
}
Please see TestRegistryBuilderUsingStrings.java in the patch.