10 Replies Latest reply on Sep 28, 2011 12:16 PM by john.genoese

    TestNG vis JBoss AS7

    john.genoese

      I am new to JBoss AS7 and new to Arquillian. I am contemplating a migration from Seam 2.2.1/ICEfaces 1.8.2/JBoss 5.1.0 to Weld/Seam3/ICEfaces 2/JBoss AS7. I am trying to build a base platform as a starter and am having a bit of difficulty getting TestNG to work with JBoss AS7. I am getting this message:

      ...

      Caused by: java.lang.IllegalStateException: No implementation found for org.jboss.arquillian.spi.client.container.DeployableContainer, please check your classpath

                at org.jboss.arquillian.impl.DynamicServiceLoader.verifyOnlyOneOrSameImplementation(DynamicServiceLoader.java:134)

                at org.jboss.arquillian.impl.DynamicServiceLoader.onlyOne(DynamicServiceLoader.java:92)

                at org.jboss.arquillian.impl.domain.ContainerRegistry.create(ContainerRegistry.java:69)

       

      I'd like to be able to somehow use all the SeamTest-derivative tests in the current Seam 2 project, and so I'm very interested in getting TestNG to work properly. Seam Forge / Arquillian didn't offer me a TestNG option so that door is closed to me for now.

       

      Can anyone offer counsel or share a similar migration experience?

       

      Thanks.

       

      pom.xml:

       

      {code:xml}

      <?xml version="1.0" encoding="UTF-8"?>

      <project

        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"

        xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <modelVersion>4.0.0</modelVersion>

                <groupId>org.memoriesdreamsandreflections.learn_seam_testng</groupId>

        <artifactId>learn_seam_testng</artifactId>

                <version>1.0.0-SNAPSHOT</version>

        <dependencies>

        <dependency>

                                    <groupId>javax.enterprise</groupId>

        <artifactId>cdi-api</artifactId>

        <version>1.0-SP4</version>

                                    <scope>provided</scope>

        </dependency>

        <!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId>

                                    <version>4.9</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.junit</groupId>

                                    <artifactId>arquillian-junit-container</artifactId> <version>1.0.0.Final-SNAPSHOT</version>

                                    <scope>test</scope> </dependency> -->

        <dependency>

        <groupId>org.testng</groupId>

        <artifactId>testng</artifactId>

        <version>6.1.1</version>

        <scope>test</scope>

        </dependency>

        <dependency>

                                    <groupId>org.jboss.arquillian</groupId>

                                    <artifactId>arquillian-testng</artifactId>

                                    <version>1.0.0.Alpha5</version>

        <scope>test</scope>

        </dependency>

        </dependencies>

        <repositories>

        <repository>

                                    <id>JBOSS_NEXUS</id>

                                    <url>http://repository.jboss.org/nexus/content/groups/public</url>

        </repository>

        </repositories>

        <build>

        <finalName>learn_seam</finalName>

        <plugins>

        <plugin>

                                              <artifactId>maven-compiler-plugin</artifactId>

        <version>2.3.2</version>

        <configuration>

        <source>1.6</source>

        <target>1.6</target>

        </configuration>

        </plugin>

        </plugins>

        </build>

        <profiles>

        <profile>

                                    <id>arq-jbossas-7-managed</id>

        <dependencies>

        <dependency>

                                                        <groupId>org.jboss.as</groupId>

                                                        <artifactId>jboss-as-arquillian-container-managed</artifactId>

                                                        <version>7.1.0.Alpha1-SNAPSHOT</version>

        <scope>test</scope>

        </dependency>

        </dependencies>

        </profile>

        </profiles>

      </project>

      {code}

       

       

       

        • 1. Re: TestNG vis JBoss AS7
          john.genoese

          Pardon the poor formatting. I had tabs in the pom.

           

          Additional info:

           

          I acknowledge that the error message is legitimate, as there is indeed no class on the classpath that implments the DeployableContainer interface. My question is: Where would I find one for TestNG/AS7?

           

          Thanks again.

          • 2. Re: TestNG vis JBoss AS7
            aslak

            First try to upgrade your Arquillian core v. to 1.0.0.CR5, also following this Maven setup helps with how Maven can override/upgrade the versions from the Container: https://gist.github.com/1154075 (see how at line 30:34)

             

            (this is probalby the issue since the DeployableContainer interface has moved from Alpha5 to Beta1+)

             

            If this still does not work, are you activating the Maven profiles when you run your tests?

             

            e.g: mvn test -Parq-jbossas-7-managed  ?

            1 of 1 people found this helpful
            • 3. Re: TestNG vis JBoss AS7
              aslak

              forgot to add link to the migration guide from Alpha5 -> http://community.jboss.org/wiki/MigrationToArquillian100CR1

              1 of 1 people found this helpful
              • 4. Re: TestNG vis JBoss AS7
                john.genoese

                Thanks so much for your reply. I'm having trouble obtainig org.jboss.as:

                jboss-as-arquillian-container-embedded, mentioned in the "Artifact name changes" section of the link you mentioned. The Embedded approach would be the very best for me, so if I could do that, it would be wonderful.

                • 5. Re: TestNG vis JBoss AS7
                  aslak

                  Sorry, that's wrong. There is no JBoss AS 7 Embedded released at this time.

                  • 6. Re: TestNG vis JBoss AS7
                    aslak
                    • 7. Re: TestNG vis JBoss AS7
                      john.genoese

                      Sweet!

                       

                       

                      Works beautifuly! Here's the working POM for my project.

                       

                      {code:xml}

                      <?xml version="1.0" encoding="UTF-8"?>

                      <project

                        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"

                        xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                        <modelVersion>4.0.0</modelVersion>

                                <groupId>org.memoriesdreamsandreflections.learn_seam_testng</groupId>

                        <artifactId>learn_seam_testng</artifactId>

                                <version>1.0.0-SNAPSHOT</version>

                        <properties>

                        <version.jbossas>7.0.1.Final</version.jbossas>

                        <version.arquillian_core>1.0.0.CR5</version.arquillian_core>

                        <version.ee6spec>1.0.1.Final</version.ee6spec>

                        <version.testng>6.1.1</version.testng>

                        </properties>

                       

                        <dependencyManagement>

                        <dependencies>

                        <dependency>

                                                              <groupId>org.jboss.arquillian</groupId>

                        <artifactId>arquillian-bom</artifactId>

                                                              <version>${version.arquillian_core}</version>

                                                              <scope>import</scope>

                        <type>pom</type>

                        </dependency>

                        <dependency>

                                                              <groupId>org.jboss.as</groupId>

                                                              <artifactId>jboss-as-arquillian-container-managed</artifactId>

                                                              <version>${version.jbossas}</version>

                        </dependency>

                        <dependency>

                                                              <groupId>org.jboss.spec</groupId>

                                                              <artifactId>jboss-javaee6-specs-bom</artifactId>

                                                              <version>${version.ee6spec}</version>

                        <type>pom</type>

                        </dependency>

                        <dependency>

                        <groupId>org.testng</groupId>

                        <artifactId>testng</artifactId>

                                                    <version>${version.testng}</version>

                        <scope>test</scope>

                        </dependency>

                        </dependencies>

                        </dependencyManagement>

                       

                        <dependencies>

                        <dependency>

                                                    <groupId>javax.enterprise</groupId>

                        <artifactId>cdi-api</artifactId>

                        <version>1.0-SP4</version>

                                                    <scope>provided</scope>

                        </dependency>

                        <!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId>

                                                    <version>4.9</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.junit</groupId>

                                                    <artifactId>arquillian-junit-container</artifactId> <version>1.0.0.Final-SNAPSHOT</version>

                                                    <scope>test</scope> </dependency> -->

                        <dependency>

                        <groupId>org.testng</groupId>

                        <artifactId>testng</artifactId>

                        <scope>test</scope>

                        </dependency>

                        <dependency>

                                                    <groupId>org.jboss.arquillian.testng</groupId>

                                                    <artifactId>arquillian-testng-container</artifactId>

                        <scope>test</scope>

                        </dependency>

                        <dependency>

                                                    <groupId>org.jboss.shrinkwrap</groupId>

                                                    <artifactId>shrinkwrap-impl-base</artifactId>

                        <scope>test</scope>

                        </dependency>

                        <dependency>

                                                    <groupId>org.jboss.as</groupId>

                                                    <artifactId>jboss-as-arquillian-container-managed</artifactId>

                        </dependency>

                       

                        </dependencies>

                       

                        <profiles>

                        <profile>

                                                    <id>arq-jbossas-managed-7</id>

                        <activation>

                        <activeByDefault>true</activeByDefault>

                        </activation>

                        <dependencies>

                        <dependency>

                                                                        <groupId>org.jboss.as</groupId>

                                                                        <artifactId>jboss-as-arquillian-container-managed</artifactId>

                        </dependency>

                        <dependency>

                                                                        <groupId>org.jboss.spec</groupId>

                                                                        <artifactId>jboss-javaee6-specs-bom</artifactId>

                                                                        <type>pom</type>

                        </dependency>

                        </dependencies>

                        <build>

                        <testResources>

                        <testResource>

                                                                                  <directory>src/test/resources</directory>

                        </testResource>

                        <testResource>

                                                                                  <directory>src/test/resources-jbossas-7</directory>

                        </testResource>

                        </testResources>

                        <plugins>

                        <plugin>

                                                                                  <groupId>org.apache.maven.plugins</groupId>

                                                                                  <artifactId>maven-dependency-plugin</artifactId>

                        <executions>

                        <execution>

                                                                                                      <id>unpack</id>

                                                                                                      <phase>process-test-classes</phase>

                                                                                                      <goals>

                                                                                                                <goal>unpack</goal>

                                                                                                      </goals>

                        <configuration>

                        <artifactItems>

                        <artifactItem>

                                                                                                                                    <groupId>org.jboss.as</groupId>

                                                                                                                                    <artifactId>jboss-as-dist</artifactId>

                                                                                                                                    <version>7.0.1.Final</version>

                                                                                                                                    <type>zip</type>

                        <overWrite>false</overWrite>

                                                                                                                                    <outputDirectory>${project.build.directory}</outputDirectory>

                        </artifactItem>

                        </artifactItems>

                        </configuration>

                        </execution>

                        </executions>

                        </plugin>

                        </plugins>

                        </build>

                        </profile>

                       

                        <profile>

                                                    <id>arq-jbossas-remote-7</id>

                        <dependencies>

                        <dependency>

                                                                        <groupId>org.jboss.as</groupId>

                                                                        <artifactId>jboss-as-arquillian-container-remote</artifactId>

                        </dependency>

                        <dependency>

                                                                        <groupId>org.jboss.spec</groupId>

                                                                        <artifactId>jboss-javaee6-specs-bom</artifactId>

                                                                        <type>pom</type>

                        </dependency>

                        </dependencies>

                        <build>

                        <testResources>

                        <testResource>

                                                                                  <directory>src/test/resources</directory>

                        </testResource>

                        <testResource>

                                                                                  <directory>src/test/resources-jbossas-7</directory>

                        </testResource>

                        </testResources>

                        </build>

                        </profile>

                        </profiles>

                        <repositories>

                        <repository>

                                                    <id>JBOSS_NEXUS</id>

                                                    <url>http://repository.jboss.org/nexus/content/groups/public</url>

                        </repository>

                        </repositories>

                        <build>

                                          <finalName>learn_seam_testng</finalName>

                        <plugins>

                        <plugin>

                                                              <artifactId>maven-compiler-plugin</artifactId>

                        <version>2.3.2</version>

                        <configuration>

                        <source>1.6</source>

                        <target>1.6</target>

                        </configuration>

                        </plugin>

                        </plugins>

                        </build>

                      </project>

                      {code}

                      • 8. Re: TestNG vis JBoss AS7
                        john.genoese

                        Aslak, thank you for all your help. All throughout my research into the new stack, your posts have been consistently helpful and of high quality. You are truly an asset to this community.

                        • 9. Re: TestNG vis JBoss AS7
                          john.genoese

                          How would I go about defing my datasource in a situation where the Managed Container is auto-extracted? The solution described above works very well, but moving on to the next step requires me to define a test datasource in the Managed Container. How do I do that? My perusal of the documentation tells me that although I can easily deploy a JDBC 4 Driver at runtime merely by copying the jar to standalone/deployments, the old -ds.xml method of datasource definition is gone.