Updated Branches:
  refs/heads/master 8ac07f3fc -> bd6ebd1dd

CAMEL-6004: Tokenize XML does not support self-closing XML tokens - added unit 
test which shows the requested behavior. Thanks to Greg Heidorn for it.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bd6ebd1d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bd6ebd1d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bd6ebd1d

Branch: refs/heads/master
Commit: bd6ebd1dd3c663455a76b0a22812f89663183a9b
Parents: 8ac07f3
Author: cmueller <cmuel...@apache.org>
Authored: Thu May 30 14:05:24 2013 +0200
Committer: cmueller <cmuel...@apache.org>
Committed: Thu May 30 14:05:24 2013 +0200

----------------------------------------------------------------------
 .../language/tokenizer/TokenizeLanguageTest.java   |   74 +++++++++++++++
 1 files changed, 74 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bd6ebd1d/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
 
b/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
new file mode 100644
index 0000000..cbc6c65
--- /dev/null
+++ 
b/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
@@ -0,0 +1,74 @@
+/**
+ * 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.tokenizer;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class TokenizeLanguageTest extends ContextTestSupport {
+
+    @Test
+    public void testSendClosedTagMessageToTokenize() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("<child 
some_attr='a' anotherAttr='a'></child>", "<child some_attr='b' 
anotherAttr='b'></child>");
+
+        template.sendBody("direct:start",
+            "<?xml version='1.0' encoding='UTF-8'?><parent><child 
some_attr='a' anotherAttr='a'></child><child some_attr='b' 
anotherAttr='b'></child></parent>");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testSendClosedTagWithLineBreaksMessageToTokenize() throws 
Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("<child 
some_attr='a' anotherAttr='a'>\n</child>", "<child some_attr='b' 
anotherAttr='b'>\n</child>");
+
+        template.sendBody("direct:start",
+            "<?xml version='1.0' encoding='UTF-8'?>\n"
+                + "<parent>\n"
+                + "<child some_attr='a' anotherAttr='a'>\n"
+                + "</child>\n"
+                + "<child some_attr='b' anotherAttr='b'>\n"
+                + "</child>\n"
+                + "</parent>");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    @Ignore
+    public void testSendSelfClosingTagMessageToTokenize() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("<child 
some_attr='a' anotherAttr='a' />", "<child some_attr='b' anotherAttr='b' />");
+
+        template.sendBody("direct:start",
+            "<?xml version='1.0' encoding='UTF-8'?><parent><child 
some_attr='a' anotherAttr='a' /><child some_attr='b' anotherAttr='b' 
/></parent>");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:start")
+                    .split().tokenizeXML("child")
+                        .to("mock:result")
+                    .end();
+            }
+        };
+    }
+}

Reply via email to