assertBDAId(war2BDA, "web2.war");
assertExpectedClasses(war2BDA, NotWBJsfBean.class);
Class<?> notWBJsfBeanWar2Class = getClass(NotWBJsfBean.class, war2Unit);
Class<?> crmWebBeanWar2Class = getClass(CrmWebBean.class, war2Unit);
JavaArchive ejbJar = createEjbJar("ejb.jar", true, BusinessInterface.class);
DeploymentUnit ejbJarUnit = assertDeploy(ejbJar);
Deployment ejbJarDeployment = initializeDeploymentBean(ejbJarUnit);
BeanDeploymentArchive ejbJarBDA = ejbJarDeployment.getBeanDeploymentArchives().iterator().next();
assertBDAId(ejbJarBDA, "ejb.jar");
assertExpectedClasses(ejbJarBDA, BusinessInterface.class);
Class<?> businessInterfaceClass = getClass(BusinessInterface.class, ejbJarUnit);
EnterpriseArchive ear1 = ShrinkWrap.create(EnterpriseArchive.class, "full.ear");
WebArchive warInEar1 = createWarWithLibs(false, true, true);
ear1.addModule(warInEar1);
ear1.addModule(war2);
JavaArchive ejbJarInEar1 = createEjbJar("ejbInFullEar.jar", false, MySLSBean.class);
ear1.addModule(ejbJarInEar1);
createLib(ear1, "lib1.jar", false, ExternalWebBean.class);
createLib(ear1, "lib2.jar", true, A.class);
createLib(ear1, "lib3.jar", false, B.class);
MockArchiveManifest.addManifest(ear1);
DeploymentUnit ear1Unit = assertDeploy(ear1);
Deployment ear1Deployment = initializeDeploymentBean(ear1Unit);
BeanDeploymentArchive ear1BDA = null, ear1War1BDA = null, ear1War2BDA = null;
for (BeanDeploymentArchive bda: ear1Deployment.getBeanDeploymentArchives())
{
if (bda.getId().contains(WAR_NAME))
{
ear1War1BDA = bda;
}
else if (bda.getId().contains("web2.war"))
{
ear1War2BDA = bda;
}
else
{
ear1BDA = bda;
}
}
assertBDAId(ear1BDA, "full.ear");
assertExpectedClasses(ear1BDA, A.class);
assertBDAId(ear1War1BDA, "full.ear/" + WAR_NAME);
assertExpectedClasses(ear1War1BDA, UIWebBean.class, CrmWebBean.class);
assertBDAId(ear1War2BDA, "full.ear/web2.war");
assertExpectedClasses(ear1War2BDA, NotWBJsfBean.class);
Class<?> servletWebBeanEar1Class = null, uiWebBeanEar1Class = null,
crmWebBeanEar1War1Class = null, notWBJsfBeanEar1Class = null,
crmWebBeanEar1War2Class = null;
for (DeploymentUnit ear1Child: ear1Unit.getChildren())
{
if (ear1Child.getName().contains(WAR_NAME))
{
servletWebBeanEar1Class = getClass(ServletWebBean.class, ear1Child);
uiWebBeanEar1Class = getClass(UIWebBean.class, ear1Child);
crmWebBeanEar1War1Class = getClass(CrmWebBean.class, ear1Child);
}
else if (ear1Child.getName().contains("web2.war"))
{
notWBJsfBeanEar1Class = getClass(NotWBJsfBean.class, ear1Child);
crmWebBeanEar1War2Class = getClass(CrmWebBean.class, ear1Child);
}
}
Class<?> externalWebBeanClass = getClass(ExternalWebBean.class, ear1Unit);
Class<?> aClass = getClass(A.class, ear1Unit);
Class<?> bClass = getClass(B.class, ear1Unit);
EnterpriseArchive ear2 = ShrinkWrap.create(EnterpriseArchive.class, "ejbWLibs.ear");
JavaArchive ejbJarInEar2 = createEjbJar("ejbInEar2.jar", true, PlainJavaBean.class);
ear2.addModule(ejbJarInEar2);
createLib(ear2, "lib1.jar", false, SomeUtil.class);
createLib(ear2, "lib2.jar", true, CrmWebBean.class);
MockArchiveManifest.addManifest(ear2);
DeploymentUnit ear2Unit = assertDeploy(ear2);