use of org.apache.felix.ipojo.api.PrimitiveComponentType in project felix by apache.
the class PrimitiveComponentTest method killTheFactory.
@Test
public void killTheFactory() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
assertThat(context, is(notNullValue()));
ComponentInstance ci = null;
PrimitiveComponentType type = createAProvider();
ci = type.createInstance();
assertThat("Ci is valid", ci.getState(), is(ComponentInstance.VALID));
assertThat(ipojoHelper.isServiceAvailableByName(Foo.class.getName(), ci.getInstanceName()), is(true));
type.stop();
assertThat("Ci is disposed", ci.getState(), is(ComponentInstance.DISPOSED));
assertThat(ipojoHelper.isServiceAvailableByName(Foo.class.getName(), ci.getInstanceName()), is(false));
}
use of org.apache.felix.ipojo.api.PrimitiveComponentType in project felix by apache.
the class PrimitiveComponentTest method notManipulatedComponent.
@Test
public void notManipulatedComponent() throws Exception {
assertThat(context, is(notNullValue()));
ComponentInstance ci;
PrimitiveComponentType x = new PrimitiveComponentType().setBundleContext(context).setClassName(PlainHelloImpl.class.getName()).setValidateMethod("start").setInvalidateMethod("stop");
x.start();
assertThat(x, is(notNullValue()));
assertThat(x.getFactory().getState(), is(Factory.VALID));
ci = x.createInstance();
ci.start();
assertThat(ci.getState(), is(ComponentInstance.VALID));
x.stop();
}
Aggregations