camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1394556 - in /camel/trunk/tests/camel-itest: pom.xml src/test/java/org/apache/camel/itest/netty/ src/test/java/org/apache/camel/itest/netty/NettyAsyncRequestReplyTest.java
Date Fri, 05 Oct 2012 14:52:11 GMT
Author: davsclaus
Date: Fri Oct  5 14:52:10 2012
New Revision: 1394556

URL: http://svn.apache.org/viewvc?rev=1394556&view=rev
Log:
Added test based on user forum issue

Added:
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/netty/
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/netty/NettyAsyncRequestReplyTest.java
  (with props)
Modified:
    camel/trunk/tests/camel-itest/pom.xml

Modified: camel/trunk/tests/camel-itest/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/pom.xml?rev=1394556&r1=1394555&r2=1394556&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/pom.xml (original)
+++ camel/trunk/tests/camel-itest/pom.xml Fri Oct  5 14:52:10 2012
@@ -160,8 +160,13 @@
       <version>1.7</version>
       <scope>test</scope>
     </dependency>
-
     <dependency>
+	  <groupId>org.apache.camel</groupId>
+	  <artifactId>camel-netty</artifactId>
+	  <scope>test</scope>
+	</dependency>
+
+	  <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-ftp</artifactId>
       <scope>test</scope>

Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/netty/NettyAsyncRequestReplyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/netty/NettyAsyncRequestReplyTest.java?rev=1394556&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/netty/NettyAsyncRequestReplyTest.java
(added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/netty/NettyAsyncRequestReplyTest.java
Fri Oct  5 14:52:10 2012
@@ -0,0 +1,69 @@
+/**
+ * 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.itest.netty;
+
+import javax.naming.Context;
+
+import org.apache.activemq.camel.component.ActiveMQComponent;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.util.jndi.JndiContext;
+import org.junit.Test;
+
+/**
+ * Doing request/reply over Netty with async processing.
+ */
+public class NettyAsyncRequestReplyTest extends CamelTestSupport {
+
+    private int port;
+
+    @Test
+    public void testNetty() throws Exception {
+        String out = template.requestBody("netty:tcp://localhost:" + port + "?textline=true?sync=true",
"World", String.class);
+        assertEquals("Bye World", out);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                port = AvailablePortFinder.getNextAvailable(8000);
+
+                from("netty:tcp://localhost:" + port + "?textline=true?sync=true?reuseAddress=true?synchronous=false")
+                    .to("activemq:queue:foo")
+                    .log("Writing reply ${body}");
+
+                from("activemq:queue:foo")
+                    .transform(simple("Bye ${body}"));
+            }
+        };
+    }
+
+    @Override
+    protected Context createJndiContext() throws Exception {
+        JndiContext answer = new JndiContext();
+
+        // add ActiveMQ with embedded broker
+        ActiveMQComponent amq = ActiveMQComponent.activeMQComponent("vm://localhost?broker.persistent=false");
+        amq.setCamelContext(context);
+        answer.bind("activemq", amq);
+        return answer;
+    }
+
+}

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/netty/NettyAsyncRequestReplyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/netty/NettyAsyncRequestReplyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message