Repository: camel
Updated Branches:
  refs/heads/master 642f16b7b -> ab7d838b4


Added test based on user forum issue


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

Branch: refs/heads/master
Commit: f23d56258a63fa5e5e40d7bf745fe4a39c4c3e01
Parents: 642f16b
Author: Claus Ibsen <davscl...@apache.org>
Authored: Fri Mar 4 13:38:17 2016 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Fri Mar 4 13:38:17 2016 +0100

----------------------------------------------------------------------
 .../netty4/http/NettyHttpRedeliveryTest.java    | 73 ++++++++++++++++++++
 .../src/test/resources/log4j.properties         |  8 +--
 2 files changed, 77 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f23d5625/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpRedeliveryTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpRedeliveryTest.java
 
b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpRedeliveryTest.java
new file mode 100644
index 0000000..0f65024
--- /dev/null
+++ 
b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpRedeliveryTest.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.netty4.http;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+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;
+
+public class NettyHttpRedeliveryTest extends BaseNettyTest {
+
+    private final CountDownLatch latch = new CountDownLatch(5);
+
+    @Test
+    public void testHttpRedelivery() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+        assertTrue(latch.await(5, TimeUnit.SECONDS));
+
+        context.startRoute("bar");
+
+        assertMockEndpointsSatisfied();
+
+        context.stopRoute("foo");
+
+        assertEquals(0, context.getInflightRepository().size());
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                onException(Exception.class)
+                    
.maximumRedeliveries(50).redeliveryDelay(100).onExceptionOccurred(new 
Processor() {
+                    @Override
+                    public void process(Exchange exchange) throws Exception {
+                        // signal to start the route (after 5 attempts)
+                        latch.countDown();
+                        // and there is only 1 inflight
+                        assertEquals(1, 
context.getInflightRepository().size());
+                    }
+                });
+
+                from("timer:foo").routeId("foo")
+                    
.to("netty4-http:http://0.0.0.0:{{port}}/bar?keepAlive=false&disconnect=true";)
+                    .to("mock:result");
+
+                
from("netty4-http:http://0.0.0.0:{{port}}/bar";).routeId("bar").autoStartup(false)
+                    .setBody().constant("Bye World");
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/f23d5625/components/camel-netty4-http/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-netty4-http/src/test/resources/log4j.properties 
b/components/camel-netty4-http/src/test/resources/log4j.properties
index a9d61c7..6c00420 100644
--- a/components/camel-netty4-http/src/test/resources/log4j.properties
+++ b/components/camel-netty4-http/src/test/resources/log4j.properties
@@ -30,14 +30,14 @@ log4j.rootLogger=INFO, file
 log4j.appender.out=org.apache.log4j.ConsoleAppender
 log4j.appender.out.layout=org.apache.log4j.PatternLayout
 #log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
-#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
 # MDC
-log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - 
%-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - 
%-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
 
 # File appender
 log4j.appender.file=org.apache.log4j.FileAppender
 log4j.appender.file.layout=org.apache.log4j.PatternLayout
-#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%m%n
 log4j.appender.file.file=target/camel-netty4-http-test.log
 # MDC
-log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - 
%-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - 
%-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - 
%-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n

Reply via email to