Skip to content

Commit

Permalink
WELD-1506 add wildfly ftest profiles, modify numberguess failover tes…
Browse files Browse the repository at this point in the history
…t to run on wildfly
  • Loading branch information
maschmid authored and jharting committed Sep 20, 2013
1 parent bbcca68 commit 3feb5e2
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 35 deletions.
8 changes: 8 additions & 0 deletions examples/jsf/login/pom.xml
Expand Up @@ -120,6 +120,14 @@
<profile>
<id>arquillian-jbossas-remote-7</id>
</profile>

<profile>
<id>arquillian-wildfly-managed-8</id>
</profile>

<profile>
<id>arquillian-wildfly-remote-8</id>
</profile>
</profiles>

</project>
Expand Down
12 changes: 12 additions & 0 deletions examples/jsf/numberguess/pom.xml
Expand Up @@ -308,6 +308,18 @@
<id>arquillian-jetty-embedded-7</id>
</profile>

<profile>
<id>arquillian-wildfly-managed-8</id>
</profile>

<profile>
<id>arquillian-wildfly-remote-8</id>
</profile>

<profile>
<id>arquillian-wildfly-cluster-8</id>
</profile>

<profile>
<id>arquillian-jbossas-cluster-7</id>
<activation>
Expand Down
Expand Up @@ -38,9 +38,10 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import org.openqa.selenium.By;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -152,27 +153,8 @@ public String getAddressForSecondInstance() {
for (int i = 4; i < parsedStrings.length; i++) {
sb.append("/").append(parsedStrings[i]);
}

String newAddress = sb.toString();
String firstPart = "";
String sid = "";

//if (selenium.isCookiePresent("JSESSIONID")) {
if (!newAddress.contains(";")) {
sid = driver.manage().getCookieNamed("JSESSIONID").getValue();
firstPart = newAddress;
} else {
// get sessionid directly from browser URL if JSESSIONID cookie is not
// present
firstPart = newAddress.substring(0, newAddress.indexOf(";"));
sid = loc.substring(loc.indexOf("jsessionid=") + "jsessionid=".length(), loc.length());
}

newAddress = firstPart + ";jsessionid=" + sid;

driver.manage().deleteAllCookies();

return newAddress;
return sb.toString();
}

private Integer getRemainingGuesses() {
Expand Down Expand Up @@ -231,7 +213,17 @@ private void smartStep() throws InterruptedException {

private void switchBrowsers() throws MalformedURLException {
String address = getAddressForSecondInstance();

String sid = driver.manage().getCookieNamed("JSESSIONID").getValue();

String contextPath = browsersSwitched ? contextPath1 : contextPath2;

// We navigate to the home page on the second server, just to set the cookies
driver.navigate().to(new URL(contextPath));
driver.manage().deleteAllCookies();
driver.manage().addCookie(new Cookie("JSESSIONID", sid));

// Now we navigate for reals
driver.navigate().to(new URL(contextPath + "/" + address));

browsersSwitched = !browsersSwitched;
Expand All @@ -257,7 +249,9 @@ public void guessingWithFailoverTest() throws MalformedURLException, Interrupted
naiveStep();
}
} while(!isOnGuessPage());


Thread.sleep(GRACE_TIME_TO_REPLICATE);

deployer.undeploy(DEPLOYMENT1);
controller.stop(CONTAINER1);

Expand Down
26 changes: 13 additions & 13 deletions examples/jsf/numberguess/src/ftest/resources/arquillian.xml
Expand Up @@ -40,31 +40,31 @@

<container qualifier="jetty-embedded-6.1">
</container>
<group qualifier="jbossas-cluster-6">

<group qualifier="wildfly-cluster-8">

<container qualifier="container1" default="true" mode="manual" managed="false">
<configuration>
<property name="profileName">${node1.profileName:all}</property>
<property name="bindAddress">${node1.bindAddress:127.0.1.1}</property>
<property name="partition">${node1.partition:test}</property>
<property name="managementAddress">${node1.managementAddress:127.0.1.1}</property>
<property name="managementPort">${node1.managementPort:9990}</property>
<property name="jbossHome">${node1.jbossHome}</property>
<property name="javaVmArguments">-Djboss.messaging.ServerPeerID=1 -Djava.net.preferIPv4Stack=true -Xmx1024m -XX:MaxPermSize=512m -Dlogging.configuration=file://${node1.jbossHome}/bin/logging.properties -Djboss.partition.udpGroup=${node1.udpGroup:239.255.101.101} -Djgroups.udp.mcast_addr=${node1.udpGroup:239.255.101.101}</property>
<property name="javaVmArguments">-Djboss.node.name=${node1.nodeName:node1} -Djava.net.preferIPv4Stack=true</property>
<property name="serverConfig">${jboss.server.config.file.name:standalone-ha.xml}</property>
</configuration>
</container>

<container qualifier="container2" default="false" mode="manual" managed="false">
<configuration>
<property name="profileName">${node2.profileName:all2}</property>
<property name="bindAddress">${node2.bindAddress:127.0.2.1}</property>
<property name="partition">${node2.partition:test}</property>
<property name="managementAddress">${node2.managementAddress:127.0.2.1}</property>
<property name="managementPort">${node2.managementPort:9990}</property>
<property name="jbossHome">${node2.jbossHome}</property>
<property name="javaVmArguments">-Djboss.messaging.ServerPeerID=2 -Djava.net.preferIPv4Stack=true -Xmx1024m -XX:MaxPermSize=512m -Dlogging.configuration=file://${node2.jbossHome}/bin/logging.properties -Djboss.partition.udpGroup=${node2.udpGroup:239.255.101.101} -Djgroups.udp.mcast_addr=${node2.udpGroup:239.255.101.101}</property>
<property name="javaVmArguments">-Djboss.node.name=${node2.nodeName:node2} -Djava.net.preferIPv4Stack=true</property>
<property name="serverConfig">${jboss.server.config.file.name:standalone-ha.xml}</property>
</configuration>
</container>

</group>

</group>

<group qualifier="jbossas-cluster-7">

<container qualifier="container1" default="true" mode="manual" managed="false">
Expand Down
8 changes: 8 additions & 0 deletions examples/jsf/pastecode/pom.xml
Expand Up @@ -213,6 +213,14 @@
<profile>
<id>arquillian-jbossas-remote-7</id>
</profile>

<profile>
<id>arquillian-wildfly-managed-8</id>
</profile>

<profile>
<id>arquillian-wildfly-remote-8</id>
</profile>
</profiles>

<scm>
Expand Down
8 changes: 8 additions & 0 deletions examples/jsf/permalink/pom.xml
Expand Up @@ -470,6 +470,14 @@
<profile>
<id>arquillian-jetty-embedded-7</id>
</profile>

<profile>
<id>arquillian-wildfly-managed-8</id>
</profile>

<profile>
<id>arquillian-wildfly-remote-8</id>
</profile>
</profiles>

</project>
8 changes: 8 additions & 0 deletions examples/jsf/translator/ftest/pom.xml
Expand Up @@ -62,6 +62,14 @@
<profile>
<id>arquillian-jbossas-remote-7</id>
</profile>

<profile>
<id>arquillian-wildfly-managed-8</id>
</profile>

<profile>
<id>arquillian-wildfly-remote-8</id>
</profile>
</profiles>

<build>
Expand Down
61 changes: 61 additions & 0 deletions examples/pom.xml
Expand Up @@ -637,6 +637,67 @@
</dependencies>
</profile>

<profile>
<id>arquillian-wildfly-cluster-8</id>
<activation>
<property>
<name>arquillian</name>
<value>wildfly-cluster-8</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<node1.contextPath>${node1.contextPath}</node1.contextPath>
<node1.managementAddress>${node1.managementAddress}
</node1.managementAddress>
<node1.managementPort>${node1.managementPort}</node1.managementPort>
<node1.jbossHome>${node1.jbossHome}</node1.jbossHome>
<node1.nodeName>${node1.nodeName}</node1.nodeName>

<node2.contextPath>${node2.contextPath}</node2.contextPath>
<node2.managementAddress>${node2.managementAddress}
</node2.managementAddress>
<node2.managementPort>${node2.managementPort}</node2.managementPort>
<node2.jbossHome>${node2.jbossHome}</node2.jbossHome>
<node2.nodeName>${node2.nodeName}</node2.nodeName>
</systemPropertyVariables>

<skip>false</skip>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
<printSummary>true</printSummary>
<includes>
<include>**/ftest/cluster/*Test.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

<profile>
<id>arquillian-jbossas-cluster-7</id>
<activation>
Expand Down

0 comments on commit 3feb5e2

Please sign in to comment.