Search in sources :

Example 1 with ZipExporterImpl

use of org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl in project camel by apache.

the class JarExporter method exportJar.

@Test
public void exportJar() throws Exception {
    Archive<?> archive = ArquillianPackager.springBootPackage(new ITestConfigBuilder().module("camel-cache").resource("components/cache-ehcache.xml", "ehcache.xml").build());
    new ZipExporterImpl(archive).exportTo(new File("target/export.zip"), true);
}
Also used : ITestConfigBuilder(org.apache.camel.itest.springboot.ITestConfigBuilder) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl) Test(org.junit.Test)

Example 2 with ZipExporterImpl

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

the class ModelPersistenceTestCase method getBrokenWar.

private static File getBrokenWar() {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "malformedDeployment.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebInfResource(new StringAsset("Malformed"), "web.xml");
    File brokenWar = new File(System.getProperty("java.io.tmpdir") + File.separator + "malformedDeployment.war");
    brokenWar.deleteOnExit();
    new ZipExporterImpl(war).exportTo(brokenWar, true);
    return brokenWar;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl)

Example 3 with ZipExporterImpl

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

the class DeployAllServerGroupsTestCase method testRedeploy.

public void testRedeploy() throws Exception {
    // check we have original deployment
    checkURL("/SimpleServlet/page.html", "Version1");
    // update the deployment - replace page.html
    war = ShrinkWrap.create(WebArchive.class, "SimpleServlet.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebResource(new StringAsset("Version2"), "page.html");
    new ZipExporterImpl(war).exportTo(warFile, true);
    // redeploy to all servers
    assertFalse(cli.sendLine("deploy --all-server-groups " + warFile.getAbsolutePath(), true));
    // force redeploy
    cli.sendLine("deploy " + warFile.getAbsolutePath() + " --force");
    // check that new version is running
    checkURL("/SimpleServlet/page.html", "Version2");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl)

Example 4 with ZipExporterImpl

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

the class DomainDeployWithRuntimeNameTestCase method createWarFile.

private File createWarFile(String content) throws IOException {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "HelloServlet.war");
    war.addClass(SimpleHelloWorldServlet.class);
    war.addAsWebInfResource(SimpleHelloWorldServlet.class.getPackage(), "web.xml", "web.xml");
    war.addAsWebResource(new StringAsset(content), "page.html");
    File tempFile = new File(System.getProperty("java.io.tmpdir"), "HelloServlet.war");
    new ZipExporterImpl(war).exportTo(tempFile, true);
    return tempFile;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SimpleHelloWorldServlet(org.jboss.as.test.integration.management.util.SimpleHelloWorldServlet) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl)

Example 5 with ZipExporterImpl

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

the class DomainDeploymentOverlayTestCase method before.

@BeforeClass
public static void before() throws Exception {
    String tempDir = System.getProperty("java.io.tmpdir");
    WebArchive war;
    // deployment1
    war = ShrinkWrap.create(WebArchive.class, "deployment0.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebInfResource("cli/deployment-overlay/web.xml", "web.xml");
    war1 = new File(tempDir + File.separator + war.getName());
    new ZipExporterImpl(war).exportTo(war1, true);
    war = ShrinkWrap.create(WebArchive.class, "deployment1.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebInfResource("cli/deployment-overlay/web.xml", "web.xml");
    war2 = new File(tempDir + File.separator + war.getName());
    new ZipExporterImpl(war).exportTo(war2, true);
    war = ShrinkWrap.create(WebArchive.class, "another.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebInfResource("cli/deployment-overlay/web.xml", "web.xml");
    war3 = new File(tempDir + File.separator + war.getName());
    new ZipExporterImpl(war).exportTo(war3, true);
    final URL overrideXmlUrl = DomainDeploymentOverlayTestCase.class.getClassLoader().getResource("cli/deployment-overlay/override.xml");
    if (overrideXmlUrl == null) {
        Assert.fail("Failed to locate cli/deployment-overlay/override.xml");
    }
    overrideXml = new File(overrideXmlUrl.toURI());
    if (!overrideXml.exists()) {
        Assert.fail("Failed to locate cli/deployment-overlay/override.xml");
    }
    final URL webXmlUrl = DomainDeploymentOverlayTestCase.class.getClassLoader().getResource("cli/deployment-overlay/web.xml");
    if (webXmlUrl == null) {
        Assert.fail("Failed to locate cli/deployment-overlay/web.xml");
    }
    webXml = new File(webXmlUrl.toURI());
    if (!webXml.exists()) {
        Assert.fail("Failed to locate cli/deployment-overlay/web.xml");
    }
    // Launch the domain
    testSupport = CLITestSuite.createSupport(DomainDeploymentOverlayTestCase.class.getSimpleName());
}
Also used : WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Aggregations

ZipExporterImpl (org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl)41 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)38 File (java.io.File)33 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)32 BeforeClass (org.junit.BeforeClass)22 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)11 BasicPath (org.jboss.shrinkwrap.impl.base.path.BasicPath)8 URL (java.net.URL)4 SimpleHelloWorldServlet (org.jboss.as.test.integration.management.util.SimpleHelloWorldServlet)3 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)3 SocketPermission (java.net.SocketPermission)2 CLIOpResult (org.jboss.as.test.integration.management.util.CLIOpResult)2 ExplodedExporterImpl (org.jboss.shrinkwrap.impl.base.exporter.ExplodedExporterImpl)2 ITestConfigBuilder (org.apache.camel.itest.springboot.ITestConfigBuilder)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 FooDriver (org.jboss.as.test.integration.domain.driver.FooDriver)1 Test (org.junit.Test)1