The sample project is here.
Openliberty 20.0.0.1 AdaptOpenJDK 8
The configuration for arquillian liberty-managed profile.
<profile>
<!-- Run with: mvn clean test -Parq-liberty-managed -->
<id>arq-liberty-managed</id>
<properties>
<skipTests>false</skipTests>
</properties>
<dependencies>
<dependency>
<groupId>io.openliberty.arquillian</groupId>
<artifactId>arquillian-liberty-managed</artifactId>
<version>${arquillian-liberty.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>unpack</id>
<phase>pre-integration-test</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>io.openliberty</groupId>
<artifactId>openliberty-runtime</artifactId>
<version>${liberty.runtime.version}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<configuration>
<!--<environmentVariables>
<WLP_HOME>${project.build.directory}/wlp</WLP_HOME>
</environmentVariables>-->
<systemProperties>
<arquillian.launch>liberty-managed</arquillian.launch>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
And the arquillian.xml file content:
<container qualifier="liberty-managed">
<configuration>
<property name="wlpHome">target/wlp/</property>
<property name="serverName">defaultServer</property>
<property name="httpPort">9080</property>
<property name="serverStartTimeout">300</property>
</configuration>
</container>
When running the test via the following command:
mvn clean verify -Parq-liberty-managed
And got the info from the console. The Github Actions build log can be found here.
087 seconds.
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 311.064 s <<< FAILURE! - in com.example.it.GreetingResourceTest
[ERROR] com.example.it.GreetingResourceTest Time elapsed: 311.05 s <<< ERROR!
org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start container
Caused by: org.jboss.arquillian.container.spi.client.container.LifecycleException: Unable to retrieve connector address for localConnector of started VM
[INFO] Running com.example.it.GreetingServiceTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.03 s <<< FAILURE! - in com.example.it.GreetingServiceTest
[ERROR] com.example.it.GreetingServiceTest Time elapsed: 0.018 s <<< ERROR!
java.lang.RuntimeException: Arquillian initialization has already been attempted, but failed. See previous exceptions for cause
Caused by: org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start container
Caused by: org.jboss.arquillian.container.spi.client.container.LifecycleException: Unable to retrieve connector address for localConnector of started VM
[AUDIT ] CWWKE0055I: Server shutdown requested on Friday, February 7, 2020 at 4:44 PM. The server defaultServer is shutting down.
[AUDIT ] CWWKE1100I: Waiting for up to 30 seconds for the server to quiesce.
[INFO ] CWWKE1101I: Server quiesce complete.
[AUDIT ] CWWKE0036I: The server defaultServer stopped after 5 minutes, 12.017 seconds.
Picked up JAVA_TOOL_OPTIONS: -Dcom.ibm.ws.logging.console.log.level=INFO
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
After reading the codes of liberty-managed, I found the reason. The liberty-managed does not read server.xml from either src/main/liberty/config(like what liberty maven plugin does) or the test classpath. It only read the server.xml file from the server config folder aka <wlp>/usr/servers/<servername>.
But the is no doc and example to explain this in the liberty arquillian project.
Create a liberty-managed specific folder under /src/test/, named arq-liberty-managed, move server.xml, arquillian.xml(add a copy of it) into it.
In my arq-liberty-managed profile, add test-resource config.
<build>
<testResources>
<testResource>
<directory>src/test/arq-liberty-managed</directory>
<includes>
<include>*</include>
</includes>
<excludes>
<exclude>server.xml</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/arq-liberty-managed</directory>
<includes>
<include>server.xml</include>
</includes>
<targetPath>
${project.build.directory}/wlp/usr/servers/defaultServer
</targetPath>
</testResource>
</testResources>
...