FAQ
Hi,

I am writing a integration testcase (in karaf) which needs to make a call to
camel route in different bundle. I understand interfacing with camel routes
become easy by having the test class extend CamelTestSupport. However my
Test classes are not at the liberty to extend CamelTestSupport as they
already inheriting a different class.

What are my options in this scenario and how can i achieve it ?

Regards,
-Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/Any-alternative-for-CamelTestSupport-tp5764259.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Search Discussions

  • Charlie Mordant at Mar 17, 2015 at 9:41 am
    Hi,

    You can use Pax Exam for your integration tests, wait for bootfinished
    event, then using your camel route's incoming technology (jms client, http
    call, etc..) to call them.
    Here's a simple example of a rest service call (would be the same with a
    camel cxfrs power from() route):
    https://github.com/OsgiliathEnterprise/net.osgiliath.parent/blob/master/net.osgiliath.samples/net.osgiliath.hello/net.osgiliath.hello.business/net.osgiliath.hello.business.impl.cdi/src/it/java/net/osgiliath/hello/business/impl/cdi/services/impl/itests/ITHelloServiceJaxRS.java

    Regards,

    2015-03-17 9:42 GMT+01:00 yogu13 <yogu13@gmail.com>:
    Hi,

    I am writing a integration testcase (in karaf) which needs to make a call
    to
    camel route in different bundle. I understand interfacing with camel routes
    become easy by having the test class extend CamelTestSupport. However my
    Test classes are not at the liberty to extend CamelTestSupport as they
    already inheriting a different class.

    What are my options in this scenario and how can i achieve it ?

    Regards,
    -Yogesh



    --
    View this message in context:
    http://camel.465427.n5.nabble.com/Any-alternative-for-CamelTestSupport-tp5764259.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Charlie Mordant

    Full OSGI/EE stack made with Karaf:
    https://github.com/OsgiliathEnterprise/net.osgiliath.parent
  • Yogu13 at Mar 17, 2015 at 10:05 am
    Hello,

    Thank you for the quick reply! I am using PAX-EXAM 4 for my integration
    tests on karaf.

    I had a quick look on the file you mentioned, were you suggesting following
    changes would help me

    1. adding @Inject and @Filter to get the component in my case its direct-vm
    so,
    @Inject
       @Filter(value = "(component-type=direct-vm)")
       private transient Component directComponent;

    2. Create the producer from this component and trigger the route ?

    Not sure if blueprint.xml plays any role in this

    Regards,
    -Yogesh




    --
    View this message in context: http://camel.465427.n5.nabble.com/Any-alternative-for-CamelTestSupport-tp5764259p5764265.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Yogu13 at Mar 17, 2015 at 12:55 pm
    Now based on above .. i keep getting
    org.ops4j.pax.swissbox.tracker.ServiceLookupException: gave up waiting for
    service org.apache.camel.Component
    :(

    Regards,
    -Yogesh




    --
    View this message in context: http://camel.465427.n5.nabble.com/Any-alternative-for-CamelTestSupport-tp5764259p5764271.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Yogu13 at Mar 17, 2015 at 1:02 pm
    Okay!

    I seem to have got it working :)

    For ppl who land up into a similar issue...

    CamelContext can be retrieved using OSGI's ServiceTracker and using the
    context instance created a producer template which helped me call the route.

    Cheers!
    -Yogesh



    --
    View this message in context: http://camel.465427.n5.nabble.com/Any-alternative-for-CamelTestSupport-tp5764259p5764272.html
    Sent from the Camel - Users mailing list archive at Nabble.com.
  • Charlie Mordant at Mar 17, 2015 at 3:08 pm
    Perfect :).

    Yes, I had a blueprint file exposing the camel components:
    https://github.com/OsgiliathEnterprise/net.osgiliath.parent/blob/master/net.osgiliath.framework/net.osgiliath.helpers.parent/net.osgiliath.helpers.camel.activemq/src/main/resources/OSGI-INF/blueprint/camel-components.xml
    .

    Glad you found the answer before I saw the mail :).
    Good luck for your tests.

    Regards,


    2015-03-17 13:57 GMT+01:00 yogu13 <yogu13@gmail.com>:
    Okay!

    I seem to have got it working :)

    For ppl who land up into a similar issue...

    CamelContext can be retrieved using OSGI's ServiceTracker and using the
    context instance created a producer template which helped me call the
    route.

    Cheers!
    -Yogesh



    --
    View this message in context:
    http://camel.465427.n5.nabble.com/Any-alternative-for-CamelTestSupport-tp5764259p5764272.html
    Sent from the Camel - Users mailing list archive at Nabble.com.


    --
    Charlie Mordant

    Full OSGI/EE stack made with Karaf:
    https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedMar 17, '15 at 8:56a
activeMar 17, '15 at 3:08p
posts6
users2
websitecamel.apache.org

2 users in discussion

Yogu13: 4 posts Charlie Mordant: 2 posts

People

Translate

site design / logo © 2021 Grokbase