X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=system%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2FSystemAssemblerTest.java;h=1bd89ca5fb212765a7f5e78a016ed443c4f6a37f;hb=cd54b07b42712775ea414fd3cc60d332948e96a2;hp=70558250b547d1b4bfdc92b7c56c0e61cbdbada2;hpb=fe01768589f67e25c16254bf27a8631ceb78afe0;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 70558250..1bd89ca5 100644 --- a/system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java +++ b/system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java @@ -13,8 +13,8 @@ public class SystemAssemblerTest extends TestCase { } public void testEnvironmentApplication() { - SubSystem environment = new Environment(); - SubSystem application = new Application(); + SubSystem environment = new Environment(_registry); + SubSystem application = new Application(_registry); SystemAssembler assembler = new SystemAssembler(new SubSystem[] { environment, application }, new ServiceDescriptor[0]); assembler.start(_registry, new Service[0]); @@ -24,17 +24,17 @@ public class SystemAssemblerTest extends TestCase { assertEquals(2, appServices.length); assertEquals(2, _registry.listAllServices().length); - environment.stop("", _registry); + environment.stop(); assertEquals(0, _registry.listAllServices().length); - application.stop("", _registry); + application.stop(); assertEquals(0, _registry.listAllServices().length); } public void testApplicationEnvironment() { try { - SubSystem environment = new Environment(); - SubSystem application = new Application(); + SubSystem environment = new Environment(_registry); + SubSystem application = new Application(_registry); SystemAssembler assembler = new SystemAssembler(new SubSystem[] { application, environment }, new ServiceDescriptor[0]); assembler.start(_registry, new Service[0]); @@ -46,12 +46,12 @@ public class SystemAssemblerTest extends TestCase { } public void testComposite() { - SubSystem environment = new Environment(); - SubSystem application = new Application(); - CompositeSystem system = new CompositeSystem("all", new SubSystem[] { + SubSystem environment = new Environment(_registry); + SubSystem application = new Application(_registry); + CompositeSystem system = new CompositeSystem("all", _registry, new SubSystem[] { environment, application }, new ServiceDescriptor[0], new ServiceDescriptor[0]); - system.start("root", _registry, new Service[0]); + system.start("root", new Service[0]); ServiceDescriptor[] required = system.getRequiredServices(); assertEquals(0, required.length); ServiceDescriptor[] provided = system.getProvidedServices(); @@ -60,9 +60,9 @@ public class SystemAssemblerTest extends TestCase { public void testCompositeWithWrongProvidedInfo() { try { - SubSystem environment = new Environment(); - SubSystem application = new Application(); - CompositeSystem system = new CompositeSystem("all", + SubSystem environment = new Environment(_registry); + SubSystem application = new Application(_registry); + CompositeSystem system = new CompositeSystem("all", _registry, new SubSystem[] { environment, application }, new ServiceDescriptor[] { new DefaultServiceDescriptor( String.class) }, new ServiceDescriptor[0]); @@ -73,13 +73,13 @@ public class SystemAssemblerTest extends TestCase { } public void testCompositeWithSuperfluousRequiredInfo() { - SubSystem environment = new Environment(); - SubSystem application = new Application(); - CompositeSystem system = new CompositeSystem("all", new SubSystem[] { + SubSystem environment = new Environment(_registry); + SubSystem application = new Application(_registry); + CompositeSystem system = new CompositeSystem("all", _registry,new SubSystem[] { environment, application }, new ServiceDescriptor[0], new ServiceDescriptor[] { new DefaultServiceDescriptor( String.class) }); - system.start("root", _registry, new Service[0]); + system.start("root", new Service[0]); ServiceDescriptor[] required = system.getRequiredServices(); assertEquals(1, required.length); ServiceDescriptor[] provided = system.getProvidedServices(); @@ -88,12 +88,12 @@ public class SystemAssemblerTest extends TestCase { public void testCompositeWithExternalDependencesNotProvided() { try { - SubSystem environment = new Environment(); - SubSystem application = new Application(); - CompositeSystem system = new CompositeSystem("all", + SubSystem environment = new Environment(_registry); + SubSystem application = new Application(_registry); + CompositeSystem system = new CompositeSystem("all", _registry, new SubSystem[] { application }, new ServiceDescriptor[0], application.getRequiredServices()); - system.start("root", _registry, new Service[0]); + system.start("root", new Service[0]); } catch (SystemAssemblyException e) { return; } @@ -103,13 +103,13 @@ public class SystemAssemblerTest extends TestCase { public void testCompositeWithExternalDependencesProvided() { - SubSystem environment = new Environment(); - SubSystem application = new Application(); - CompositeSystem system = new CompositeSystem("all", + SubSystem environment = new Environment(_registry); + SubSystem application = new Application(_registry); + CompositeSystem system = new CompositeSystem("all", _registry, new SubSystem[] { application }, new ServiceDescriptor[0], application.getRequiredServices()); - Service[] envServices = environment.start("env", _registry,new Service[0]); - system.start("root", _registry, envServices); + Service[] envServices = environment.start("env", new Service[0]); + system.start("root", envServices); ServiceDescriptor[] required = system.getRequiredServices(); assertEquals(2, required.length); ServiceDescriptor[] provided = system.getProvidedServices();