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 in a blueprint that contains a property placeholder
Date Tue, 05 Feb 2013 14:26:26 GMT
On Tue, Feb 5, 2013 at 3:18 PM, Martin Ford <Martin.Ford@monitise.com> wrote:
> Hi,
>
>
>
> I have a simple blueprint route that uses camel-mail to send an email. The protocol (i.e.
component), host and port are set up as property
>
> placeholders:
>
>
>
> <route id="myRoute">
>
>   <from uri="direct:sendEmail"/>
>
>   <to uri="{{email.protocol}}://{{email.host}}:{{email.port}}" />
>
> </route>
>
>
>
> When deployed to Fuse ESB the blueprint containing this route works fine. My problem
comes when trying to mock the to endpoint in a unit test (which extends CamelBlueprintTestSupport).
>
>
>
> When I run my test I find that it's looking for a ComponentResolver for component={{email.protocol}},
which makes sense. Unfortunately this seems to be happening during the creation of the CamelContext
so I can't mock it or replace it with a stub.
>
>
>
> I believe I could create a ComponentResolver to handle such a component, but I'd rather
not. Is there a simpler solution?
>
>
>
> If you're wondering, I've got the component part of the endpoint as a property placeholder
so we can easily configure smpt vs. smtps.
>

I think there is a method on CamelTestSupport =
useOverridePropertiesWithPropertiesComponent you can override and
return the properties to use for testing.
I guess we should document that on: http://camel.apache.org/camel-test.html.



>
> Thanks
>
> ________________________________
>
> This message contains confidential and proprietary information of the sender, and is
intended only for the person(s) to whom it is addressed. Any use, distribution, copying, disclosure
or taking of any action in reliance upon it by any other person is strictly prohibited. If
you have received this message in error, please notify the e-mail sender immediately, and
delete the original message without making a copy. Monitise accepts no liability if this email
harms any systems or data of the recipient (including as a result of software virus infection
or where this e-mail is modified or amended in any way during or following transmission) or
if this email is accessed by anyone other than the person(s) to whom it is addressed.
>
> The Monitise group includes Monitise plc (Reg. No. 6011822), Monitise Group Limited (Reg.
No. 5590897), Monitise International Limited (Reg. No. 5556711), Monitise Europe Limited (Reg.
No. 4831976) and Mobile Money Network Limited (Reg. No. 7153130). These companies are registered
in England and Wales and their registered office address is 95 Gresham Street, London, EC2V
7NA United Kingdom.



-- 
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