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<String> EVENT_TRACKER;
ProvidedInterface[] services = scope.getProvidedInterfaces();
assertEquals("Property Value", scope.getInterfaceImplementation(services[0], HelloService.class).say());
}
+
+ public void testWithPropertiesAsBean() throws IOException {
+ Map<String, ProvidedInterface> provided = new HashMap<String, ProvidedInterface>();
+ provided.put("helloService", new DefaultProvidedInterface("hello",
+ HelloService2.class));
+ SpringComponent system = new SpringComponent("system",
+ new String[] { HELLO_SERVICE_SPRING_WITH_PROPERTIES_XML2 },
+ provided, new HashMap<RequiredInterface, String>());
+ 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 {