A DeployableContainer implementation that can connect to and run tests in a JBoss EAP 5.1 instance running locally or on a separate machine (effectively a different JVM). This implementation has no lifecycle support, so it can not be started or stopped.
Container adapter selection
Arquillian has adapters for the JBoss Application Server 5.1 (the community project), but does not have distinct adapters for the JBoss Enterprise Application Platform 5.1, the product based on the community project.
However, Arquillian can be configured to run tests on JBoss EAP 5.1 using a mix of JBoss AS 5.1 and JBoss AS 6.0 dependencies and by updating the JBoss EAP 5 profile service to disable authentication.
Supported injections
Container Injection Support Matrix
@EJB
|
@EJB (no-interface)
|
@Inject (CDI)
|
@Inject (MC)
|
@PersistenceContext @PersistenceUnit
|
|
|
|
|
|
Profile service modification
If authentication is enabled in the JBoss EAP 5 profile service, Arquillian will be unable to deploy the archive. If that's the case, we'll need to disable it. (See the last section of this chapter to learn how to setup Arquillian to authenticate properly).
To disable authentication, edit the file deploy/profileservice-jboss-beans.xml and comment out the following beans nested within the ProfileServiceProxyFactory bean as shown:
<!-- comment this list to disable auth checks for the profileservice -->
<!--
<bean>
<constructor>
<parameter>
<value-factory bean="JNDIBasedSecurityManagement"
method="getAuthenticationManager" parameter="jmx-console"/>
</parameter>
</constructor>
</bean>
<bean>
<constructor>
<parameter>
<value-factory bean="JNDIBasedSecurityManagement"
method="getAuthenticationManager" parameter="jmx-console"/>
</parameter>
<parameter>
<value-factory bean="JNDIBasedSecurityManagement"
method="getAuthenticationManager" parameter="jmx-console"/>
</parameter>
</constructor>
</bean>
-->
Arquillian dependencies
Add the necessary Arquillian dependencies for executing the tests inside/against a JBoss EAP 5.1 server that has been started and is available via localhost. We'll use a Maven profile named arquillian-jboss-eap-5.1-remote.
Note that Arquillian with JBoss EAP 5.1 requires the JBoss AS 5.1 client, but the JBoss AS 6.0 profile service client.
<profiles>
<profile>
<id>arquillian-jboss-eap-5.1-remote</id>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-jbossas-remote-5.1</artifactId>
<version>1.0.0.CR3</version>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>5.1.0.GA</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-profileservice-client</artifactId>
<version>6.0.0.Final</version>
<type>pom</type>
</dependency>
</dependencies>
</profile>
</profiles>
The parent of the jboss-as-client dependency (jboss-as-parent) includes repository configuration for the old JBoss Maven repository (http://repository.jboss.org/maven2). Therefore, a mirror has to be configured in the Maven settings.xml file so that this repository is replaced with the new JBoss Nexus (Deprecated) repository (https://repository.jboss.org/nexus).
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-4.0.0.xsd">
<mirrors>
<mirror>
<mirrorOfLayouts/>
<id>jboss-deprecated</id>
<name>JBoss Deprecated Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
<mirrorOf>repository.jboss.org</mirrorOf>
</mirror>
</mirrors>
</settings>
Secure server support
If you aren't able to disable the authentication on the profile service, you can instead configure Arquillian to authenticate properly.
If you haven't done so already, create an Arquillian configuration file, arquillian.xml, on the classpath (e.g., src/test/resources). Add the following container configuration for the JBoss EAP 5.1 adapter:
<?xml version="1.0" encoding="UTF-8"?>
<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="jboss-eap-5.1" default="true">
<configuration>
<property name="contextFactory">org.jboss.security.jndi.LoginInitialContextFactory</property>
</configuration>
</container>
</arquillian>
Next, create an authentication configuration file, auth.conf, on the classpath (e.g., src/test/resources).
jmx-console {
org.jboss.security.ClientLoginModule required;
};
Next, create a JNDI properties file, jndi.properties, on the classpath (e.g., src/test/resources) to set the authentication credentials and activate the configuration:
java.naming.security.principal=admin
java.naming.security.credentials=admin
java.naming.security.protocol=jmx-console
Finally, add a build element to the Maven profile defined above to set a system variable that activates the authentication configuration when the tests are run.
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<java.security.auth.login.config>src/test/resources/auth.conf</java.security.auth.login.config>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
In summary, we added the contextFactory configuration property in arquillian.xml, an auth.conf file, a jndi.properties file and passed -Djava.security.auth.login.config= to the Maven Surefire plugin.
You can run the test in Eclipse using the the "Maven test" option provided by the Maven Integration for Eclipse plugin. The test will work just as it does from the commandline.
To run the test using the internal JUnit runner in Eclipse, you need to set java.security.auth.login.config needs in the Run Configuration for each test.