0 Replies Latest reply on Oct 9, 2012 12:03 PM by Vineela Gampa

    Trying to get simple arquillian test to work against jboss 7

    Vineela Gampa Novice

      Hi

       

      Iam trying to get simple arquillian test to work with Guice injection,.I have attached surefire report , arquillian.xml. Pasted below aer contents of test and pom.xml.

       

      import java.io.File;

      import java.net.URL;

       

       

      import org.jboss.arquillian.container.test.api.Deployment;

      import org.jboss.arquillian.guice.annotations.GuiceConfiguration;

      import org.jboss.arquillian.junit.Arquillian;

      import org.jboss.shrinkwrap.api.ShrinkWrap;

      import org.jboss.shrinkwrap.api.spec.WebArchive;

      import org.junit.Test;

      import org.junit.runner.RunWith;

       

       

      import com.ca.chorus.server.pds.ChorusPDSModule;

      import com.ca.chorus.server.pds.impl.PDSMemberAdaptor;

      import com.google.inject.Inject;

      @RunWith(Arquillian.class)

      @GuiceConfiguration(ChorusPDSModule.class)

      public class SampleDBTest {

       

        @Inject

         private PDSMemberAdaptor cachedsetter;

       

       

       

        @Deployment

                public static WebArchive createTestArchive() {

       

                  String pathwebxml = "web.xml";

                  String path = "META-INF/jboss-deployment-structure.xml";

            URL resourceURL = SampleTest.class.getResource("/" + path);

                  WebArchive webArchive =  ShrinkWrap.create(WebArchive.class,"Chorus-test.war").addAsWebInfResource(new File(resourceURL.getFile()))

                            .setWebXML(pathwebxml);

                  return webArchive;

        }

       

          @Test

          public void sample() {

                    System.out.println("#################### Here:" + cachedsetter.toString());

          }

       

      pom.xml contents. I cant attach the file as it has many other dependencies, hence copying arquillian related configuration.

      properties

       

      <version.shrinkwrap_shrinkwrap>1.0.0-cr-1</version.shrinkwrap_shrinkwrap>

              <version.shrinkwrap_resolver>1.0.0-beta-5</version.shrinkwrap_resolver>

              <version.shrinkwrap_descriptors>1.1.0-beta-1</version.shrinkwrap_descriptors>

       

       

              <!-- Arquillian Core common Deps, Test related -->

              <version.javax.inject_javax.inject>1</version.javax.inject_javax.inject>

              <version.jboss_logging>2.1.0.GA</version.jboss_logging>

              <version.jetty_jetty>6.1.9</version.jetty_jetty>

              <version.junit_junit>4.8.1</version.junit_junit>

              <version.mockito_all>1.8.3</version.mockito_all>

              <version.testng_testng>5.14.6</version.testng_testng>

       

       

              <!-- Google Guice dependencies -->

              <version.google_guice>3.0</version.google_guice>

       

      <dependencies>

        <dependency>

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

                            <artifactId>jboss-javaee-6.0</artifactId>

                            <version>1.0.0.Final</version>

                            <type>pom</type>

                            <scope>provided</scope>

                        </dependency>

                         <dependency>

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

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

                            <version>7.1.1.Final</version>

                            <scope>test</scope>

                        </dependency>

                          <dependency>

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

                              <artifactId>arquillian-junit-container</artifactId>

                               <!--  <version>1.0.0.Final</version> -->

                              <scope>test</scope>

                          </dependency>

                           <dependency>

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

                  <artifactId>arquillian-container-spi</artifactId>

                  <version>1.0.0.Final</version>

                  <scope>test</scope>

              </dependency>

                          <dependency>

                  <groupId>com.google.inject</groupId>

                  <artifactId>guice</artifactId>

                  <version>3.0</version>

              </dependency>

                           <dependency>

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

                        <artifactId>arquillian-guice</artifactId>

                                    <version>1.0.2.Final</version>

                        <scope>test</scope>

              </dependency>

             <!--  <dependency>

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

                  <artifactId>shrinkwrap-resolver-depchain</artifactId>

                  <version>2.0.0-alpha-1</version>

                  <type>pom</type>

                  <scope>test</scope>

              </dependency>

               <dependency>

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

                      <artifactId>shrinkwrap-resolver-api-maven</artifactId>

                      <version>2.0.0-alpha-1</version>

                  </dependency>

       

       

                 <dependency>

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

          <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

          <version>2.0.0-alpha-1</version>

          <scope>test</scope>

      </dependency>

               -->

              <dependency>

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

          <artifactId>arquillian-protocol-servlet</artifactId>

          <scope>test</scope>

      </dependency>

       

       

      <!-- org.jboss.arquillian -->

              <dependency>

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

                  <artifactId>arquillian-test-spi</artifactId>

                  <version>1.0.0.Final</version>

              </dependency>

              <dependency>

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

                  <artifactId>arquillian-container-test-spi</artifactId>

                  <version>1.0.0.Final</version>

              </dependency>

       

       

              <dependency>

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

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

                  <scope>test</scope>

              </dependency>

       

       

              <dependency>

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

                  <artifactId>shrinkwrap-resolver-api-maven</artifactId>

              </dependency>

       

       

              <dependency>

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

                  <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

              </dependency>

                </dependencies>

       

       


      <dependencyManagement>

              <dependencies>

             <dependency>

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

                  <artifactId>arquillian-bom</artifactId>

                  <version>1.0.2.Final</version>

                  <scope>import</scope>

                  <type>pom</type>

              </dependency>

                  <dependency>

                      <groupId>javax.inject</groupId>

                      <artifactId>javax.inject</artifactId>

                      <version>${version.javax.inject_javax.inject}</version>

                      <scope>provided</scope>

                  </dependency>

                  <dependency>

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

                      <artifactId>shrinkwrap-api</artifactId>

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

                  </dependency>

                  <dependency>

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

                      <artifactId>shrinkwrap-spi</artifactId>

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

                  </dependency>

                  <dependency>

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

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

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

                  </dependency>

                  <dependency>

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

                      <artifactId>shrinkwrap-descriptors-api</artifactId>

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

                  </dependency>

                  <dependency>

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

                      <artifactId>shrinkwrap-descriptors-spi</artifactId>

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

                  </dependency>

                  <dependency>

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

                      <artifactId>shrinkwrap-descriptors-impl</artifactId>

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

                  </dependency>

       

       

                  <dependency>

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

                      <artifactId>shrinkwrap-resolver-api-maven</artifactId>

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

                  </dependency>

       

       

                  <dependency>

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

                      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>

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

                  </dependency>

       

       

                

                  <dependency>

                      <groupId>com.google.inject</groupId>

                      <artifactId>guice</artifactId>

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

                  </dependency>

       

       

                  <dependency>

                      <groupId>com.google.inject.extensions</groupId>

                      <artifactId>guice-persist</artifactId>

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

                  </dependency>

       

       

              </dependencies>

          </dependencyManagement>