X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=system%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2FSystemAssemblerTest.java;h=ab8bae6902debd4b49c16554c57345166f9f19fd;hb=2a885e74d3f518def3887df98920f632177ed0b9;hp=885cff39739a748fbd1e015c4f45f66b461128db;hpb=6f277575685808a5c5a76555dd3e839dc5255031;p=utils diff --git a/system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java b/system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java index 885cff39..ab8bae69 100644 --- a/system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java +++ b/system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; +import org.wamblee.system.Component.Status; import org.wamblee.test.AssertionUtils; import junit.framework.TestCase; @@ -98,21 +99,32 @@ public class SystemAssemblerTest extends TestCase { public void testComposite() { Component environment = new Environment(_registry); Component application = new Application(_registry); - CompositeSystem system = new CompositeSystem("all", _registry, + assertEquals(Status.NOT_STARTED, environment.getStatus()); + assertEquals(Status.NOT_STARTED, application.getStatus()); + CompositeComponent system = new CompositeComponent("all", _registry, new Component[] { environment, application }, new InterfaceDescriptor[0], new InterfaceDescriptor[0]); + assertEquals(Status.NOT_STARTED, system.getStatus()); system.start("root", new Service[0]); InterfaceDescriptor[] required = system.getRequiredServices(); assertEquals(0, required.length); InterfaceDescriptor[] provided = system.getProvidedServices(); assertEquals(0, provided.length); + assertEquals(Status.RUNNING, environment.getStatus()); + assertEquals(Status.RUNNING, application.getStatus()); + assertEquals(Status.RUNNING, system.getStatus()); + + system.stop(); + assertEquals(Status.STOPPED, environment.getStatus()); + assertEquals(Status.STOPPED, application.getStatus()); + assertEquals(Status.STOPPED, system.getStatus()); } public void testCompositeWithWrongProvidedInfo() { try { Component environment = new Environment(_registry); Component application = new Application(_registry); - CompositeSystem system = new CompositeSystem( + CompositeComponent system = new CompositeComponent( "all", _registry, new Component[] { environment, application }, @@ -128,7 +140,7 @@ public class SystemAssemblerTest extends TestCase { public void testCompositeWithSuperfluousRequiredInfo() { Component environment = new Environment(_registry); Component application = new Application(_registry); - CompositeSystem system = new CompositeSystem("all", _registry, + CompositeComponent system = new CompositeComponent("all", _registry, new Component[] { environment, application }, new InterfaceDescriptor[0], new InterfaceDescriptor[] { new DefaultRequiredInterfaceDescriptor( @@ -144,7 +156,7 @@ public class SystemAssemblerTest extends TestCase { try { Component environment = new Environment(_registry); Component application = new Application(_registry); - CompositeSystem system = new CompositeSystem("all", _registry, + CompositeComponent system = new CompositeComponent("all", _registry, new Component[] { application }, new InterfaceDescriptor[0], application.getRequiredServices()); system.start("root", new Service[0]); @@ -159,7 +171,7 @@ public class SystemAssemblerTest extends TestCase { Component environment = new Environment(_registry); Component application = new Application(_registry); - CompositeSystem system = new CompositeSystem("all", _registry, + CompositeComponent system = new CompositeComponent("all", _registry, new Component[] { application }, new InterfaceDescriptor[0], application.getRequiredServices()); Service[] envServices = environment.start("env", new Service[0]);