AbstractKernelDeployment deployment = new AbstractKernelDeployment();
deployment.setBeanFactories(Arrays.asList(builder.getBeanMetaDataFactory()));
Kernel kernel = bootstrap();
KernelController controller = kernel.getController();
AbstractKernelDeployer deployer = new AbstractKernelDeployer(kernel);
deployer.deploy(deployment);
try
{
Object o = controller.getInstalledContext("CollectionBean").getTarget();
assertNotNull(o);
assertInstanceOf(o, SimpleBean.class);
SimpleBean bean = (SimpleBean)o;
Object[] arr = bean.getArray();
assertEquals(2, arr.length);
assertEquals(5, arr[0]);
assertEquals(10, arr[1]);
List<?> lst = bean.getList();
assertEquals(2, lst.size());
assertEquals("One", lst.get(0));
assertEquals("Two", lst.get(1));
Set<?> st = bean.getSet();
assertEquals(2, lst.size());
assertTrue(st.contains("En"));
assertTrue(st.contains("To"));
Collection<?> coll = bean.getCollection();
assertEquals(2, lst.size());
assertTrue(coll.contains("Eins"));
assertTrue(coll.contains("Zwei"));
Map<?, ?> mp = bean.getMap();
assertEquals(2, mp.size());
assertEquals("Uno", mp.get("One"));
assertEquals("Dos", mp.get("Two"));
}
finally
{
deployer.undeploy(deployment);
}
}