6 Replies Latest reply on Mar 6, 2012 10:24 AM by aslak

    Arquillian - Maven

    apodgorsek

      Hello.

       

      I have the following concept in mind...

       

      On dev machine I would like to deploy-test w arquillian-maven plugin on local managed/remote server. But on our CI server I want to make tests on remote test server, which is ofcourse phisically different virt machine than hudson or my dev machine, so i have to use arquillian-jboss-remote.

       

      I would like to know how to configure/create profiles in arquillian.xml or/and pom.xml to have different target servers on which I want to make arquillian tests in same SVN controlled project.

       

      Any guidelines?

        • 1. Re: Arquillian - Maven
          aslak

          Take a look at the Arquillian Showcase.. It has many examples of multiple profiles: https://github.com/arquillian/arquillian-showcase/blob/master/jaxrs/pom.xml#L65

           

          And the jaxrs example shows how to use multiple arquillian container configurations as well: https://github.com/arquillian/arquillian-showcase/blob/master/jaxrs/src/test/resources/arquillian.xml

          This example does not show how to choose the configuration via maven, but it uses the arquillian.launch file (easier to edit via IDE then hacking around with system properties) https://github.com/arquillian/arquillian-showcase/blob/master/jaxrs/src/test/resources/arquillian.launch

           

          The concept is the same tho..

           

          To specify which container configuration to use, you add the system property arquillian.launch=[qualifier-name] to the surefire configuration in the maven profile.

           

          pesudo arq.xml

           

            container qualifier="managed-config" default="true"

            container qualifier="remote-config"

           

          pesudo pom.xml

           

            profile dev-profile activated by default (not needed since "managed-config" is default, but equal to surefire arquillian.launch="managed-config" )

               depends on arquillian managed conainer adapter

           

            profile build-server-profile surefire arquillian.launch="remote-config"

               depends on arquillian remote container adapter

          1 of 1 people found this helpful
          • 2. Re: Arquillian - Maven
            apodgorsek

            So if I understand correctly (I confes I am a bit green in Arq and Mvn world), I set multiple profiles in my project POM, which also include arquillian.launch=[qualifier-name] which is defined in arquillian.xml, and then set different activeprofiles on dev machines and on CI server's maven general settings.xml . Am I kicking in the dark or am I on the right path? Thanks

            • 3. Re: Arquillian - Maven
              aslak

              sounds correct..

               

              So on your dev machine that runs the managed profile you only have to do: mvn clean install

              On your build server, you set it to run: mvn clean install -Pbuild-server-profile

               

               

              And yes, include the arquillian.launch=qualifier-name in the surefire configuration of your maven profile

              http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#systemPropertyVariables

              • 4. Re: Arquillian - Maven
                apodgorsek

                Hmm I have to be doin something wrong...check my pom

                 

                <profile>

                 

                         <id>ciserver</id>

                     

                         <build>

                            <plugins>

                               <plugin>

                                  <artifactId>maven-surefire-plugin</artifactId>

                                  <version>2.4.3</version>

                                  <configuration>

                                      <skipTests>false</skipTests>

                                    <testFailureIgnore>true</testFailureIgnore>

                                   <systemProperties>arquillian.launch=jboss71test</systemProperties>

                                  </configuration>

                               </plugin>

                            </plugins>

                         </build>

                       </profile>

                 

                arquillian.xml

                ...

                <container qualifier="jboss71local" default="true">

                              <configuration>

                                <property name="managementAddress">localhost</property>

                                <property name="managementPort">9999</property>

                              </configuration>

                              </container>

                             

                              <container qualifier="jboss71test">

                                        <configuration>

                                          <property name="managementAddress">x.y.z</property>

                                          <property name="managementPort">9999</property>

                                          <property name="username">user</property>

                                          <property name="password">pwd</property>

                                        </configuration>

                                     </container>

                ...

                 

                running on Hudson with

                 

                clean install -Pciserver

                 

                gets error

                 

                Caused by: java.lang.RuntimeException: java.net.ConnectException: JBAS012174: Could not connect to remote://localhost:9999. The connection failed

                at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeAsync(AbstractModelControllerClient.java:113)

                at org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager.executeOperation(ModelControllerClientServerDeploymentManager.java:47)

                at org.jboss.as.controller.client.helpers.standalone.impl.AbstractServerDeploymentManager.execute(AbstractServerDeploymentManager.java:79)

                 

                which obviously take jboss71local qualifier instead of jboss71test

                • 5. Re: Arquillian - Maven
                  apodgorsek

                  Stupid me

                   

                  <systemProperties>

                                               <arquillian.launch>jboss71local</arquillian.launch>

                                     </systemProperties>

                   

                  this is the way...

                   

                  but i found out that I get

                   

                  [WARNING] The requested profile "ciserver" could not be activated because it does not exist.

                   

                  even though i have it defined as a profile in my project pom.xml

                   

                  <profile>

                           <id>ciserver</id>

                           <build>

                              <plugins>

                                 <plugin>

                                    <artifactId>maven-surefire-plugin</artifactId>

                                    <version>2.4.3</version>

                                    <configuration>

                                        <skipTests>false</skipTests>

                                      <testFailureIgnore>true</testFailureIgnore>

                                     <systemProperties>

                                                         <arquillian.launch>jboss71test</arquillian.launch>

                                     </systemProperties>

                                    </configuration>

                                 </plugin>

                              </plugins>

                           </build>

                         </profile>

                  • 6. Re: Arquillian - Maven
                    aslak

                    what does your complete pom.xml look like?