You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2011/09/19 19:45:04 UTC

svn commit: r1172724 - in /camel/branches/camel-2.8.x: ./ components/camel-restlet/ components/camel-restlet/src/main/java/org/apache/camel/component/restlet/ components/camel-restlet/src/test/java/org/apache/camel/component/restlet/

Author: dkulp
Date: Mon Sep 19 17:45:03 2011
New Revision: 1172724

URL: http://svn.apache.org/viewvc?rev=1172724&view=rev
Log:
Merged revisions 1164343 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1164343 | ningjiang | 2011-09-01 23:47:22 -0400 (Thu, 01 Sep 2011) | 1 line
  
  CAMEL-4325 Fixed the issue of wrong exception uri when an HTTP error code is returned
........

Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-restlet/pom.xml
    camel/branches/camel-2.8.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
    camel/branches/camel-2.8.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletExceptionResponseTest.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 19 17:45:03 2011
@@ -1 +1 @@
-/camel/trunk:1148706,1148710,1149570,1150300-1150311,1150651,1151000,1151054,1151087,1151126,1151362,1152170,1152569,1152733,1152755,1152868,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1158230,1158295,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163231,1163420,1163656-1163669,1163725,1164544,1164557,1164633,1164972-1165000,1165152,1165157,1165658,1165971,1165987,1167098,1167131,1167448,1167487,1167555,1169610,1169620,1170122,1170226,1170397,1170956,1171396,1171755,1171941,1171947
+/camel/trunk:1148706,1148710,1149570,1150300-1150311,1150651,1151000,1151054,1151087,1151126,1151362,1152170,1152569,1152733,1152755,1152868,1153620,1153812,1153829,1154684,1155230,1156108,1156260,1156277,1156479,1156524,1157348,1157749,1157798,1157831,1157878,1158153,1158230,1158295,1159171,1159174,1159326,1159457,1159460,1159606,1159682-1159683,1159867,1160547,1160637,1161010,1161082,1161524,1162309,1162395,1163231,1163420,1163656-1163669,1163725,1164343,1164544,1164557,1164633,1164972-1165000,1165152,1165157,1165658,1165971,1165987,1167098,1167131,1167448,1167487,1167555,1169610,1169620,1170122,1170226,1170397,1170956,1171396,1171755,1171941,1171947

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/components/camel-restlet/pom.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-restlet/pom.xml?rev=1172724&r1=1172723&r2=1172724&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-restlet/pom.xml (original)
+++ camel/branches/camel-2.8.x/components/camel-restlet/pom.xml Mon Sep 19 17:45:03 2011
@@ -72,6 +72,12 @@
     </dependency>
 
     <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-jetty</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>
       <version>${httpclient4-version}</version>

Modified: camel/branches/camel-2.8.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java?rev=1172724&r1=1172723&r2=1172724&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java (original)
+++ camel/branches/camel-2.8.x/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java Mon Sep 19 17:45:03 2011
@@ -168,7 +168,7 @@ public class RestletProducer extends Def
 
     protected RestletOperationException populateRestletProducerException(Exchange exchange, Response response, int responseCode) {
         RestletOperationException exception;
-        String uri = exchange.getFromEndpoint().getEndpointUri();
+        String uri = response.getRequest().getResourceRef().toString();
         String statusText = response.getStatus().getDescription();
         Map<String, String> headers = parseResponseHeaders(response, exchange);
         String copy = response.toString();

Modified: camel/branches/camel-2.8.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletExceptionResponseTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletExceptionResponseTest.java?rev=1172724&r1=1172723&r2=1172724&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletExceptionResponseTest.java (original)
+++ camel/branches/camel-2.8.x/components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestletExceptionResponseTest.java Mon Sep 19 17:45:03 2011
@@ -41,6 +41,7 @@ public class RestletExceptionResponseTes
                         exchange.setException(new IllegalArgumentException("Damn something went wrong"));
                     }
                 });
+                from("direct:start").to("restlet:http://localhost:" + portNum + "/users/tester?restletMethod=POST");
             }
         };
     }
@@ -54,4 +55,31 @@ public class RestletExceptionResponseTes
         assertTrue(body.contains("IllegalArgumentException"));
         assertTrue(body.contains("Damn something went wrong"));
     }
+
+    @Test
+    public void testRestletProducerGetExceptionResponse() throws Exception {
+        sendRequest("restlet:http://localhost:" + portNum + "/users/tester?restletMethod=POST");
+    }
+
+    @Test
+    public void testSendRequestDirectEndpoint() throws Exception {
+        sendRequest("direct:start");
+    }
+
+    protected void sendRequest(String endpointUri) throws Exception {
+        Exchange exchange = template.request(
+            endpointUri,
+                new Processor() {
+                    @Override
+                    public void process(Exchange exchange) throws Exception {
+                        exchange.getIn().setBody("<order foo='1'/>");
+                    }
+            });
+        RestletOperationException exception = (RestletOperationException) exchange.getException();
+        String body = exception.getResponseBody();
+        assertEquals("http://localhost:" + portNum + "/users/tester", exception.getUri());
+        assertTrue(body.contains("IllegalArgumentException"));
+        assertTrue(body.contains("Damn something went wrong"));
+    }
+
 }
\ No newline at end of file