elimintated the system assembler.
[utils] / system / general / src / test / java / org / wamblee / system / ContainerTest.java
similarity index 90%
rename from system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java
rename to system/general/src/test/java/org/wamblee/system/ContainerTest.java
index c67529b875b6a7e1819ce30b4e25427a16659696..33f3c00da080b6b42945fffbd9ba8098ae11b907 100644 (file)
@@ -25,7 +25,7 @@ import org.wamblee.test.EventTracker;
 
 import junit.framework.TestCase;
 
-public class SystemAssemblerTest extends TestCase {
+public class ContainerTest extends TestCase {
 
        private EventTracker<String> _tracker;
 
@@ -55,32 +55,34 @@ public class SystemAssemblerTest extends TestCase {
                                MyMultiple.class);
 
                AssertionUtils.assertEquals(new RequiredInterface[] { req1 },
-                               SystemAssembler.filterRequiredServices(prov1, Arrays
+                               Container.filterRequiredServices(prov1, Arrays
                                                .asList(new RequiredInterface[] { req1 })));
                AssertionUtils.assertEquals(new RequiredInterface[] { req1 },
-                               SystemAssembler.filterRequiredServices(prov1, Arrays
+                               Container.filterRequiredServices(prov1, Arrays
                                                .asList(new RequiredInterface[] { req1, req2 })));
                AssertionUtils.assertEquals(new RequiredInterface[] { req1, req2 },
-                               SystemAssembler.filterRequiredServices(prov3, Arrays
+                               Container.filterRequiredServices(prov3, Arrays
                                                .asList(new RequiredInterface[] { req1, req2 })));
 
                AssertionUtils.assertEquals(new ProvidedInterface[] { prov1 },
-                               SystemAssembler.filterProvidedServices(req1, Arrays
+                               Container.filterProvidedServices(req1, Arrays
                                                .asList(new ProvidedInterface[] { prov1 })));
                AssertionUtils.assertEquals(new ProvidedInterface[] { prov1 },
-                               SystemAssembler.filterProvidedServices(req1, Arrays
+                               Container.filterProvidedServices(req1, Arrays
                                                .asList(new ProvidedInterface[] { prov1, prov2 })));
                AssertionUtils.assertEquals(new ProvidedInterface[] { prov1, prov3 },
-                               SystemAssembler.filterProvidedServices(req1, Arrays
+                               Container.filterProvidedServices(req1, Arrays
                                                .asList(new ProvidedInterface[] { prov1, prov3 })));
        }
 
        public void testEnvironmentApplication() {
                Component environment = new Environment(_tracker);
                Component application = new Application(_tracker);
-               SystemAssembler assembler = new SystemAssembler(new Component[] {
-                               environment, application }, new ProvidedInterface[0]);
-               assembler.start();
+               Container container = new Container("root", new Component[] {
+                               environment, application }, new ProvidedInterface[0],
+                               new RequiredInterface[0]);
+                               
+               container.start("top");
                AssertionUtils.assertEquals(new String[] { "start.environment",
                                "start.application" }, _tracker.getEvents(
                                Thread.currentThread()).toArray(new String[0]));
@@ -95,9 +97,12 @@ public class SystemAssemblerTest extends TestCase {
                try {
                        Component environment = new Environment();
                        Component application = new Application();
-                       SystemAssembler assembler = new SystemAssembler(new Component[] {
-                                       application, environment }, new ProvidedInterface[0]);
-                       assembler.start();
+                       Container container = new Container(
+                                       "root",
+                                       new Component[] {
+                                       application, environment }, 
+                                       new ProvidedInterface[0], new RequiredInterface[0]);
+                       container.start("top");
                } catch (SystemAssemblyException e) {
                        // e.printStackTrace();
                        return;
@@ -229,10 +234,10 @@ public class SystemAssemblerTest extends TestCase {
                        Component environment1 = new Environment();
                        Component environment2 = new Environment();
                        Component application = new Application();
-                       SystemAssembler assembler = new SystemAssembler(new Component[] {
+                       Container container = new Container("root", new Component[] {
                                        environment1, environment2, application },
-                                       new ProvidedInterface[0]);
-                       assembler.start();
+                                       new ProvidedInterface[0], new RequiredInterface[0]);
+                       container.start("top");
 
                } catch (SystemAssemblyException e) {
                        return;