Search in sources :

Example 36 with ZipExporterImpl

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

the class ArchiveDefaultScriptNamesTestCase method before.

@BeforeClass
public static void before() throws Exception {
    String tempDir = TestSuiteEnvironment.getTmpDir();
    WebArchive[] wars = new WebArchive[3];
    // deployment1
    wars[0] = ShrinkWrap.create(WebArchive.class, "deployment0.war");
    wars[0].addClass(SimpleServlet.class);
    wars[0].addAsWebResource(new StringAsset("Version0"), "page.html");
    // deployment2
    wars[1] = ShrinkWrap.create(WebArchive.class, "deployment1.war");
    wars[1].addClass(SimpleServlet.class);
    wars[1].addAsWebResource(new StringAsset("Version1"), "page.html");
    // deployment3 is included but not deployed
    wars[2] = ShrinkWrap.create(WebArchive.class, "deployment2.war");
    wars[2].addClass(SimpleServlet.class);
    wars[2].addAsWebResource(new StringAsset("Version2"), "page.html");
    // build cli archive
    EnterpriseArchive cliArchive = ShrinkWrap.create(EnterpriseArchive.class, "archive.cli");
    String deploy = "deploy deployment0.war\ndeploy deployment1.war";
    String undeploy = "undeploy deployment0.war\nundeploy deployment1.war";
    cliArchive.add(new StringAsset(deploy), new BasicPath("/", "deploy.scr"));
    cliArchive.add(new StringAsset(undeploy), new BasicPath("/", "undeploy.scr"));
    for (WebArchive war : wars) {
        cliArchive.add(war, new BasicPath("/"), ZipExporter.class);
    }
    cliArchiveFile = new File(tempDir + File.separator + "archive.cli");
    new ZipExporterImpl(cliArchive).exportTo(cliArchiveFile, true);
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) BasicPath(org.jboss.shrinkwrap.impl.base.path.BasicPath) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl) BeforeClass(org.junit.BeforeClass)

Example 37 with ZipExporterImpl

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

the class DeployAllServerGroupsTestCase method before.

@BeforeClass
public static void before() throws Exception {
    CLITestSuite.createSupport(DeployAllServerGroupsTestCase.class.getSimpleName());
    war = ShrinkWrap.create(WebArchive.class, "SimpleServlet.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebResource(new StringAsset("Version1"), "page.html");
    String tempDir = System.getProperty("java.io.tmpdir");
    warFile = new File(tempDir, "SimpleServlet.war");
    new ZipExporterImpl(war).exportTo(warFile, true);
    AbstractCliTestBase.initCLI(DomainTestSupport.masterAddress);
}
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) BeforeClass(org.junit.BeforeClass)

Example 38 with ZipExporterImpl

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

the class RolloutPlanTestCase method before.

@BeforeClass
public static void before() throws Exception {
    CLITestSuite.initSuite();
    CLITestSuite.createSupport(RolloutPlanTestCase.class.getSimpleName());
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "RolloutPlanTestCase.war");
    war.addClass(RolloutPlanTestServlet.class);
    war.addAsManifestResource(createPermissionsXmlAsset(// main-one
    new SocketPermission(TestSuiteEnvironment.formatPossibleIpv6Address(CLITestSuite.hostAddresses.get("master")) + ":" + TEST_PORT, "listen,resolve"), // main-three
    new SocketPermission(TestSuiteEnvironment.formatPossibleIpv6Address(CLITestSuite.hostAddresses.get("master")) + ":" + (TEST_PORT + 350), "listen,resolve")), "permissions.xml");
    String tempDir = System.getProperty("java.io.tmpdir");
    warFile = new File(tempDir + File.separator + "RolloutPlanTestCase.war");
    new ZipExporterImpl(war).exportTo(warFile, true);
    AbstractCliTestBase.initCLI(DomainTestSupport.masterAddress);
    // add another server group to default profile
    cli.sendLine("/server-group=test-server-group:add(profile=default,socket-binding-group=standard-sockets)");
    // add a server to the group
    cli.sendLine("/host=master/server-config=test-one:add(group=test-server-group,socket-binding-port-offset=700");
    cli.sendLine("/host=master/server-config=test-one/interface=public:add(inet-address=" + CLITestSuite.hostAddresses.get("master") + ")");
    CLITestSuite.addServer("test-one", "master", "test-server-group", "default", 700, true);
    // start main-two
    cli.sendLine("/host=master/server-config=main-two:start(blocking=true)");
    CLIOpResult res = cli.readAllAsOpResult();
    Assert.assertTrue(res.isIsOutcomeSuccess());
    waitUntilState("main-two", "STARTED");
    // start test-one
    cli.sendLine("/host=master/server-config=test-one:start(blocking=true)");
    res = cli.readAllAsOpResult();
    Assert.assertTrue(res.isIsOutcomeSuccess());
    waitUntilState("test-one", "STARTED");
}
Also used : WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SocketPermission(java.net.SocketPermission) CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl) BeforeClass(org.junit.BeforeClass)

Example 39 with ZipExporterImpl

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

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)

Example 40 with ZipExporterImpl

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

the class DeploySingleServerGroupTestCase method before.

@BeforeClass
public static void before() throws Exception {
    CLITestSuite.initSuite();
    CLITestSuite.createSupport(DeploySingleServerGroupTestCase.class.getSimpleName());
    war = ShrinkWrap.create(WebArchive.class, "SimpleServlet.war");
    war.addClass(SimpleServlet.class);
    war.addAsWebResource(new StringAsset("Version1"), "page.html");
    String tempDir = System.getProperty("java.io.tmpdir");
    warFile = new File(tempDir + File.separator + "SimpleServlet.war");
    new ZipExporterImpl(war).exportTo(warFile, true);
    serverGroups = CLITestSuite.serverGroups.keySet().toArray(new String[CLITestSuite.serverGroups.size()]);
    AbstractCliTestBase.initCLI(DomainTestSupport.masterAddress);
}
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) 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