Search in sources :

Example 11 with ProvidedServiceDescription

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());
}
Also used : FooService(org.apache.felix.ipojo.runtime.core.services.FooService) ProvidedServiceDescription(org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceDescription) ComponentInstance(org.apache.felix.ipojo.ComponentInstance) CheckService(org.apache.felix.ipojo.runtime.core.services.CheckService) ProvidedServiceHandlerDescription(org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandlerDescription) Test(org.junit.Test)

Aggregations

ProvidedServiceDescription (org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceDescription)11 ProvidedServiceHandlerDescription (org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandlerDescription)9 FooService (org.apache.felix.ipojo.runtime.core.services.FooService)8 Test (org.junit.Test)8 ComponentInstance (org.apache.felix.ipojo.ComponentInstance)4 Factory (org.apache.felix.ipojo.Factory)4 Architecture (org.apache.felix.ipojo.architecture.Architecture)4 HandlerDescription (org.apache.felix.ipojo.architecture.HandlerDescription)4 InstanceDescription (org.apache.felix.ipojo.architecture.InstanceDescription)4 ServiceReference (org.osgi.framework.ServiceReference)4 Properties (java.util.Properties)3 PrimitiveInstanceDescription (org.apache.felix.ipojo.PrimitiveInstanceDescription)2 CheckService (org.apache.felix.ipojo.runtime.core.services.CheckService)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ProvidedServiceListener (org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceListener)1 BarService (org.apache.felix.ipojo.runtime.core.services.BarService)1