activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
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 <mknutson@baselogic.com>:
> 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...
http://activemq.apache.org/camel/discussion-forums.html

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
TestNG
http://activemq.apache.org/camel/spring-testing.html

for TestNG you might want to derive from AbstractTestNGSpringContextTests see
http://static.springframework.org/spring/docs/2.5.x/reference/testing.html#testcontext-fixture-di

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
http://activemq.apache.org/camel/bean-integration.html

plus you can then inject mock endpoints for testing as well as described here
http://activemq.apache.org/camel/spring-testing.html
http://activemq.apache.org/camel/mock.html

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message