Skip to content

Commit

Permalink
AS7-4460 TS: adapt NonHaWebSessionPersistenceTestCase to custom conta…
Browse files Browse the repository at this point in the history
…iners
  • Loading branch information
rhusar committed Mar 13, 2013
1 parent 1fb8ba8 commit 4b650cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</configuration>
</container>

<container qualifier="container-single" mode="manual" managed="false">
<container qualifier="container-single" mode="custom" managed="false">
<configuration>
<property name="jbossHome">${basedir}/target/jbossas-clustering-SYNC-tcp-0</property>
<property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/jbossas-clustering-SYNC-tcp-0</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,25 @@
*/
package org.jboss.as.test.clustering.cluster.web;

import static org.jboss.as.test.clustering.ClusteringTestConstants.CONTAINER_SINGLE;
import static org.jboss.as.test.clustering.ClusteringTestConstants.DEPLOYMENT_1;

import java.io.IOException;
import java.net.URL;
import javax.servlet.http.HttpServletResponse;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.jboss.arquillian.container.test.api.ContainerController;
import org.jboss.arquillian.container.test.api.Deployer;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.OperateOnDeployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.container.test.api.TargetsContainer;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.as.test.clustering.cluster.ClusterAbstractTestCase;
import org.jboss.as.test.clustering.single.web.SimpleServlet;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -55,10 +49,9 @@
* @author Radoslav Husar
* @version Oct 2012
*/
@Ignore("Enable after rebase")
@RunWith(Arquillian.class)
@RunAsClient
public class NonHaWebSessionPersistenceTestCase {
public class NonHaWebSessionPersistenceTestCase extends ClusterAbstractTestCase {

@Deployment(name = DEPLOYMENT_1, managed = false, testable = false)
@TargetsContainer(CONTAINER_SINGLE)
Expand All @@ -69,16 +62,14 @@ public static Archive<?> deployment() {
return war;
}

@ArquillianResource
private ContainerController controller;
@ArquillianResource
private Deployer deployer;
@Override
public void testSetup() {
// TODO rethink how this can be done faster with one less stopping (eg. make this test last)
stop(CONTAINER_1);
stop(CONTAINER_2);

@Test
@InSequence(-1)
public void testStartContainerAndDeployment() {
controller.start(CONTAINER_SINGLE);
deployer.deploy(DEPLOYMENT_1);
start(CONTAINER_SINGLE);
deploy(DEPLOYMENT_1);
}

@Test
Expand All @@ -102,8 +93,8 @@ public void testSessionPersistence(@ArquillianResource(SimpleServlet.class) @Ope
Boolean.valueOf(response.getFirstHeader("serialized").getValue()));
response.getEntity().getContent().close();

controller.stop(CONTAINER_SINGLE);
controller.start(CONTAINER_SINGLE);
stop(CONTAINER_SINGLE);
start(CONTAINER_SINGLE);

response = client.execute(new HttpGet(url));
Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode());
Expand All @@ -115,7 +106,7 @@ public void testSessionPersistence(@ArquillianResource(SimpleServlet.class) @Ope
client.getConnectionManager().shutdown();
}

deployer.undeploy(DEPLOYMENT_1);
controller.stop(CONTAINER_SINGLE);
undeploy(DEPLOYMENT_1);
stop(CONTAINER_SINGLE);
}
}

0 comments on commit 4b650cf

Please sign in to comment.