activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: testNG test harness for Camel, sending and receiving messages
Date Wed, 17 Sep 2008 09:14:02 GMT
2008/9/16 Mick Knutson <>:
> I am trying to setup camel within Maven to start my camel context via the
>           <plugin>
>                <groupId>org.apache.camel</groupId>
>                <artifactId>camel-maven-plugin</artifactId>
>                <version>1.4.0</version>
>            </plugin>
> Now I was hoping that someone has already created a baseCamelTestNG class to
> start/stop camel, then helper class to send and receive messages.
> Then after the tests have run, the plugin can shutdown.

BTW there's a Camel user list, I've CC'd so other camel users can listen too...

The best approach for unit testing and sending & receiving messages is
to use the Spring Testing mechanism which works with JUnit 3.x, 4.x or

for TestNG you might want to derive from AbstractTestNGSpringContextTests see

this then does the dependency injection with Spring and runs your test case.

To send messages you can inject a ProducerTemplate; then to receive
messages you can then use the @MessageDriven annotation on a method -
see the examples here

plus you can then inject mock endpoints for testing as well as described here


Open Source Integration

View raw message