SystemAssembler.filterRequiredServices(prov1, Arrays
.asList(new RequiredInterfaceDescriptor[] { req1 })));
AssertionUtils.assertEquals(new RequiredInterfaceDescriptor[] { req1 },
- SystemAssembler
- .filterRequiredServices(prov1, Arrays
- .asList(new RequiredInterfaceDescriptor[] { req1,
- req2 })));
+ SystemAssembler.filterRequiredServices(prov1,
+ Arrays.asList(new RequiredInterfaceDescriptor[] { req1,
+ req2 })));
AssertionUtils.assertEquals(new RequiredInterfaceDescriptor[] { req1,
req2 }, SystemAssembler.filterRequiredServices(prov3, Arrays
.asList(new RequiredInterfaceDescriptor[] { req1, req2 })));
- AssertionUtils.assertEquals(new ProvidedInterfaceDescriptor[] { prov1 },
+ AssertionUtils.assertEquals(
+ new ProvidedInterfaceDescriptor[] { prov1 },
SystemAssembler.filterProvidedServices(req1, Arrays
.asList(new ProvidedInterfaceDescriptor[] { prov1 })));
- AssertionUtils.assertEquals(new ProvidedInterfaceDescriptor[] { prov1 },
- SystemAssembler.filterProvidedServices(req1,
- Arrays.asList(new ProvidedInterfaceDescriptor[] { prov1,
- prov2 })));
+ AssertionUtils.assertEquals(
+ new ProvidedInterfaceDescriptor[] { prov1 }, SystemAssembler
+ .filterProvidedServices(req1, Arrays
+ .asList(new ProvidedInterfaceDescriptor[] {
+ prov1, prov2 })));
AssertionUtils.assertEquals(new ProvidedInterfaceDescriptor[] { prov1,
prov3 }, SystemAssembler.filterProvidedServices(req1, Arrays
.asList(new ProvidedInterfaceDescriptor[] { prov1, prov3 })));
Component application = new Application(_registry);
assertEquals(Status.NOT_STARTED, environment.getStatus());
assertEquals(Status.NOT_STARTED, application.getStatus());
- CompositeComponent system = new CompositeComponent("all", _registry,
- new Component[] { environment, application },
- new InterfaceDescriptor[0], new InterfaceDescriptor[0]);
+ Container system = new Container("all", _registry, new Component[] {
+ environment, application }, new ProvidedInterfaceDescriptor[0],
+ new RequiredInterfaceDescriptor[0]);
assertEquals(Status.NOT_STARTED, system.getStatus());
system.start("root", new Service[0]);
InterfaceDescriptor[] required = system.getRequiredServices();
assertEquals(Status.RUNNING, environment.getStatus());
assertEquals(Status.RUNNING, application.getStatus());
assertEquals(Status.RUNNING, system.getStatus());
-
+
system.stop();
assertEquals(Status.STOPPED, environment.getStatus());
assertEquals(Status.STOPPED, application.getStatus());
try {
Component environment = new Environment(_registry);
Component application = new Application(_registry);
- CompositeComponent system = new CompositeComponent(
+ Container system = new Container(
"all",
_registry,
new Component[] { environment, application },
- new InterfaceDescriptor[] { new DefaultProvidedInterfaceDescriptor(
+ new ProvidedInterfaceDescriptor[] { new DefaultProvidedInterfaceDescriptor(
"string", String.class) },
new DefaultRequiredInterfaceDescriptor[0]);
} catch (SystemAssemblyException e) {
public void testCompositeWithSuperfluousRequiredInfo() {
Component environment = new Environment(_registry);
Component application = new Application(_registry);
- CompositeComponent system = new CompositeComponent("all", _registry,
+ Container system = new Container(
+ "all",
+ _registry,
new Component[] { environment, application },
- new InterfaceDescriptor[0],
- new InterfaceDescriptor[] { new DefaultRequiredInterfaceDescriptor(
+ new ProvidedInterfaceDescriptor[0],
+ new RequiredInterfaceDescriptor[] { new DefaultRequiredInterfaceDescriptor(
"string", String.class) });
system.start("root", new Service[0]);
- InterfaceDescriptor[] required = system.getRequiredServices();
+ RequiredInterfaceDescriptor[] required = system.getRequiredServices();
assertEquals(1, required.length);
- InterfaceDescriptor[] provided = system.getProvidedServices();
+ ProvidedInterfaceDescriptor[] provided = system.getProvidedServices();
assertEquals(0, provided.length);
}
try {
Component environment = new Environment(_registry);
Component application = new Application(_registry);
- CompositeComponent system = new CompositeComponent("all", _registry,
- new Component[] { application }, new InterfaceDescriptor[0],
- application.getRequiredServices());
+ Container system = new Container("all", _registry,
+ new Component[] { application },
+ new ProvidedInterfaceDescriptor[0], application
+ .getRequiredServices());
system.start("root", new Service[0]);
} catch (SystemAssemblyException e) {
return;
Component environment = new Environment(_registry);
Component application = new Application(_registry);
- CompositeComponent system = new CompositeComponent("all", _registry,
- new Component[] { application }, new InterfaceDescriptor[0],
- application.getRequiredServices());
+ Container system = new Container("all", _registry,
+ new Component[] { application },
+ new ProvidedInterfaceDescriptor[0], application
+ .getRequiredServices());
Service[] envServices = environment.start("env", new Service[0]);
system.start("root", envServices);
- InterfaceDescriptor[] required = system.getRequiredServices();
+ RequiredInterfaceDescriptor[] required = system.getRequiredServices();
assertEquals(2, required.length);
- InterfaceDescriptor[] provided = system.getProvidedServices();
+ ProvidedInterfaceDescriptor[] provided = system.getProvidedServices();
assertEquals(0, provided.length);
}
environment1, environment2, application },
new ProvidedInterfaceDescriptor[0]);
assembler.start(_registry, new Service[0]);
-
+
+ } catch (SystemAssemblyException e) {
+ return;
+ }
+ fail();
+ }
+
+ public void testIncompleteRequirements() {
+ try {
+ Component application = new Application(_registry);
+ Container system = new Container("all", _registry,
+ new Component[] { application },
+ new ProvidedInterfaceDescriptor[0],
+ new RequiredInterfaceDescriptor[0]);
+ system.start("root", new Service[0]);
} catch (SystemAssemblyException e) {
return;
}
fail();
}
-
}