camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1458217 - in /camel/trunk/components/camel-jetty/src/test: java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java resources/log4j.properties
Date Tue, 19 Mar 2013 10:48:30 GMT
Author: davsclaus
Date: Tue Mar 19 10:48:30 2013
New Revision: 1458217

URL: http://svn.apache.org/r1458217
Log:
CAMEL-6175: Issue when bridging with jetty http producer and uri query parameter has encoded
value

Modified:
    camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
    camel/trunk/components/camel-jetty/src/test/resources/log4j.properties

Modified: camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java?rev=1458217&r1=1458216&r2=1458217&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
(original)
+++ camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpBridgeEncodedPathTest.java
Tue Mar 19 10:48:30 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.component.jetty;
 
-import java.io.ByteArrayInputStream;
-
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
@@ -30,8 +28,7 @@ public class JettyHttpBridgeEncodedPathT
 
     @Test
     public void testJettyHttpClient() throws Exception {
-        String response = template.requestBodyAndHeader("http://localhost:" + port2 + "/jettyTestRouteA?param1=%2B447777111222",
-                new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "text/plain",
String.class);
+        String response = template.requestBody("http://localhost:" + port2 + "/jettyTestRouteA?param1=%2B447777111222",
null, String.class);
         assertEquals("Get a wrong response", "param1=+447777111222", response);
     }
 
@@ -48,25 +45,22 @@ public class JettyHttpBridgeEncodedPathT
                     public void process(Exchange exchange) throws Exception {
                         // %2B becomes decoded to a space
                         Object s = exchange.getIn().getHeader("param1");
-                        assertEquals(" 447777111222", exchange.getIn().getHeader("param1"));
-                        // and in the http query %20 becomes a + sign
-                        assertEquals("param1=+447777111222", exchange.getIn().getHeader(Exchange.HTTP_QUERY));
+                        // can be either + or %2B
+                        assertTrue(s.equals(" 447777111222") || s.equals("+447777111222")
|| s.equals("%2B447777111222"));
 
                         // send back the query
                         exchange.getOut().setBody(exchange.getIn().getHeader(Exchange.HTTP_QUERY));
                     }
                 };
                 from("jetty://http://localhost:" + port2 + "/jettyTestRouteA?matchOnUriPrefix=true")
-                    .log("Using JettyTestRouteA route: CamelHttpPath=[${header.CamelHttpPath}],
CamelHttpUri=[${header.CamelHttpUri}]")
-                    // TODO: Jetty has a bug in its client so use http for now
-                    // .to("jetty://http://localhost:" + port1 + "/jettyTestRouteB?throwExceptionOnFailure=false&bridgeEndpoint=true");
-                    .to("http://localhost:" + port1 + "/jettyTestRouteB?throwExceptionOnFailure=false&bridgeEndpoint=true");
+                        .log("Using JettyTestRouteA route: CamelHttpPath=[${header.CamelHttpPath}],
CamelHttpUri=[${header.CamelHttpUri}]")
+                        .to("jetty://http://localhost:" + port1 + "/jettyTestRouteB?throwExceptionOnFailure=false&bridgeEndpoint=true");
 
                 from("jetty://http://localhost:" + port1 + "/jettyTestRouteB?matchOnUriPrefix=true")
-                    .log("Using JettyTestRouteB route: CamelHttpPath=[${header.CamelHttpPath}],
CamelHttpUri=[${header.CamelHttpUri}]")
-                    .process(serviceProc);
+                        .log("Using JettyTestRouteB route: CamelHttpPath=[${header.CamelHttpPath}],
CamelHttpUri=[${header.CamelHttpUri}]")
+                        .process(serviceProc);
             }
         };
-    }    
+    }
 
 }

Modified: camel/trunk/components/camel-jetty/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/test/resources/log4j.properties?rev=1458217&r1=1458216&r2=1458217&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/test/resources/log4j.properties (original)
+++ camel/trunk/components/camel-jetty/src/test/resources/log4j.properties Tue Mar 19 10:48:30
2013
@@ -27,6 +27,7 @@ log4j.rootLogger=INFO, file
 #log4j.logger.org.apache.camel.component.jetty=TRACE
 #log4j.logger.org.apache.camel.component.jetty.CamelContinuationServlet=TRACE
 #log4j.logger.org.apache.camel.component.http.CamelServlet=TRACE
+#log4j.logger.org.apache.camel.component.jetty.JettyContentExchange=DEBUG
 #log4j.logger.org.apache.camel.component.http=TRACE
 #log4j.logger.org.apache.camel=DEBUG
 #log4j.logger.org.apache.camel.impl.converter.PropertyEditorTypeConverter=TRACE



Mime
View raw message