camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <>
Subject Re: 答复: How to test routes in exported OSGI bundles using Camel Test Framework
Date Mon, 29 Aug 2011 10:51:09 GMT
You can get the mock endpoint from camel context.
If you want to replace it with real component with mock enpdoint, you 
may need to change the route yourself.

On 8/29/11 11:22 AM, XiaoPeng Li wrote:
> Hi Jiang
> Thanks for your reply.
> Sorry about the unclear description. I mean someone has finished a Route with some logic
endpoints, and then exported it as an OSGI bundle. And if he/she wants to test the Route,
how to mock the real endpoints?
> In a typical route test, users have to provide a route to test in "createRouteBuilder()"
if using "org.apache.camel.test.junit4.CamelTestSupport". And If the route has been finished
and only binary classes are provided, how to do such Mock components replacement?
> For example, how to add the "mock:result" endpoint?
> " @EndpointInject(uri = "mock:result")
>    protected MockEndpoint resultEndpoint;"
> Maybe I got some misunderstanding about Camel Test framework, I thought it was due to
route developers who do the mock component replacement.
> Thanks
> Xiaopeng Li
> -----邮件原件-----
> 发件人: Willem Jiang []
> 发送时间: 2011年8月29日 10:58
> 收件人:
> 主题: Re: How to test routes in exported OSGI bundles using Camel Test Framework
> I don't get what you are asking for.
> If you want to test the route by using the Camel Test Framework, you
> don't need to care about the if the route is in a OSGi bundle or not.
> The Mock endpoint can do it job if you setup the test framework rightly.
> On Mon Aug 29 10:39:54 2011, XiaoPeng Li wrote:
>> Hi
>> Here is my question:
>> I want to unit test my routes using Camel Test Framework, however these routes are
exported as OSGI bundles which only contains binary classes or resources. Thus it's hard to
Mock the real endpoint using Mock component, would someone give some suggestions?
>> I am using Camel 2.7.2
>> Thanks
>> Xiaopeng Li

Blog: (English)
Twitter: willemjiang
Weibo: willemjiang

View raw message