Added test based on user issue
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4adb1e74 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4adb1e74 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4adb1e74 Branch: refs/heads/master Commit: 4adb1e7491ec57e968f533017b8c8d6fcb1e018b Parents: 353abe0 Author: Claus Ibsen <davscl...@apache.org> Authored: Wed Jul 24 15:44:49 2013 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Wed Jul 24 15:44:49 2013 +0200 ---------------------------------------------------------------------- .../http/NettyHttpProducerWithHeaderTest.java | 23 ++++++-------------- 1 file changed, 7 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4adb1e74/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java index 8452663..3362cb1 100644 --- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java +++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpProducerWithHeaderTest.java @@ -23,32 +23,23 @@ import org.junit.Test; public class NettyHttpProducerWithHeaderTest extends BaseNettyTest { @Test - public void testHttpSimple() throws Exception { + public void testHttpSimpleGet() throws Exception { getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET"); + getMockEndpoint("mock:input").expectedHeaderReceived("myTraceId", "mockCorrelationID"); - String out = template.requestBody("netty-http:http://localhost:{{port}}/foo", null, String.class); + String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", null, "myTraceId", "mockCorrelationID", String.class); assertEquals("Bye World", out); assertMockEndpointsSatisfied(); } @Test - public void testHttpSimpleHeader() throws Exception { - getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET"); - - String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", null, Exchange.HTTP_METHOD, "GET", String.class); - assertEquals("Bye World", out); - - assertMockEndpointsSatisfied(); - } - - @Test - public void testHttpSimpleHeaderAndBody() throws Exception { - // even if we have a body we force it to be GET + public void testHttpSimplePost() throws Exception { + getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "POST"); + getMockEndpoint("mock:input").expectedHeaderReceived("myTraceId", "mockCorrelationID"); getMockEndpoint("mock:input").expectedBodiesReceived("Hello World"); - getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_METHOD, "GET"); - String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", "Hello World", Exchange.HTTP_METHOD, "GET", String.class); + String out = template.requestBodyAndHeader("netty-http:http://localhost:{{port}}/foo", "Hello World", "myTraceId", "mockCorrelationID", String.class); assertEquals("Bye World", out); assertMockEndpointsSatisfied();