Updated Branches: refs/heads/master b5902106e -> 13a454b27
CAMEL-6400: Added unit test. Thanks to Nerses Aznauryan for the test. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/89a575a0 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/89a575a0 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/89a575a0 Branch: refs/heads/master Commit: 89a575a0e8cd1cab33ee3ead3c36dc5a13024450 Parents: 4e7a1d6 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue May 28 07:45:53 2013 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue May 28 07:55:46 2013 +0200 ---------------------------------------------------------------------- .../SpringSimplePropertyPlaceholderClashTest.java | 51 +++++++++++++++ ...gSimplePropertyPlaceholderClashTest-context.xml | 32 +++++++++ ...simplePropertiesPlaceholderClashTest.properties | 18 +++++ 3 files changed, 101 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/89a575a0/components/camel-spring/src/test/java/org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest.java b/components/camel-spring/src/test/java/org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest.java new file mode 100644 index 0000000..f8b7fb1 --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest.java @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.language; + +import org.apache.camel.Exchange; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.spring.SpringTestSupport; +import org.springframework.context.support.AbstractXmlApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class SpringSimplePropertyPlaceholderClashTest extends SpringTestSupport { + + @Override + protected AbstractXmlApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest-context.xml"); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start") + .setHeader(Exchange.FILE_NAME, simple("{{file.rootdir}}/$simple{in.header.CamelFileName}")) + .to("mock:result"); + } + }; + } + + public void testReplaceSimpleExpression() throws Exception { + getMockEndpoint("mock:result").expectedHeaderReceived(Exchange.FILE_NAME, "/root/dir/test.txt"); + + template.sendBodyAndHeader("direct:start", "Test", Exchange.FILE_NAME, "test.txt"); + + assertMockEndpointsSatisfied(); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/89a575a0/components/camel-spring/src/test/resources/org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest-context.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest-context.xml b/components/camel-spring/src/test/resources/org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest-context.xml new file mode 100644 index 0000000..437836f --- /dev/null +++ b/components/camel-spring/src/test/resources/org/apache/camel/language/SpringSimplePropertyPlaceholderClashTest-context.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:camel="http://camel.apache.org/schema/spring" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer"> + <property name="location" value="classpath:org/apache/camel/language/simplePropertiesPlaceholderClashTest.properties"/> + </bean> + + <camel:camelContext id="camel"> + <camel:contextScan/> + </camel:camelContext> + +</beans> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89a575a0/components/camel-spring/src/test/resources/org/apache/camel/language/simplePropertiesPlaceholderClashTest.properties ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/language/simplePropertiesPlaceholderClashTest.properties b/components/camel-spring/src/test/resources/org/apache/camel/language/simplePropertiesPlaceholderClashTest.properties new file mode 100644 index 0000000..48adbb2 --- /dev/null +++ b/components/camel-spring/src/test/resources/org/apache/camel/language/simplePropertiesPlaceholderClashTest.properties @@ -0,0 +1,18 @@ +## ------------------------------------------------------------------------ +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## ------------------------------------------------------------------------ + +file.rootdir=/root/dir \ No newline at end of file