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:27 UTC
[7/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/9160475d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9160475d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9160475d
Branch: refs/heads/camel-2.16.x
Commit: 9160475de448688d8b2762eac86d473ba647cd52
Parents: 20bbbcc
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:23:03 2016 +0200
----------------------------------------------------------------------
.../netty4/http/NettyHttp500ErrorTest.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9160475d/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() {