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, DEFAULT_TIMEOUT);
assertNotNull(obj);
assertEquals(obj, foo);
obj = blueprintContainer.getComponentInstance("accountOne");
assertNotNull(obj);
Account account = (Account)obj;
assertEquals(1, account.getAccountNumber());
obj = blueprintContainer.getComponentInstance("accountTwo");
assertNotNull(obj);
account = (Account)obj;
assertEquals(2, account.getAccountNumber());
obj = blueprintContainer.getComponentInstance("accountThree");
assertNotNull(obj);
account = (Account)obj;
assertEquals(3, account.getAccountNumber());
obj = blueprintContainer.getComponentInstance("accountFactory");
assertNotNull(obj);
AccountFactory accountFactory = (AccountFactory)obj;
assertEquals("account factory", accountFactory.getFactoryName());
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());
}