X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=system%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2FSystemAssemblerTest.java;h=60d1b587007387dc710ef1e56cdfe0b32b8f04b7;hb=4c7e63f11337abfaa6ea13eab4b6ca11891f4977;hp=94bf63c0cb88e8547e31eaf1215d7c822693a9ae;hpb=35b19fe3a3158e865125153d53cd7d106ab2fae4;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 94bf63c0..60d1b587 100644 --- a/system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java +++ b/system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java @@ -3,17 +3,26 @@ package org.wamblee.system; import junit.framework.TestCase; public class SystemAssemblerTest extends TestCase { + + private ServiceRegistry _registry; + + @Override + protected void setUp() throws Exception { + super.setUp(); + _registry = new DefaultServiceRegistry(); + } public void testEnvironmentApplication() { SubSystem environment = new Environment(); SubSystem application = new Application(); SystemAssembler assembler = new SystemAssembler(new SubSystem[] { environment, application }, new ServiceDescriptor[0]); - assembler.start(new Service[0]); + assembler.start(_registry, new Service[0]); Service[] envServices = environment.getRunningServices(); assertEquals(2, envServices.length); Service[] appServices = environment.getRunningServices(); assertEquals(2, appServices.length); + assertEquals(2, _registry.listAllServices().length); } public void testApplicationEnvironment() { @@ -22,7 +31,7 @@ public class SystemAssemblerTest extends TestCase { SubSystem application = new Application(); SystemAssembler assembler = new SystemAssembler(new SubSystem[] { application, environment }, new ServiceDescriptor[0]); - assembler.start(new Service[0]); + assembler.start(_registry, new Service[0]); } catch (SystemAssemblyException e) { // e.printStackTrace(); return; @@ -36,7 +45,7 @@ public class SystemAssemblerTest extends TestCase { CompositeSystem system = new CompositeSystem("all", new SubSystem[] { environment, application }, new ServiceDescriptor[0], new ServiceDescriptor[0]); - system.initialize("root", new Service[0]); + system.start("root", _registry, new Service[0]); ServiceDescriptor[] required = system.getRequiredServices(); assertEquals(0, required.length); ServiceDescriptor[] provided = system.getProvidedServices(); @@ -64,7 +73,7 @@ public class SystemAssemblerTest extends TestCase { environment, application }, new ServiceDescriptor[0], new ServiceDescriptor[] { new DefaultServiceDescriptor( String.class) }); - system.initialize("root", new Service[0]); + system.start("root", _registry, new Service[0]); ServiceDescriptor[] required = system.getRequiredServices(); assertEquals(1, required.length); ServiceDescriptor[] provided = system.getProvidedServices(); @@ -78,7 +87,7 @@ public class SystemAssemblerTest extends TestCase { CompositeSystem system = new CompositeSystem("all", new SubSystem[] { application }, new ServiceDescriptor[0], application.getRequiredServices()); - system.initialize("root", new Service[0]); + system.start("root", _registry, new Service[0]); } catch (SystemAssemblyException e) { return; } @@ -93,8 +102,8 @@ public class SystemAssemblerTest extends TestCase { CompositeSystem system = new CompositeSystem("all", new SubSystem[] { application }, new ServiceDescriptor[0], application.getRequiredServices()); - Service[] envServices = environment.initialize("env", new Service[0]); - system.initialize("root", envServices); + Service[] envServices = environment.start("env", _registry,new Service[0]); + system.start("root", _registry, envServices); ServiceDescriptor[] required = system.getRequiredServices(); assertEquals(2, required.length); ServiceDescriptor[] provided = system.getProvidedServices();