File explodedwars_basedir = new File(tempDir + File.separator + "exploded_deployments");
explodedwars_basedir.mkdirs();
war1 = new File(tempDir + File.separator + war.getName());
new ZipExporterImpl(war).exportTo(war1, true);
war1_exploded = new ExplodedExporterImpl(war).exportExploded(explodedwars_basedir);
war = ShrinkWrap.create(WebArchive.class, "deployment1.war");
war.addClass(SimpleServlet.class);
war.addAsWebInfResource(DeploymentOverlayCLITestCase.class.getPackage(), "web.xml", "web.xml");
war.addAsLibraries(jar);
war2 = new File(tempDir + File.separator + war.getName());
new ZipExporterImpl(war).exportTo(war2, true);
war2_exploded = new ExplodedExporterImpl(war).exportExploded(explodedwars_basedir);
war = ShrinkWrap.create(WebArchive.class, "another.war");
war.addClass(SimpleServlet.class);
war.addAsWebInfResource(DeploymentOverlayCLITestCase.class.getPackage(), "web.xml", "web.xml");
war.addAsLibraries(jar);
war3 = new File(tempDir + File.separator + war.getName());
new ZipExporterImpl(war).exportTo(war3, true);
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "eardeployment1.ear");
ear.addAsModule(war1);
ear1 = new File(tempDir + File.separator + ear.getName());
new ZipExporterImpl(ear).exportTo(ear1, true);
ear1_exploded = new ExplodedExporterImpl(ear).exportExploded(explodedwars_basedir);
war = ShrinkWrap.create(WebArchive.class, "deployment0.war");
war.addClass(SimpleServlet.class);
war.addClass(EarServlet.class);
war.addAsWebResource(DeploymentOverlayCLITestCase.class.getPackage(), "a.jsp", "a.jsp");
war.addAsWebInfResource(DeploymentOverlayCLITestCase.class.getPackage(), "web.xml", "web.xml");
jar = ShrinkWrap.create(JavaArchive.class, "lib.jar");
jar.add(new StringAsset("original library"),"jar-info.txt");
ear = ShrinkWrap.create(EnterpriseArchive.class, "eardeployment2.ear");
ear.addAsModule(war);
ear.addAsLibraries(jar);
ear2 = new File(tempDir + File.separator + ear.getName());
new ZipExporterImpl(ear).exportTo(ear2, true);
ear2_exploded = new ExplodedExporterImpl(ear).exportExploded(explodedwars_basedir);
final URL overrideXmlUrl = DeploymentOverlayCLITestCase.class.getResource("override.xml");
if(overrideXmlUrl == null) {
Assert.fail("Failed to locate override.xml");
}