Search in sources :

Example 1 with ConstructorComponent

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

the class ComponentConstructorTest method test_constructor_singleRef.

@Test
public void test_constructor_singleRef() throws Exception {
    final String componentname = "ConstructorComponent.refsingle";
    ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
    assertEquals(1, cc.description.init);
    ConstructorComponent cmp = this.getServiceFromConfiguration(cc, ConstructorComponent.class);
    final String msg = cmp.test();
    assertNull(msg);
    disableAndCheck(cc);
}
Also used : ComponentConfigurationDTO(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO) ConstructorComponent(org.apache.felix.scr.integration.components.ConstructorComponent) Test(org.junit.Test)

Example 2 with ConstructorComponent

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

the class ComponentConstructorTest method test_constructor_success.

@Test
public void test_constructor_success() throws Exception {
    final String componentname = "ConstructorComponent.satisfied";
    ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
    assertEquals(4, cc.description.init);
    ConstructorComponent cmp = this.getServiceFromConfiguration(cc, ConstructorComponent.class);
    final String msg = cmp.test();
    assertNull(msg);
    disableAndCheck(cc);
}
Also used : ComponentConfigurationDTO(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO) ConstructorComponent(org.apache.felix.scr.integration.components.ConstructorComponent) Test(org.junit.Test)

Example 3 with ConstructorComponent

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

the class ComponentConstructorTest method test_constructor_multiRef.

@Test
public void test_constructor_multiRef() throws Exception {
    final String componentname = "ConstructorComponent.refmulti";
    ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
    assertEquals(1, cc.description.init);
    ConstructorComponent cmp = this.getServiceFromConfiguration(cc, ConstructorComponent.class);
    final String msg = cmp.test();
    assertNull(msg);
    disableAndCheck(cc);
}
Also used : ComponentConfigurationDTO(org.osgi.service.component.runtime.dto.ComponentConfigurationDTO) ConstructorComponent(org.apache.felix.scr.integration.components.ConstructorComponent) Test(org.junit.Test)

Aggregations

ConstructorComponent (org.apache.felix.scr.integration.components.ConstructorComponent)3 Test (org.junit.Test)3 ComponentConfigurationDTO (org.osgi.service.component.runtime.dto.ComponentConfigurationDTO)3