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: Mock endpoints and parameters
Date Fri, 18 Mar 2011 14:34:29 GMT
On Thu, Mar 17, 2011 at 7:43 PM, Barry Kaplan <groups1@memelet.com> wrote:
> I'm trying to test a component that sends email via smtp. But I'm not able to
> configure mock endpoint because it contains parameters that don't get
> resolved.
>
>  ccontext.addComponent("smtp", new MockComponent)
>  val uri = "smtp://host:9999?username=smtpusername&password=smtppassword"
>  ccontext.getEndpoint(uri,
> classOf[MockEndpoint]).expectedBodiesReceived(...)
>
> The getEndpoint fails complaining about ?username and &password paremeters.
>
> I would expect that mock endpoints would not care about parameters.
> Hopefully there must some way to test this that I must be aware of... ?
>

In Camel 2.7 you can more easily manipulate your routes using the weave
http://camel.apache.org/advicewith.html

You can also use the interceptSendToEndpoint and then
skipSendToOriginalEndpoint as shown here
http://camel.apache.org/advicewith.html

We should most likely let mocks be lenient about options so you can do
what Barry wanna do.
To substitute an endpoint uri with a mock by replacing the component.
Thats also very easy to understand how to do.

Fell free to create a JIRA, all it requires is to set isLenient()
return true. See camel-http for example.

> --
> View this message in context: http://camel.465427.n5.nabble.com/Mock-endpoints-and-parameters-tp3894208p3894208.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
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message