camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Newbie: how to test?
Date Thu, 22 Sep 2011 01:07:22 GMT
When you are planing to test your route as an unit test, you can 
register a seda component with the name for jms. Then you can fire the 
message to the seda endpoint.

There are lot of other way to do it in Camel in Action Charpter6, you 
need to have a one :)
On 9/21/11 7:07 PM, kenhans wrote:
> hello,
> I started looking into Camel a few days ago and was wondering how to test...
>
> I define my camelContext through Spring, with the route I want to use
>
> <camelContext xmlns="http://camel.apache.org/schema/spring">
>        <routeBuilder ref="subscriptionRoute"/>
> </camelContext>
>
> my subscriptionRoute is defined like this:
> from("jms:queue:subscription").....
> where jms is ActiveMQ, added to the context, not part of the test project.
>
> Now I would like to test my routes through a simple JUnit-test. So how do I
> fire messages into the subscription queue from my JUnit test so that my
> route picks it up? Do I need to create a new camelContext in my test class
> and have a ProducerTemplate create messages? But how can I be sure I put
> them into the queue for the subscriptionRoute to pick them up?
>
> Sorry if this is extremely newbie, but I am kind of stuck on this and would
> highly appreciate any hints. I've gone through the steps doing it all
> through the JUnit-test (i.e. creating the route, posting to a queue,
> checking the outputs etc), but I simply do not understand how to separate
> the test from my eventual production code...
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Newbie-how-to-test-tp4825969p4825969.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Mime
View raw message