Skip to content

Commit dd8bcc4

Browse files
committed
Added tests for eap-datagrid-subsystem
1 parent cf9e092 commit dd8bcc4

File tree

10 files changed

+647
-7
lines changed

10 files changed

+647
-7
lines changed

eap-datagrid-subsystem/README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Simple start
2727

2828
$EAP_HOME/bin/standalone.sh
2929

30-
4. use the CLI scipts to configure the datagrid subsystem and necessary dependencies
30+
4. use the CLI scripts to configure the datagrid subsystem and necessary dependencies
3131

3232
$EAP_HOME/bin/jboss-cli.sh -c --file=$SRC_HOME/install1-standalone-local.cli
3333
> restart the server !
@@ -66,7 +66,7 @@ To see the behaviour for JDG caches
6666

6767
$EAP_HOME/bin/standalone.sh [-c standalone-ha.xml]
6868

69-
4. use the CLI scipts to configure the datagrid subsystem and necessary dependencies
69+
4. use the CLI scripts to configure the datagrid subsystem and necessary dependencies
7070

7171
$EAP_HOME/bin/jboss-cli.sh -c --file=$SRC_HOME/install1-standalone-clustered.cli
7272
> restart the server !
@@ -91,11 +91,32 @@ To see the behaviour for JDG caches
9191
Notes
9292
=======
9393
- You can simple rename the jboss-eap-datagrid-subsystem-AppWeb.war to any other name.war to simulate different applications.
94-
If there are multiple applicatations they share the same cache!
94+
If there are multiple applications they share the same cache!
9595
- Caches are independent from application lifecycles. Undeploying any, or all, applications instances has no affect on a cache's lifecycle or data.
9696
Even if the cache has no persistence the data will be kept as long as the server is not stopped.
9797
- In this example the EAP server is not clustered, but if the cache is configured as clustered with the datagrid-jgroups subsystem and replicated or
9898
distributed caches, the cache will be synchronized between different EAP instances if configured correctly.
9999
- The respective JGroups subsystem needs to be defined for both EAP and JDG as the respective subsystems depend on different JGroups versions and provide different functionality.
100100
- Also it is indespensable that the communication addresses and port for the JGroups subsystems need to be different. This prevent from cross-talking
101101
which cause performance drawback, WARN message or error messages.
102+
103+
104+
Run tests
105+
========================
106+
1. Prepare the server instances and keep EAP server running
107+
108+
2. Run `mvn test -Ptests-eap -DeapHome=$EAP_HOME`
109+
110+
111+
112+
Run tests in clustered cache mode
113+
========================
114+
1. Set variables
115+
$EAP_SERVER_ZIP_PATH - path to jboss-eap.zip
116+
$JDG_MODULES_ZIP_PATH - path to jboss-datagrid-eap-modules-library.zip
117+
118+
2. Prepare two EAP server instances or run prepareTwoEAP.sh from working directory (this will prepare two EAPs)
119+
120+
3. Save path to EAPs directories as $EAP_HOME1 and $EAP_HOME2
121+
122+
4. Run `mvn test -Ptests-eap-clustered -DeapHome1=$EAP_HOME1 -DeapHome2=$EAP_HOME2`

eap-datagrid-subsystem/pom.xml

Lines changed: 176 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@
6666
<ear.plugin.version>2.10.1</ear.plugin.version>
6767
<ear.plugin.version>2.10.1</ear.plugin.version>
6868
<war.plugin.version>3.0.0</war.plugin.version>
69+
70+
<!---->
71+
<version.maven.ant.plugin>1.7</version.maven.ant.plugin>
72+
<version.jboss.spec.javaee.7.0>9.0.1.Final</version.jboss.spec.javaee.7.0>
73+
<version.buildhelper.maven.plugin>1.7</version.buildhelper.maven.plugin>
74+
<!-- test dependencies versions -->
75+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
76+
<browser>phantomjs</browser>
6977
</properties>
7078

7179
<dependencyManagement>
@@ -93,17 +101,33 @@
93101
<type>pom</type>
94102
<scope>import</scope>
95103
</dependency>
104+
<!-- Define the version of JBoss' Java EE 7 APIs we want to import.
105+
Any dependencies from org.wildfly.bom will have their version defined by this
106+
BOM -->
107+
<!-- JBoss distributes a complete set of Java EE 7 APIs including
108+
a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
109+
a collection) of artifacts. We use this here so that we always get the correct
110+
versions of artifacts. Here we use the jboss-javaee-7-with-tools stack.
111+
The -with-tools means also versions of other artifacts like Arquillian. -->
96112
<dependency>
97-
<groupId>org.wildfly</groupId>
98-
<artifactId>wildfly-ejb-client-bom</artifactId>
99-
<version>${version.wildfly}</version>
100-
<scope>import</scope>
113+
<groupId>org.wildfly.bom</groupId>
114+
<artifactId>jboss-javaee-7.0-wildfly-with-tools</artifactId>
115+
<version>${version.jboss.spec.javaee.7.0}</version>
101116
<type>pom</type>
117+
<scope>import</scope>
102118
</dependency>
103119
</dependencies>
104120
</dependencyManagement>
105121

106122
<build>
123+
<!-- export browser property to arquillian.xml -->
124+
<testResources>
125+
<testResource>
126+
<directory>src/test/resources</directory>
127+
<filtering>true</filtering>
128+
</testResource>
129+
</testResources>
130+
107131
<plugins>
108132
<plugin>
109133
<groupId>org.codehaus.mojo</groupId>
@@ -116,5 +140,153 @@
116140
</plugins>
117141
</build>
118142

143+
<profiles>
144+
<profile>
145+
<id>skip.tests.by.default</id>
146+
<activation>
147+
<activeByDefault>true</activeByDefault>
148+
</activation>
149+
<properties>
150+
<maven.test.skip>true</maven.test.skip>
151+
</properties>
152+
</profile>
153+
154+
<!-- This profile is for running tests on EAP standalone -->
155+
<profile>
156+
<id>tests-eap</id>
157+
<activation>
158+
<activeByDefault>false</activeByDefault>
159+
<!--<property>-->
160+
<!--<name>eapHome</name>-->
161+
<!--</property>-->
162+
</activation>
163+
<dependencies>
164+
<dependency>
165+
<groupId>org.wildfly.arquillian</groupId>
166+
<artifactId>wildfly-arquillian-container-managed</artifactId>
167+
</dependency>
168+
<dependency>
169+
<groupId>org.jboss.arquillian.protocol</groupId>
170+
<artifactId>arquillian-protocol-servlet</artifactId>
171+
<scope>test</scope>
172+
</dependency>
173+
</dependencies>
174+
<build>
175+
<plugins>
176+
<plugin>
177+
<!-- This plugin will add the src/local/java source
178+
folder -->
179+
<groupId>org.codehaus.mojo</groupId>
180+
<artifactId>build-helper-maven-plugin</artifactId>
181+
<version>${version.buildhelper.maven.plugin}</version>
182+
<executions>
183+
<execution>
184+
<id>add-source</id>
185+
<phase>generate-sources</phase>
186+
<goals>
187+
<goal>add-source</goal>
188+
</goals>
189+
<configuration>
190+
<sources>
191+
<source>src/local/java</source>
192+
</sources>
193+
</configuration>
194+
</execution>
195+
</executions>
196+
</plugin>
197+
<plugin>
198+
<artifactId>maven-surefire-plugin</artifactId>
199+
<configuration>
200+
<!--Test only SubsystemTest for standalone mode-->
201+
<includes>
202+
<include>**/SubsystemTest*</include>
203+
</includes>
204+
<reportNameSuffix>tests-eap</reportNameSuffix>
205+
<systemPropertyVariables>
206+
<subsystem.war.directory>${basedir}/target</subsystem.war.directory>
207+
<subsystem.war.file>${project.artifactId}.war</subsystem.war.file>
208+
</systemPropertyVariables>
209+
<systemProperties>
210+
<arquillian.launch>jbossas-managed</arquillian.launch>
211+
</systemProperties>
212+
<!-- Added so selenium doesn't print it's INFO logs to console (there's a LOT of them -
213+
like 5000 lines for each run) - they are instead appended (important when
214+
there are multiple profiles) to <module>/target/jul-info.log (warnings are printed in console) -->
215+
<argLine>-Djava.util.logging.config.file=${basedir}/web/src/test/resources/logging.properties</argLine>
216+
</configuration>
217+
218+
</plugin>
219+
</plugins>
220+
</build>
221+
</profile>
222+
223+
<!-- This profile is for running tests on clustered EAPs -->
224+
<profile>
225+
<id>tests-eap-clustered</id>
226+
<activation>
227+
<activeByDefault>false</activeByDefault>
228+
</activation>
229+
<dependencies>
230+
<dependency>
231+
<groupId>org.wildfly.arquillian</groupId>
232+
<artifactId>wildfly-arquillian-container-managed</artifactId>
233+
</dependency>
234+
<dependency>
235+
<groupId>org.jboss.arquillian.protocol</groupId>
236+
<artifactId>arquillian-protocol-servlet</artifactId>
237+
<scope>test</scope>
238+
</dependency>
239+
</dependencies>
240+
<build>
241+
<plugins>
242+
<plugin>
243+
<!-- This plugin will add the src/local/java source
244+
folder -->
245+
<groupId>org.codehaus.mojo</groupId>
246+
<artifactId>build-helper-maven-plugin</artifactId>
247+
<version>${version.buildhelper.maven.plugin}</version>
248+
<executions>
249+
<execution>
250+
<id>add-source</id>
251+
<phase>generate-sources</phase>
252+
<goals>
253+
<goal>add-source</goal>
254+
</goals>
255+
<configuration>
256+
<sources>
257+
<source>src/local/java</source>
258+
</sources>
259+
</configuration>
260+
</execution>
261+
</executions>
262+
</plugin>
263+
<plugin>
264+
<artifactId>maven-surefire-plugin</artifactId>
265+
<configuration>
266+
<!--Test only SubsystemClusteredTest for clustered mode-->
267+
<includes>
268+
<include>**/SubsystemClusteredTest*</include>
269+
</includes>
270+
<reportNameSuffix>tests-eap-clustered</reportNameSuffix>
271+
<systemPropertyVariables>
272+
<subsystem.war.directory>${basedir}/target</subsystem.war.directory>
273+
<subsystem.war.file>${project.artifactId}.war</subsystem.war.file>
274+
</systemPropertyVariables>
275+
<systemProperties>
276+
<arquillian.launch>jbossas-cluster</arquillian.launch>
277+
<!--<arquillian.launch>clustered-jbossas-managed-1</arquillian.launch>-->
278+
<!--<arquillian.launch>clustered-jbossas-managed-2</arquillian.launch>-->
279+
</systemProperties>
280+
<!-- Added so selenium doesn't print it's INFO logs to console (there's a LOT of them -
281+
like 5000 lines for each run) - they are instead appended (important when
282+
there are multiple profiles) to <module>/target/jul-info.log (warnings are printed in console) -->
283+
<argLine>-Djava.util.logging.config.file=${basedir}/web/src/test/resources/logging.properties</argLine>
284+
</configuration>
285+
</plugin>
286+
</plugins>
287+
</build>
288+
</profile>
289+
</profiles>
290+
119291
</project>
120292

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
export SRC_HOME=`pwd`
4+
5+
echo "Removing directories from previous run ..."
6+
rm -rf eap-server
7+
rm -rf jdg-modules
8+
rm -rf eap1
9+
rm -rf eap2
10+
11+
echo "Unzipping EAP server ..."
12+
unzip -q ${EAP_SERVER_ZIP_PATH} -d eap-server
13+
export EAP_HOME=`cd eap-server/*;pwd`
14+
echo $EAP_HOME
15+
16+
echo "Unzipping JDG eap modules library ..."
17+
unzip -q ${JDG_MODULES_ZIP_PATH} -d jdg-modules
18+
export JDG_MODULES=`cd jdg-modules/*;pwd`
19+
echo $JDG_MODULES
20+
21+
echo "Copying the JDG modules to EAP home directory"
22+
cp -a "${JDG_MODULES}/modules" "${EAP_HOME}"
23+
24+
echo "Starting EAP server"
25+
sh "${EAP_HOME}"/bin/standalone.sh > "${EAP_HOME}/server.log" &
26+
sleep 10
27+
28+
echo "Executing install1-standalone-clustered.cli console scripts"
29+
"${EAP_HOME}"/bin/jboss-cli.sh -c --file="${SRC_HOME}"/install1-standalone-clustered.cli
30+
sleep 2
31+
32+
echo "Restarting EAP server"
33+
(ps -ef | grep 'Standalone' | grep -v grep | awk '{print $2}' | xargs kill) > /dev/null 2>&1
34+
sleep 2
35+
sh "${EAP_HOME}"/bin/standalone.sh > "${EAP_HOME}/server.log" &
36+
sleep 10
37+
38+
echo "Executing install2-standalone-clustered.cli console scripts"
39+
"${EAP_HOME}"/bin/jboss-cli.sh -c --file="${SRC_HOME}"/install2-standalone-clustered.cli
40+
sleep 5
41+
42+
echo "Stopping EAP server"
43+
(ps -ef | grep 'Standalone' | grep -v grep | awk '{print $2}' | xargs kill) > /dev/null 2>&1
44+
45+
echo "Making the first copy of EAP server ..."
46+
cp -R "${EAP_HOME}" eap1
47+
export EAP_HOME1=`cd eap1;pwd`
48+
49+
echo "Making the second copy of EAP server ..."
50+
cp -R "${EAP_HOME}" eap2
51+
export EAP_HOME1=`cd eap2;pwd`

eap-datagrid-subsystem/web/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636

3737
<url>http://maven.apache.org</url>
3838
<packaging>war</packaging>
39+
<properties>
40+
<browser>phantomjs</browser>
41+
</properties>
3942

4043
<dependencies>
4144
<!-- add dependencies to all related EJB applications which are used.
@@ -68,6 +71,23 @@
6871
<version>${version.org.infinispan}</version>
6972
<scope>provided</scope>
7073
</dependency>
74+
<!-- Test dependencies -->
75+
<dependency>
76+
<groupId>org.jboss.arquillian.junit</groupId>
77+
<artifactId>arquillian-junit-container</artifactId>
78+
<scope>test</scope>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.jboss.arquillian.graphene</groupId>
82+
<artifactId>graphene-webdriver</artifactId>
83+
<type>pom</type>
84+
<scope>test</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>junit</groupId>
88+
<artifactId>junit</artifactId>
89+
<scope>test</scope>
90+
</dependency>
7191
</dependencies>
7292

7393
<build>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.jboss.as.quickstarts.datagrid.subsystem;
2+
3+
import org.jboss.shrinkwrap.api.ShrinkWrap;
4+
import org.jboss.shrinkwrap.api.importer.ZipImporter;
5+
import org.jboss.shrinkwrap.api.spec.WebArchive;
6+
7+
import java.io.File;
8+
9+
public class Deployments {
10+
private static final String ARCHIVE_NAME = System.getProperty("subsystem.war.file");
11+
private static final String BUILD_DIRECTORY = System.getProperty("subsystem.war.directory");
12+
13+
public static WebArchive createDeployment() {
14+
System.out.println(BUILD_DIRECTORY + '/' + ARCHIVE_NAME);
15+
return ShrinkWrap.create(ZipImporter.class, ARCHIVE_NAME).importFrom(new File(BUILD_DIRECTORY + '/' + ARCHIVE_NAME))
16+
.as(WebArchive.class);
17+
}
18+
19+
}

0 commit comments

Comments
 (0)