JBoss Community Archive (Read Only)

Arquillian

JBoss AS 7.1, JBoss EAP 6.0 - Managed

An Arquillian container adapter (DeployableContainer implementation) that can start and stop a local JBoss AS 7.1 or JBoss EAP 6.0 process and run tests on it over a remote protocol (effectively in a different JVM).

Container Injection Support Matrix

@EJB

@EJB (no-interface)

@Inject (CDI)

@Resource

@PersistenceContext / @PersistenceUnit

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

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

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

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

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

The JBoss AS 7 container adapters also support 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

jbossHome

String

$JBOSS_HOME

The JBoss configuration to start.

javaHome

String

$JAVA_HOME

The Java runtime to use to start the server.

modulePath

String

$module.path

The location of the module repository.

javaVmArguments

String

-Xmx512m -XX:MaxPermSize=128m

JVM arguments used to start the server.

startupTimeoutInSeconds

int

30

Time to wait before throwing Exception on server startup.

outputToConsole

boolean

true

Should the server startup console log be piped to the console

serverConfig

String

standalone.xml

Which server configuration file to startup with

managementAddress

String

127.0.0.1

The ip address of the running server instances manage interface

managementPort

int

9999

The management port for deployment

allowConnectingToRunningServer

boolean

false

If true, if a running AS is found on managementPort, it is used; if false, fails.

username

String

null

The username for the ManagementRealm (not required by default)

password

String

null

The password for the ManagementRealm (not required by default)

Example Maven profile:

<profile>
    <id>jbossas-managed-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-managed</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:54 UTC, last content change 2012-09-24 10:40:58 UTC.