Updated Branches: refs/heads/camel-2.12.x de697543a -> ddc6b43c1 refs/heads/master 81d00c1c4 -> e76d870de
Added 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/38c21fe6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/38c21fe6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/38c21fe6 Branch: refs/heads/master Commit: 38c21fe609804b4e3aff9805bc05c1a656f15f8e Parents: 81d00c1 Author: Claus Ibsen <davscl...@apache.org> Authored: Fri Oct 11 10:22:33 2013 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Oct 11 10:22:33 2013 +0200 ---------------------------------------------------------------------- .../SplitTokenizerXmlMultilineTest.java | 63 ++++++++++++++++++++ 1 file changed, 63 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/38c21fe6/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerXmlMultilineTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerXmlMultilineTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerXmlMultilineTest.java new file mode 100644 index 0000000..530b757 --- /dev/null +++ b/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerXmlMultilineTest.java @@ -0,0 +1,63 @@ +/** + * 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.processor; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.builder.RouteBuilder; + +/** + * + */ +public class SplitTokenizerXmlMultilineTest extends ContextTestSupport { + + public void testSingleLine() throws Exception { + String payload = "<Parent>\n" + + "\t<Child A=\"1\" B=\"2\"/>\n" + + "</Parent>"; + + getMockEndpoint("mock:result").expectedMessageCount(1); + + template.sendBody("direct:start", payload); + + assertMockEndpointsSatisfied(); + } + + public void testMultipleLines() throws Exception { + String payload = "<Parent>\n" + + "\t<Child A=\"1\"\n" + + "\tB=\"2\"/>\n" + + "</Parent>"; + + getMockEndpoint("mock:result").expectedMessageCount(1); + + template.sendBody("direct:start", payload); + + assertMockEndpointsSatisfied(); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start") + .split().tokenizeXML("Child") + .to("mock:result"); + } + }; + } +}