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.ProvidedInterface;
+import org.wamblee.system.RequiredInterface;
import org.wamblee.system.Service;
-import org.wamblee.system.InterfaceDescriptor;
import org.wamblee.system.ServiceRegistry;
import org.wamblee.system.SystemAssemblyException;
public void testBlackboxSystem() {
SpringComponent system = new SpringComponent("system", _registry,
new String[] { HELLO_SERVICE_SPRING_XML },
- new HashMap<String, ProvidedInterfaceDescriptor>(),
- new HashMap<RequiredInterfaceDescriptor, String>());
+ new HashMap<String, ProvidedInterface>(),
+ new HashMap<RequiredInterface, String>());
system.start("Hello", new Service[0]);
Service[] services = system.getRunningServices();
assertEquals(0, services.length);
}
public void testOneProvidedService() {
- Map<String, ProvidedInterfaceDescriptor> provided = new HashMap<String, ProvidedInterfaceDescriptor>();
- provided.put("helloService", new AbstractProvidedInterfaceDescriptor(
+ Map<String, ProvidedInterface> provided = new HashMap<String, ProvidedInterface>();
+ provided.put("helloService", new DefaultProvidedInterfaceDescriptor(
"hello", HelloService.class));
SpringComponent system = new SpringComponent("system", _registry,
new String[] { HELLO_SERVICE_SPRING_XML }, provided,
- new HashMap<RequiredInterfaceDescriptor, String>());
+ new HashMap<RequiredInterface, String>());
system.start("Hello", new Service[0]);
Service[] services = system.getRunningServices();
assertEquals(1, services.length);
}
public void testWithProperties() throws IOException {
- Map<String, ProvidedInterfaceDescriptor> provided = new HashMap<String, ProvidedInterfaceDescriptor>();
- provided.put("helloService", new AbstractProvidedInterfaceDescriptor(
+ Map<String, ProvidedInterface> provided = new HashMap<String, ProvidedInterface>();
+ provided.put("helloService", new DefaultProvidedInterfaceDescriptor(
"hello", HelloService.class));
SpringComponent system = new SpringComponent("system", _registry,
new String[] { HELLO_SERVICE_SPRING_WITH_PROPERTIES_XML },
provided,
- new HashMap<RequiredInterfaceDescriptor, String>());
+ new HashMap<RequiredInterface, String>());
Properties props = new Properties();
props.load(new ClassPathResource(PROPERTY_FILE).getInputStream());
system.addProperties(props);
try {
SpringComponent system = new SpringComponent("system", _registry,
new String[] { HELLO_SERVICE_SPRING_WITH_REQS_XML },
- new HashMap<String, ProvidedInterfaceDescriptor>(),
- new HashMap<RequiredInterfaceDescriptor, String>());
+ new HashMap<String, ProvidedInterface>(),
+ new HashMap<RequiredInterface, String>());
system.start("Bla", new Service[0]);
} catch (SystemAssemblyException e) {
//e.printStackTrace();
}
public void testWithRequirement() {
- Map<RequiredInterfaceDescriptor, String> required = new HashMap<RequiredInterfaceDescriptor, String>();
+ Map<RequiredInterface, String> required = new HashMap<RequiredInterface, String>();
required.put(new DefaultRequiredInterfaceDescriptor("hello", HelloService.class),
"helloService");
SpringComponent system = new SpringComponent("system", _registry,
new String[] { HELLO_SERVICE_SPRING_WITH_REQS_XML },
- new HashMap<String, ProvidedInterfaceDescriptor>(), required);
+ new HashMap<String, ProvidedInterface>(), 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();
}
public void testWithRequirementAndProvidedService() {
- Map<RequiredInterfaceDescriptor, String> required = new HashMap<RequiredInterfaceDescriptor, String>();
+ Map<RequiredInterface, String> required = new HashMap<RequiredInterface, String>();
required.put(new DefaultRequiredInterfaceDescriptor("hello", HelloService.class),
"helloService");
- Map<String,ProvidedInterfaceDescriptor> provided = new HashMap<String, ProvidedInterfaceDescriptor>();
- provided.put("blaService", new AbstractProvidedInterfaceDescriptor("bla",
+ Map<String,ProvidedInterface> provided = new HashMap<String, ProvidedInterface>();
+ provided.put("blaService", new DefaultProvidedInterfaceDescriptor("bla",
BlaService.class));
SpringComponent system = new SpringComponent("system", _registry,
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);