rename subsystem to component.
[utils] / system / spring / src / test / java / org / wamblee / system / spring / SpringSystemTest.java
index e12e0113a46e2d9a2b42e7f1b9ca3929d3cc64f2..1543b7ab8cd39067b6d9a9aa64450c9a733a8669 100644 (file)
@@ -5,14 +5,14 @@ import java.util.Map;
 
 import junit.framework.TestCase;
 
-import org.wamblee.system.AbstractServiceDescriptor;
-import org.wamblee.system.DefaultProvidedServiceDescriptor;
-import org.wamblee.system.DefaultRequiredServiceDescriptor;
+import org.wamblee.system.AbstractInterfaceDescriptor;
+import org.wamblee.system.DefaultProvidedInterfaceDescriptor;
+import org.wamblee.system.DefaultRequiredInterfaceDescriptor;
 import org.wamblee.system.DefaultServiceRegistry;
-import org.wamblee.system.ProvidedServiceDescriptor;
-import org.wamblee.system.RequiredServiceDescriptor;
+import org.wamblee.system.ProvidedInterfaceDescriptor;
+import org.wamblee.system.RequiredInterfaceDescriptor;
 import org.wamblee.system.Service;
-import org.wamblee.system.ServiceDescriptor;
+import org.wamblee.system.InterfaceDescriptor;
 import org.wamblee.system.ServiceRegistry;
 import org.wamblee.system.SystemAssemblyException;
 
@@ -32,8 +32,8 @@ public class SpringSystemTest extends TestCase {
        public void testBlackboxSystem() {
                SpringSystem system = new SpringSystem("system", _registry,
                                new String[] { HELLO_SERVICE_SPRING_XML },
-                               new HashMap<String, ProvidedServiceDescriptor>(),
-                               new HashMap<RequiredServiceDescriptor, String>());
+                               new HashMap<String, ProvidedInterfaceDescriptor>(),
+                               new HashMap<RequiredInterfaceDescriptor, String>());
                system.start("Hello", new Service[0]);
                Service[] services = system.getRunningServices();
                assertEquals(0, services.length);
@@ -42,13 +42,13 @@ public class SpringSystemTest extends TestCase {
        }
 
        public void testOneProvidedService() {
-               Map<String, ProvidedServiceDescriptor> provided = new HashMap<String, ProvidedServiceDescriptor>();
-               provided.put("helloService", new DefaultProvidedServiceDescriptor(
+               Map<String, ProvidedInterfaceDescriptor> provided = new HashMap<String, ProvidedInterfaceDescriptor>();
+               provided.put("helloService", new DefaultProvidedInterfaceDescriptor(
                                "hello", HelloService.class));
 
                SpringSystem system = new SpringSystem("system", _registry,
                                new String[] { HELLO_SERVICE_SPRING_XML }, provided,
-                               new HashMap<RequiredServiceDescriptor, String>());
+                               new HashMap<RequiredInterfaceDescriptor, String>());
                system.start("Hello", new Service[0]);
                Service[] services = system.getRunningServices();
                assertEquals(1, services.length);
@@ -62,8 +62,8 @@ public class SpringSystemTest extends TestCase {
                try {
                        SpringSystem system = new SpringSystem("system", _registry,
                                        new String[] { HELLO_SERVICE_SPRING_WITH_REQS_XML },
-                                       new HashMap<String, ProvidedServiceDescriptor>(),
-                                       new HashMap<RequiredServiceDescriptor, String>());
+                                       new HashMap<String, ProvidedInterfaceDescriptor>(),
+                                       new HashMap<RequiredInterfaceDescriptor, String>());
                        system.start("Bla", new Service[0]);
                } catch (SystemAssemblyException e) {
                        //e.printStackTrace();
@@ -73,25 +73,25 @@ public class SpringSystemTest extends TestCase {
        }
 
        public void testWithRequirement() {
-               Map<RequiredServiceDescriptor, String> required = new HashMap<RequiredServiceDescriptor, String>();
-               required.put(new DefaultRequiredServiceDescriptor("hello", HelloService.class),
+               Map<RequiredInterfaceDescriptor, String> required = new HashMap<RequiredInterfaceDescriptor, String>();
+               required.put(new DefaultRequiredInterfaceDescriptor("hello", HelloService.class),
                                "helloService");
                SpringSystem system = new SpringSystem("system", _registry,
                                new String[] { HELLO_SERVICE_SPRING_WITH_REQS_XML },
-                               new HashMap<String, ProvidedServiceDescriptor>(), required);
+                               new HashMap<String, ProvidedInterfaceDescriptor>(), required);
                
                HelloService helloObject = new HelloService("ladida"); 
-               Service helloService = _registry.register(new DefaultProvidedServiceDescriptor("hello", HelloService.class), helloObject);
+               Service helloService = _registry.register(new DefaultProvidedInterfaceDescriptor("hello", HelloService.class), helloObject);
                system.start("Bla", new Service[] { helloService } );
                system.stop();
        }
        
        public void testWithRequirementAndProvidedService() {
-               Map<RequiredServiceDescriptor, String> required = new HashMap<RequiredServiceDescriptor, String>();
-               required.put(new DefaultRequiredServiceDescriptor("hello", HelloService.class),
+               Map<RequiredInterfaceDescriptor, String> required = new HashMap<RequiredInterfaceDescriptor, String>();
+               required.put(new DefaultRequiredInterfaceDescriptor("hello", HelloService.class),
                                "helloService");
-               Map<String,ProvidedServiceDescriptor> provided = new HashMap<String, ProvidedServiceDescriptor>();
-               provided.put("blaService", new DefaultProvidedServiceDescriptor("bla",
+               Map<String,ProvidedInterfaceDescriptor> provided = new HashMap<String, ProvidedInterfaceDescriptor>();
+               provided.put("blaService", new DefaultProvidedInterfaceDescriptor("bla",
                                BlaService.class));
 
                SpringSystem system = new SpringSystem("system", _registry,
@@ -99,7 +99,7 @@ public class SpringSystemTest extends TestCase {
                                provided, required);
                
                HelloService helloObject = new HelloService("ladida"); 
-               Service helloService = _registry.register(new DefaultProvidedServiceDescriptor("hello", HelloService.class), helloObject);
+               Service helloService = _registry.register(new DefaultProvidedInterfaceDescriptor("hello", HelloService.class), helloObject);
                Service[] services = system.start("Bla", new Service[] { helloService } );
                assertEquals(1, services.length);