Red Hat
Mar 15, 2013
by Snjezana Peco

When debugging an Arquillian test using a remote container, we usually do the following steps:

 

  • create a project
  • add the Arquillian support
  • create a test
  • configure Maven profiles
  • create a JBoss server
  • start the server in the debug mode
  • start the test in the debug mode

 

We can debug the classes from the project's source by adding the Eclipse Java Project source container to the Source Lookup.

However, if we want to debug some Arquillian code in a server (remote) JVM, adding the Eclipse container won't be enough. The Arquillian classes aren't included in a JBoss server and the Java Project source container searches only the project's source folders.

 

If we can deploy the project, the JBoss Source Lookup plugin will solve all the classes from a mavenized archive so that we can debug the classes from such a project.

 

If we can't (or don't want to) deploy the project, we can use the JBoss Java Project Source Container from the arquillian eclipse plugin.

 

The JBoss Java Project Source Container is similar to the Java Project source container. The differ is that it searches classes from the project's classpath. The container solves source files for all the classes from a mavenized library included in the classpath.

The project can, but doesn't have to be a Maven project.

 

Test case:

 

  • create a JBoss AS Server
  • import the JBoss Central Java EE project (don't deploy it)
  • set a breakpoint in the org.jboss.arquillian.junit.Arquillian.methodInvoker(FrameworkMethod, Object) method (at line 270 in Arquillian 1.0.3)
  • start the server in the debug mode
  • debug MemberRegistrationTest

 

The Eclipse won't open the Arquillian source file, which happens because this method is called from within the server's JVM that doesn't know anything about the Java EE project.

Adding the Eclipse Java Project source container won't help because it adds only source folders.

 

 

You will be able to debug any class from the project.

 

It is possible to create different helper projects and add the container to different remote launch configurations.

 

The JBoss Java Project Source Container isn't related to the arquillian-eclipse feature and/or JBoss servers and can be added to any launch configuration. The container probably has to be moved to the JBoss Source Lookup plugin.

 

See