This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch exchange-factory
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 3172229b29b132886a9aa26a268d0d271c9e6e37
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Tue Feb 23 16:25:29 2021 +0100

    CAMEL-16222: PooledExchangeFactory experiment
---
 .../http/NettyHttpSimplePooledExchangeTest.java    | 72 ++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimplePooledExchangeTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimplePooledExchangeTest.java
new file mode 100644
index 0000000..d2e9634
--- /dev/null
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpSimplePooledExchangeTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.netty.http;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.engine.PooledExchangeFactory;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class NettyHttpSimplePooledExchangeTest extends BaseNettyTest {
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext camelContext = super.createCamelContext();
+        camelContext.adapt(ExtendedCamelContext.class).setExchangeFactory(new 
PooledExchangeFactory());
+        return camelContext;
+    }
+
+    @Test
+    public void testOne() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("World");
+
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo";, "World", 
String.class);
+        assertEquals("Bye World", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Test
+    public void testTwo() throws Exception {
+        getMockEndpoint("mock:input").expectedBodiesReceived("World", "Camel");
+
+        String out = 
template.requestBody("netty-http:http://localhost:{{port}}/foo";, "World", 
String.class);
+        assertEquals("Bye World", out);
+
+        out = template.requestBody("netty-http:http://localhost:{{port}}/foo";, 
"Camel", String.class);
+        assertEquals("Bye Camel", out);
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://0.0.0.0:{{port}}/foo";)
+                        .convertBodyTo(String.class)
+                        .to("mock:input")
+                        .transform().simple("Bye ${body}");
+            }
+        };
+    }
+
+}

Reply via email to