camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/2] git commit: CAMEL-7123 fixed the test failures
Date Mon, 13 Jan 2014 02:24:36 GMT
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 <willem.jiang@gmail.com>
Authored: Mon Jan 13 10:13:45 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
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("<mail><subject>Hey</subject><body>Hello
world!</body></mail>".getBytes());
     }
     
-    public void testSendEntityMessage() throws Exception {
-        
-        MockEndpoint endpoint = getMockEndpoint("mock:result");
-        endpoint.expectedMessageCount(1);
-        //String message = "<!DOCTYPE foo [<!ENTITY xxe SYSTEM \"file:///Users//jiangning//.CFUserTextEncoding\">]><task><name>&xxe;</name></task>";
-
-        String message = "<hello/>";
-        template.sendBody("direct:start2", message);
-
-        assertMockEndpointsSatisfied();
-        
-        List<Exchange> 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<Exchange> 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 = "<name>Camel</name>";
@@ -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();
     }
 


Mime
View raw message