camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Camel Testing
Date Tue, 09 Nov 2010 08:00:28 GMT

Yeah you should be able to use the Spring Test framework with Camel.
Just do as you normally do with Spring testing.

Then you can use Spring IoC to inject ProducerTemplate and Endpoint so you
can use those Camel concepts from the unit test class.

See more here:

On Tue, Nov 9, 2010 at 7:21 AM, Mark Borner <>wrote:

> Hi all:
> I'm familiar with a common practice in Spring to create a unit test
> sub-classing AbstractTransactionalJUnit4SpringContextTests.  Then in your
> @Before's, you setup the data in the database for your unit test.  And in
> your @Test's you can test your code that expects the data in the database.
>  After your @Test runs, Spring will rollback the transaction and all the DB
> changes.
> Now in Camel, I have a route that expects certain data to already exist in
> the DB, and interacts with the data (such as reading it and updating it).  I
> want to create a unit test for this Camel route with automatic transaction
> rollback.  What is the recommended way to accomplish this?  Should I be able
> to use the "AbstractTransactionalJUnit4SpringContextTests" approach?
> I've looked in the Camel in Action book and in the examples, and I can't
> see an example of what I'm trying to do.
> Thanks,
> Mark
> Mark Borner
> Java Developer - ZStream Xpress
> ----
> This email is intended for the named recipient only. It may contain
> information which is confidential, commercially sensitive, or
> copyright. If you are not the intended recipient you must not
> reproduce or distribute any part of the email, disclose its contents,
> or take any action in reliance. If you have received this email in
> error, please contact the sender and delete the message. It is your
> responsibility to scan this email and any attachments for viruses and
> other defects. To the extent permitted by law, Zurich and its
> associates will not be liable for any loss or damage arising in any
> way from this communication including any file attachments. We may
> monitor email you send to us, either as a reply to this email or any
> email you send to us, to confirm our systems are protected and for
> compliance with company policies. Although we take reasonable
> precautions to protect the confidentiality of our email systems, we
> do not warrant the confidentiality or security of email or
> attachments we receive.

Claus Ibsen
Twitter: davsclaus
Author of Camel in Action:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message