camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <cschnei...@talend.com>
Subject AW: Unit test camel with activeMQ
Date Mon, 30 May 2011 09:43:08 GMT
First thing. You can very nicely test such routes. Camel provides some nice test classes and
also the great mock:endpoint.

It would be a bit lengthy to describe how to do it in the mail. I think you best look into
the tests of the jms component. They test very similar things.

https://svn.apache.org/repos/asf/camel/trunk/components/camel-jms/src/test/

Christian


-----Urspr√ľngliche Nachricht-----
Von: hbellat [mailto:hbellat@gmail.com] 
Gesendet: Montag, 30. Mai 2011 11:19
An: users@camel.apache.org
Betreff: Unit test camel with activeMQ

Hello,

I used Junit for java program but I need some examples to understand how it works in camel
with activeMQ

I wrote a simple camel.xml as follow :

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
			<from uri="activemq:start"/>
			<bean ref="MyBean" method="route" />
			<to uri="activemq:finish"/>
			</route>
    </camelContext>

and MyBean.java is :

      public class MyBean {

	
	public void route(Exchange message){

		 String name = message.getIn().getBody(String.class);
		 
		 name="test";
		 
		 message.getOut().setBody(name);
}
}

In my route I send any string like "my unit Test", this string received by the bean and affecte
"test" in my String and route it to activemq:finish.

How can I write a unit test for that simple code ?

In my test I was wondring if my activemq must be started ?

I will appreciate your help.





--
View this message in context: http://camel.465427.n5.nabble.com/Unit-test-camel-with-activeMQ-tp4438797p4438797.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message