assertEquals("a list element", bar.getList().get(0));
assertEquals(Integer.valueOf(5), bar.getList().get(1));
obj = blueprintContainer.getComponentInstance("foo");
assertNotNull(obj);
assertEquals(Foo.class, obj.getClass());
Foo foo = (Foo) obj;
assertEquals(5, foo.getA());
assertEquals(10, foo.getB());
assertSame(bar, foo.getBar());
assertEquals(Currency.getInstance("PLN"), foo.getCurrency());
assertEquals(new SimpleDateFormat("yyyy.MM.dd").parse("2009.04.17"),
foo.getDate());
assertTrue(foo.isInitialized());
assertFalse(foo.isDestroyed());
obj = getOsgiService(bc == null ? bundleContext : bc, Foo.class, null, 5000);
assertNotNull(obj);
assertSame(foo, obj);
bundle.stop();
Thread.sleep(1000);
try {
blueprintContainer = getBlueprintContainerForBundle(bc == null ? bundleContext : bc,
"org.apache.aries.blueprint.sample", 1);
fail("BlueprintContainer should have been unregistered");
} catch (Exception e) {
// Expected, as the module container should have been unregistered
}
assertTrue(foo.isInitialized());
assertTrue(foo.isDestroyed());
}