use of org.apache.aries.blueprint.sample.FooRegistrationListener in project aries by apache.
the class TestRegistrationListener method testWithAutoExportEnabled.
@Test
public void testWithAutoExportEnabled() throws Exception {
BlueprintContainer blueprintContainer = Helper.getBlueprintContainerForBundle(context(), "org.apache.aries.blueprint.sample");
assertNotNull(blueprintContainer);
Foo foo = context().getService(Foo.class, "(" + BlueprintConstants.COMPONENT_NAME_PROPERTY + "=foo)");
assertEquals(5, foo.getA());
FooRegistrationListener listener = (FooRegistrationListener) blueprintContainer.getComponentInstance("fooRegistrationListener");
// If registration listener works fine, the registration method should
// have already been called and properties that were passed to this
// method should have been not null
Map<?, ?> props = listener.getProperties();
assertNotNull(props);
assertTrue(props.containsKey(BlueprintConstants.COMPONENT_NAME_PROPERTY));
assertEquals("foo", props.get(BlueprintConstants.COMPONENT_NAME_PROPERTY));
assertTrue(props.containsKey("key"));
assertEquals("value", props.get("key"));
}
Aggregations