The easy way is to look at: http://camel.apache.org/camel-test.html
The harder way is a deeper conversation as there are several tricks in testing routes and Camel. Start small with the above link then you will have better questions as you go along. Also, sorry for the plug, but this book is the best place to start: http://www.manning.com/ibsen/ --- Thank You… Mick Knutson, President BASE Logic, Inc. Enterprise Architecture, Design, Mentoring & Agile Consulting p. (855) BASE-LOGIC: (227-3564-42) p. (478) BASE-LOGIC (227-3564-42) f. (855) BASE-LOGIC: (227-3564-42) Website: http://www.baselogic.com Blog: http://www.baselogic.com/blog/ Linked IN: http://linkedin.com/in/mickknutson Twitter: http://twitter.com/mickknutson --- On Wed, Sep 21, 2011 at 7:07 AM, kenhans <kenha...@hotmail.co.uk> 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. >