Payara Micro Arquillian Container

The Payara Micro Arquillian container provides a managed Payara Micro instance for integration testing.

Steps for Building

In 5.184, the Payara Micro Arquillian container is in beta, and as such required building from the Payara Git project. The steps for doing so are as follows:

Clone the Payara Git repository:

git clone https://github.com/payara/Payara.git

Build and install:

cd Payara/
mvn clean install -DskipTests -f appserver/extras/arquillian-containers/pom.xml

The Arquillian container can then be found in your local Maven repository, and can be included in your project using the following Maven coordinates:

<dependency>
    <groupId>fish.payara.arquillian</groupId>
    <artifactId>arquillian-payara-micro-5-managed</artifactId>
    <version>${version}</version>
</dependency>

Configuring the Container

The following configuration options are available, each of which can be provided through the specified system properties or environment variables:

Table 1. Configuration Options
Option Description System Property Environment Variable Default

microJar

Provides the location of the Payara Micro Jar.

payara.microJar

MICRO_JAR

null

startupTimeoutInSeconds

Specifies the amount of time in seconds that the container will wait for Payara Micro to start.

payara.startupTimeoutInSeconds

MICRO_STARTUP_TIMEOUT_IN_SECONDS

180

randomHttpPort

Randomises the initial HTTP port of Payara Micro. This saves time by avoiding collisions with the default port.

payara.randomHttpPort

MICRO_RANDOM_HTTP_PORT

true

autoBindHttp

Enables the --autoBindHttp option for the Micro instance.

payara.autoBindHttp

MICRO_AUTOBIND_HTTP

true

clusterEnabled

Enables clustering on the Micro instance.

payara.clusterEnabled

MICRO_CLUSTER_ENABLED

false

consoleOutput

Enables/disables console output on the Micro instance.

payara.consoleOutput

MICRO_CONSOLE_OUTPUT

true

debug

Enables debugging on the Micro instance. By default Payara Micro will wait for the debugger on port 5005 before starting. Disables the startup timeout. To change this, provide java debug options to cmdOptions.

payara.debug

MICRO_DEBUG

false

cmdOptions

Provides additional options to the Java process running the Micro instance (I.e. between java and -jar.).

payara.cmdOptions

MICRO_CMD_OPTIONS

null

extraMicroOptions

Provides additional options to the Micro instance (I.e. at the end of the command.).

payara.extraMicroOptions

EXTRA_MICRO_OPTIONS

null

These options can all be provided through either an environment variable or system property. The easiest way to provide these to the test instance is through the surefire plugin.

Example
<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <systemProperties>
            <payara.microJar>/path/to/micro.jar</payara.microJar>
        </systemProperties>
    </configuration>
</plugin>