(no commit message)
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Fri, 4 Apr 2008 19:08:18 +0000 (19:08 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Fri, 4 Apr 2008 19:08:18 +0000 (19:08 +0000)
system/general/src/main/java/org/wamblee/system/DefaultProvidedInterfaceDescriptor.java [moved from system/general/src/main/java/org/wamblee/system/AbstractProvidedInterfaceDescriptor.java with 77% similarity]
system/general/src/main/java/org/wamblee/system/DefaultRequiredInterfaceDescriptor.java
system/general/src/test/java/org/wamblee/system/DefaultInterfaceDescriptorTest.java
system/general/src/test/java/org/wamblee/system/Environment.java
system/general/src/test/java/org/wamblee/system/SystemAssemblerTest.java
system/spring/src/main/java/org/wamblee/system/spring/SpringComponent.java
system/spring/src/test/java/org/wamblee/system/spring/SpringComponentTest.java

similarity index 77%
rename from system/general/src/main/java/org/wamblee/system/AbstractProvidedInterfaceDescriptor.java
rename to system/general/src/main/java/org/wamblee/system/DefaultProvidedInterfaceDescriptor.java
index 2d60e34e44b55442b1223ede2c68f41b9cb46539..31eb64bb06097d841153ff18c3c9b6cec612f783 100644 (file)
@@ -7,7 +7,7 @@ import java.util.Arrays;
  *
  * @author Erik Brakkee
  */
-public class AbstractProvidedInterfaceDescriptor implements ProvidedInterfaceDescriptor {
+public class DefaultProvidedInterfaceDescriptor implements ProvidedInterfaceDescriptor {
        
        private String _name; 
        private Class[] _interfaces; 
@@ -16,12 +16,12 @@ public class AbstractProvidedInterfaceDescriptor implements ProvidedInterfaceDes
         * Constructs the descriptor. 
         * @param aInterface Type of service. 
         */
-       public AbstractProvidedInterfaceDescriptor(String aName, Class aInterface) {
+       public DefaultProvidedInterfaceDescriptor(String aName, Class aInterface) {
                _name = aName; 
                _interfaces = new Class[] { aInterface };  
        }
        
-       public AbstractProvidedInterfaceDescriptor(String aName, Class[] aInterfaces) {
+       public DefaultProvidedInterfaceDescriptor(String aName, Class[] aInterfaces) {
                _name = aName; 
                _interfaces = Arrays.copyOf(aInterfaces, aInterfaces.length);  
        }
@@ -38,10 +38,10 @@ public class AbstractProvidedInterfaceDescriptor implements ProvidedInterfaceDes
        
        @Override
        public boolean equals(Object obj) {
-               if ( !(obj instanceof AbstractProvidedInterfaceDescriptor)) { 
+               if ( !(obj instanceof DefaultProvidedInterfaceDescriptor)) { 
                        return false; 
                }
-               AbstractProvidedInterfaceDescriptor descr = (AbstractProvidedInterfaceDescriptor)obj;
+               DefaultProvidedInterfaceDescriptor descr = (DefaultProvidedInterfaceDescriptor)obj;
                if ( _interfaces.length != descr._interfaces.length ) { 
                        return false; 
                }
index a6e85bc53f33cf8fe0fef3c69cc017515a2de152..08411f90ad260ec7c1ba9a8604fb244a46273d79 100644 (file)
@@ -1,6 +1,6 @@
 package org.wamblee.system;
 
-public class DefaultRequiredInterfaceDescriptor extends AbstractProvidedInterfaceDescriptor
+public class DefaultRequiredInterfaceDescriptor extends DefaultProvidedInterfaceDescriptor
                implements RequiredInterfaceDescriptor {
 
        public DefaultRequiredInterfaceDescriptor(String aName, Class aInterface) {
index 7f9dc9333bf0d571f4d5b9f9a2e00f130538a1d9..dd3451dbc1cf0ed8427e630d58eccacca0e53257 100644 (file)
@@ -7,25 +7,25 @@ import junit.framework.TestCase;
 public class DefaultInterfaceDescriptorTest extends TestCase {
 
        public void testOneRequiredOneProvidedMatch() { 
-               ProvidedInterfaceDescriptor provided = new AbstractProvidedInterfaceDescriptor("name", String.class);
+               ProvidedInterfaceDescriptor provided = new DefaultProvidedInterfaceDescriptor("name", String.class);
                RequiredInterfaceDescriptor required = new DefaultRequiredInterfaceDescriptor("name", String.class);
                assertTrue(required.implementedBy(provided));
        }
        
        public void testOneRequiredOneProvidedMatchSubClass() { 
-               ProvidedInterfaceDescriptor provided = new AbstractProvidedInterfaceDescriptor("name", Integer.class);
+               ProvidedInterfaceDescriptor provided = new DefaultProvidedInterfaceDescriptor("name", Integer.class);
                RequiredInterfaceDescriptor required = new DefaultRequiredInterfaceDescriptor("name", Number.class);
                assertTrue(required.implementedBy(provided));
        }
        
        public void testOneRequiredOneProvidedNoMatch() { 
-               ProvidedInterfaceDescriptor provided = new AbstractProvidedInterfaceDescriptor("name", String.class);
+               ProvidedInterfaceDescriptor provided = new DefaultProvidedInterfaceDescriptor("name", String.class);
                RequiredInterfaceDescriptor required = new DefaultRequiredInterfaceDescriptor("name", Number.class);
                assertFalse(required.implementedBy(provided));
        }
        
        public void testOneRequiredMultipleProvidedMatch() { 
-               ProvidedInterfaceDescriptor provided = new AbstractProvidedInterfaceDescriptor("name", 
+               ProvidedInterfaceDescriptor provided = new DefaultProvidedInterfaceDescriptor("name", 
                                new Class[] { String.class, Integer.class} );
                RequiredInterfaceDescriptor required = new DefaultRequiredInterfaceDescriptor("name", String.class);
                assertTrue(required.implementedBy(provided));
@@ -39,7 +39,7 @@ public class DefaultInterfaceDescriptorTest extends TestCase {
        }
        
        public void testMultipleRequiredOneProvidedMatch() { 
-               ProvidedInterfaceDescriptor provided = new AbstractProvidedInterfaceDescriptor("name", 
+               ProvidedInterfaceDescriptor provided = new DefaultProvidedInterfaceDescriptor("name", 
                                MyMultiple.class );
                RequiredInterfaceDescriptor required = new DefaultRequiredInterfaceDescriptor("name", 
                                new Class[] {Runnable.class, Serializable.class} );
@@ -47,7 +47,7 @@ public class DefaultInterfaceDescriptorTest extends TestCase {
        }
        
        public void testMultipleRequiredOneProvidedNoMatch() { 
-               ProvidedInterfaceDescriptor provided = new AbstractProvidedInterfaceDescriptor("name", 
+               ProvidedInterfaceDescriptor provided = new DefaultProvidedInterfaceDescriptor("name", 
                                MyMultiple.class );
                RequiredInterfaceDescriptor required = new DefaultRequiredInterfaceDescriptor("name", 
                                new Class[] { String.class, Runnable.class} );
@@ -55,7 +55,7 @@ public class DefaultInterfaceDescriptorTest extends TestCase {
        }
        
        public void testMultipleRequiredMultipleProvidedMatch() { 
-               ProvidedInterfaceDescriptor provided = new AbstractProvidedInterfaceDescriptor("name", 
+               ProvidedInterfaceDescriptor provided = new DefaultProvidedInterfaceDescriptor("name", 
                                new Class[] { Runnable.class, Serializable.class, String.class}  );
                RequiredInterfaceDescriptor required = new DefaultRequiredInterfaceDescriptor("name", 
                                new Class[] {Runnable.class, Serializable.class} );
index 6c9512ca2b75383c92c96ab24135276fe4616f23..ebc432657c88c227197f1ec0fd46d92964adc64e 100644 (file)
@@ -7,8 +7,8 @@ public class Environment extends AbstractComponent {
        
        private static final ProvidedInterfaceDescriptor[] PROVIDED = 
                new ProvidedInterfaceDescriptor[] { 
-                       new AbstractProvidedInterfaceDescriptor("datasource", DataSource.class), 
-                       new AbstractProvidedInterfaceDescriptor("integer", Integer.class)
+                       new DefaultProvidedInterfaceDescriptor("datasource", DataSource.class), 
+                       new DefaultProvidedInterfaceDescriptor("integer", Integer.class)
        };
        
        public Environment(ServiceRegistry aRegistry) { 
index 810ff4c7d4cfcdeebd990866e60006e2c0ed1f27..edd4bc2c0a9577def246f3401442415635bc6c08 100644 (file)
@@ -31,11 +31,11 @@ public class SystemAssemblerTest extends TestCase {
                                "name", Runnable.class);
                RequiredInterfaceDescriptor req2 = new DefaultRequiredInterfaceDescriptor(
                                "name", Serializable.class);
-               ProvidedInterfaceDescriptor prov1 = new AbstractProvidedInterfaceDescriptor(
+               ProvidedInterfaceDescriptor prov1 = new DefaultProvidedInterfaceDescriptor(
                                "name", Runnable.class);
-               ProvidedInterfaceDescriptor prov2 = new AbstractProvidedInterfaceDescriptor(
+               ProvidedInterfaceDescriptor prov2 = new DefaultProvidedInterfaceDescriptor(
                                "name", Serializable.class);
-               ProvidedInterfaceDescriptor prov3 = new AbstractProvidedInterfaceDescriptor(
+               ProvidedInterfaceDescriptor prov3 = new DefaultProvidedInterfaceDescriptor(
                                "name", MyMultiple.class);
 
                AssertionUtils.assertEquals(new RequiredInterfaceDescriptor[] { req1 },
@@ -129,7 +129,7 @@ public class SystemAssemblerTest extends TestCase {
                                        "all",
                                        _registry,
                                        new Component[] { environment, application },
-                                       new ProvidedInterfaceDescriptor[] { new AbstractProvidedInterfaceDescriptor(
+                                       new ProvidedInterfaceDescriptor[] { new DefaultProvidedInterfaceDescriptor(
                                                        "string", String.class) },
                                        new DefaultRequiredInterfaceDescriptor[0]);
                } catch (SystemAssemblyException e) {
index 6f153e5749ee7154c25e685e90f5bb68f0b6f099..a5dd685d4d6074be65811bac4dd3f1197956edfb 100644 (file)
@@ -2,22 +2,18 @@ package org.wamblee.system.spring;
 
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 
 import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.ConstructorArgumentValues;
 import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.context.support.GenericApplicationContext;
 import org.wamblee.system.AbstractComponent;
-import org.wamblee.system.Container;
 import org.wamblee.system.ProvidedInterfaceDescriptor;
 import org.wamblee.system.RequiredInterfaceDescriptor;
 import org.wamblee.system.Service;
-import org.wamblee.system.InterfaceDescriptor;
 import org.wamblee.system.ServiceRegistry;
 import org.wamblee.system.SystemAssembler;
 import org.wamblee.system.SystemAssemblyException;
index c02f951ae82f63836067683e8e948a9b9d58140d..f83e2ec116a885cb7a78dd23f4f03a59e95635f9 100644 (file)
@@ -8,14 +8,12 @@ import java.util.Properties;
 import junit.framework.TestCase;
 
 import org.wamblee.io.ClassPathResource;
-import org.wamblee.system.AbstractProvidedInterfaceDescriptor;
-import org.wamblee.system.AbstractProvidedInterfaceDescriptor;
+import org.wamblee.system.DefaultProvidedInterfaceDescriptor;
 import org.wamblee.system.DefaultRequiredInterfaceDescriptor;
 import org.wamblee.system.DefaultServiceRegistry;
 import org.wamblee.system.ProvidedInterfaceDescriptor;
 import org.wamblee.system.RequiredInterfaceDescriptor;
 import org.wamblee.system.Service;
-import org.wamblee.system.InterfaceDescriptor;
 import org.wamblee.system.ServiceRegistry;
 import org.wamblee.system.SystemAssemblyException;
 
@@ -48,7 +46,7 @@ public class SpringComponentTest extends TestCase {
 
        public void testOneProvidedService() {
                Map<String, ProvidedInterfaceDescriptor> provided = new HashMap<String, ProvidedInterfaceDescriptor>();
-               provided.put("helloService", new AbstractProvidedInterfaceDescriptor(
+               provided.put("helloService", new DefaultProvidedInterfaceDescriptor(
                                "hello", HelloService.class));
 
                SpringComponent system = new SpringComponent("system", _registry,
@@ -65,7 +63,7 @@ public class SpringComponentTest extends TestCase {
        
        public void testWithProperties() throws IOException {
                Map<String, ProvidedInterfaceDescriptor> provided = new HashMap<String, ProvidedInterfaceDescriptor>();
-               provided.put("helloService", new AbstractProvidedInterfaceDescriptor(
+               provided.put("helloService", new DefaultProvidedInterfaceDescriptor(
                                "hello", HelloService.class));
                SpringComponent system = new SpringComponent("system", _registry,
                                new String[] { HELLO_SERVICE_SPRING_WITH_PROPERTIES_XML },
@@ -103,7 +101,7 @@ public class SpringComponentTest extends TestCase {
                                new HashMap<String, ProvidedInterfaceDescriptor>(), required);
                
                HelloService helloObject = new HelloService("ladida"); 
-               Service helloService = _registry.register(new AbstractProvidedInterfaceDescriptor("hello", HelloService.class), helloObject);
+               Service helloService = _registry.register(new DefaultProvidedInterfaceDescriptor("hello", HelloService.class), helloObject);
                system.start("Bla", new Service[] { helloService } );
                system.stop();
        }
@@ -113,7 +111,7 @@ public class SpringComponentTest extends TestCase {
                required.put(new DefaultRequiredInterfaceDescriptor("hello", HelloService.class),
                                "helloService");
                Map<String,ProvidedInterfaceDescriptor> provided = new HashMap<String, ProvidedInterfaceDescriptor>();
-               provided.put("blaService", new AbstractProvidedInterfaceDescriptor("bla",
+               provided.put("blaService", new DefaultProvidedInterfaceDescriptor("bla",
                                BlaService.class));
 
                SpringComponent system = new SpringComponent("system", _registry,
@@ -121,7 +119,7 @@ public class SpringComponentTest extends TestCase {
                                provided, required);
                
                HelloService helloObject = new HelloService("ladida"); 
-               Service helloService = _registry.register(new AbstractProvidedInterfaceDescriptor("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);