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 B4A2410D78 for ; Mon, 13 Jan 2014 02:24:36 +0000 (UTC) Received: (qmail 91248 invoked by uid 500); 13 Jan 2014 02:24:36 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 91202 invoked by uid 500); 13 Jan 2014 02:24:36 -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 91194 invoked by uid 99); 13 Jan 2014 02:24:36 -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, 13 Jan 2014 02:24:36 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 34759913F42; Mon, 13 Jan 2014 02:24:36 +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, 13 Jan 2014 02:24:36 -0000 Message-Id: <93ab026710de4c8482babdb0e8b2579d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: CAMEL-7123 fixed the test failures Updated Branches: refs/heads/camel-2.11.x 570ec9ae7 -> dbaa2bc07 refs/heads/camel-2.12.x 3cc1f5c65 -> 277c9d393 CAMEL-7123 fixed the test failures Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/277c9d39 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/277c9d39 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/277c9d39 Branch: refs/heads/camel-2.12.x Commit: 277c9d3936961af2994ddbbc1ba97b2b0f287ee9 Parents: 3cc1f5c Author: Willem Jiang Authored: Mon Jan 13 10:13:45 2014 +0800 Committer: Willem Jiang Committed: Mon Jan 13 10:24:02 2014 +0800 ---------------------------------------------------------------------- .../camel/component/xslt/XsltRouteTest.java | 27 ++------------------ .../xslt/XsltTransformingExceptionTest.java | 15 +++++++---- 2 files changed, 12 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/277c9d39/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java index 9d1e5d9..094d5f9d 100644 --- a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltRouteTest.java @@ -22,7 +22,6 @@ import org.apache.camel.ContextTestSupport; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.converter.jaxp.XmlConverter; import org.apache.camel.impl.JndiRegistry; public class XsltRouteTest extends ContextTestSupport { @@ -35,24 +34,6 @@ public class XsltRouteTest extends ContextTestSupport { sendMessageAndHaveItTransformed("HeyHello world!".getBytes()); } - public void testSendEntityMessage() throws Exception { - - MockEndpoint endpoint = getMockEndpoint("mock:result"); - endpoint.expectedMessageCount(1); - //String message = "]>&xxe;"; - - String message = ""; - template.sendBody("direct:start2", message); - - assertMockEndpointsSatisfied(); - - List list = endpoint.getReceivedExchanges(); - Exchange exchange = list.get(0); - String xml = exchange.getIn().getBody(String.class); - - System.out.println(xml); - } - private void sendMessageAndHaveItTransformed(Object body) throws Exception { MockEndpoint endpoint = getMockEndpoint("mock:result"); endpoint.expectedMessageCount(1); @@ -64,8 +45,7 @@ public class XsltRouteTest extends ContextTestSupport { List list = endpoint.getReceivedExchanges(); Exchange exchange = list.get(0); String xml = exchange.getIn().getBody(String.class); - System.out.println(xml); - + assertNotNull("The transformed XML should not be null", xml); assertTrue(xml.indexOf("transformed") > -1); // the cheese tag is in the transform.xsl @@ -89,10 +69,7 @@ public class XsltRouteTest extends ContextTestSupport { .multicast() .beanRef("testBean") .to("mock:result"); - - from("direct:start2") - .to("xslt:org/apache/camel/component/xslt/transform_text_imported.xsl") - .to("mock:result"); + } }; } http://git-wip-us.apache.org/repos/asf/camel/blob/277c9d39/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java index 8afcd83..7b61c39 100644 --- a/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java +++ b/camel-core/src/test/java/org/apache/camel/component/xslt/XsltTransformingExceptionTest.java @@ -22,7 +22,7 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; /** - * + * */ public class XsltTransformingExceptionTest extends ContextTestSupport { private static final String GOOD_XML_STRING = "Camel"; @@ -36,17 +36,22 @@ public class XsltTransformingExceptionTest extends ContextTestSupport { fail("Except a camel Execution exception here"); } catch (CamelExecutionException ex) { assertTrue(ex.getCause() instanceof javax.xml.transform.TransformerException); - assertTrue(ex.getCause().getCause() instanceof IllegalArgumentException); } // we should not get any message from the result endpoint assertMockEndpointsSatisfied(); } + // As the transformer is turned into security processing mode, + // This test behavior is changed. public void testXsltWithoutException() throws Exception { MockEndpoint mock = getMockEndpoint("mock:result"); - mock.expectedMessageCount(1); - mock.message(0).body().contains("Camel"); - template.sendBody("direct:start", GOOD_XML_STRING); + mock.expectedMessageCount(0); + try { + template.sendBody("direct:start", GOOD_XML_STRING); + fail("Except a camel Execution exception here"); + } catch (CamelExecutionException ex) { + assertTrue(ex.getCause() instanceof javax.xml.transform.TransformerException); + } assertMockEndpointsSatisfied(); }