Payara Micro Managed Arquillian Container
The Payara Micro Managed Arquillian container provides a managed Payara Micro instance for integration testing.
Usage
The Payara Micro Managed Arquillian container can be found on Maven Central, and can be included in your project using the following Maven coordinates:
<dependency>
<groupId>fish.payara.arquillian</groupId>
<artifactId>arquillian-payara-micro-managed</artifactId>
<version>${version}</version>
</dependency>
You can find the latest artifact version from here.
Configuring the Container
The container can be configured via the arquillian.xml using the standard Arquillian Container Configuration mechanism, via system properties, or via environment variables.
The following configuration options are available:
Container Option | Description | System Property | Environment Variable | Default |
---|---|---|---|---|
|
Provides the location of the Payara Micro Jar. |
|
|
|
|
Specifies the amount of time in seconds that the container will wait for Payara Micro to start. |
|
|
|
|
Randomises the initial HTTP port of Payara Micro. This saves time by avoiding collisions with the default port. |
|
|
|
|
Enables the |
|
|
|
|
Enables clustering on the Micro instance. |
|
|
|
|
Enables/disables console output on the Micro instance. |
|
|
|
|
Enables debugging on the Micro instance. By default Payara Micro will wait for the debugger on port |
|
|
|
|
Provides additional options to the Java process running the Micro instance (I.e. between |
|
|
|
|
Provides additional options to the Micro instance (I.e. at the end of the command.). |
|
|
Examples
To configure Container options using Arquillian container properties, you need to use an arquillian.xml
file placed on the test classpath. Here’s an example arquillian.xml
file. It configures randomHttpPort
and autoBindHttp
options.
arquillian.xml
file<?xml version="1.0"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="payara-micro-managed" default="true">
<configuration>
<property name="randomHttpPort">false</property>
<property name="autoBindHttp">false</property>
</configuration>
</container>
</arquillian>
You can configure the options also using system properties. Here’s an example configuration if you run your tests using the maven surefire
plugin:
pom.xml
file<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<arquillian.launch>payara-micro-managed</arquillian.launch>
<payara.randomHttpPort>false</payara.randomHttpPort>
<payara.autoBindHttp>false</payara.autoBindHttp>
</systemPropertyVariables>
</configuration>
</plugin>
You can also configure the options using environment variables, for example when running the maven mvn test
command:
export MICRO_RANDOM_HTTP_PORT=false
export MICRO_AUTOBIND_HTTP=false
mvn test