Search in sources :

Example 1 with ExplodedExporterImpl

use of org.jboss.shrinkwrap.impl.base.exporter.ExplodedExporterImpl in project wildfly by wildfly.

the class DeploymentOverlayCLITestCase method before.

@BeforeClass
public static void before() throws Exception {
    String tempDir = TestSuiteEnvironment.getTmpDir();
    WebArchive war;
    JavaArchive jar;
    jar = ShrinkWrap.create(JavaArchive.class, "lib.jar");
    jar.addClass(ReplacedLibraryServlet.class);
    jar.add(new StringAsset("replaced library"), "jar-info.txt");
    replacedLibrary = new File(tempDir + File.separator + jar.getName());
    new ZipExporterImpl(jar).exportTo(replacedLibrary, true);
    jar = ShrinkWrap.create(JavaArchive.class, "addedlib.jar");
    jar.addClass(AddedLibraryServlet.class);
    addedLibrary = new File(tempDir + File.separator + jar.getName());
    new ZipExporterImpl(jar).exportTo(addedLibrary, true);
    jar = ShrinkWrap.create(JavaArchive.class, "lib.jar");
    jar.addClass(OriginalLibraryServlet.class);
    // deployment1
    war = ShrinkWrap.create(WebArchive.class, "deployment0.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebResource(DeploymentOverlayCLITestCase.class.getPackage(), "a.jsp", "a.jsp");
    war.addAsWebInfResource(DeploymentOverlayCLITestCase.class.getPackage(), "web.xml", "web.xml");
    war.addAsLibraries(jar);
    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");
    }
    overrideXml = new File(overrideXmlUrl.toURI());
    if (!overrideXml.exists()) {
        Assert.fail("Failed to locate override.xml");
    }
    final URL webXmlUrl = DeploymentOverlayCLITestCase.class.getResource("web.xml");
    if (webXmlUrl == null) {
        Assert.fail("Failed to locateweb.xml");
    }
    webXml = new File(webXmlUrl.toURI());
    if (!webXml.exists()) {
        Assert.fail("Failed to locate web.xml");
    }
    final URL ajsp = DeploymentOverlayCLITestCase.class.getResource("a-replaced.jsp");
    if (ajsp == null) {
        Assert.fail("Failed to locate a-replaced.jsp");
    }
    replacedAjsp = new File(ajsp.toURI());
    if (!replacedAjsp.exists()) {
        Assert.fail("Failed to locate a-replaced.jsp");
    }
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl) URL(java.net.URL) ExplodedExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.ExplodedExporterImpl) BeforeClass(org.junit.BeforeClass)

Example 2 with ExplodedExporterImpl

use of org.jboss.shrinkwrap.impl.base.exporter.ExplodedExporterImpl in project eap-additional-testsuite by jboss-set.

the class DeploymentOverlayCLITestCase method before.

@BeforeClass
public static void before() throws Exception {
    String tempDir = TestSuiteEnvironment.getTmpDir();
    WebArchive war;
    JavaArchive jar;
    jar = ShrinkWrap.create(JavaArchive.class, "lib.jar");
    jar.addClass(ReplacedLibraryServlet.class);
    jar.add(new StringAsset("replaced library"), "jar-info.txt");
    replacedLibrary = new File(tempDir + File.separator + jar.getName());
    new ZipExporterImpl(jar).exportTo(replacedLibrary, true);
    jar = ShrinkWrap.create(JavaArchive.class, "addedlib.jar");
    jar.addClass(AddedLibraryServlet.class);
    addedLibrary = new File(tempDir + File.separator + jar.getName());
    new ZipExporterImpl(jar).exportTo(addedLibrary, true);
    jar = ShrinkWrap.create(JavaArchive.class, "lib.jar");
    jar.addClass(OriginalLibraryServlet.class);
    // deployment1
    war = ShrinkWrap.create(WebArchive.class, "deployment0.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebResource("a.jsp");
    war.addAsWebInfResource("web.xml");
    war.addAsLibraries(jar);
    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("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("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("a.jsp");
    war.addAsWebInfResource("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");
    }
    overrideXml = new File(overrideXmlUrl.toURI());
    if (!overrideXml.exists()) {
        Assert.fail("Failed to locate override.xml");
    }
    final URL webXmlUrl = DeploymentOverlayCLITestCase.class.getResource("/web.xml");
    if (webXmlUrl == null) {
        Assert.fail("Failed to locateweb.xml");
    }
    webXml = new File(webXmlUrl.toURI());
    if (!webXml.exists()) {
        Assert.fail("Failed to locate web.xml");
    }
    final URL ajsp = DeploymentOverlayCLITestCase.class.getResource("/a-replaced.jsp");
    if (ajsp == null) {
        Assert.fail("Failed to locate a-replaced.jsp");
    }
    replacedAjsp = new File(ajsp.toURI());
    if (!replacedAjsp.exists()) {
        Assert.fail("Failed to locate a-replaced.jsp");
    }
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl) URL(java.net.URL) ExplodedExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.ExplodedExporterImpl) BeforeClass(org.junit.BeforeClass)

Aggregations

File (java.io.File)2 URL (java.net.URL)2 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)2 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)2 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)2 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)2 ExplodedExporterImpl (org.jboss.shrinkwrap.impl.base.exporter.ExplodedExporterImpl)2 ZipExporterImpl (org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl)2 BeforeClass (org.junit.BeforeClass)2