You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2012/06/09 14:45:24 UTC

Re: Overwrite blueprint properties in camel blueprint tests

Hi

I logged a ticket to make this easier
https://issues.apache.org/jira/browse/CAMEL-5349


On Fri, May 25, 2012 at 9:22 AM, Michael Süess <mi...@basis06.ch>wrote:

> Hi
>
>
> Yes, this solves the problem of restarting the route after a config change
> in karaf/servicemix.
>
> But my problem is how to set the properties in a junit test using
> CamelBlueprintTestSupport.
>
> - where to put my config file?
> - or can i set the properties programmatically in the junit test class?
>
>
>
> On 25.05.2012 05:20, alexey-s wrote:
>
>> Hi
>>
>> Change cm namespace form
>>   xmlns:cm="http://aries.apache.**org/blueprint/xmlns/blueprint-**
>> cm/v1.0.0 <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0>"
>> to
>>   xmlns:cm="http://aries.apache.**org/blueprint/xmlns/blueprint-**
>> cm/v1.1.0 <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>"
>> and change lile from
>> <cm:property-placeholder persistent-id="foo">
>> to
>> <cm:property-placeholder persistent-id="foo" update-strategy="reload">
>>
>> After change config file $KARAF_HOME/etc/foo.cfg, blueprint restart all
>> camel route in this bundle.
>>
>>
>> Aleksey
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.**
>> com/Overwrite-blueprint-**properties-in-camel-blueprint-**
>> tests-tp5710948p5713531.html<http://camel.465427.n5.nabble.com/Overwrite-blueprint-properties-in-camel-blueprint-tests-tp5710948p5713531.html>
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>
> --
> Michael Sueess                           Senior Software Engineer
>
> basis06 AG, Birkenweg 61, CH-3013 Bern - Fon +41 31 311 32 22
> http://www.basis06.ch - source of smart business
>
> Keine News verpassen? http://www.basis06.ch/**newsletter-registration.html<http://www.basis06.ch/newsletter-registration.html>
> Schon gebloggt? http://blog.basis06.ch
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Overwrite blueprint properties in camel blueprint tests

Posted by Michael Süess <mi...@basis06.ch>.
Hi


i am a little bit confused...


I looked at the jira feature (which is resolved)

CAMEL-5349: Make it easy to provider override properties from unit tests

with the comment

Updated docs. See the using property placeholder docs for details.


i found the new section in the docu
http://camel.apache.org/using-propertyplaceholder.html:

"Available as of Camel 2.10
When Testing with Camel and using the Properties component, you may want 
to be able to provide the properties to be used from directly within the 
unit test source code.
This is now possible from Camel 2.10 onwards, as the Camel test kits, eg 
CamelTestSupport class offers the following methods
useOverridePropertiesWithPropertiesComponent
ignoreMissingLocationWithPropertiesComponent
So for example in your unit test classes, you can override the 
useOverridePropertiesWithPropertiesComponent method and return a 
java.util.Properties that contains the properties which should be 
preferred to be used.
Providing properties from within unit test source
// override this method to provide our custom properties we use in this 
unit test
@Override
protected Properties useOverridePropertiesWithPropertiesComponent() {
     Properties extra = new Properties();
     extra.put("destination", "mock:extra");
     extra.put("greeting", "Bye");
     return extra;
}
This can be done from any of the Camel Test kits, such as camel-test, 
camel-test-spring, and camel-test-blueprint.
The ignoreMissingLocationWithPropertiesComponent can be used to instruct 
Camel to ignore any locations which was not discoverable, for example if 
you run the unit test, in an environment that does not have access to 
the location of the properties."


but i couldn't find the mentioned method in the camel maven 
2.10-SNAPSHOT (be the way, i tried to download the 2.10 windows and 
source distros, both links 
[http://www.apache.org/dyn/closer.cgi/camel/apache-camel/2.10.0/apache-camel-2.10.0.zip 
and 
http://www.apache.org/dyn/closer.cgi/camel/apache-camel/2.10.0/apache-camel-2.10.0-src.zip] 
are broken!)

Thx for any help...


On 09.06.2012 14:45, Claus Ibsen wrote:
> Hi
>
> I logged a ticket to make this easier
> https://issues.apache.org/jira/browse/CAMEL-5349
>
>
> On Fri, May 25, 2012 at 9:22 AM, Michael Süess<mi...@basis06.ch>wrote:
>
>> Hi
>>
>>
>> Yes, this solves the problem of restarting the route after a config change
>> in karaf/servicemix.
>>
>> But my problem is how to set the properties in a junit test using
>> CamelBlueprintTestSupport.
>>
>> - where to put my config file?
>> - or can i set the properties programmatically in the junit test class?
>>
>>
>>
>> On 25.05.2012 05:20, alexey-s wrote:
>>
>>> Hi
>>>
>>> Change cm namespace form
>>>    xmlns:cm="http://aries.apache.**org/blueprint/xmlns/blueprint-**
>>> cm/v1.0.0<http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0>"
>>> to
>>>    xmlns:cm="http://aries.apache.**org/blueprint/xmlns/blueprint-**
>>> cm/v1.1.0<http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>"
>>> and change lile from
>>> <cm:property-placeholder persistent-id="foo">
>>> to
>>> <cm:property-placeholder persistent-id="foo" update-strategy="reload">
>>>
>>> After change config file $KARAF_HOME/etc/foo.cfg, blueprint restart all
>>> camel route in this bundle.
>>>
>>>
>>> Aleksey
>>>
>>> --
>>> View this message in context: http://camel.465427.n5.nabble.**
>>> com/Overwrite-blueprint-**properties-in-camel-blueprint-**
>>> tests-tp5710948p5713531.html<http://camel.465427.n5.nabble.com/Overwrite-blueprint-properties-in-camel-blueprint-tests-tp5710948p5713531.html>
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>> --
>> Michael Sueess                           Senior Software Engineer
>>
>> basis06 AG, Birkenweg 61, CH-3013 Bern - Fon +41 31 311 32 22
>> http://www.basis06.ch - source of smart business
>>
>> Keine News verpassen? http://www.basis06.ch/**newsletter-registration.html<http://www.basis06.ch/newsletter-registration.html>
>> Schon gebloggt? http://blog.basis06.ch
>>
>
>
>