Repository: camel
Updated Branches:
  refs/heads/master 59ad39424 -> 69b00a31f


CAMEL-7476 Added an unit test to verify the setting of throwExceptionOnFailure


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6b3c1fa9
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6b3c1fa9
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6b3c1fa9

Branch: refs/heads/master
Commit: 6b3c1fa940446456de9dda31151d87b7fc899aa4
Parents: 59ad394
Author: Willem Jiang <willem.ji...@gmail.com>
Authored: Thu Jun 5 15:37:04 2014 +0800
Committer: Willem Jiang <willem.ji...@gmail.com>
Committed: Fri Jun 6 08:55:05 2014 +0800

----------------------------------------------------------------------
 .../component/cxf/jaxrs/CxfRsProducerTest.java  | 27 ++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6b3c1fa9/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
index 8eb6d0d..0eeb742 100644
--- 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java
@@ -166,6 +166,33 @@ public class CxfRsProducerTest extends 
CamelSpringTestSupport {
     }
     
     @Test
+    public void testSuppressGetCustomerExceptionWithCxfRsEndpoint() {
+        Exchange exchange 
+            = template.send("cxfrs://http://localhost:"; + getPort1() + "/" + 
getClass().getSimpleName() + 
"/?httpClientAPI=true&throwExceptionOnFailure=false", new Processor() {
+                public void process(Exchange exchange) throws Exception {
+                    exchange.setPattern(ExchangePattern.InOut);
+                    Message message = exchange.getIn();
+                    // set the Http method
+                    message.setHeader(Exchange.HTTP_METHOD, "PUT");
+                    // set the relative path
+                    message.setHeader(Exchange.HTTP_PATH, 
"/customerservice/customers");
+                    // we just setup the customer with a wrong id
+                    Customer customer = new Customer();
+                    customer.setId(222);
+                    customer.setName("user");
+                    message.setBody(customer);                
+                }
+            });
+ 
+        // we should get the exception here 
+        assertNull("Don't expect the exception here", exchange.getException());
+        Message result = exchange.getOut();
+        assertEquals("Get a wrong http status code.", 
result.getHeader(Exchange.HTTP_RESPONSE_CODE), 406);
+        
+        
+    }
+    
+    @Test
     public void testGetCustomerExceptionWithCxfRsEndpoint() {
         Exchange exchange 
             = template.send("cxfrs://http://localhost:"; + getPort1() + "/" + 
getClass().getSimpleName() + "/?httpClientAPI=true", new Processor() {

Reply via email to