use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project felix by apache.
the class ComponentConfigurationPidTest method test_configurationpid_must_not_use_name_as_pid.
@Test
public void test_configurationpid_must_not_use_name_as_pid() throws Exception {
final String name = "ConfigurationPid.componentName";
final String pid = name;
deleteConfig(pid);
delay();
getConfigurationsDisabledThenEnable(name, 0, ComponentConfigurationDTO.UNSATISFIED_REFERENCE);
TestCase.assertNull(SimpleComponent.INSTANCE);
configure(pid);
delay();
ComponentDescriptionDTO cd = checkConfigurationCount(name, 0, -1);
TestCase.assertNull(SimpleComponent.INSTANCE);
deleteConfig(pid);
delay();
disableAndCheck(cd);
}
use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project felix by apache.
the class ComponentTestBase method disableAndCheck.
protected void disableAndCheck(ComponentConfigurationDTO cc) throws InvocationTargetException, InterruptedException {
ComponentDescriptionDTO cd = cc.description;
disableAndCheck(cd);
}
use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project felix by apache.
the class Felix4350Test method doTest.
protected void doTest(String componentName) throws Exception {
ServiceRegistration dep1Reg = register(new SimpleComponent(), 0);
ServiceRegistration dep2Reg = register(new SimpleComponent2(), 1000);
final ComponentDescriptionDTO main = findComponentDescriptorByName(componentName);
TestCase.assertNotNull(main);
// needs to be async
asyncEnable(main);
// dep2 getService has not yet returned
delay(300);
dep1Reg.unregister();
// dep2 getService has returned
delay(2000);
Felix4350Component.check(0, 0, false);
dep1Reg = register(new SimpleComponent(), 0);
delay(300);
Felix4350Component.check(1, 0, true);
// does not need to be asyncv??
disableAndCheck(main);
dep1Reg.unregister();
dep2Reg.unregister();
Felix4350Component.check(1, 1, false);
dep1Reg = register(new SimpleComponent(), 0);
dep2Reg = register(new SimpleComponent2(), 1000);
Felix4350Component.check(1, 1, false);
// needs to be async
asyncEnable(main);
delay(300);
dep1Reg.unregister();
delay(100);
dep1Reg = register(new SimpleComponent(), 0);
delay(2000);
// n.b. counts are cumulative
Felix4350Component.check(2, 1, true);
}
use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project felix by apache.
the class Main method dumpA.
private void dumpA() {
ComponentDescriptionDTO c = m_scr.getComponentDescriptionDTO(m_bctx.getBundle(), "org.apache.felix.scr.integration.components.felix3680_2.A");
m_logService.log(LogService.LOG_WARNING, "State of " + c.name + " enabled:" + m_scr.isComponentEnabled(c) + "\n");
}
use of org.osgi.service.component.runtime.dto.ComponentDescriptionDTO in project felix by apache.
the class ActivateSignatureTest method test.
@Test
public void test() {
// wait for components to fire up in the background....
delay();
final Collection<ComponentDescriptionDTO> components = getComponentDescriptions();
TestCase.assertNotNull(components);
for (ComponentDescriptionDTO component : components) {
TestCase.assertTrue("Expecting component " + component.name + " to be enabled", component.defaultEnabled);
ComponentConfigurationDTO cc = findComponentConfigurationByName(component.name, 0);
TestCase.assertEquals("Expecting component " + component.name + " to be active", ComponentConfigurationDTO.ACTIVE, cc.state);
TestCase.assertNotNull("Expect activate method to be called", AbstractActivateSignatureTestComponent.getInstance(component.name));
}
}
Aggregations