I am getting up to speed with the FUSE and OSGi and trying to put together a simple blueprint test that should check a Camel route (written by another developer):
public class CamelBrokerTest extends CamelBlueprintTestSupport {
@Override
protected String getBlueprintDescriptor() {
return "OSGI-INF/blueprint/peoplesoft-service.xml";
}
@Test
public void testRoute() throws Exception {
MockEndpoint endpoint = getMockEndpoint("seda:peopleSoftFinanceSchedulerProcessInstances");
endpoint.expectedMessageCount(1);
template.sendBody("activemq:peopleSoftFinanceIncomingFiles", "TRANSACTION_INFO");
assertMockEndpointsSatisfied();
}
}
However, when I try to run it, I end up getting
Caused by: java.lang.ClassNotFoundException: ca.custom.camel.servlet.registry.CamelServletHTTPRegistry
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
... 40 more
The dependency containing the class is included in the POM file with the test scope:
<dependency>
<groupId>ca.custom</groupId>
<artifactId>camel-servlet-osgi</artifactId>
<version>${camel.servlet.osgi.version}</version>
<scope>test</scope>
</dependency>
And I verified that the file is in the repo, and actually contains the required files. It also looks like the generated OSGi bundle descriptor has the correct dependencies also:
Import-Package: ca.custom.camel.servlet.osgi;version="[1.1,2)",ca.
custom.camel.servlet.registry,ca.mcmaster.uts.service.directory.i
ntegration;version="[1.2,2)",javax.jws,javax.jws.soap,javax.net.ssl,jav
ax.security.auth.callback,javax.xml.bind,javax.xml.bind.annotation,java
This code seems to be running well in production, yet, fails when executed as a JUnit test. Any ideas as to why this exception might occur? Did I miss any configuration steps?