5 Replies Latest reply on Feb 15, 2017 2:52 AM by mjobanek

    Arquillian deploys application but test runs only locally

    dokaspar

      I am using the Websphere container adapter (arquillian-was-remote-8) to deploy an EAR file to a remote container and run an Arquillian test on it. The basic setup is working, Arquillian deploys the EAR to the Websphere container (when running a simple test that just waits in a loop, I can manually access the web application via a browser).

      However...

      1. the @Test method seems to be only executed locally, all the JUnit output and any System.out.println()statements appear on my local shell and I find nothing related to my test in the server-side log files.
      2. the injection does not work, the myService object remains always null.

      Here's my Arquillian test class:

      @RunWith(Arquillian.class)
      public class MyArquillianTest {
        @EJB MyService myService;
       
        @Deployment public static EnterpriseArchive createEarDeployment() {
          File f = new File("/path/to/application.ear");
          EnterpriseArchive ear = ShrinkWrap.createFromZipFile(EnterpriseArchive.class, f);

         
      // add test jar to ear (https://developer.jboss.org/thread/200399)
          JavaArchive testJar = ShrinkWrap.create(JavaArchive.class);
          testJar.addClass(MyArquillianTest.class);
          return ear.addAsLibrary(testJar);
        }

        @Test
      public void test() {
          System.out.println("TEST!");
          if (myService != null) {
              myService.getServerStatus();
          }
          else {
              System.out.println("Injection failed :(");
          }
        }
      }

      I have also tried to not deploy the whole EAR, but individual WAR files contained in it, but always came to the same result that the archive is deployed with injected objects remaining null and no System.out.println() appearing in server-side logs.

        • 1. Re: Arquillian deploys application but test runs only locally
          mjobanek

          Hi,

          could you please paste here your pom.xml file or dependency tree? Check that you are using the dependency: arquillian-junit-container: The Central Repository Search Engine

          If you're using the standalone one, change it because the standalone is only for local testing.

          • 2. Re: Arquillian deploys application but test runs only locally
            dokaspar

            In the meantime I created a simple WebApp based on Tutorial - Very Simple HelloWorld Web Application | Pivotal tc Server Docs and arquillian-container-was-remote-8 properly deploys the application, but the test still just runs locally ...

             

            The project's dependency tree looks like this:

             

                 [exec] [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ myproject-test-arquillian ---

                 [exec] [INFO] org.mycompany.myproject:myproject-test-arquillian:jar:0.0.0.0_dev-SNAPSHOT

                 [exec] [INFO] +- org.mycompany.myproject:myproject-util-java:jar:0.0.0.0_dev-SNAPSHOT:test

                 [exec] [INFO] |  +- org.mycompany.myproject:myproject-persistence:jar:0.0.0.0_dev-SNAPSHOT:test

                 [exec] [INFO] |  +- commons-collections:commons-collections:jar:3.2.1:test

                 [exec] [INFO] |  +- org.apache.commons:commons-lang3:jar:3.4:test

                 [exec] [INFO] |  \- commons-beanutils:commons-beanutils:jar:1.8.3:test

                 [exec] [INFO] |     \- commons-logging:commons-logging:jar:1.1.1:test

                 [exec] [INFO] +- junit:junit:jar:4.12:test

                 [exec] [INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test

                 [exec] [INFO] +- org.jboss.arquillian:arquillian-bom:pom:1.1.10.Final:test

                 [exec] [INFO] +- org.jboss.arquillian.junit:arquillian-junit-container:jar:1.1.10.Final:test

                 [exec] [INFO] |  +- org.jboss.arquillian.junit:arquillian-junit-core:jar:1.1.10.Final:test

                 [exec] [INFO] |  +- org.jboss.arquillian.test:arquillian-test-api:jar:1.1.10.Final:test

                 [exec] [INFO] |  |  \- org.jboss.arquillian.core:arquillian-core-api:jar:1.1.10.Final:test

                 [exec] [INFO] |  +- org.jboss.arquillian.test:arquillian-test-spi:jar:1.1.10.Final:test

                 [exec] [INFO] |  |  \- org.jboss.arquillian.core:arquillian-core-spi:jar:1.1.10.Final:test

                 [exec] [INFO] |  +- org.jboss.arquillian.container:arquillian-container-test-api:jar:1.1.10.Final:test

                 [exec] [INFO] |  |  \- org.jboss.shrinkwrap:shrinkwrap-api:jar:1.2.2:test

                 [exec] [INFO] |  +- org.jboss.arquillian.container:arquillian-container-test-spi:jar:1.1.10.Final:test

                 [exec] [INFO] |  |  \- org.jboss.arquillian.container:arquillian-container-spi:jar:1.1.10.Final:test

                 [exec] [INFO] |  +- org.jboss.arquillian.core:arquillian-core-impl-base:jar:1.1.10.Final:test

                 [exec] [INFO] |  +- org.jboss.arquillian.test:arquillian-test-impl-base:jar:1.1.10.Final:test

                 [exec] [INFO] |  +- org.jboss.arquillian.container:arquillian-container-impl-base:jar:1.1.10.Final:test

                 [exec] [INFO] |  |  +- org.jboss.arquillian.config:arquillian-config-api:jar:1.1.10.Final:test

                 [exec] [INFO] |  |  +- org.jboss.arquillian.config:arquillian-config-impl-base:jar:1.1.10.Final:test

                 [exec] [INFO] |  |  \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-spi:jar:2.0.0-alpha-8:test

                 [exec] [INFO] |  +- org.jboss.arquillian.container:arquillian-container-test-impl-base:jar:1.1.10.Final:test

                 [exec] [INFO] |  \- org.jboss.shrinkwrap:shrinkwrap-impl-base:jar:1.2.2:test

                 [exec] [INFO] |     \- org.jboss.shrinkwrap:shrinkwrap-spi:jar:1.2.2:test

                 [exec] [INFO] +- org.jboss.arquillian.container:arquillian-was-remote-8:jar:1.0.0.Final-SNAPSHOT:test

                 [exec] [INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:compile

                 [exec] [INFO] +- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-api-javaee:jar:2.0.0-alpha-10:test

                 [exec] [INFO] |  \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-api-base:jar:2.0.0-alpha-10:test

                 [exec] [INFO] +- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-impl-javaee:jar:2.0.0-alpha-10:test

                 [exec] [INFO] |  \- org.jboss.shrinkwrap.descriptors:shrinkwrap-descriptors-impl-base:jar:2.0.0-alpha-10:test

                 [exec] [INFO] \- org.eclipse.core:org.eclipse.core.runtime:jar:3.7.0:test

                 [exec] [INFO]    +- org.eclipse.osgi:org.eclipse.osgi:jar:3.7.1:test

                 [exec] [INFO]    +- org.eclipse.equinox:org.eclipse.equinox.common:jar:3.6.0:test

                 [exec] [INFO]    +- org.eclipse.core:org.eclipse.core.jobs:jar:3.5.100:test

                 [exec] [INFO]    +- org.eclipse.equinox:org.eclipse.equinox.registry:jar:3.5.101:test

                 [exec] [INFO]    +- org.eclipse.equinox:org.eclipse.equinox.preferences:jar:3.4.1:test

                 [exec] [INFO]    +- org.eclipse.core:org.eclipse.core.contenttype:jar:3.4.100:test

                 [exec] [INFO]    \- org.eclipse.equinox:org.eclipse.equinox.app:jar:1.3.100:test

                 [exec] [INFO] ------------------------------------------------------------------------

            • 3. Re: Arquillian deploys application but test runs only locally
              marek.winkler

              Hi,

               

              your deployment method in the code snippet seems to add a different test class:

               

              testJar.addClass(LeasmanServiceBeanIntTest.class);

               

              l would expect it to add MyArquillianTest class, or have I missed something?

              • 4. Re: Arquillian deploys application but test runs only locally
                dokaspar

                Sorry, while trimming down my code to a minimum, I renamed the test and forgot to adjust this line. It definitely should be MyArquillianTest.

                • 5. Re: Arquillian deploys application but test runs only locally
                  mjobanek

                  The thing that it still runs only locally is really weird. Are you able to provide some simple example?

                  I was trying to reproduce your issue but without any success, however, I have to admit that I'm not expert on EAR archives.