Payara Platform

Payara Micro Managed Arquillian Container Adapter

When using this adapter, the Payara Micro container lifecycle is managed by Arquillian by starting a separate JVM process to launch and stop a Payara Micro instance locally.

Usage

The Payara Micro Managed Arquillian container adapter can be found on Maven Central, and can be included in your project using the following Maven GAV coordinates:

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

Container Configuration

The Payara Micro container can be configured via the arquillian.xml file using the standard Arquillian Container Configuration mechanism.

The following configuration options are available:

Configuration Options

|=== | | Container Option | Description | System Property | Environment Variable | Default |

| microJar | | Provides the location of the Payara Micro Jar. | | payara.microJar | | MICRO_JAR | |

| 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 Payara 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 JVM options to the Java process running the Micro instance. | | payara.cmdOptions | | MICRO_CMD_OPTIONS | |

| extraMicroOptions | | Provides standard Payara Micro arguments for the server instance to launch with | | payara.extraMicroOptions | | EXTRA_MICRO_OPTIONS | | |=== |

Examples

To configure the 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.

Example 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:

Example - Surefire plugin configuration in the project’s POM 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
Back to Top