You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/10/11 10:24:37 UTC
[3/4] git commit: Added test based on user forum issue
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/041c0ef4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/041c0ef4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/041c0ef4
Branch: refs/heads/camel-2.12.x
Commit: 041c0ef4c0ccaf922459b444792e63c9daa15dae
Parents: de69754
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Oct 11 10:22:33 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Oct 11 10:23:52 2013 +0200
----------------------------------------------------------------------
.../SplitTokenizerXmlMultilineTest.java | 63 ++++++++++++++++++++
1 file changed, 63 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/041c0ef4/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");
+ }
+ };
+ }
+}