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

[3/8] camel git commit: Add test based on user forum trouble

Add test based on user forum trouble


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

Branch: refs/heads/master
Commit: 9a82687c6cb2fba229609d04f94cefa57e998beb
Parents: c2f3631
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Apr 9 09:17:55 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Apr 9 09:17:55 2016 +0200

----------------------------------------------------------------------
 .../netty4/http/NettyHttp500ErrorTest.java       | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9a82687c/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttp500ErrorTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttp500ErrorTest.java b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttp500ErrorTest.java
index ef8ddbe..f895fac 100644
--- a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttp500ErrorTest.java
+++ b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttp500ErrorTest.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.netty4.http;
 
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
 
@@ -49,6 +50,24 @@ public class NettyHttp500ErrorTest extends BaseNettyTest {
         assertMockEndpointsSatisfied();
     }
 
+    @Test
+    public void testHttp500ErrorDisabledStatusCode() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
+
+        Exchange out = template.request("netty4-http:http://localhost:{{port}}/foo?throwExceptionOnFailure=false", new Processor() {
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                exchange.getIn().setBody("Hello World");
+            }
+        });
+        assertNotNull(out);
+
+        assertEquals(500, out.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE));
+        assertEquals("Internal Server Error", out.getOut().getHeader(Exchange.HTTP_RESPONSE_TEXT));
+
+        assertMockEndpointsSatisfied();
+    }
+
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {