You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by "Kent Tong (JIRA)" <hi...@jakarta.apache.org> on 2006/09/13 17:41:23 UTC
[jira] Updated: (HIVEMIND-185) Should allow providing module
descriptors using strings for easier testing
[ http://issues.apache.org/jira/browse/HIVEMIND-185?page=all ]
Kent Tong updated HIVEMIND-185:
-------------------------------
Attachment: patch2
A patch implementing this enhancement.
> Should allow providing module descriptors using strings for easier testing
> --------------------------------------------------------------------------
>
> Key: HIVEMIND-185
> URL: http://issues.apache.org/jira/browse/HIVEMIND-185
> Project: HiveMind
> Issue Type: Improvement
> Components: framework
> Affects Versions: 1.2
> Reporter: Kent Tong
> Attachments: patch2
>
>
> 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[] { module1, module2 });
> 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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira