added spring subsystem implementation.
[utils] / system / general / src / test / java / org / wamblee / system / SystemAssemblerTest.java
index 70558250b547d1b4bfdc92b7c56c0e61cbdbada2..1bd89ca5fb212765a7f5e78a016ed443c4f6a37f 100644 (file)
@@ -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();