camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fordm <ford.j.mar...@gmail.com>
Subject Mocking an endpoint within a try-catch block
Date Thu, 07 Feb 2013 09:40:51 GMT
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).

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.

Mime
View raw message