Uploaded image for project: 'HiveMind'
  1. HiveMind
  2. HIVEMIND-185

Should allow providing module descriptors using strings for easier testing

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.2
    • None
    • framework
    • 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[]

      { 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.

      Attachments

        1. patch2
          122 kB
          Kent Tong

        Activity

          People

            Unassigned Unassigned
            freemant Kent Tong
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: