JBoss Community Archive (Read Only)

Arquillian

JBoss AS 7.1, JBoss EAP 6.0 - Remote

An Arquillian container adapter (DeployableContainer implementation) that can connect to and run tests on a JBoss AS 7.1 or JBoss EAP 6.0 instance running locally or on a separate machine (effectively a different JVM). This container adapter has no lifecycle support, so it can not start and stop the server. It relies on a server that is already running.

Container Injection Support Matrix

@EJB

@EJB (no-interface)

@Inject (CDI)

@Resource

@PersistenceContext / @PersistenceUnit

images/author/download/attachments/26706027/fact_good.png

images/author/download/attachments/26706027/fact_good.png

images/author/download/attachments/26706027/fact_good.png

images/author/download/attachments/26706027/fact_good.png

images/author/download/attachments/26706027/fact_good.png

The JBoss AS 7.1 container adapter also supports OSGi Bundle / Context injection in OSGi modules and Module Contexts/ServiceController when developing Modules (only when using the jmx-as7 protocol).

Configuration

Default Protocol: jmx-as7

Container Configuration Options

Name

Type

Default

Description

managementAddress

String

127.0.0.1

The ip address of the running server instances management interface

managementPort

int

9999

The management port for deployment

username

String

null

The username for the ManagementRealm (not required when server is running on localhost)

password

String

null

The password for the ManagementRealm (not required when server is running on localhost)

Example Maven profile:

<profile>
    <id>jbossas-remote-7</id>
    <dependencies>
        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-6.0</artifactId>
            <version>1.0.0.Final</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.as</groupId>
            <artifactId>jboss-as-arquillian-container-remote</artifactId>
            <version>7.1.1.Final</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</profile>

By default, the JBoss AS 7 container adapters execute tests over JMX. If the test relies on CDI scopes to be active, they will not work on this protocol. You can configure Arquillian to run tests using the Servlet protocol instead, which is the default for most other Arquillian Java EE adapters.

First, you need to add the Servlet protocol dependency to the Maven profile. The version of the Servlet protocol dependency is managed by the Arquillian BOM, which you should have configured in the dependency management section.

<profile>
    <id>jbossas-remote-7</id>
    <dependencies>
        ...
        <dependency>
            <groupId>org.jboss.arquillian.protocol</groupId>
            <artifactId>arquillian-protocol-servlet</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</profile>

Next, you need to set the default protocol in the arquillian.xml descriptor:

<arquillian xmlns="http://jboss.org/schema/arquillian"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

    <defaultProtocol type="Servlet 3.0"/>

</arquillian>

At the moment, this setting changes the default protocol for all container adapters. There's an open issue for making the default protocol configurable per container adapter (see ARQ-579).

MacOS with Java 7

If you are on Mac OS with Java 7 you might get the following error while running tests:

JBAS012144: Could not connect to remote://127.0.0.1:9999

This is an issue in Java 7, and you can work around this by adding a VM paramter.

-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.KQueueSelectorProvider
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 09:40:56 UTC, last content change 2012-09-24 10:40:34 UTC.