setupBeanMetaDatas();
ControllerContext context1 = assertInstall(0, "Name1");
ControllerContext context2 = assertInstall(1, "Name2");
GenericBeanFactoryRepository bean1 = (GenericBeanFactoryRepository) context1.getTarget();
assertNotNull(bean1);
GenericBeanFactory bean2 = (GenericBeanFactory) context2.getTarget();
assertNotNull(bean2);
ArrayList<Object> expected = new ArrayList<Object>();
expected.add(bean2);
assertEquals(expected, bean1.getBeans());
assertUninstall("Name1");
assertContext("Name2", ControllerState.START);
expected = new ArrayList<Object>();
assertEquals(expected, bean1.getBeans());
context1 = assertInstall(0, "Name1");
assertContext("Name2", ControllerState.INSTALLED);
bean1 = (GenericBeanFactoryRepository) context1.getTarget();
assertNotNull(bean1);
expected = new ArrayList<Object>();
expected.add(bean2);
assertEquals(expected, bean1.getBeans());
assertUninstall("Name2");
assertContext("Name1", ControllerState.INSTALLED);
expected = new ArrayList<Object>();
assertEquals(expected, bean1.getBeans());
context2 = assertInstall(1, "Name2");
assertContext("Name1", ControllerState.INSTALLED);
bean2 = (GenericBeanFactory) context2.getTarget();
assertNotNull(bean2);
expected = new ArrayList<Object>();
expected.add(bean2);
assertEquals(expected, bean1.getBeans());
}