Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ A brief instruction how to clone, build, import and run the samples on your loca

Only one container profile and one profile for browser can be active at a given time otherwise there will be dependency conflicts.

There are 5 available container profiles:
There are 8 available container profiles, for 5 different servers:

* ``wildfly-managed-arquillian``

The default profile and it will install a Wildfly server and start up the server per sample.
This profile will install a Wildfly server and start up the server per sample.
Useful for CI servers.

* ``wildfly-remote-arquillian``

This profile requires you to start up a Wildfly server outside of the build. Each sample will then
reuse this instance to run the tests.
Useful for development to avoid the server start up cost per sample.
Useful for development to avoid the server start up cost per sample. This is the default profile.

* ``glassfish-embedded-arquillian``

Expand All @@ -36,9 +36,39 @@ There are 5 available container profiles:
reuse this instance to run the tests.
Useful for development to avoid the server start up cost per sample.

* ``tomee-managed-arquillian``

This profile will install a TomEE server and start up that server per sample.
Useful for CI servers. This profile cannot connect to a running server.

Note that the version of TomEE to be used has to be present in an
available maven repository. The defaults in this profile assume that the arquillian adapter and
the TomEE server have the same version. E.g both 7.0.0-SNAPSHOT.

To use a TomEE server that's not available in maven central, one way to use it for the samples is to
install it in a local .m2 as follows:

Clone TomEE repo:

``git clone https://github.com/apache/tomee``
``cd tomee``

Switch to the desired version if needed, then build and install in .m2:

``mvn clean install -pl tomee/apache-tomee -am -Dmaven.test.skip=true``

``mvn clean install -pl arquillian -amd -Dmaven.test.skip=true``

Make sure the version that's installed (see pom.xml in TomEE project) matches the ``tomee.version`` in the
properties section in the root pom.xml of the samples project.

* ``tomee-embedded-arquillian``

This profile uses the TomEE embedded server and runs in the same JVM as the TestClass.

* ``liberty-managed-arquillian``

This profile will start up the server per sample, and optionally connects to a running server that you
This profile will start up the Liberty server per sample, and optionally connects to a running server that you
can start up outside of the build (with the restriction that this server has to run on the host as where
the tests are run using the same user).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,19 @@ protected URL getBase() {
* @return the raw content as a string as returned by the server
*/
protected String getFromServerPath(final String path) {
try {
response = null;
response = webClient.getPage(base + path).getWebResponse().getContentAsString();
return response;
} catch (FailingHttpStatusCodeException | IOException e) {
throw new IllegalStateException(e);
response = null;
for (int i=0; i<=3; i++) {
try {
response = webClient.getPage(base + path).getWebResponse().getContentAsString();
if (!response.contains("The response wrapper must wrap the response obtained from getResponse()")) {
return response;
}
} catch (FailingHttpStatusCodeException | IOException e) {
throw new IllegalStateException(e);
}
}

return response;
}

}
103 changes: 90 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@
<maven.test.skip>false</maven.test.skip>
<hamcrest.version>1.3</hamcrest.version>
<glassfish.version>4.0</glassfish.version>
<tomee.version>7.0.0-M3</tomee.version>

<!--
TomEE version that's installed and used when selecting the
tomee-managed-arquillian profile. Has to be made available
locally or version has to be changed to a version available in
maven central.
See README.md for details.
-->
<tomee.version>7.0.0-SNAPSHOT</tomee.version>
</properties>

<modules>
Expand Down Expand Up @@ -706,15 +714,10 @@
<artifactId>tomee-webservices</artifactId>
<version>${tomee.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>tomee-jaxrs</artifactId>
<version>${tomee.version}</version>
</dependency>
<dependency>
<groupId>org.apache.batchee</groupId>
<artifactId>batchee-jbatch</artifactId>
<version>0.2-incubating</version>
<version>0.3-incubating</version>
</dependency>
<dependency>
<groupId>org.apache.johnzon</groupId>
Expand All @@ -724,17 +727,17 @@
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-el-api</artifactId>
<version>8.0.32</version>
<version>8.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper-el</artifactId>
<version>8.0.32</version>
<version>8.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
<version>3.3.2</version>
</dependency>
</dependencies>
<build>
Expand All @@ -752,21 +755,95 @@
</profile>

<profile>
<id>tomee-remote-arquillian</id>
<id>tomee-managed-arquillian</id>

<dependencies>

<!-- The arquillian "remote" adapter that installs and starts/stops TomEE and deploys/undeploys tests -->
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>arquillian-tomee-remote</artifactId>
<version>${tomee.version}</version>
<exclusions>
<exclusion> <!-- let's use default (JTA) otherwise we need to setup the pom in a harder way -->
<groupId>org.apache.tomee</groupId>
<artifactId>arquillian-openejb-transaction-provider</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- The version of TomEE that the "remote" adapter is going to install and use.
Note that the adapter does *not* connect to an existing user installed TomEE
instance.
-->
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>apache-tomee</artifactId>
<version>${tomee.version}</version>
<classifier>plus</classifier>
<type>zip</type>
<classifier>plus</classifier>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.191</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>3.1.5</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-DTOMEE_LOCK_FILE=${user.dir}/.tomee-ports.lock</argLine>
<systemPropertyVariables>

<!--
TomEE Remote Arquillian Adapter Configuration

The TomEE adapter can be directly configured via system properties
without requiring to shuffle these to the arquillian.xml file.
-->

<!-- Using random port to run in // tests -->
<tomee.stopPort>-1</tomee.stopPort>
<tomee.httpPort>-1</tomee.httpPort>
<tomee.httpsPort>-1</tomee.httpsPort>
<tomee.ajpPort>-1</tomee.ajpPort>

<!-- Configure arquillian adapter here to do it once without any other module -->
<tomee.dir>target/tomee/server</tomee.dir>
<tomee.appWorkingDir>target/tomee/arquillian</tomee.appWorkingDir>
<tomee.cleanOnStartUp>true</tomee.cleanOnStartUp>
<tomee.classifier>plus</tomee.classifier>
<tomee.properties>
# default resources are not on by default cause it can need ports etc (JMS)
openejb.environment.default=true

# see additionalLibs
javax.persistence.provider = org.eclipse.persistence.jpa.PersistenceProvider
</tomee.properties>
<tomee.additionalLibs>
# OpenJPA is not yet JPA 2.1 and a lot of test - not only JPA - rely on javax.persistence properties
remove:openjpa
mvn:org.eclipse.persistence:eclipselink:2.5.2
mvn:org.eclipse.persistence:commonj.sdo:2.1.1
# some tests rely on h2 presence so ensure it is there even if tomee default is hsqldb
mvn:com.h2database:h2:1.4.191
</tomee.additionalLibs>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
Expand Down Expand Up @@ -946,4 +1023,4 @@
</profile>
</profiles>

</project>
</project>