Repository: camel Updated Branches: refs/heads/master 1592c2988 -> c60691dbb
Added unit test based on user forum issue Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c60691db Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c60691db Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c60691db Branch: refs/heads/master Commit: c60691dbb1066778d1cc86c44c4e2db1319e4566 Parents: 1592c29 Author: Claus Ibsen <[email protected]> Authored: Tue May 16 14:37:41 2017 +0200 Committer: Claus Ibsen <[email protected]> Committed: Tue May 16 14:37:41 2017 +0200 ---------------------------------------------------------------------- .../properties/myproperties.properties | 3 +- ...SpringOptionalPropertiesDslTokenizeTest.java | 45 ++++++++++++++++++++ .../SpringOptionalPropertiesDslTokenizeTest.xml | 45 ++++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/c60691db/camel-core/src/test/resources/org/apache/camel/component/properties/myproperties.properties ---------------------------------------------------------------------- diff --git a/camel-core/src/test/resources/org/apache/camel/component/properties/myproperties.properties b/camel-core/src/test/resources/org/apache/camel/component/properties/myproperties.properties index 5cfac14..8c698d5 100644 --- a/camel-core/src/test/resources/org/apache/camel/component/properties/myproperties.properties +++ b/camel-core/src/test/resources/org/apache/camel/component/properties/myproperties.properties @@ -40,5 +40,4 @@ myQueueSize=10 myDelayPattern=3:1000;5:3000;10:5000;20:10000 stop=true - - +onlytwo=2 http://git-wip-us.apache.org/repos/asf/camel/blob/c60691db/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.java b/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.java new file mode 100644 index 0000000..c6bd48d --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.java @@ -0,0 +1,45 @@ +/** + * 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.component.properties; + +import org.apache.camel.spring.SpringTestSupport; +import org.junit.Test; +import org.springframework.context.support.AbstractXmlApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * Spring placeholder DSL test + */ +public class SpringOptionalPropertiesDslTokenizeTest extends SpringTestSupport { + + @Override + protected AbstractXmlApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.xml"); + } + + @Test + public void testPlaceholderDslTest() throws Exception { + // should come in groups of 2 + getMockEndpoint("mock:a").expectedMessageCount(2); + getMockEndpoint("mock:a").expectedBodiesReceived("a,b", "c,d"); + + template.sendBody("direct:start", "a,b,c,d"); + + assertMockEndpointsSatisfied(); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/c60691db/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.xml new file mode 100644 index 0000000..ec20873 --- /dev/null +++ b/components/camel-spring/src/test/resources/org/apache/camel/component/properties/SpringOptionalPropertiesDslTokenizeTest.xml @@ -0,0 +1,45 @@ +<?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:prop="http://camel.apache.org/schema/placeholder" + 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 + "> + + <camelContext xmlns="http://camel.apache.org/schema/spring"> + + <propertyPlaceholder id="properties" + location="classpath:org/apache/camel/component/properties/myproperties.properties" + xmlns="http://camel.apache.org/schema/spring"/> + + <route> + <from uri="direct:start"/> + <split> + <tokenize token="," prop:group="onlytwo"/> + <to uri="mock:a"/> + </split> + </route> + + </camelContext> + +</beans> +
