Testing Fabric with the Pax Exam behind the firewall and Nexus

Solution Verified - Updated -

Environment

  • JBoss Fuse 6.1

Issue

My Fabric Pax Exam tests don't work on my corporate machine (behind firewall, with Nexus used to fetch Maven dependencies). They work on my home laptop.

Resolution

If you are using Nexus to fetch your Maven dependencies, you need to tell Exam about it. First of all you need to add your Nexus address to the configuration of the Exam container running the test:

@Configuration
public Option[] config() {
  return new Option[]{
    ...
    editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.repositories", "http://repo.mynexus.com@id=corporateNexus")
  }
}

You need also to pass the same information to the Fabric Maven Proxy, so Fabric deployment agent could create the containers. You can do it by executing the following command after creating the Fabric in the test container:

executeCommand("fabric:create -n");
...
executeCommand("fabric:profile-edit --pid io.fabric8.agent/org.ops4j.pax.url.mvn.repositories=http://repo.mynexus.com default");

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.