ModulesMetaData modules = ear.getModules();
if(hasJBossAppOverride)
assertEquals(9, modules.size());
else
assertEquals(6, modules.size());
ModuleMetaData connector = modules.get(0);
assertEquals("connector0", connector.getId());
ConnectorModuleMetaData connectorMD = (ConnectorModuleMetaData) connector.getValue();
assertEquals("rar0.rar", connectorMD.getConnector());
ModuleMetaData java = modules.get(1);
assertEquals("java0", java.getId());
JavaModuleMetaData javaMD = (JavaModuleMetaData)java.getValue();
assertEquals("client0.jar", javaMD.getClientJar());
ModuleMetaData ejb0 = modules.get(2);
assertEquals("ejb0", ejb0.getId());
EjbModuleMetaData ejb0MD = (EjbModuleMetaData)ejb0.getValue();
assertEquals("ejb-jar0.jar", ejb0MD.getEjbJar());
ModuleMetaData ejb1 = modules.get(3);
assertEquals("ejb1", ejb1.getId());
EjbModuleMetaData ejb1MD = (EjbModuleMetaData)ejb1.getValue();
assertEquals("ejb-jar1.jar", ejb1MD.getEjbJar());
ModuleMetaData web0 = modules.get(4);
assertEquals("web0", web0.getId());
WebModuleMetaData web0MD = (WebModuleMetaData) web0.getValue();
assertEquals("/web0", web0MD.getContextRoot());
assertEquals("web-app0.war", web0MD.getWebURI());
ModuleMetaData web1 = modules.get(5);
assertEquals("web1", web1.getId());
WebModuleMetaData web1MD = (WebModuleMetaData) web1.getValue();
if(hasJBossAppOverride)
assertEquals("/web1-override", web1MD.getContextRoot());
else
assertEquals("/web1", web1MD.getContextRoot());
assertEquals("web-app1.war", web1MD.getWebURI());
if(hasJBossAppOverride)
{
// Validate the sar, web2, har added in jboss-app.xml
ModuleMetaData sar = modules.get(6);
assertEquals("sar0", sar.getId());
ServiceModuleMetaData sarMD = (ServiceModuleMetaData) sar.getValue();
assertEquals("sar0.sar", sarMD.getSar());
ModuleMetaData web2 = modules.get(7);
assertEquals("web2", web2.getId());
WebModuleMetaData web2MD = (WebModuleMetaData) web2.getValue();
assertEquals("/web2", web2MD.getContextRoot());
assertEquals("web-app2.war", web2MD.getWebURI());
ModuleMetaData har = modules.get(8);
assertEquals("har0", har.getId());
ServiceModuleMetaData harMD = (ServiceModuleMetaData) har.getValue();
assertEquals("har0.har", harMD.getSar());
}
// Validate lookup by module file name
ModuleMetaData mmd = modules.get("rar0.rar");
assertEquals(connector, mmd);
mmd = modules.get("ejb-jar1.jar");
assertEquals(ejb1, mmd);
mmd = modules.get("web-app0.war");
assertEquals(web0, mmd);