4 Replies Latest reply: Apr 27, 2012 2:35 AM by Dan Allen RSS

Rewrite and Arquillian - Multiple containers?

Lincoln Baxter III Master

We need to start running our tests on multiple containers before a release. Any advise? Here is how our test harness is currently set up.

 

https://github.com/ocpsoft/rewrite/tree/master/test-harness

 

Advise?

  • 1. Re: Rewrite and Arquillian - Multiple containers?
    Lincoln Baxter III Master

    Dan Allen says:

     

    The simplest possible solution is just to have a Jenkins job for each container. Time is a commodity in CI, so there's no real benefit to having a complex build just to optimize execution time. Besides, the results make a heck of a lot more sense when you deal with one container at a time.

    ...the complex approach is to use Aslak's surefire patch that allows you to reexecute the test goal for each profile. I don't think we're at the point yet where we are advocating for other projects to take that approach as we are still feeling it out. Aslak, you can correct me if I'm wrong, of course

  • 2. Re: Rewrite and Arquillian - Multiple containers?
    Lincoln Baxter III Master

    Well, the problem with multiple Jenkins jobs, is yes, while you can activate a different profile in each build, how do you handle the configuration of each container? Right now we set up several files (including web.xml and some container specific configuration to boot weld on Jetty,) and that needs to be updated for each profile run. I guess that's the main pain point right now. What is the best solution for this?

  • 3. Re: Rewrite and Arquillian - Multiple containers?
    Karel Piwko Master

    Following approach works successfully for QE:

     

     

    <?xml version="1.0" encoding="UTF-8"?>
    <project 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/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>org.jboss.wfk.examples</groupId>
        <artifactId>abc</artifactId>
        <packaging>war</packaging>
        <name>abc</name>
    
    
        <build>
            <finalName>abc-xyz</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <attachClasses>true</attachClasses>
                        <webResources>
                            <resource>
                                <directory>src/main/webapp</directory>
                                <filtering>true</filtering>
                            </resource>
                            <resource>
                                <directory>src/main/webapp-${target.environment}</directory>
                                <filtering>true</filtering>
                            </resource>
                        </webResources>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
        ... 
    
        <profiles>
            <profile>
                <id>eap6</id>
    
    
                <activation>
                    <property>
                        <name>CONTAINER</name>
                        <value>eap6</value>
                    </property>
                </activation>
                <properties>
                    <eap.dependency.scope>provided</eap.dependency.scope>
                    <target.environment>jboss</target.environment>
                </properties>
            </profile>
    
    
            <profile>
                <id>ews1-t5</id>
                <activation>
                    <property>
                        <name>CONTAINER</name>
                        <value>ews1-t5</value>
                    </property>
                </activation>
    
    
                <properties>
                    <eap.dependency.scope>compile</eap.dependency.scope>
                    <target.environment>tomcat</target.environment>
                </properties>
    
            </profile>
    
    
            <profile>
                <id>ews1-t6</id>
                <activation>
                    <property>
                        <name>CONTAINER</name>
                        <value>ews1-t6</value>
                    </property>
                </activation>
    
    
                <properties>
                    <eap.dependency.scope>compile</eap.dependency.scope>
                    <target.environment>tomcat</target.environment>
                </properties>
            </profile>
        </profiles>
    </project>
    
    

     

    CONTAINER is simply an user defined axis in Jenkins CI.

  • 4. Re: Rewrite and Arquillian - Multiple containers?
    Dan Allen Master

    Oh yeah, I totally missed part of your question when I originally answered it. The trick that Karel is suggesting is used and explained in the Testing Java Persistence guide. Basically, you just need to do some classpath resource swapping with profiles, just as you do with dependencies. Fortunately, the JBoss Tools Maven Profile selector makes this not so bad in development.