public void testPlainLifecycleDependencyReinstall() throws Throwable
{
plainLifecycleDependencyReinstall();
ControllerContext context1 = assertInstall(0, "Name1");
ControllerContext context2 = assertInstall(1, "Name2");
SimpleBeanWithLifecycle bean1 = (SimpleBeanWithLifecycle) context1.getTarget();
assertNotNull(bean1);
SimpleBeanWithLifecycle bean2 = (SimpleBeanWithLifecycle) context2.getTarget();
assertNotNull(bean2);
assertEquals(1, bean1.createOrder);
assertEquals(2, bean1.startOrder);
assertEquals(3, bean2.createOrder);
assertEquals(4, bean2.startOrder);
uninstall("Name1");
assertContext("Name2", ControllerState.CONFIGURED);
assertEquals(5, bean2.stopOrder);
assertEquals(6, bean1.stopOrder);
assertEquals(7, bean2.destroyOrder);
assertEquals(8, bean1.destroyOrder);
context1 = assertInstall(0, "Name1");
bean1 = (SimpleBeanWithLifecycle) context1.getTarget();
assertNotNull(bean1);
assertContext("Name2", ControllerState.INSTALLED);
assertEquals(9, bean1.createOrder);
assertEquals(10, bean2.createOrder);
assertEquals(11, bean1.startOrder);
assertEquals(12, bean2.startOrder);
uninstall("Name2");
assertContext("Name1", ControllerState.INSTALLED);
assertEquals(13, bean2.stopOrder);
assertEquals(14, bean2.destroyOrder);
assertEquals(-1, bean1.stopOrder);
assertEquals(-1, bean1.destroyOrder);
context2 = assertInstall(1, "Name2");
bean2 = (SimpleBeanWithLifecycle) context2.getTarget();
assertNotNull(bean2);
assertContext("Name1", ControllerState.INSTALLED);
assertEquals(15, bean2.createOrder);
assertEquals(16, bean2.startOrder);