You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2010/11/09 09:00:28 UTC

Re: Camel Testing

Hi

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



On Tue, Nov 9, 2010 at 7:21 AM, Mark Borner <ma...@zurich.com.au>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
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/