Hi,

CamelTestSupport is for utest whereas pax-exam is more for itest.

You can take a look on some itest I did about Camel, for instance:

https://github.com/apache/karaf-decanter/pull/111/files#diff-f23addf50c34ea79c8df17bb2861d649

So, you should *NOT* use CamelTestSupport for itest (and keep it for
utest), and directly use producerTemplate, etc for itest.

Regards

JB

On 29/11/2019 09:59, Dietrich Schulten wrote:
> 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 - ops4j@googlegroups.com
>
> ---
> 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 ops4j+unsubscr...@googlegroups.com
> <mailto:ops4j+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ops4j/99d4fc11-99bb-44b9-8385-f07bd559a22c%40googlegroups.com
> <https://groups.google.com/d/msgid/ops4j/99d4fc11-99bb-44b9-8385-f07bd559a22c%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
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 ops4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/e1c60b1a-4581-f8a4-80c7-e156f07545a3%40gmail.com.

Reply via email to