Hi,

I want to test Camel routes in Karaf. I use Pax-Exam to run Karaf. 
For older Karaf and Camel versions, I found a blog article by J.B. Onofre 
which shows how one can use CamelTestSupport to do that.

I got it working on JDK 8 for an older combination of Camel, Karaf and 
PaxExam with numerous adjustments (see links below). But when I switch to 
the current versions (Camel 2.24.2, Karaf 4.2.7, Pax-Exam 4.13.1), the 
CamelTestSupport 
setup fails, complaining with ClassNotFoundException: 
org.apache.camel.util.jndi.CamelInitialContextFactory.

When I disable the CamelTestSupport.setUp() method by overriding it with an 
empty method, I can see that the camel-core feature is present:

assertTrue(featuresService.isInstalled(featuresService.getFeature("camel-core")));

I have also tried to import the org.apache.camel.util.jndi package into the 
probe bundle. The package gets exported by the camel-core bundle jar, at 
least its MANIFEST.MF says so.

    @ProbeBuilder
    public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
        probe.setHeader(Constants.IMPORT_PACKAGE, 
"*,org.apache.camel.util.jndi");
        return probe;
    }

The import appears to work, at least I get no import error during test 
execution.

Why can the test bundle not find the CamelInitialContextFactory?

I have created a clone of J.B. Onofre's Github example which fixes the JDK 
8 issues and another one with recent versions which demonstrates the 
problem.

Works: Karaf 2.4 with Camel 2.12.1 on JDK 8 
<https://github.com/dschulten/blog-camel-blueprint/tree/karaf24-jdk8>
Fails: Karaf 4.2.7 using Camel 2.24.2 
<https://github.com/dschulten/blog-camel-blueprint/tree/karaf4-paxexam4>.

Here is my stack overflow question with all the details and other attempts 
I have made:
https://stackoverflow.com/questions/59075424/testing-camel-2-24-x-routes-in-karaf-4-2-7-with-cameltestsupport

Best,
Dietrich

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/99d4fc11-99bb-44b9-8385-f07bd559a22c%40googlegroups.com.

Reply via email to