Title: TomEE and Arquillian
{info
See [Arquillian.org](http://arquillian.org) for some great quickstart information on Arquillian itself.
}
All the Aqruillian Adapters for TomEE support the following configuration options in the arquillian.xml:
0
0
The above can also be set as system properties rather than via the arquillian.xml file.
org.apache.maven.plugins
maven-surefire-plugin
0
0
When a port is set to zero, a random port will be chosen. This is key to avoiding port conflicts on CI systems or for just plain clean testing.
The TomEE Arquillian adapters will export the actual port chosen back as a system propert using the same name. The test case can use the property to retrieve the port and contact the server.
URL url = new URL("http://localhost:" + System.getProperty("tomee.httpPort");
// use the URL to connect to the server
# TomEE Embedded Adapter
The TomEE Embedded Adapter will boot TomEE right inside the testcase itself resulting in one JVM running both the application and the test case.
This is generally much faster than the TomEE Remote Adapter and great for development. That said, it is strongly recommended to also run all tests in a Continous Integration
system using the TomEE Remote Adapter.
To use the TomEE Embedded Arquillian Adapter, simply add this Maven dependency to your Arquillian setup:
org.apache.openejb
arquillian-tomee-embedded
1.0.0
As mentioned above the Embedded Adapter has the following properties which can be specified in the `arquillian.xml` file:
- `httpPort`
- `stopPort`
Or alternatively as System properties, possibly shared with other TomEE Arquillian Adapters:
- `tomee.httpPort`
- `tomee.stopPort`
Or more specifically as a System properties only applicable to the Embedded Adapter:
- `tomee.embedded.httpPort`
- `tomee.embedded.stopPort`
# TomEE Remote Adapter
The TomEE Remote Adapter will unzip and setup a TomEE or TomEE Plus distribution. Once setup, the server will execute in a separate process. This will be slower, but
with the added benefit it is 100% match with the production system.
The following shows a typical configuration for testing against TomEE (webprofile version). The same can be done against TomEE+ by changing `webprofile` to `plus`
1.0.0
webprofile
org.apache.maven.plugins
maven-surefire-plugin
${tomee.classifier}
${tomee.version}
org.apache.openejb
arquillian-tomee-remote
${tomee.version}
org.apache.openejb
apache-tomee
${tomee.version}
${tomee.classifier}
zip
The Remote Adapter has the following properties which can be specified in the `arquillian.xml` file:
- `httpPort`
- `stopPort`
- `version`
- `classifier` (must be either `webprofile` or `plus`)
Or alternatively as System properties, possibly shared with other TomEE Arquillian Adapters:
- `tomee.httpPort`
- `tomee.stopPort`
- `tomee.version`
- `tomee.classifier`
Or more specifically as a System properties only applicable to the Remote Adapter:
- `tomee.remote.httpPort`
- `tomee.remote.stopPort`
- `tomee.remote.version`
- `tomee.remote.classifier`
# Maven Profiles
Setting up both adapters is quite easy via maven profiles. Here the default adapter is the Embedded Adapter, the Remote Adapter will run with `-Ptomee-webprofile-remote` specified as a `mvn` command argument.
tomee-embedded
true
org.apache.openejb
arquillian-tomee-embedded
1.0.0
tomee-webprofile-remote
1.0.0
webprofile
org.apache.maven.plugins
maven-surefire-plugin
${tomee.classifier}
${tomee.version}
org.apache.openejb
arquillian-tomee-remote
${tomee.version}
org.apache.openejb
apache-tomee
${tomee.version}
${tomee.classifier}
zip
tomee-plus-remote
1.0.0
plus
org.apache.maven.plugins
maven-surefire-plugin
${tomee.classifier}
${tomee.version}
org.apache.openejb
arquillian-tomee-remote
${tomee.version}
org.apache.openejb
apache-tomee
${tomee.version}
${tomee.classifier}
zip