svn commit: r550444 - in /activemq/camel/trunk/components/camel-http/src: main/java/org/apache/camel/component/http/HttpMessage.java test/java/org/apache/camel/component/http/HttpRouteTest.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r550444 - in /activemq/camel/trunk/components/camel-http/src: main/java/org/apache/camel/component/http/HttpMessage.java test/java/org/apache/camel/component/http/HttpRouteTest.java

jstrachan-2
Author: jstrachan
Date: Mon Jun 25 03:21:08 2007
New Revision: 550444

URL: http://svn.apache.org/viewvc?view=rev&rev=550444
Log:
fixed up the test case to remove some of the timing issue from it as we force the conversion to a String to happen within the route (and the HTTP servlet)

Modified:
    activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
    activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRouteTest.java

Modified: activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java?view=diff&rev=550444&r1=550443&r2=550444
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java (original)
+++ activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpMessage.java Mon Jun 25 03:21:08 2007
@@ -37,8 +37,9 @@
         setExchange(exchange);
         this.request = request;
 
-        // lets force a parse of the body
+        // lets force a parse of the body and headers
         getBody();
+        getHeaders();
     }
 
     @Override

Modified: activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRouteTest.java?view=diff&rev=550444&r1=550443&r2=550444
==============================================================================
--- activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRouteTest.java (original)
+++ activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRouteTest.java Mon Jun 25 03:21:08 2007
@@ -32,6 +32,7 @@
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @version $Revision: 520220 $
@@ -53,12 +54,14 @@
         Message in = exchange.getIn();
         assertNotNull("in", in);
 
+        Map<String,Object> headers = in.getHeaders();
         String actualBody = in.getBody(String.class);
 
-        log.info("Headers: " + in.getHeaders());
+        log.info("Headers: " + headers);
         log.info("Received body: " + actualBody);
 
         assertEquals("Body", expectedBody, actualBody);
+        assertTrue("Should be more than one header but was: " + headers, headers.size() > 0);
     }
 
     protected void invokeHttpEndpoint() throws IOException {
@@ -94,7 +97,7 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() {
-                from("http://localhost:8080/test").to("mock:a");
+                from("http://localhost:8080/test").convertBodyTo(String.class).to("mock:a");
             }
         };
     }