adam bien's blog

Arquillian Configuration For Embedded GlassFish 3.1.2 and Maven 3 📎

Maven 3 dependencies for Arquillian integration tests with GlassFish 3.1.2 require the declaration of a few dependencies:

<project>
    <modelVersion></modelVersion>
    <groupId></groupId>
    <artifactId></artifactId>
    <version></version>
    <packaging>war</packaging>
    <name>alienfish</name>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.0.0.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.glassfish.main.extras</groupId>
            <artifactId>glassfish-embedded-all</artifactId>
            <version>3.1.2</version>
            <scope>provided</scope>
        </dependency>        
        <dependency>
            <groupId>org.jboss.arquillian.container</groupId>
            <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
            <version>1.0.0.CR3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency> 
                   
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

The missing Maven 3 parts can be easily created from CLI.
Enjoy integration testing with the Alien and the Fish :-).

[x-ray's configuration and logging subsystems were tested with Arquillian. You will also find the integration tests in the git repo (project x-ray-services, class eg. ConfigurationIT), See also page 115 "Injection and Infrastructure Testing with Aliens" in Real World Java EE Night Hacks--Dissecting the Business Tier.]