Search in sources :

Example 1 with SimpleService2Impl

use of org.apache.felix.scr.integration.components.SimpleService2Impl in project felix by apache.

the class ServiceBindTest method test_multi_service_bind_unbind_order.

@Test
public void test_multi_service_bind_unbind_order() throws Exception {
    final SimpleServiceImpl srv1 = SimpleServiceImpl.create(bundleContext, "srv1");
    final SimpleService2Impl srv2 = SimpleService2Impl.create(bundleContext, "srv2");
    String name = "test_multi_service_bind_unbind_order";
    ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(name, ComponentConfigurationDTO.ACTIVE);
    final SimpleComponent2 comp10 = SimpleComponent2.INSTANCE;
    TestCase.assertNotNull(comp10);
    TestCase.assertEquals(2, comp10.getBindings().size());
    TestCase.assertEquals("bindSimpleService", comp10.getBindings().get(0));
    TestCase.assertEquals("bindSimpleService2", comp10.getBindings().get(1));
    disableAndCheck(cc);
    delay();
    TestCase.assertEquals(4, comp10.getBindings().size());
    TestCase.assertEquals("bindSimpleService", comp10.getBindings().get(0));
    TestCase.assertEquals("bindSimpleService2", comp10.getBindings().get(1));
    TestCase.assertEquals("unbindSimpleService2", comp10.getBindings().get(2));
    TestCase.assertEquals("unbindSimpleService", comp10.getBindings().get(3));
    srv1.drop();
    srv2.drop();
}
Also used : SimpleService2Impl(org.apache.felix.scr.integration.components.SimpleService2Impl) SimpleComponent2(org.apache.felix.scr.integration.components.SimpleComponent2) ComponentConfigurationDTO(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO) SimpleServiceImpl(org.apache.felix.scr.integration.components.SimpleServiceImpl) Test(org.junit.Test)

Example 2 with SimpleService2Impl

use of org.apache.felix.scr.integration.components.SimpleService2Impl in project felix by apache.

the class ServiceBindGreedyTest method test_multi_service_bind_unbind_order.

@Test
public void test_multi_service_bind_unbind_order() throws Exception {
    final SimpleServiceImpl srv1 = SimpleServiceImpl.create(bundleContext, "srv1");
    final SimpleService2Impl srv2 = SimpleService2Impl.create(bundleContext, "srv2");
    String name = "test_multi_service_bind_unbind_order";
    ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(name, ComponentConfigurationDTO.ACTIVE);
    final SimpleComponent2 comp10 = SimpleComponent2.INSTANCE;
    TestCase.assertNotNull(comp10);
    TestCase.assertEquals(2, comp10.getBindings().size());
    TestCase.assertEquals("bindSimpleService", comp10.getBindings().get(0));
    TestCase.assertEquals("bindSimpleService2", comp10.getBindings().get(1));
    disableAndCheck(cc);
    delay();
    TestCase.assertEquals(4, comp10.getBindings().size());
    TestCase.assertEquals("bindSimpleService", comp10.getBindings().get(0));
    TestCase.assertEquals("bindSimpleService2", comp10.getBindings().get(1));
    TestCase.assertEquals("unbindSimpleService2", comp10.getBindings().get(2));
    TestCase.assertEquals("unbindSimpleService", comp10.getBindings().get(3));
    srv1.drop();
    srv2.drop();
}
Also used : SimpleService2Impl(org.apache.felix.scr.integration.components.SimpleService2Impl) SimpleComponent2(org.apache.felix.scr.integration.components.SimpleComponent2) ComponentConfigurationDTO(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO) SimpleServiceImpl(org.apache.felix.scr.integration.components.SimpleServiceImpl) Test(org.junit.Test)

Aggregations

SimpleComponent2 (org.apache.felix.scr.integration.components.SimpleComponent2)2 SimpleService2Impl (org.apache.felix.scr.integration.components.SimpleService2Impl)2 SimpleServiceImpl (org.apache.felix.scr.integration.components.SimpleServiceImpl)2 Test (org.junit.Test)2 ComponentConfigurationDTO (org.osgi.service.component.runtime.dto.ComponentConfigurationDTO)2