Updated Branches: refs/heads/master b62e88ff6 -> bcc65808b
Extended the test to show the user how to properly make use of the Spring PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_XYZ setting. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bcc65808 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bcc65808 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bcc65808 Branch: refs/heads/master Commit: bcc65808bc7373832410ee53bb98db258add3259 Parents: b62e88f Author: Babak Vahdat <bvah...@apache.org> Authored: Tue Oct 8 10:20:49 2013 +0200 Committer: Babak Vahdat <bvah...@apache.org> Committed: Tue Oct 8 10:20:49 2013 +0200 ---------------------------------------------------------------------- ...pringPropertyPlaceholderConfigurer3Test.java | 24 ++++++++++++++++++-- ...SpringPropertyPlaceholderConfigurer3Test.xml | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/bcc65808/components/camel-spring/src/test/java/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.java b/components/camel-spring/src/test/java/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.java index b22037d..dcf02dc 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.java +++ b/components/camel-spring/src/test/java/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.java @@ -21,7 +21,6 @@ import java.util.Properties; import org.apache.camel.CamelContext; import org.apache.camel.spring.SpringTestSupport; import org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer; - import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -31,12 +30,33 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class CamelSpringPropertyPlaceholderConfigurer3Test extends SpringTestSupport { @Override + protected void setUp() throws Exception { + // inside the used properties file (cheese.properties) we've defined the following key/value mapping: + // hi2=Guten Tag + // however as we make use of the PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_OVERRIDE mode + // (which is NOT the default mode) we expect that setting the system property below should override + // the mapping being defined above. that's we expect the following key/value mapping taking effect: + // hi2=Gute Nacht + System.setProperty("hi2", "Gute Nacht"); + + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + // clear the property properly to avoid any side effect by the other tests + System.clearProperty("hi2"); + + super.tearDown(); + } + + @Override protected AbstractXmlApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.xml"); } public void testCamelSpringPropertyPlaceholderConfigurerTest() throws Exception { - getMockEndpoint("mock:result").expectedBodiesReceived("Guten Tag Camel"); + getMockEndpoint("mock:result").expectedBodiesReceived("Gute Nacht Camel"); template.sendBody("direct:bar", "Camel"); http://git-wip-us.apache.org/repos/asf/camel/blob/bcc65808/components/camel-spring/src/test/resources/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.xml index b95b2d8..ae5a476 100644 --- a/components/camel-spring/src/test/resources/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.xml +++ b/components/camel-spring/src/test/resources/org/apache/camel/component/properties/CamelSpringPropertyPlaceholderConfigurer3Test.xml @@ -26,6 +26,7 @@ <bean id="myBridgePropertyPlaceholder" class="org.apache.camel.component.properties.CamelSpringPropertyPlaceholderConfigurer3Test$MyBridgePropertyPlaceholderConfigurer"> <property name="location" value="classpath:org/apache/camel/component/properties/cheese.properties"/> + <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/> </bean> <!-- a bean that uses Spring property placeholder -->