Search in sources :

Example 1 with HandlerBindingTestService

use of org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService in project felix by apache.

the class TestHandlerBindingAndIgnoreAnnotation method testFooHandlerBinding.

@Test
public void testFooHandlerBinding() {
    /*
        HandlerFactory handlerFactory = ipojoHelper.getHandlerFactory("com.acme:foo");
        assertNotNull(handlerFactory);
        assertEquals(Factory.VALID, handlerFactory.getState());
*/
    // verify component's factory is here
    // verify BazService has been published
    // --> verify instance has been created
    Factory factory = ipojoHelper.getFactory(FACTORY_NAME);
    assertNotNull(factory);
    assertEquals(Factory.VALID, factory.getState());
    List<HandlerBindingTestService> services = osgiHelper.getServiceObjects(HandlerBindingTestService.class);
    assertEquals(1, services.size());
    HandlerBindingTestService baz = services.get(0);
    assertEquals("Bonjour", baz.get("greeting"));
    assertEquals("Welcome", baz.get("welcome"));
    assertNull(baz.get("ignored"));
    ipojoHelper.dispose();
}
Also used : HandlerBindingTestService(org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService) Factory(org.apache.felix.ipojo.Factory) HandlerFactory(org.apache.felix.ipojo.HandlerFactory) Test(org.junit.Test) BaseTest(org.ow2.chameleon.testing.helpers.BaseTest)

Aggregations

Factory (org.apache.felix.ipojo.Factory)1 HandlerFactory (org.apache.felix.ipojo.HandlerFactory)1 HandlerBindingTestService (org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService)1 Test (org.junit.Test)1 BaseTest (org.ow2.chameleon.testing.helpers.BaseTest)1