Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AD2110A10 for ; Mon, 9 Dec 2013 02:11:11 +0000 (UTC) Received: (qmail 37124 invoked by uid 500); 9 Dec 2013 02:11:07 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 36021 invoked by uid 500); 9 Dec 2013 02:11:07 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 34816 invoked by uid 99); 9 Dec 2013 02:11:06 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Dec 2013 02:11:06 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EEE648ABC22; Mon, 9 Dec 2013 02:11:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Date: Mon, 09 Dec 2013 02:11:37 -0000 Message-Id: <283faef50a4a4633aae68c961449cf88@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [33/50] [abbrv] git commit: CAMEL-7036 Fixed the issue of Camel XSD validation not working with apache xerces CAMEL-7036 Fixed the issue of Camel XSD validation not working with apache xerces Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f5dafb14 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f5dafb14 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f5dafb14 Branch: refs/heads/camel-gora Commit: f5dafb1495fe307f6a5aeb4a4adbc85d478d77a9 Parents: 1c1d3a8 Author: Willem Jiang Authored: Wed Dec 4 12:51:50 2013 +0800 Committer: Willem Jiang Committed: Wed Dec 4 12:52:18 2013 +0800 ---------------------------------------------------------------------- .../processor/validation/ValidatingProcessor.java | 5 ++--- .../camel/processor/ValidatingProcessorTest.java | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/f5dafb14/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java index bd9f783..200d0fe 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java +++ b/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java @@ -130,13 +130,12 @@ public class ValidatingProcessor implements AsyncProcessor { } } + //CAMEL-7036 We don't need to set the result if the source is an instance of StreamSource if (source instanceof DOMSource) { result = new DOMResult(); - } else if (source instanceof StreamSource) { - result = new StreamResult(new StringWriter()); } else if (source instanceof SAXSource) { result = new SAXResult(); - } else if (source instanceof StAXSource) { + } else if (source instanceof StAXSource || source instanceof StreamSource) { result = null; } http://git-wip-us.apache.org/repos/asf/camel/blob/f5dafb14/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java b/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java index 2b2175e..0726e2b 100644 --- a/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java +++ b/camel-core/src/test/java/org/apache/camel/processor/ValidatingProcessorTest.java @@ -20,6 +20,7 @@ import java.io.File; import org.apache.camel.ContextTestSupport; import org.apache.camel.RuntimeCamelException; +import org.apache.camel.StringSource; import org.apache.camel.ValidationException; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; @@ -56,6 +57,21 @@ public class ValidatingProcessorTest extends ContextTestSupport { assertMockEndpointsSatisfied(); } + + public void testStringSourceMessage() throws Exception { + MockEndpoint mock = getMockEndpoint("mock:valid"); + mock.expectedMessageCount(1); + + String xml = "" + + "" + + " 1" + + " davsclaus" + + ""; + + template.sendBody("direct:start", new StringSource(xml)); + + assertMockEndpointsSatisfied(); + } public void testValidMessageTwice() throws Exception { MockEndpoint mock = getMockEndpoint("mock:valid");