camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
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 <> 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

You can also use the interceptSendToEndpoint and then
skipSendToOriginalEndpoint as shown here

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:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus
Author of Camel in Action:

View raw message