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.
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.