Search in sources :

Example 26 with ZipExporterImpl

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

the class DeploySingleServerGroupTestCase method before.

@BeforeClass
public static void before() throws Exception {
    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)

Example 27 with ZipExporterImpl

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

the class DeploySingleServerGroupTestCase method testRedeploy.

public void testRedeploy() throws Exception {
    // check we have original deployment
    checkURL("/SimpleServlet/page.html", "Version1", serverGroups[0]);
    // 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 group servers
    assertFalse(cli.sendLine("deploy --server-groups=" + serverGroups[0] + " " + warFile.getAbsolutePath(), true));
    // force redeploy
    cli.sendLine("deploy " + warFile.getAbsolutePath() + " --force");
    // check that new version is running
    checkURL("/SimpleServlet/page.html", "Version2", serverGroups[0]);
}
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 28 with ZipExporterImpl

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

the class RolloutPlanTestCase method before.

@BeforeClass
public static void before() throws Exception {
    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)");
    cli.sendLine("/server-group=test-server-group/jvm=default:add");
    // 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 29 with ZipExporterImpl

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

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 30 with ZipExporterImpl

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

the class DeploymentScannerTestCase method addDeploymentScanner.

private void addDeploymentScanner() throws Exception {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "SimpleServlet.war");
    war.addClass(SimpleServlet.class);
    warFile = new File(deployDir.getAbsolutePath() + File.separator + "SimpleServlet.war");
    new ZipExporterImpl(war).exportTo(warFile, true);
    // add deployment scanner
    String path = deployDir.getAbsolutePath();
    path = path.replaceAll("\\\\", "/");
    cli.sendLine("/subsystem=deployment-scanner/scanner=testScanner:add(scan-interval=1000,path=\"" + path + "\")");
    // wait for deployment
    Thread.sleep(2000);
    // check that the app has been deployed
    File marker = new File(deployDir.getAbsolutePath() + File.separator + "SimpleServlet.war.deployed");
    assertTrue(marker.exists());
    String response = HttpRequest.get(getBaseURL(url) + "SimpleServlet/SimpleServlet", 10, TimeUnit.SECONDS);
    assertTrue("Invalid response: " + response, response.indexOf("SimpleServlet") >= 0);
}
Also used : WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl)

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