use of org.apache.felix.scr.integration.components.FieldActivatorComponent in project felix by apache.
the class ComponentFieldActivationTest method test_field_activator_failure.
@Test
public void test_field_activator_failure() throws Exception {
final String componentname = "FieldActivatorComponent.unsatisfied";
ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
assertEquals(1, cc.description.activationFields.length);
assertTrue(Arrays.asList(cc.description.activationFields).contains("foo"));
// we get the component, although the field does not exist!
FieldActivatorComponent cmp = this.getServiceFromConfiguration(cc, FieldActivatorComponent.class);
assertTrue(cmp.isActivateCalled());
assertTrue(cmp.setBeforeActivate().isEmpty());
assertEquals(4, cmp.notSetBeforeActivate().size());
assertNull(cmp.additionalError());
disableAndCheck(cc);
}
use of org.apache.felix.scr.integration.components.FieldActivatorComponent in project felix by apache.
the class ComponentFieldActivationTest method test_field_activator_failure_partially.
@Test
public void test_field_activator_failure_partially() throws Exception {
final String componentname = "FieldActivatorComponent.partiallysatisfied";
ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
assertEquals(3, cc.description.activationFields.length);
assertTrue(Arrays.asList(cc.description.activationFields).contains("bundle"));
assertTrue(Arrays.asList(cc.description.activationFields).contains("context"));
assertTrue(Arrays.asList(cc.description.activationFields).contains("foo"));
// we get the component, although some fields do not exist!
FieldActivatorComponent cmp = this.getServiceFromConfiguration(cc, FieldActivatorComponent.class);
assertTrue(cmp.isActivateCalled());
assertEquals(2, cmp.setBeforeActivate().size());
assertTrue(cmp.setBeforeActivate().contains("bundle"));
assertTrue(cmp.setBeforeActivate().contains("context"));
assertEquals(2, cmp.notSetBeforeActivate().size());
assertNull(cmp.additionalError());
disableAndCheck(cc);
}
use of org.apache.felix.scr.integration.components.FieldActivatorComponent in project felix by apache.
the class ComponentFieldActivationTest method test_field_activator_success.
@Test
public void test_field_activator_success() throws Exception {
final String componentname = "FieldActivatorComponent.satisfied";
ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(componentname, ComponentConfigurationDTO.SATISFIED);
assertEquals(4, cc.description.activationFields.length);
assertTrue(Arrays.asList(cc.description.activationFields).contains("bundle"));
assertTrue(Arrays.asList(cc.description.activationFields).contains("context"));
assertTrue(Arrays.asList(cc.description.activationFields).contains("config"));
assertTrue(Arrays.asList(cc.description.activationFields).contains("annotation"));
FieldActivatorComponent cmp = this.getServiceFromConfiguration(cc, FieldActivatorComponent.class);
assertTrue(cmp.isActivateCalled());
assertTrue(cmp.notSetBeforeActivate().isEmpty());
assertEquals(4, cmp.setBeforeActivate().size());
assertNull(cmp.additionalError());
disableAndCheck(cc);
}
Aggregations