On Mon, May 30, 2011 at 12:04 PM, Willem Jiang <willem.ji...@gmail.com> wrote:
> Hi,
>
> It depends on if you want to start the JMS broker.
> In most case, you don't need to start the JMS broker if you just want to
> test the route method.

Yeah the camel-activemq component can automatic embed a local broker.
Thats very convenient for unit testing.

And you can use the vm protocol so you do not send messages over TCP
and whatnot.

As mentioned the unit tests of camel-jms shows that. Likewise some of
the examples using JMS.
And in terms of the Camel book, then chapter 7 covers using JMS and
have source code with unit tests as well.

>
> So you can replace the activemq to direct or seda endpoint.
> There are some useful discussion in the Chapter6 of Camel in Action.
>
> On 5/30/11 5:19 PM, hbellat wrote:
>>
>> 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.
>>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>         http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to