Migration to Arquillian 1.0.0.Alpha5

Version 5

    This page documents the changes between Arquillian 1.0.0.Alpha4 and 1.0.0.Alpha5.

     

     

    ShrinkWrap API changes

     

    Arquillian 1.0.0.Alpha5 uses ShrinkWrap 1.0.0-alpha-12, which introduced changes in the builder methods on the archive types.

     

    All of the add* methods on the ShrinkWrap archive types, except for the methods on Archive and ClassContainer, have been changed to addAs*. The exceptions are as follows:

     

    • add (from Archive)
    • addDirectory / addDirectories (from Archive)
    • addClass / addClasses (from ClassContainer)
    • addPackage / addPackages (from ClassContainer)

     

    There have also been some method remappings in the WebArchive. Specifically:

     

    • addWebResource has been changed to addWebInfResource, which maps to /WEB-INF
    • addAsWebResource maps to / instead of /WEB-INF
    • addAsManifestResource maps to /META-INF instead of /WEB-INF/classes/META-INF (see SHRINKWRAP-266 for discussion)
    • addAsServiceProvider maps to /META-INF/services instead of /WEB-INF/classes/META-INF/services (see SHRINKWRAP-266 for discussion)

     

    Container configuration

     

    Container configuration changed quite drastically in Alpha5 to accomodate a requirement that was overlooked. Previously, configuration was done by container adapter. However, that ignores the possibility of using different instances of the same container, such as dev, qa and staging.

     

    Both the schema and the means for activating a configuration changed. Each entry is given a qualifier, which is used to select the configuration. There can be one configuration which is selected by default when no explicit qualifier is provided.

     

    Here's an example of how you might configure a remote GlassFish container adapter (using arquillian.xml):

     

    <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">
    
        <container qualifier="dev" default="true">
            <configuration>
                <property name="remoteServerAdminPort">4848</property>
                <property name="remoteServerHttpPort">8080</property>
            </configuration>
        </container>
    
    </arquillian>
    

     

    You don't need to do anything to enable this configuration, because it's set as the default.

     

    If you have additional instances, you configure them using additional container nodes.

     

    <container qualifier="qa" default="true">
        <configuration>
            <property name="remoteServerAdminPort">5848</property>
            <property name="remoteServerHttpPort">9080</property>
        </configuration>
    </container>
    
    <container qualifier="staging">
        <configuration>
            <property name="remoteServerAdminPort">6848</property>
            <property name="remoteServerHttpPort">10080</property>
        </configuration>
    </container>
    

     

    To activate the configuration for either qa or staging, you create an arquillian.launch file in the same directory as arquillian.xml and populate it with the name of the qualifier.

     

    qa
    

     

    You will still use Maven profiles (or the classpath selection for the build tool of your choice) to activate different container adapters. You need to update the arquillian.launch to match the configuration of the container you are using.

     

    More to come...