
The Payara Monthly Catch -September 2025
Welcome aboard the September issue of The Monthly Catch! With summer holidays wrapping up, the Java world is back […]
One of the core steps in every continuous integration process is running integration tests for your application. Unlike vanilla unit tests, integration tests allow you to assess the state of your applications or systems by testing all of its components together (modules, databases, messaging, etc.) and verifying that they work correctly as a whole unit. Needless to say, integration tests are more complex that simple unit tests, have a larger footprint, take more time and are usually saved to test full releases or major changes to implementations.
Usually, when testing Java EE applications, there is a need to configure and start an instance of your preferred application server, run the tests against this running instance and when finished, clear everything up. In some cases it may be needed to prepare a separate running instance for each test, making the whole process CPU intensive, expensive and cumbersome to automate. That was usually the case until Arquillian came along.
Arquillian came along to simplify the process of running full integration tests suites for Java EE applications, by managing the lifecycle of your application servers or containers, bundling the test case along necessary resources into a test archive, providing dependency injection providers to the test cases to simplify the test writing and more. In addition, Arquillian supports both JUnit and TestNG so writing tests with it shouldn’t be a problem. This is done thanks to the concept of container adapters, which Arquillian uses to connect and manage a profile of an specific application server’s container (like GlassFish or WildFly). If you are developing application that you want to test for an specific container, simply use the corresponding container adapter on your integration tests. There are 3 types of container adapters for application servers:
Payara Server has, until now, not been officially supported in the list of available container adapters that Arquillian provides to developers. As a workaround, when writing integration tests for Payara Server in mind, it was officially recommended to use the official Glassfish 3.1 Arquillian Container adapter to let integration tests communicate with Payara Server (since Payara Server is derived from GlassFish, there’s a degree of compatibility between them). If you are using Maven to handle your application testing, you only need to add the following dependency to use the embedded mode adapter for GlassFish 3.1:
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
There are some problems with depending on this container adapter, mainly that is for communicating with either commercial or open source GlassFish server 3.1, which is compatible with Java EE 6. Considering that Payara Server is derived from GlassFish 4.1 which is compatible with Java EE 7, this means that you won’t be able to test features or APIs introduced in Java EE 7. For this reason alone, starting with release 4.1.2.173, we have developed a special container adapter with the following Maven coordinates:
<dependency>
<groupId>fish.payara.arquillian</groupId>
<artifactId>arquillian-payara-server-4-embedded</artifactId>
<version>1.0.Beta2</version>
<scope>test</scope>
</dependency>
And that’s it! To use the managed and remote adapters, change the artifactId to either arquillian-payara-server-4-managed
or arquillian-payara-server-4-remote
instead.
When running an integration test suite using this adapter, you should see no difference when running them using the adapter for GlassFish 3.1, with the exception of updated output values for the libraries and changes made for Payara Server 4.x
Also, remember to add the payara-embedded-all
or payara-embedded-web
dependencies to your project as well. Specify the exact version of the intended Payara Server this way:
<dependency>
<groupId>fish.payara.extras</groupId>
<artifactId>payara-embedded-all</artifactId>
<version>4.1.2.173</version>
<scope>test</scope>
</dependency>
With this official container adapter, Payara Server now has full integration with the Arquillian environment, bringing the following benefits:
With this in mind, we recommend you to start using the new Arquillian adapter to run your integration tests – and once you do, please make sure you give us your feedback!
Welcome aboard the September issue of The Monthly Catch! With summer holidays wrapping up, the Java world is back […]
We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]
If your Java EE 8 applications run on Red Hat JBoss Enterprise Application Platform (EAP) 7, you can’t afford […]
Thanks a lot, this is great news.
I have one question:
How do I have to configure my arquillian.xml file when using Payara arquillian-payara-server-4-remote?
Do I keep my Glassfish configuartion (container qualifier=”glassfish”…) or do I need to switch to “payara”?
Thanks,
Jo
Greetings Jo Ha
Since the adapters were based on the official adapters for GlassFish 3.1, the configuration settings used in the arquillian.xml file is still the same (including the container qualifier). In the future, we plan to diverge more from the GlassFish settings and introduce our own, so keep an eye on the blog for all of these possible changes.
Cheers,
Fabio.
Hello Fabio,
where can we find the sources of the project?
Cheers,
Thomas
Hello Fabio,
Where can I see the project completely?
Greetings Andrew,
There is no particular code project that was created in mind for this article. However, there are a lot of examples that use the Arquillian Container Adapters in Java EE Samples repositories:
* Java EE 7 samples: https://github.com/javaee-samples/javaee7-samples/
* Java EE 8 samples: https://github.com/javaee-samples/javaee8-samples/
All sample projects are configured to use several Java Application Server container adapters, not only Payara Server, so you can cross-test several standard features across vendors. For Payara Server there are 3 specific Maven profiles that can be used to configure the same adapter configurations described in the blog: payara-ci-managed, payara-ci-embedded and payara-ci-remote.