Scenario:
I am currently trying to develop unit test inside java ee application using arquillian. As a test container I use a remote container running on a wildfly server. The setup is working for test as long as the source classes needed are inside the test directory.Problem:
Once the classes I want to perform test upon are outside the test directory the class loader does not recognize them anymore and I can no longer add them to the micro-deployment using shrinkWrap as I have done previously.what am I doing wrong, what am I forgetting? I feel like this could be a very simple setup problem inside my project, as I am new to maven and java ee as well. As the setup seems to be working as long as all resources are inside the test directory I am assuming that the error is not a dependency problem but rather a problem with my project setup. Its my first question here on stackoverflow, please exuse any shortcomings on my side :D
Error message
Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.JavaArchive de.mathplan.moses.core.studiengang.model.StudiengangTest.createDeployment()
at org.jboss.shrinkwrap.api.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:70)
at org.jboss.shrinkwrap.impl.base.URLPackageScanner.foundClass(URLPackageScanner.java:165)
at org.jboss.shrinkwrap.impl.base.URLPackageScanner.handle(URLPackageScanner.java:157)
at org.jboss.shrinkwrap.impl.base.URLPackageScanner.handle(URLPackageScanner.java:145)
at org.jboss.shrinkwrap.impl.base.URLPackageScanner.scanPackage(URLPackageScanner.java:113)
at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addPackage(ContainerBase.java:1520)
at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addPackages(ContainerBase.java:1497)
at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addClasses(ContainerBase.java:1358)
at org.jboss.shrinkwrap.impl.base.container.ContainerBase.addClass(ContainerBase.java:1285)
at de.mathplan.moses.core.studiengang.model.StudiengangTest.createDeployment(StudiengangTest.java:18)
]]></error>
Arquillian Dependencies
<!-- inside profile -->
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>3.0.1.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.7.0.Alpha5</version>
<scope>test</scope>
</dependency>
<!-- client deployment APIs for communicating with the container process -->
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<version>1.4.0.Final</version>
<scope>test</scope>
</dependency>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.4.0.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
You have to configure the file arquillian.xml that is stored inside the src/test/resources folder.
A sample of this file is the following:
The qualifier "remote" inside arquillian.xml is used when configuring maven-failsafe-plugin as follow:
To run your integration test you can use: