use of org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceDescription in project felix by apache.
the class TestServiceController method testArchitecture.
@Test
public void testArchitecture() {
ComponentInstance ci = ipojoHelper.createComponentInstance("PS-Controller-1-default");
// Controller set to true.
osgiHelper.waitForService(FooService.class.getName(), null, 5000);
osgiHelper.waitForService(CheckService.class.getName(), null, 5000);
ProvidedServiceHandlerDescription pshd = null;
pshd = (ProvidedServiceHandlerDescription) ci.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:provides");
ProvidedServiceDescription ps = getPS(FooService.class.getName(), pshd.getProvidedServices());
assertEquals("true", ps.getController());
CheckService check = (CheckService) osgiHelper.getServiceObject(CheckService.class.getName(), null);
assertNotNull(check);
assertFalse(check.check());
ps = getPS(FooService.class.getName(), pshd.getProvidedServices());
assertEquals("false", ps.getController());
assertTrue(check.check());
ps = getPS(FooService.class.getName(), pshd.getProvidedServices());
assertEquals("true", ps.getController());
}
Aggregations