activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject writing easier test cases for ActiveMQ using Camel
Date Thu, 17 Jan 2008 14:26:50 GMT
I've just written a little helper class which makes it a bit easier to
write JUnit test cases for ActiveMQ features using Camel.

There's a base class called : CamelEmbeddedBrokerTestSupport which is
very much like the ContextTestSupport inside Camel but with one
difference, it also creates an embedded broker which can be easily
configured if need be with specific policies etc.

You can then use camel to do the sending, either explicitly with Java
code or by bridging some directory of sample messages to some
destination.

To see it in action, check out MessageAuthenticationTest where we
customize the per message authorization plugin, send a bunch of
messages and assert that only the allowed messages have been consumed,
using Camel Mock endpoints.

You don't need to derive from CamelEmbeddedBrokerTestSupport if you
don't want to use Java code to customize an embedded broker; you could
do it all by spring if you prefer and use one of the default Camel
test cases if you prefer - but lots of ActiveMQ test cases don't need
Spring or anything; just some Java code to set things up will often do
the trick.

We can then use all of the nice testing mechanisms of the Mock
Endpoints in Camel to test ActiveMQ's behaviour...
http://activemq.apache.org/camel/mock.html

As usual any feedback appreciated

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

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

Mime
View raw message