X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=trunk%2Fsystem%2Fspring%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsystem%2Fspring%2FSpringComponentTest.java;h=3e63c7eaba4ee1b18b5399d9c3a7dca40bda7df4;hb=9f044681bb504c6e50850af0dba9e7707f61857e;hp=170297fa2c3f5ec0b3ce297e9920c979f6e5d7b3;hpb=206d5915da4795c9665c7a7bfc0f7079bf5626be;p=utils diff --git a/trunk/system/spring/src/test/java/org/wamblee/system/spring/SpringComponentTest.java b/trunk/system/spring/src/test/java/org/wamblee/system/spring/SpringComponentTest.java index 170297fa..3e63c7ea 100644 --- a/trunk/system/spring/src/test/java/org/wamblee/system/spring/SpringComponentTest.java +++ b/trunk/system/spring/src/test/java/org/wamblee/system/spring/SpringComponentTest.java @@ -37,6 +37,8 @@ public class SpringComponentTest extends TestCase { private static final String HELLO_SERVICE_SPRING_XML = "test.org.wamblee.system.spring.xml"; private static final String HELLO_SERVICE_SPRING_WITH_REQS_XML = "test.org.wamblee.system.springWithRequirements.xml"; private static final String HELLO_SERVICE_SPRING_WITH_PROPERTIES_XML = "test.org.wamblee.system.springWithProperties.xml"; + private static final String HELLO_SERVICE_SPRING_WITH_PROPERTIES_XML2 = "test.org.wamblee.system.springWithProperties2.xml"; + private static final String PROPERTY_FILE = "test.org.wamblee.system.spring.properties"; public static EventTracker EVENT_TRACKER; @@ -103,6 +105,25 @@ public class SpringComponentTest extends TestCase { ProvidedInterface[] services = scope.getProvidedInterfaces(); assertEquals("Property Value", scope.getInterfaceImplementation(services[0], HelloService.class).say()); } + + public void testWithPropertiesAsBean() throws IOException { + Map provided = new HashMap(); + provided.put("helloService", new DefaultProvidedInterface("hello", + HelloService2.class)); + SpringComponent system = new SpringComponent("system", + new String[] { HELLO_SERVICE_SPRING_WITH_PROPERTIES_XML2 }, + provided, new HashMap()); + Properties props = new Properties(); + props.load(new ClassPathResource(PROPERTY_FILE).getInputStream()); + system.addProperties("properties", props); + + Scope scope = system.start(_externalScope); + + ProvidedInterface[] services = scope.getProvidedInterfaces(); + + Properties props2 = scope.getInterfaceImplementation(services[0], HelloService2.class).getProperties(); + assertEquals(props, props2); + } public void testWithMissingRequirement() { try {