camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Mocking an endpoint within a try-catch block
Date Thu, 07 Feb 2013 09:46:23 GMT
On Thu, Feb 7, 2013 at 10:40 AM, fordm <ford.j.martin@gmail.com> wrote:
> Hi,
>
> Using Camel 2.10, I'm writing a test for the following camel route,
> contained in a blueprint:
>
> <route id="myRoute">
>   <from uri="direct:sendEmail"/>
>   <doTry>
>     <log message="The message contains ${body}"/>
>     <to id="smtpEndpoint" uri="smtp://localhost:25" />
>     <doCatch>
>       <exception>java.lang.Exception</exception>
>       <log message="Exception caught when processing email request" />
>     </doCatch>
>     <doFinally>
>       <log message="Email Response processed ${body}" />
>     </doFinally>
>   </doTry>
> </route>
>
> If the smtpEndpoint is outside the doTry then I can happily mock the
> endpoint using adviceWith (and weaveById).
>
> However, if the smtpEndpoint is inside the doTry mocking the endpoint with
> adviceWith fails (the test tries to connect to a SMTP server on
> localhost:25).
>
> Is there something I'm missing or is it just not possible to mock endpoints
> within a doTry (which I find hard to believe).
>

Can you share the advice with code you use?


> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mocking-an-endpoint-within-a-try-catch-block-tp5727081.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

Mime
View raw message