Overview
This project provides Arquillian container adapters for running tests on Eclipse GlassFish server in different modes:
-
Managed – Starts and stops a local GlassFish server instance.
-
Remote – Connects to a running GlassFish server instance.
-
Embedded – Runs Embedded GlassFish in-process in the test JVM.
Installation
Add one of the following dependencies to your Maven pom.xml, depending on your target container mode.
Managed GlassFish
<dependency>
<groupId>ee.omnifish.arquillian</groupId>
<artifactId>arquillian-glassfish-server-managed</artifactId>
<version>YOUR_VERSION</version>
<scope>test</scope>
</dependency>
Configuration Options
The following configuration options are available for all GlassFish Arquillian containers (managed, remote, embedded). Each option may be set via a system property (-Dglassfish.X) or inside arquillian.xml as a container <property>.
Configuration Table
| Property (arquillian.xml) | System Property | Type | Default | Modes | Description |
|---|---|---|---|---|---|
|
|
String |
none |
Managed |
The local GlassFish installation directory (required) |
|
|
String |
|
Managed, Remote |
Admin server host address |
|
|
int |
|
Managed, Remote |
Admin console port |
|
|
boolean |
|
Managed, Remote |
Use HTTPS for admin URL |
|
|
int |
|
Managed, Remote |
HTTP port |
|
|
int |
|
Managed, Remote |
HTTPS port |
|
|
boolean |
|
Managed, Remote |
Enable login with admin credentials |
|
|
boolean |
|
All |
If SSL certificates are ignored |
|
|
String |
none |
Managed, Remote |
Admin username (required if |
|
|
String |
none |
Managed, Remote |
Admin password (required if |
|
|
String |
|
All |
Deployment target (e.g., |
|
|
String |
none |
Managed |
Comma-separated library JAR paths for deployed applications |
|
|
String |
none |
All |
Additional deployment properties for the deployment - keyword-value pairs. |
|
|
String |
none |
All |
Deployment archive type (e.g., |
|
|
String |
none |
Managed |
GlassFish domain name. The default will be used if not specified |
|
|
String |
none |
Managed, Embedded |
Multiline asadmin commands executed after boot |
|
|
String |
none |
Managed |
Multiline JVM system properties |
|
|
boolean |
|
All |
Use HTTPS port as default connector |
|
|
boolean |
|
Managed |
Start server in debug mode |
|
|
boolean |
|
Managed |
Suspend until debugger connects |
|
|
boolean |
|
All |
Add deploy name to archive |
|
|
boolean |
|
Managed |
Show the output of the admin commands on the console |
|
|
boolean |
|
Managed |
Allow Arquillian to use an already running GlassFish instance |
|
|
boolean |
|
Managed |
Starts the server if needed, but keeps it running after tests |
|
|
boolean |
|
Managed |
Keep deployment after tests |
|
|
boolean |
|
Managed |
Flag to start/stop the registered Derby server using standard Derby port |
|
|
String |
none |
Managed |
Derby database name |
|
|
String |
none |
Managed |
Derby SQL file to execute |
|
|
String |
none |
Managed |
Derby user |
|
|
String |
none |
Managed |
Derby password file |
|
|
String |
none |
Managed |
JVM max heap size (e.g., |
|
|
String |
none |
Managed |
Enable JVM assertions for specific packages (e.g., |
|
none |
int |
|
Embedded |
The port number of the http-listener for the embedded GlassFish server |
|
none |
int |
|
Embedded |
The port number of the https-listener for the embedded GlassFish server |
|
none |
String |
none |
Embedded |
The instance root directory (parent of server instance directory) |
|
none |
String |
none |
Embedded |
The location of the GlassFish installation root directory |
|
none |
boolean |
|
Embedded |
Specifies whether GlassFish should writeback changes to configuration file |
|
none |
String |
none |
Embedded |
Location of configuration file (domain.xml) for the GlassFish server |
|
none |
String |
none |
Embedded |
Comma-separated list of GlassFish resources.xml files to add using add-resources command |
|
none |
boolean |
|
Embedded |
Specifies whether Arquillian should cleanup on shutdown (deletes instanceRoot files) |
Usage Notes
-
System properties must be passed to the JVM, e.g.
-Dglassfish.adminPort=4848. -
arquillian.xmlshould define properties under the container configuration:
<container qualifier="glassfish-managed" default="true">
<configuration>
<property name="adminUser">admin</property>
<property name="adminPassword">admin123</property>
</configuration>
</container>
-
Properties like
postBootCommandsandsystemPropertiessupport multiline values. -
When
authorisationis enabled, bothadminUserandadminPasswordmust be provided.
Usage Examples
Example: arquillian.xml for Managed GlassFish
<arquillian>
<container qualifier="glassfish-managed" default="true">
<configuration>
<property name="adminUser">admin</property>
<property name="adminPassword">admin123</property>
<property name="glassfishHome">${env.GLASSFISH_HOME}</property>
<property name="postBootCommands">
create-jdbc-connection-pool --datasourceclassname=com.mysql.cj.jdbc.MysqlDataSource ...
create-jdbc-resource --connectionpoolid=MyPool jdbc/MyDS
</property>
</configuration>
</container>
</arquillian>