You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "dhruv.sachdeva" <dh...@jktech.com> on 2013/01/10 09:10:38 UTC

Camel choice processor

Hi ,
I have to write a unit test case for myclass which routes a message to
queues using choice processor and checking predicates such as when.

Here is a code snippet:-

from("direct:setMessageIdentifier").
			choice().
		
when(ns.xpath("/cus:CustomerUpdateRoot")).setHeader("MessageIdentifier",ns.xpath("/cus:CustomerUpdateRoot/cus",String.class)).setHeader("MessageType",
constant("Customer")).to("direct:applyIdempotent").
			when(ns.xpath("/customer:some")).setHeader("BusinessKey",
ns.xpath("/cust",String.class)).setHeader("MessageType",
constant("Cust")).to("direct:applyIdempotent");



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-choice-processor-tp5725214.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel choice processor

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jan 11, 2013 at 12:31 PM, dhruv.sachdeva
<dh...@jktech.com> wrote:
> I read the camel testing link ,but i am using Camel 1.6 and hence
> CamelTestSupport cannot be extended.
> If you can suggest some example to test the route using camel 1.6 .
> Your suggestion are welcome.
>

Look at the source code for Camel 1.6 and see how Camel tests itself,
and the choice.

>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-choice-processor-tp5725214p5725369.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Camel choice processor

Posted by "dhruv.sachdeva" <dh...@jktech.com>.
I read the camel testing link ,but i am using Camel 1.6 and hence
CamelTestSupport cannot be extended.
If you can suggest some example to test the route using camel 1.6 . 
Your suggestion are welcome.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-choice-processor-tp5725214p5725369.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel choice processor

Posted by "dhruv.sachdeva" <dh...@jktech.com>.
I read the camel testing link ,but i am using Camel 1.6 and hence
CamelTestSupport cannot be extended.
If you can suggest some example to test the route using camel 1.6 . 
Your suggestion are welcomed.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-choice-processor-tp5725214p5725368.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel choice processor

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 10, 2013 at 10:29 AM, dhruv.sachdeva
<dh...@jktech.com> wrote:
> Yes.Actually it was correctly how to test that.
>

Hi

I suggest to read the docs at
http://camel.apache.org/testing

.. and the links from that page.

And then give it a try and see how far you get.



>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-choice-processor-tp5725214p5725219.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Camel choice processor

Posted by "dhruv.sachdeva" <dh...@jktech.com>.
Yes.Actually it was correctly how to test that.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-choice-processor-tp5725214p5725219.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel choice processor

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 10, 2013 at 9:10 AM, dhruv.sachdeva
<dh...@jktech.com> wrote:
> Hi ,
> I have to write a unit test case for myclass which routes a message to
> queues using choice processor and checking predicates such as when.
>

Okay good luck with writing that test.
Do you have any questions?


> Here is a code snippet:-
>
> from("direct:setMessageIdentifier").
>                         choice().
>
> when(ns.xpath("/cus:CustomerUpdateRoot")).setHeader("MessageIdentifier",ns.xpath("/cus:CustomerUpdateRoot/cus",String.class)).setHeader("MessageType",
> constant("Customer")).to("direct:applyIdempotent").
>                         when(ns.xpath("/customer:some")).setHeader("BusinessKey",
> ns.xpath("/cust",String.class)).setHeader("MessageType",
> constant("Cust")).to("direct:applyIdempotent");
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-choice-processor-tp5725214.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen