简体   繁体   中英

Arquillian deploys application but test runs only locally

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.

经过Arquillian论坛的大量调查和帮助(我在论坛上发布了此问题) ,我最终发现,我错误地使用Java 8而不是IBM Java(1.6)来构建arquillian-was-remote-8。我WAS8_HOME一部分。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM