Arquillian deploys application but test runs only locally

75 Views Asked by At

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.

However, the @Test method seems to be only executed locally, all the System.out.println() statements appear on my local shell and I cannot find them in the server-side log files. Also, 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(LeasmanServiceBeanIntTest.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

There are 1 best solutions below

0
On BEST ANSWER

After a lot of investigations and help from the Arquillian forum, where I posted this question, I finally figured out that I made the mistake to build the arquillian-was-remote-8 using Java 8 instead of the IBM Java (1.6) that is part of my WAS8_HOME.