You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gilboy <jo...@gmail.com> on 2012/07/01 09:21:35 UTC

Unit testing of an existing RouteBuilder class

Hi

I was reading how camel supports unit testing of an existing RouteBuilder
class. 

I think this is very useful as I don't want to have to duplicate the route
in the unit test. 

However, suppose the route defined in the existing RouteBuilder class
contains an endpoint that I need to mock. Is there anyway after loading the
route in the unit test class that I can replace the endpoint that needs to
be mocked?

Thanks

--
View this message in context: http://camel.465427.n5.nabble.com/Unit-testing-of-an-existing-RouteBuilder-class-tp5715327.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unit testing of an existing RouteBuilder class

Posted by Christian Müller <ch...@gmail.com>.
Or you use a properties placeholder and provide different endpoint URI's
for your test environment.

Best,
Christian

On Sun, Jul 1, 2012 at 9:36 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Yeah I suggest to read these couple of links
> http://camel.apache.org/advicewith.html
> http://camel.apache.org/mock
>
> For example the advice with allows you to manipulate the routes before
> unit testing.
> And mock allows to mock endpoints by pattern, and whether to skip
> sending to the target endpoint or not.
>
>
>
> On Sun, Jul 1, 2012 at 9:21 AM, gilboy <jo...@gmail.com> wrote:
> > Hi
> >
> > I was reading how camel supports unit testing of an existing RouteBuilder
> > class.
> >
> > I think this is very useful as I don't want to have to duplicate the
> route
> > in the unit test.
> >
> > However, suppose the route defined in the existing RouteBuilder class
> > contains an endpoint that I need to mock. Is there anyway after loading
> the
> > route in the unit test class that I can replace the endpoint that needs
> to
> > be mocked?
> >
> > Thanks
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Unit-testing-of-an-existing-RouteBuilder-class-tp5715327.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>

Re: Unit testing of an existing RouteBuilder class

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah I suggest to read these couple of links
http://camel.apache.org/advicewith.html
http://camel.apache.org/mock

For example the advice with allows you to manipulate the routes before
unit testing.
And mock allows to mock endpoints by pattern, and whether to skip
sending to the target endpoint or not.



On Sun, Jul 1, 2012 at 9:21 AM, gilboy <jo...@gmail.com> wrote:
> Hi
>
> I was reading how camel supports unit testing of an existing RouteBuilder
> class.
>
> I think this is very useful as I don't want to have to duplicate the route
> in the unit test.
>
> However, suppose the route defined in the existing RouteBuilder class
> contains an endpoint that I need to mock. Is there anyway after loading the
> route in the unit test class that I can replace the endpoint that needs to
> be mocked?
>
> Thanks
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unit-testing-of-an-existing-RouteBuilder-class-tp5715327.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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