Search in sources :

Example 11 with ComponentDescriptionDTO

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);
}
Also used : ComponentDescriptionDTO(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO) Test(org.junit.Test)

Example 12 with ComponentDescriptionDTO

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);
}
Also used : ComponentDescriptionDTO(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)

Example 13 with ComponentDescriptionDTO

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);
}
Also used : ComponentDescriptionDTO(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO) SimpleComponent(org.apache.felix.scr.integration.components.SimpleComponent) SimpleComponent2(org.apache.felix.scr.integration.components.SimpleComponent2) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Example 14 with ComponentDescriptionDTO

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");
}
Also used : ComponentDescriptionDTO(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)

Example 15 with ComponentDescriptionDTO

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));
    }
}
Also used : ComponentDescriptionDTO(org.osgi.service.component.runtime.dto.ComponentDescriptionDTO) ComponentConfigurationDTO(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO) Test(org.junit.Test)

Aggregations

ComponentDescriptionDTO (org.osgi.service.component.runtime.dto.ComponentDescriptionDTO)36 ComponentConfigurationDTO (org.osgi.service.component.runtime.dto.ComponentConfigurationDTO)18 ArrayList (java.util.ArrayList)7 Test (org.junit.Test)6 Bundle (org.osgi.framework.Bundle)3 ServiceComponentRuntime (org.osgi.service.component.runtime.ServiceComponentRuntime)3 ReferenceDTO (org.osgi.service.component.runtime.dto.ReferenceDTO)3 UnsatisfiedReferenceDTO (org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO)3 Iterator (java.util.Iterator)2 TreeMap (java.util.TreeMap)2 Component (org.apache.felix.scr.Component)2 Descriptor (org.apache.felix.service.command.Descriptor)2 JSONWriter (org.apache.felix.utils.json.JSONWriter)2 ServiceReferenceDTO (org.osgi.framework.dto.ServiceReferenceDTO)2 SatisfiedReferenceDTO (org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Pattern (java.util.regex.Pattern)1