Skip to content

Commit

Permalink
WFLY-9598 Update "twocluster" test to use CLI
Browse files Browse the repository at this point in the history
* rename to "forwarding"
* move to ejb tests
* drop separate execution
  • Loading branch information
rhusar committed Jan 8, 2018
1 parent fd16de7 commit 8672020
Show file tree
Hide file tree
Showing 19 changed files with 126 additions and 330 deletions.
89 changes: 2 additions & 87 deletions testsuite/integration/clustering/pom.xml
Expand Up @@ -112,6 +112,7 @@
to the includes in the following execution. --> to the includes in the following execution. -->
<excludes> <excludes>
<exclude>${test-group}/dispatcher/**/*TestCase.java</exclude> <exclude>${test-group}/dispatcher/**/*TestCase.java</exclude>
<exclude>${test-group}/ejb/forwarding/**/*TestCase.java</exclude>
<exclude>${test-group}/ejb/remote/**/*TestCase.java</exclude> <exclude>${test-group}/ejb/remote/**/*TestCase.java</exclude>
<exclude>${test-group}/ejb2/**/*TestCase.java</exclude> <exclude>${test-group}/ejb2/**/*TestCase.java</exclude>
<exclude>${test-group}/provider/**/*TestCase.java</exclude> <exclude>${test-group}/provider/**/*TestCase.java</exclude>
Expand Down Expand Up @@ -147,6 +148,7 @@
<reuseForks>false</reuseForks> <reuseForks>false</reuseForks>
<includes> <includes>
<include>${test-group}/dispatcher/**/*TestCase.java</include> <include>${test-group}/dispatcher/**/*TestCase.java</include>
<include>${test-group}/ejb/forwarding/**/*TestCase.java</include>
<include>${test-group}/ejb/remote/**/*TestCase.java</include> <include>${test-group}/ejb/remote/**/*TestCase.java</include>
<include>${test-group}/ejb2/**/*TestCase.java</include> <include>${test-group}/ejb2/**/*TestCase.java</include>
<include>${test-group}/provider/**/*TestCase.java</include> <include>${test-group}/provider/**/*TestCase.java</include>
Expand Down Expand Up @@ -379,93 +381,6 @@
</build> </build>
</profile> </profile>


<profile>
<id>ts.clustering.two.clusters.profile</id>
<activation>
<property>
<name>!ts.noClustering</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions combine.children="append">
<execution>
<id>ts.config-as.clustering.two.clusters</id>
<phase>process-test-resources</phase>
<goals><goal>run</goal></goals>
<configuration>
<target>
<echo>Creating two clusters configurations</echo>
<!-- Build the UDP server configs in target/ . -->
<!-- this configuration uses one interface and port offsets -->
<ant antfile="${basedir}/../src/test/scripts/clustering-build.xml">
<property name="node0" value="${node0}"/>
<property name="node1" value="${node1}"/>
<property name="node2" value="${node2}"/>
<property name="node3" value="${node3}"/>
<property name="mcast-clusterA" value="${mcast}"/>
<property name="mcast-clusterB" value="${mcast1}"/>
<property name="mcast-mping" value="${mcast2}"/>
<property name="mcast.ttl" value="${mcast.ttl}"/>
<target name="build-clustering-two-clusters"/>
</ant>
</target>
</configuration>
</execution>
</executions>
</plugin>

<!--
Surefire test executions.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions combine.children="append">

<!-- Disable default-test execution. -->
<execution>
<id>default-test</id>
<goals><goal>test</goal></goals>
<phase>none</phase>
</execution>

<!-- Single node clustering tests. -->
<execution>
<id>ts.surefire.clustering.two.clusters</id>
<phase>test</phase>
<goals><goal>test</goal></goals>
<configuration>
<!-- Needed for EJB client tests -->
<reuseForks>false</reuseForks>

<!-- Tests to execute. -->
<includes>
<include>org/jboss/as/test/clustering/twoclusters/**/*TestCase.java</include>
</includes>

<!-- Parameters to test cases. -->
<systemPropertyVariables combine.children="append">
<arquillian.launch>clustering-two-clusters</arquillian.launch>
<jboss.server.config.file.name>standalone-ha.xml</jboss.server.config.file.name>
<!--bit of a workaround, we don't include ${jvm.args.ip.server} as clustering does custom binding-->
<server.jvm.args>${surefire.system.args} ${jvm.args.ip} ${jvm.args.other} ${jvm.args.timeouts} -Dnode0=${node0} -Dnode1=${node1} -Dmcast=${mcast} -Dmcast.ttl=${mcast.ttl} ${jvm.args.dirs}</server.jvm.args>
<stack>udp</stack>
</systemPropertyVariables>
</configuration>
</execution>

</executions>
</plugin>
</plugins>
</build>
</profile>



<profile> <profile>
<id>ts.clustering.session-db-persistence.profile</id> <id>ts.clustering.session-db-persistence.profile</id>
<activation> <activation>
Expand Down
Expand Up @@ -338,63 +338,4 @@
</configuration> </configuration>
</container> </container>
</group> </group>

<group qualifier="clustering-two-clusters">

<container qualifier="node-1" mode="custom" managed="false" default="true">
<configuration>
<property name="jbossHome">${basedir}/target/wildfly-clusterA-node0</property>
<property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/wildfly-clusterA-node0 -Djboss.node.name=clusterA-node0</property>
<property name="serverConfig">${jboss.server.config.file.name}</property>
<property name="jbossArguments">${jboss.args}</property>
<property name="managementAddress">${node0}</property>
<property name="managementPort">${as.managementPort:9990}</property>

<property name="waitForPorts">${as.debug.port:8787} ${as.managementPort:9999}</property>
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>

<container qualifier="node-2" mode="custom" managed="false">
<configuration>
<property name="jbossHome">${basedir}/target/wildfly-clusterA-node1</property>
<property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/wildfly-clusterA-node1 -Djboss.node.name=clusterA-node1 -Djboss.socket.binding.port-offset=100</property>
<property name="serverConfig">${jboss.server.config.file.name}</property>
<property name="jbossArguments">${jboss.args}</property>
<property name="managementAddress">${node1}</property>
<property name="managementPort">10090</property>

<property name="waitForPorts">${as.debug.port.node1} 10099</property>
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>

<container qualifier="node-3" mode="custom" managed="false">
<configuration>
<property name="jbossHome">${basedir}/target/wildfly-clusterB-node0</property>
<property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/wildfly-clusterB-node0 -Djboss.node.name=clusterB-node0 -Djboss.socket.binding.port-offset=200</property>
<property name="serverConfig">${jboss.server.config.file.name}</property>
<property name="jbossArguments">${jboss.args}</property>
<property name="managementAddress">${node2}</property>
<property name="managementPort">10190</property>

<property name="waitForPorts">${as.debug.port.node2} 10199</property>
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>

<container qualifier="node-4" mode="custom" managed="false">
<configuration>
<property name="jbossHome">${basedir}/target/wildfly-clusterB-node1</property>
<property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/wildfly-clusterB-node1 -Djboss.node.name=clusterB-node1 -Djboss.socket.binding.port-offset=300</property>
<property name="serverConfig">${jboss.server.config.file.name}</property>
<property name="jbossArguments">${jboss.args}</property>
<property name="managementAddress">${node3}</property>
<property name="managementPort">10290</property>

<property name="waitForPorts">${as.debug.port.node3} 10299</property>
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>
</group>
</arquillian> </arquillian>
Expand Up @@ -31,6 +31,7 @@
import org.jboss.as.cli.batch.Batch; import org.jboss.as.cli.batch.Batch;
import org.jboss.as.test.integration.management.util.CLITestUtil; import org.jboss.as.test.integration.management.util.CLITestUtil;
import org.jboss.dmr.ModelNode; import org.jboss.dmr.ModelNode;
import org.jboss.logging.Logger;


/** /**
* Implementation of {@link ServerSetupTask} which runs provided CLI commands. * Implementation of {@link ServerSetupTask} which runs provided CLI commands.
Expand All @@ -39,6 +40,7 @@
*/ */
public class CLIBatchServerSetupTask implements ServerSetupTask { public class CLIBatchServerSetupTask implements ServerSetupTask {


private static final Logger LOG = Logger.getLogger(CLIBatchServerSetupTask.class);
private final List<String> nodes; private final List<String> nodes;
private final List<String> setupCommands; private final List<String> setupCommands;
private final List<String> tearDownCommands; private final List<String> tearDownCommands;
Expand All @@ -51,6 +53,14 @@ public CLIBatchServerSetupTask(String[] nodes, String[] setupCommands, String[]
this(nodes == null ? null : Arrays.asList(nodes), Arrays.asList(setupCommands), Arrays.asList(tearDownCommands)); this(nodes == null ? null : Arrays.asList(nodes), Arrays.asList(setupCommands), Arrays.asList(tearDownCommands));
} }


/**
* Constructs a {@link ServerSetupTask} which is run after the container is started and before the deployment is deployed and its
* corresponding tear down commands run after undeployment.
*
* @param nodes list of nodes to run the commands on used to run specific setup on concrete nodes; {@code null} to run on all
* @param setupCommands list of CLI commands to run on container setup
* @param tearDownCommands list of CLI commands to run on container tear down, specifically undoing all changes done in setup commands
*/
public CLIBatchServerSetupTask(List<String> nodes, List<String> setupCommands, List<String> tearDownCommands) { public CLIBatchServerSetupTask(List<String> nodes, List<String> setupCommands, List<String> tearDownCommands) {
this.nodes = nodes; this.nodes = nodes;
this.setupCommands = setupCommands; this.setupCommands = setupCommands;
Expand Down
Expand Up @@ -40,16 +40,16 @@
import org.junit.Before; import org.junit.Before;


/** /**
* Base cluster test that guarantees a framework contract as follows: * Base implementation for every clustering test which guarantees a framework contract as follows:
* <ul> * <ol>
* <li>test case is constructed specifying nodes and deployments required</li>
* <li>before every test method, containers are started and deployments are deployed via {@link #beforeTestMethod()}</li> * <li>before every test method, containers are started and deployments are deployed via {@link #beforeTestMethod()}</li>
* <li>after every method execution the deployments are undeployed via {@link #afterTestMethod()}</li> * <li>after every method execution the deployments are undeployed via {@link #afterTestMethod()}</li>
* </ul> * </ol>
* * Should the test demand different node and deployment handling, the methods must be overridden.
* Should the test demand different node/deployment setup, the methods must be overridden. * <p>
* * Furthermore, this base class provides common constants for node/instance-id, deployment/deployment helpers, timeouts and provides
* Furthermore provides convenience methods for {@link NodeUtil} utility ({@link #start(String...)}, * convenience methods for managing container and deployment lifecycle ({@link #start(String...)}, {@link #deploy(String...)}, etc).
* {@link #deploy(String...)}, etc).
* *
* @author Radoslav Husar * @author Radoslav Husar
*/ */
Expand All @@ -68,10 +68,10 @@ public abstract class AbstractClusteringTestCase {
public static final String NODE_NAME_PROPERTY = "jboss.node.name"; public static final String NODE_NAME_PROPERTY = "jboss.node.name";


// Test deployment names // Test deployment names
public static final String DEPLOYMENT_1 = "deployment-0"; public static final String DEPLOYMENT_1 = "deployment-1";
public static final String DEPLOYMENT_2 = "deployment-1"; public static final String DEPLOYMENT_2 = "deployment-2";
public static final String DEPLOYMENT_3 = "deployment-2"; public static final String DEPLOYMENT_3 = "deployment-3";
public static final String DEPLOYMENT_4 = "deployment-3"; public static final String DEPLOYMENT_4 = "deployment-4";
public static final String[] TWO_DEPLOYMENTS = new String[] { DEPLOYMENT_1, DEPLOYMENT_2 }; public static final String[] TWO_DEPLOYMENTS = new String[] { DEPLOYMENT_1, DEPLOYMENT_2 };
public static final String[] FOUR_DEPLOYMENTS = new String[] {DEPLOYMENT_1, DEPLOYMENT_2, DEPLOYMENT_3, DEPLOYMENT_4 }; public static final String[] FOUR_DEPLOYMENTS = new String[] {DEPLOYMENT_1, DEPLOYMENT_2, DEPLOYMENT_3, DEPLOYMENT_4 };


Expand All @@ -91,10 +91,14 @@ public abstract class AbstractClusteringTestCase {
public static final int HTTP_REQUEST_WAIT_TIME_S = TimeoutUtil.adjust(5); public static final int HTTP_REQUEST_WAIT_TIME_S = TimeoutUtil.adjust(5);


// System Properties // System Properties
public static final String MCAST = System.getProperty("mcast", "230.0.0.4"); public static final String TESTSUITE_NODE0 = System.getProperty("node0", "127.0.0.1");
public static final String MCAST1 = System.getProperty("mcast1", "230.0.0.5"); public static final String TESTSUITE_NODE1 = System.getProperty("node1", "127.0.0.1");
public static final String MCAST2 = System.getProperty("mcast2", "230.0.0.6"); public static final String TESTSUITE_NODE2 = System.getProperty("node2", "127.0.0.1");
public static final String MCAST3 = System.getProperty("mcast3", "230.0.0.7"); public static final String TESTSUITE_NODE3 = System.getProperty("node3", "127.0.0.1");
public static final String TESTSUITE_MCAST = System.getProperty("mcast", "230.0.0.4");
public static final String TESTSUITE_MCAST1 = System.getProperty("mcast1", "230.0.0.5");
public static final String TESTSUITE_MCAST2 = System.getProperty("mcast2", "230.0.0.6");
public static final String TESTSUITE_MCAST3 = System.getProperty("mcast3", "230.0.0.7");


protected static final Logger log = Logger.getLogger(AbstractClusteringTestCase.class); protected static final Logger log = Logger.getLogger(AbstractClusteringTestCase.class);
private static final RoutingSupport routing = new SimpleRoutingSupport(); private static final RoutingSupport routing = new SimpleRoutingSupport();
Expand Down

0 comments on commit 8672020

Please sign in to comment.