Repository: camel Updated Branches: refs/heads/master 9b91c58ee -> 257f7df7d
Fixed the CS errors of camel-core Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/257f7df7 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/257f7df7 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/257f7df7 Branch: refs/heads/master Commit: 257f7df7dc1009f4eb9835cca5edf9b6ad814ef1 Parents: 9b91c58 Author: Akitoshi Yoshida <a...@apache.org> Authored: Wed May 28 13:59:16 2014 +0200 Committer: Akitoshi Yoshida <a...@apache.org> Committed: Wed May 28 13:59:16 2014 +0200 ---------------------------------------------------------------------- .../camel/support/RecordableInputStream.java | 15 ++++++++++- .../support/XMLTokenExpressionIterator.java | 21 ++++++++++++--- .../tokenizer/XMLTokenizeLanguageTest.java | 25 +++++++++++------ .../tokenizer/XMLTokenizeWrapLanguageTest.java | 6 +++-- .../support/XMLTokenExpressionIteratorTest.java | 28 ++++++++++++++------ 5 files changed, 73 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/257f7df7/camel-core/src/main/java/org/apache/camel/support/RecordableInputStream.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/support/RecordableInputStream.java b/camel-core/src/main/java/org/apache/camel/support/RecordableInputStream.java index 1a061d8..f0288fe 100644 --- a/camel-core/src/main/java/org/apache/camel/support/RecordableInputStream.java +++ b/camel-core/src/main/java/org/apache/camel/support/RecordableInputStream.java @@ -1,5 +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. */ package org.apache.camel.support; http://git-wip-us.apache.org/repos/asf/camel/blob/257f7df7/camel-core/src/main/java/org/apache/camel/support/XMLTokenExpressionIterator.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/support/XMLTokenExpressionIterator.java b/camel-core/src/main/java/org/apache/camel/support/XMLTokenExpressionIterator.java index 63a3ba0..111bdaa 100644 --- a/camel-core/src/main/java/org/apache/camel/support/XMLTokenExpressionIterator.java +++ b/camel-core/src/main/java/org/apache/camel/support/XMLTokenExpressionIterator.java @@ -1,5 +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. */ package org.apache.camel.support; @@ -288,7 +301,7 @@ public class XMLTokenExpressionIterator extends ExpressionAdapter implements Nam return token; } - private String createContextualToken(String token){ + private String createContextualToken(String token) { StringBuilder sb = new StringBuilder(); if (wrap) { for (int i = 0; i < segments.size(); i++) { @@ -366,7 +379,7 @@ public class XMLTokenExpressionIterator extends ExpressionAdapter implements Nam // intermediary match down(); } - } else if (isDoS()){ + } else if (isDoS()) { // continue } else { // skip @@ -412,6 +425,8 @@ public class XMLTokenExpressionIterator extends ExpressionAdapter implements Nam case XMLStreamReader.END_DOCUMENT: LOG.trace("depth={}", depth); break; + default: + break; } } return null; http://git-wip-us.apache.org/repos/asf/camel/blob/257f7df7/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguageTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguageTest.java b/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguageTest.java index 99c450f..d5c0689 100644 --- a/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguageTest.java +++ b/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeLanguageTest.java @@ -23,7 +23,8 @@ import org.apache.camel.builder.xml.Namespaces; public class XMLTokenizeLanguageTest extends ContextTestSupport { public void testSendClosedTagMessageToTokenize() throws Exception { - getMockEndpoint("mock:result").expectedBodiesReceived("<c:child some_attr='a' anotherAttr='a' xmlns:c=\"urn:c\"></c:child>", "<c:child some_attr='b' anotherAttr='b' xmlns:c=\"urn:c\"></c:child>"); + getMockEndpoint("mock:result").expectedBodiesReceived("<c:child some_attr='a' anotherAttr='a' xmlns:c=\"urn:c\"></c:child>", + "<c:child some_attr='b' anotherAttr='b' xmlns:c=\"urn:c\"></c:child>"); template.sendBody("direct:start", "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child some_attr='a' anotherAttr='a'></c:child><c:child some_attr='b' anotherAttr='b'></c:child></c:parent>"); @@ -32,7 +33,8 @@ public class XMLTokenizeLanguageTest extends ContextTestSupport { } public void testSendClosedTagWithLineBreaksMessageToTokenize() throws Exception { - getMockEndpoint("mock:result").expectedBodiesReceived("<c:child some_attr='a' anotherAttr='a' xmlns:c=\"urn:c\">\n</c:child>", "<c:child some_attr='b' anotherAttr='b' xmlns:c=\"urn:c\">\n</c:child>"); + getMockEndpoint("mock:result").expectedBodiesReceived("<c:child some_attr='a' anotherAttr='a' xmlns:c=\"urn:c\">\n</c:child>", + "<c:child some_attr='b' anotherAttr='b' xmlns:c=\"urn:c\">\n</c:child>"); template.sendBody("direct:start", "<?xml version='1.0' encoding='UTF-8'?>\n" @@ -57,10 +59,13 @@ public class XMLTokenizeLanguageTest extends ContextTestSupport { public void testSendMixedClosingTagMessageToTokenize() throws Exception { getMockEndpoint("mock:result").expectedBodiesReceived( - "<c:child some_attr='a' anotherAttr='a' xmlns:c=\"urn:c\">ha</c:child>", "<c:child some_attr='b' anotherAttr='b' xmlns:c=\"urn:c\"/>", "<c:child some_attr='c' xmlns:c=\"urn:c\"></c:child>"); + "<c:child some_attr='a' anotherAttr='a' xmlns:c=\"urn:c\">ha</c:child>", + "<c:child some_attr='b' anotherAttr='b' xmlns:c=\"urn:c\"/>", + "<c:child some_attr='c' xmlns:c=\"urn:c\"></c:child>"); template.sendBody("direct:start", - "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child some_attr='a' anotherAttr='a'>ha</c:child><c:child some_attr='b' anotherAttr='b' /><c:child some_attr='c'></c:child></c:parent>"); + "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child some_attr='a' anotherAttr='a'>ha</c:child>" + + "<c:child some_attr='b' anotherAttr='b' /><c:child some_attr='c'></c:child></c:parent>"); assertMockEndpointsSatisfied(); } @@ -82,24 +87,28 @@ public class XMLTokenizeLanguageTest extends ContextTestSupport { "<c:child xmlns:c='urn:c' some_attr='a' anotherAttr='a'></c:child>", "<c:child xmlns:c='urn:c' some_attr='b' anotherAttr='b' />"); template.sendBody("direct:start", - "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child xmlns:c='urn:c' some_attr='a' anotherAttr='a'></c:child><c:child xmlns:c='urn:c' some_attr='b' anotherAttr='b' /></c:parent>"); + "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child xmlns:c='urn:c' some_attr='a' anotherAttr='a'></c:child>" + + "<c:child xmlns:c='urn:c' some_attr='b' anotherAttr='b' /></c:parent>"); assertMockEndpointsSatisfied(); } public void testSendNamespacedParentMessageToTokenize() throws Exception { getMockEndpoint("mock:result").expectedBodiesReceived( - "<c:child some_attr='a' anotherAttr='a' xmlns:d=\"urn:d\" xmlns:c=\"urn:c\"></c:child>", "<c:child some_attr='b' anotherAttr='b' xmlns:d=\"urn:d\" xmlns:c=\"urn:c\"/>"); + "<c:child some_attr='a' anotherAttr='a' xmlns:d=\"urn:d\" xmlns:c=\"urn:c\"></c:child>", + "<c:child some_attr='b' anotherAttr='b' xmlns:d=\"urn:d\" xmlns:c=\"urn:c\"/>"); template.sendBody("direct:start", - "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c' xmlns:d=\"urn:d\"><c:child some_attr='a' anotherAttr='a'></c:child><c:child some_attr='b' anotherAttr='b'/></c:parent>"); + "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c' xmlns:d=\"urn:d\"><c:child some_attr='a' anotherAttr='a'></c:child>" + + "<c:child some_attr='b' anotherAttr='b'/></c:parent>"); assertMockEndpointsSatisfied(); } public void testSendMoreParentsMessageToTokenize() throws Exception { getMockEndpoint("mock:result").expectedBodiesReceived( - "<c:child some_attr='a' anotherAttr='a' xmlns:g=\"urn:g\" xmlns:d=\"urn:d\" xmlns:c=\"urn:c\"></c:child>", "<c:child some_attr='b' anotherAttr='b' xmlns:g=\"urn:g\" xmlns:d=\"urn:d\" xmlns:c=\"urn:c\"/>"); + "<c:child some_attr='a' anotherAttr='a' xmlns:g=\"urn:g\" xmlns:d=\"urn:d\" xmlns:c=\"urn:c\"></c:child>", + "<c:child some_attr='b' anotherAttr='b' xmlns:g=\"urn:g\" xmlns:d=\"urn:d\" xmlns:c=\"urn:c\"/>"); template.sendBody("direct:start", "<?xml version='1.0' encoding='UTF-8'?><g:greatgrandparent xmlns:g='urn:g'><grandparent><uncle/><aunt>emma</aunt><c:parent xmlns:c='urn:c' xmlns:d=\"urn:d\">" http://git-wip-us.apache.org/repos/asf/camel/blob/257f7df7/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeWrapLanguageTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeWrapLanguageTest.java b/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeWrapLanguageTest.java index f18e709..1d5d913 100644 --- a/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeWrapLanguageTest.java +++ b/camel-core/src/test/java/org/apache/camel/language/tokenizer/XMLTokenizeWrapLanguageTest.java @@ -65,7 +65,8 @@ public class XMLTokenizeWrapLanguageTest extends ContextTestSupport { "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child some_attr='c'></c:child></c:parent>"); template.sendBody("direct:start", - "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child some_attr='a' anotherAttr='a'>ha</c:child><c:child some_attr='b' anotherAttr='b' /><c:child some_attr='c'></c:child></c:parent>"); + "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child some_attr='a' anotherAttr='a'>ha</c:child>" + + "<c:child some_attr='b' anotherAttr='b' /><c:child some_attr='c'></c:child></c:parent>"); assertMockEndpointsSatisfied(); } @@ -88,7 +89,8 @@ public class XMLTokenizeWrapLanguageTest extends ContextTestSupport { "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child xmlns:c='urn:c' some_attr='b' anotherAttr='b' /></c:parent>"); template.sendBody("direct:start", - "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child xmlns:c='urn:c' some_attr='a' anotherAttr='a'></c:child><c:child xmlns:c='urn:c' some_attr='b' anotherAttr='b' /></c:parent>"); + "<?xml version='1.0' encoding='UTF-8'?><c:parent xmlns:c='urn:c'><c:child xmlns:c='urn:c' some_attr='a' anotherAttr='a'></c:child>" + + "<c:child xmlns:c='urn:c' some_attr='b' anotherAttr='b' /></c:parent>"); assertMockEndpointsSatisfied(); } http://git-wip-us.apache.org/repos/asf/camel/blob/257f7df7/camel-core/src/test/java/org/apache/camel/support/XMLTokenExpressionIteratorTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/support/XMLTokenExpressionIteratorTest.java b/camel-core/src/test/java/org/apache/camel/support/XMLTokenExpressionIteratorTest.java index eedc7f7..67bb159 100644 --- a/camel-core/src/test/java/org/apache/camel/support/XMLTokenExpressionIteratorTest.java +++ b/camel-core/src/test/java/org/apache/camel/support/XMLTokenExpressionIteratorTest.java @@ -1,5 +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. */ package org.apache.camel.support; @@ -12,13 +25,12 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import javax.xml.stream.XMLStreamException; +import junit.framework.TestCase; import org.apache.camel.Exchange; import org.apache.camel.builder.ExchangeBuilder; import org.apache.camel.impl.DefaultCamelContext; -import junit.framework.TestCase; /** * @@ -158,22 +170,22 @@ public class XMLTokenExpressionIteratorTest extends TestCase { invokeAndVerify("//C:child", false, new ByteArrayInputStream(TEST_BODY), RESULTS_CHILD); } - public void testExtractChildWithAncestorGGP_GP() throws Exception { + public void testExtractChildWithAncestorGGPdGP() throws Exception { invokeAndVerify("/G:greatgrandparent/grandparent//C:child", true, new ByteArrayInputStream(TEST_BODY), RESULTS_CHILD_WRAPPED); } - public void testExtractChildWithAncestorGGP_P() throws Exception { + public void testExtractChildWithAncestorGGPdP() throws Exception { invokeAndVerify("/G:greatgrandparent//C:parent/C:child", true, new ByteArrayInputStream(TEST_BODY), RESULTS_CHILD_WRAPPED); } - public void testExtractChildWithAncestorGP__P() throws Exception { + public void testExtractChildWithAncestorGPddP() throws Exception { invokeAndVerify("//grandparent//C:parent/C:child", true, new ByteArrayInputStream(TEST_BODY), RESULTS_CHILD_WRAPPED); } - public void testExtractChildWithAncestorGP_P() throws Exception { + public void testExtractChildWithAncestorGPdP() throws Exception { invokeAndVerify("//grandparent/C:parent/C:child", true, new ByteArrayInputStream(TEST_BODY), RESULTS_CHILD_WRAPPED); } @@ -183,7 +195,7 @@ public class XMLTokenExpressionIteratorTest extends TestCase { true, new ByteArrayInputStream(TEST_BODY), RESULTS_CHILD_WRAPPED); } - public void testExtractChildWithAncestorGGP_GP_P() throws Exception { + public void testExtractChildWithAncestorGGPdGPdP() throws Exception { invokeAndVerify("/G:greatgrandparent/grandparent/C:parent/C:child", true, new ByteArrayInputStream(TEST_BODY), RESULTS_CHILD_WRAPPED); }