Another option is to create a Mock endpoint and register it into the
context as the URI you want.

context.addEndpoint("smtp://host:9999?username=smtpusername&password=smtppassword",
new MockEndpoint());


On 18 March 2011 14:34, Claus Ibsen <claus.ib...@gmail.com> wrote:
> On Thu, Mar 17, 2011 at 7:43 PM, Barry Kaplan <grou...@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: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
James
-------
FuseSource
Email: ja...@fusesource.com
Web: http://fusesource.com
Twitter: jstrachan
Blog: http://macstrac.blogspot.com/

Open Source Integration

Reply via email to