);
Object bootstrap;
String duSimpleName = null;
Deployment deployment = createVFSDeployment(ear);
DeployerClient mainDeployer = getDeployerClient();
mainDeployer.addDeployment(deployment);
mainDeployer.process();
ControllerContext wbContext = null;
try
{
DeploymentUnit earDU = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
String bootName = DeployersUtils.getBootstrapBeanName(earDU);
bootstrap = getBean(bootName, null);
assertInstanceOf(bootstrap, "org.jboss.test.deployers.support.CheckableBootstrap", earDU.getClassLoader());
// waiting on ejb
assertTrue(invoke(bootstrap, "Create"));
assertFalse(invoke(bootstrap, "Boot")); // not yet booted
assertFalse(invoke(bootstrap, "Shutdown"));
// install ejb
KernelControllerContext ejb = deploy(new AbstractBeanMetaData("EjbContainer#1", Object.class.getName()));
try
{
assertTrue(ejb.getState().equals(ControllerState.INSTALLED));
/// check boot
assertTrue(invoke(bootstrap, "Create"));
assertTrue(invoke(bootstrap, "Boot"));
assertFalse(invoke(bootstrap, "Shutdown"));
// test jndi binding
duSimpleName = earDU.getSimpleName();
Context context = assertInstanceOf(bmContext.lookup(duSimpleName), Context.class, false);
assertSame("Bootstrap Dummy", context.lookup("bootstrap"));
Class<?> wbClass = earDU.getClassLoader().loadClass("org.jboss.test.deployers.support.CheckableBootstrap");
wbContext = controller.getContextByClass(wbClass);
assertNotNull(wbContext);
assertSame(bootstrap, wbContext.getTarget());
}
finally
{
undeploy(ejb);
}
}
finally
{
mainDeployer.removeDeployment(deployment);
mainDeployer.process();
// clear binding
assertNull(bmContext.lookup(duSimpleName));
// clear context 2 class mapping