use of org.apache.felix.scr.integration.components.ActivatorComponent in project felix by apache.
the class ComponentActivationTest method test_activate_register_service.
@Test
public void test_activate_register_service() throws Exception {
final String componentname = "ActivatorComponent.activate.with.bind";
ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.ACTIVE);
ActivatorComponent ac = ActivatorComponent.getInstance();
TestCase.assertNotNull(ac.getSimpleService());
disableAndCheck(cc);
TestCase.assertNull(ac.getSimpleService());
}
use of org.apache.felix.scr.integration.components.ActivatorComponent in project felix by apache.
the class ComponentActivationTest method testRequiredDependency.
private void testRequiredDependency(final String componentname) throws Exception {
ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.UNSATISFIED_REFERENCE);
SimpleServiceImpl ss = SimpleServiceImpl.create(bundleContext, "foo");
findComponentConfigurationByName(componentname, ComponentConfigurationDTO.SATISFIED);
ServiceReference<ActivatorComponent> ref = bundleContext.getServiceReference(ActivatorComponent.class);
ss.drop();
findComponentConfigurationByName(componentname, ComponentConfigurationDTO.UNSATISFIED_REFERENCE);
TestCase.assertNull(bundleContext.getServiceReference(ActivatorComponent.class));
ss = SimpleServiceImpl.create(bundleContext, "foo");
ref = bundleContext.getServiceReference(ActivatorComponent.class);
ActivatorComponent ac = bundleContext.getService(ref);
TestCase.assertNotNull(ac.getSimpleService());
findComponentConfigurationByName(componentname, ComponentConfigurationDTO.ACTIVE);
disableAndCheck(cc);
}
Aggregations