I'm trying to run Arquillian tests on a Wildfly managed container.
Here's the Arquillian's deployment and the test:
@RunWith(Arquillian.class)
public abstract class ArquillianTestCase {
@Deployment
public static WebArchive createDeployment() {
/* Create the war file according to build.gradle. */
WebArchive war = ShrinkWrap.create(EmbeddedGradleImporter.class)
.forThisProjectDirectory().importBuildOutput()
.as(WebArchive.class);
/* Add the abstract test classes to war. */
war.addClasses(ArquillianTestCase.class, SeleniumTestCase.class);
/* Add selenium and its transitive dependencies to war's lib. */
String seleniumJava = "org.seleniumhq.selenium:selenium-java:3.3.1";
MavenResolverSystem resolver = Maven.resolver();
File[] seleniumFiles = resolver.resolve(seleniumJava).withTransitivity()
.asFile();
war.addAsLibraries(seleniumFiles);
return war;
}
}
public class LoginTest extends ArquillianTestCase {
@Test
public void shouldRun() throws Exception {
System.out.println("LoginTest!");
Assert.assertTrue(true);
}
}
I don't have any arquillian.xml
file, so I rely on JBOSS_HOME
environment variable to let Arquillian find my Wildfly:
echo $JBOSS_HOME
/opt/wildfly-8.2.1.Final
All of this process is started by a Gradle build, so here are the most relevant dependencies of my build.gradle
file:
dependencies {
/* Arquillian for managing the life cycle of the container. */
testCompile 'org.jboss.arquillian.junit:arquillian-junit-container:1.1.10.Final'
/* Arquillian and Wildfly integration. */
testCompile 'org.wildfly:wildfly-arquillian-container-managed:8.2.1.Final'
/* Arquillian and Gradle integration. */
testCompile 'org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-gradle-depchain:2.2.6'
/* Arquillian and Maven integration for resolving dependencies at runtime. */
testCompile 'org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-api-maven:2.2.6'
testCompile 'org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:2.2.6'
/* Selenium for front-end testing. */
testCompile 'org.seleniumhq.selenium:selenium-java:3.3.1'
}
If I run this setup on Windows
with my JBOSS_HOME
pointing to a valid Wildfly installation, it works fine, but when I reproduce the same setup on Ubuntu Server 14.04
, I get the error below:
org.jboss.arquillian.container.spi.client.container.LifecycleException: Could not start container
at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.startInternal(ManagedDeployableContainer.java:208)
at org.jboss.as.arquillian.container.CommonDeployableContainer.start(CommonDeployableContainer.java:112)
at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:199)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:163)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:157)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:156)
(omitted dozens of lines to improve readability)
Caused by: java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at org.jboss.as.arquillian.container.managed.ManagedDeployableContainer.startInternal(ManagedDeployableContainer.java:94)
... 84 more
I tried to reproduce this behavior on Windows
and realised that it happens when I remove my environment variable JBOSS_HOME
, so Arquillian doesn't find my container, but back on Ubuntu
, even that variable exists, it doesn't work.
Any ideas? Thanks in advance.