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 2011/06/12 13:40:08 UTC

svn commit: r1134916 - /camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/

Author: davsclaus
Date: Sun Jun 12 11:40:07 2011
New Revision: 1134916

URL: http://svn.apache.org/viewvc?rev=1134916&view=rev
Log:
Use dynamic assigned ports in unit test.

Added:
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/BaseNettyTest.java
Modified:
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/Netty2978IssueTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactoryAsynchTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyDisconnectTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyFileTcpTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutCloseChannelWhenCompleteTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutFromSedaTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyProducerAsyncEndpointTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettySSLTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncNotLazyChannelTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyNullDelimiterTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousFalseTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTransferExchangeOptionTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPObjectSyncTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPSyncTest.java
    camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUdpWithInOutUsingPlainSocketTest.java

Added: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/BaseNettyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/BaseNettyTest.java?rev=1134916&view=auto
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/BaseNettyTest.java (added)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/BaseNettyTest.java Sun Jun 12 11:40:07 2011
@@ -0,0 +1,97 @@
+/**
+ * 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;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Properties;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.converter.IOConverter;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ *
+ */
+public class BaseNettyTest extends CamelTestSupport {
+    private static volatile int port;
+
+    @BeforeClass
+    public static void initPort() throws Exception {
+        File file = new File("./target/nettyport.txt");
+        file = file.getAbsoluteFile();
+
+        if (!file.exists()) {
+            // start from somewhere in the 25xxx range
+            port = AvailablePortFinder.getNextAvailable(25000);
+        } else {
+            // read port number from file
+            String s = IOConverter.toString(file, null);
+            port = Integer.parseInt(s);
+            // use next port
+            port++;
+        }
+
+    }
+
+    @AfterClass
+    public static void savePort() throws Exception {
+        File file = new File("./target/nettyport.txt");
+        file = file.getAbsoluteFile();
+
+        // save to file, do not append
+        FileOutputStream fos = new FileOutputStream(file, false);
+        try {
+            fos.write(String.valueOf(port).getBytes());
+        } finally {
+            fos.close();
+        }
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        context.addComponent("properties", new PropertiesComponent("ref:prop"));
+        return context;
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+
+        Properties prop = new Properties();
+        prop.setProperty("port", "" + getPort());
+        jndi.bind("prop", prop);
+
+        return jndi;
+    }
+
+    protected int getNextPort() {
+        port = AvailablePortFinder.getNextAvailable(port + 1);
+        return port;
+    }
+
+    protected int getPort() {
+        return port;
+    }
+
+}

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/MultipleCodecsTest.java Sun Jun 12 11:40:07 2011
@@ -23,7 +23,6 @@ import java.util.concurrent.TimeUnit;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.jboss.netty.channel.ChannelDownstreamHandler;
 import org.jboss.netty.channel.ChannelUpstreamHandler;
 import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
@@ -32,7 +31,7 @@ import org.jboss.netty.handler.codec.str
 import org.jboss.netty.handler.codec.string.StringEncoder;
 import org.junit.Test;
 
-public class MultipleCodecsTest extends CamelTestSupport {
+public class MultipleCodecsTest extends BaseNettyTest {
 
     @Override
     protected JndiRegistry createRegistry() throws Exception {
@@ -78,9 +77,9 @@ public class MultipleCodecsTest extends 
         return new RouteBuilder() {
             public void configure() throws Exception {
                 // START SNIPPET: routes
-                from("direct:multiple-codec").to("netty:tcp://localhost:5150?encoders=#encoders&sync=false");
+                from("direct:multiple-codec").to("netty:tcp://localhost:{{port}}?encoders=#encoders&sync=false");
                 
-                from("netty:tcp://localhost:5150?decoders=#length-decoder,#string-decoder&sync=false").to("mock:multiple-codec");
+                from("netty:tcp://localhost:{{port}}?decoders=#length-decoder,#string-decoder&sync=false").to("mock:multiple-codec");
                 // START SNIPPET: routes
             }
         };

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/Netty2978IssueTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/Netty2978IssueTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/Netty2978IssueTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/Netty2978IssueTest.java Sun Jun 12 11:40:07 2011
@@ -33,7 +33,6 @@ import org.apache.camel.Processor;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -41,7 +40,7 @@ import org.junit.Test;
  * @version 
  */
 @Ignore
-public class Netty2978IssueTest extends CamelTestSupport {
+public class Netty2978IssueTest extends BaseNettyTest {
 
     @Test
     public void testNetty2978() throws Exception {
@@ -93,7 +92,7 @@ public class Netty2978IssueTest extends 
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("netty:tcp://localhost:22048?sync=true")
+                from("netty:tcp://localhost:{{port}}?sync=true")
                         .process(new Processor() {
                             public void process(final Exchange exchange) {
                                 String body = exchange.getIn().getBody(String.class);
@@ -111,7 +110,7 @@ public class Netty2978IssueTest extends 
 
         public CamelClient() {
             this.context = new DefaultCamelContext();
-            this.endpoint = context.getEndpoint("netty:tcp://localhost:22048?sync=true");
+            this.endpoint = context.getEndpoint("netty:tcp://localhost:{{port}}?sync=true");
             this.producerTemplate = context.createProducerTemplate();
         }
 

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyConcurrentTest.java Sun Jun 12 11:40:07 2011
@@ -28,9 +28,8 @@ import java.util.concurrent.Future;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.CamelTestSupport;
 
-public class NettyConcurrentTest extends CamelTestSupport {
+public class NettyConcurrentTest extends BaseNettyTest {
 
     public void testNoConcurrentProducers() throws Exception {
         doSendMessages(1, 1);
@@ -49,7 +48,7 @@ public class NettyConcurrentTest extends
             final int index = i;
             Future out = executor.submit(new Callable<Object>() {
                 public Object call() throws Exception {
-                    return template.requestBody("netty:tcp://localhost:5150", index, String.class);
+                    return template.requestBody("netty:tcp://localhost:{{port}}", index, String.class);
                 }
             });
             responses.put(index, out);
@@ -73,7 +72,7 @@ public class NettyConcurrentTest extends
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("netty:tcp://localhost:5150?sync=true").process(new Processor() {
+                from("netty:tcp://localhost:{{port}}?sync=true").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         String body = exchange.getIn().getBody(String.class);
                         exchange.getOut().setBody("Bye " + body);

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactoryAsynchTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactoryAsynchTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactoryAsynchTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactoryAsynchTest.java Sun Jun 12 11:40:07 2011
@@ -24,7 +24,6 @@ import org.apache.camel.builder.RouteBui
 import org.apache.camel.component.netty.handlers.ClientChannelHandler;
 import org.apache.camel.component.netty.handlers.ServerChannelHandler;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.CamelTestSupport;
 import org.jboss.netty.channel.ChannelPipeline;
 import org.jboss.netty.channel.Channels;
 import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
@@ -33,11 +32,8 @@ import org.jboss.netty.handler.codec.str
 import org.jboss.netty.handler.codec.string.StringEncoder;
 import org.jboss.netty.util.CharsetUtil;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class NettyCustomPipelineFactoryAsynchTest extends CamelTestSupport {
-    private static final transient Logger LOG = LoggerFactory.getLogger(NettyCustomPipelineFactoryAsynchTest.class);
+public class NettyCustomPipelineFactoryAsynchTest extends BaseNettyTest {
 
     @Produce(uri = "direct:start")
     protected ProducerTemplate producerTemplate;
@@ -47,7 +43,7 @@ public class NettyCustomPipelineFactoryA
     
     @Override
     protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = new JndiRegistry(createJndiContext());
+        JndiRegistry registry = super.createRegistry();
         clientPipelineFactory = new TestClientChannelPipelineFactory();
         serverPipelineFactory = new TestServerChannelPipelineFactory();
         registry.bind("cpf", clientPipelineFactory);
@@ -63,7 +59,7 @@ public class NettyCustomPipelineFactoryA
     private void sendRequest() throws Exception {
         // Async request
         response = (String) producerTemplate.requestBody(
-            "netty:tcp://localhost:5110?clientPipelineFactory=#cpf&textline=true", 
+            "netty:tcp://localhost:{{port}}?clientPipelineFactory=#cpf&textline=true",
             "Forest Gump describing Vietnam...");        
     }
     
@@ -71,7 +67,7 @@ public class NettyCustomPipelineFactoryA
     public void testCustomClientPipelineFactory() throws Exception {
         context.addRoutes(new RouteBuilder() {
             public void configure() {
-                from("netty:tcp://localhost:5110?serverPipelineFactory=#spf&textline=true")
+                from("netty:tcp://localhost:{{port}}?serverPipelineFactory=#spf&textline=true")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             exchange.getOut().setBody("Forrest Gump: We was always taking long walks, and we was always looking for a guy named 'Charlie'");                           
@@ -81,9 +77,7 @@ public class NettyCustomPipelineFactoryA
         });
         context.start();
         
-        LOG.debug("Beginning Test ---> testCustomClientPipelineFactory()");       
         sendRequest();
-        LOG.debug("Completed Test ---> testCustomClientPipelineFactory()");
         context.stop();
         
         assertEquals("Forrest Gump: We was always taking long walks, and we was always looking for a guy named 'Charlie'", response);

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyCustomPipelineFactorySynchTest.java Sun Jun 12 11:40:07 2011
@@ -24,7 +24,6 @@ import org.apache.camel.builder.RouteBui
 import org.apache.camel.component.netty.handlers.ClientChannelHandler;
 import org.apache.camel.component.netty.handlers.ServerChannelHandler;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.CamelTestSupport;
 import org.jboss.netty.channel.ChannelPipeline;
 import org.jboss.netty.channel.Channels;
 import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
@@ -33,11 +32,8 @@ import org.jboss.netty.handler.codec.str
 import org.jboss.netty.handler.codec.string.StringEncoder;
 import org.jboss.netty.util.CharsetUtil;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class NettyCustomPipelineFactorySynchTest extends CamelTestSupport {
-    private static final transient Logger LOG = LoggerFactory.getLogger(NettyCustomPipelineFactorySynchTest.class);
+public class NettyCustomPipelineFactorySynchTest extends BaseNettyTest {
 
     @Produce(uri = "direct:start")
     protected ProducerTemplate producerTemplate;
@@ -47,7 +43,7 @@ public class NettyCustomPipelineFactoryS
     
     @Override
     protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = new JndiRegistry(createJndiContext());
+        JndiRegistry registry = super.createRegistry();
         clientPipelineFactory = new TestClientChannelPipelineFactory();
         serverPipelineFactory = new TestServerChannelPipelineFactory();
         registry.bind("cpf", clientPipelineFactory);
@@ -63,7 +59,7 @@ public class NettyCustomPipelineFactoryS
     private void sendRequest() throws Exception {
         // Async request
         response = (String) producerTemplate.requestBody(
-            "netty:tcp://localhost:5110?clientPipelineFactory=#cpf&sync=true&textline=true", 
+            "netty:tcp://localhost:{{port}}?clientPipelineFactory=#cpf&sync=true&textline=true",
             "Forest Gump describing Vietnam...");        
     }
     
@@ -71,7 +67,7 @@ public class NettyCustomPipelineFactoryS
     public void testCustomClientPipelineFactory() throws Exception {
         context.addRoutes(new RouteBuilder() {
             public void configure() {
-                from("netty:tcp://localhost:5110?serverPipelineFactory=#spf&sync=true&textline=true")
+                from("netty:tcp://localhost:{{port}}?serverPipelineFactory=#spf&sync=true&textline=true")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             exchange.getOut().setBody("Forrest Gump: We was always taking long walks, and we was always looking for a guy named 'Charlie'");                           
@@ -81,9 +77,7 @@ public class NettyCustomPipelineFactoryS
         });
         context.start();
         
-        LOG.debug("Beginning Test ---> testCustomClientPipelineFactory()");       
         sendRequest();
-        LOG.debug("Completed Test ---> testCustomClientPipelineFactory()");
         context.stop();
         
         assertEquals("Forrest Gump: We was always taking long walks, and we was always looking for a guy named 'Charlie'", response);

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyDisconnectTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyDisconnectTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyDisconnectTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyDisconnectTest.java Sun Jun 12 11:40:07 2011
@@ -19,19 +19,16 @@ package org.apache.camel.component.netty
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyDisconnectTest extends CamelTestSupport {
-
-    private String uri = "netty:tcp://localhost:8080?sync=true&disconnect=true";
+public class NettyDisconnectTest extends BaseNettyTest {
 
     @Test
     public void testCloseSessionWhenComplete() throws Exception {
-        Object out = template.requestBody(uri, "Claus");
+        Object out = template.requestBody("netty:tcp://localhost:{{port}}?sync=true&disconnect=true", "Claus");
         assertEquals("Bye Claus", out);
     }
 
@@ -39,7 +36,7 @@ public class NettyDisconnectTest extends
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from(uri).process(new Processor() {
+                from("netty:tcp://localhost:{{port}}?sync=true&disconnect=true").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         String body = exchange.getIn().getBody(String.class);
                         exchange.getOut().setBody("Bye " + body);

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyFileTcpTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyFileTcpTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyFileTcpTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyFileTcpTest.java Sun Jun 12 11:40:07 2011
@@ -18,13 +18,12 @@ package org.apache.camel.component.netty
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyFileTcpTest extends CamelTestSupport {
+public class NettyFileTcpTest extends BaseNettyTest {
 
     @Test
     public void testMinaRoute() throws Exception {
@@ -39,11 +38,11 @@ public class NettyFileTcpTest extends Ca
         return new RouteBuilder() {
             public void configure() {
                 // lets setup a server
-                from("netty:tcp://localhost:9123?sync=false&textline=true")
+                from("netty:tcp://localhost:{{port}}?sync=false&textline=true")
                         .to("mock:results");
 
                 from("file:src/test/data?noop=true&fileName=message1.txt").
-                        to("netty:tcp://localhost:9123?sync=false&textline=true");
+                        to("netty:tcp://localhost:{{port}}?sync=false&textline=true");
             }
         };
     }

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutCloseChannelWhenCompleteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutCloseChannelWhenCompleteTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutCloseChannelWhenCompleteTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutCloseChannelWhenCompleteTest.java Sun Jun 12 11:40:07 2011
@@ -19,17 +19,16 @@ package org.apache.camel.component.netty
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyInOutCloseChannelWhenCompleteTest extends CamelTestSupport {
+public class NettyInOutCloseChannelWhenCompleteTest extends BaseNettyTest {
 
     @Test
     public void testCloseSessionWhenComplete() throws Exception {
-        Object out = template.requestBody("netty:tcp://localhost:8080?sync=true", "Claus");
+        Object out = template.requestBody("netty:tcp://localhost:{{port}}?sync=true", "Claus");
         assertEquals("Bye Claus", out);
     }
 
@@ -37,7 +36,7 @@ public class NettyInOutCloseChannelWhenC
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("netty:tcp://localhost:8080?sync=true").process(new Processor() {
+                from("netty:tcp://localhost:{{port}}?sync=true").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         String body = exchange.getIn().getBody(String.class);
                         exchange.getOut().setBody("Bye " + body);

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutFromSedaTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutFromSedaTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutFromSedaTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutFromSedaTest.java Sun Jun 12 11:40:07 2011
@@ -18,13 +18,12 @@ package org.apache.camel.component.netty
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyInOutFromSedaTest extends CamelTestSupport {
+public class NettyInOutFromSedaTest extends BaseNettyTest {
 
     @Test
     public void testInOutIssue() throws Exception {
@@ -45,11 +44,11 @@ public class NettyInOutFromSedaTest exte
             public void configure() throws Exception {
                 from("seda:start")
                     .log("before ${body}")
-                    .to("netty:tcp://localhost:8555?textline=true&sync=true")
+                    .to("netty:tcp://localhost:{{port}}?textline=true&sync=true")
                     .log("after ${body}")
                     .to("mock:result");
 
-                from("netty:tcp://localhost:8555?textline=true&sync=true")
+                from("netty:tcp://localhost:{{port}}?textline=true&sync=true")
                     .transform(body().prepend("Bye "));
             }
         };

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyInOutWithForcedNoResponseTest.java Sun Jun 12 11:40:07 2011
@@ -18,24 +18,23 @@ package org.apache.camel.component.netty
 
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyInOutWithForcedNoResponseTest extends CamelTestSupport {
+public class NettyInOutWithForcedNoResponseTest extends BaseNettyTest {
 
     @Test
     public void testResponse() throws Exception {
-        Object out = template.requestBody("netty:tcp://localhost:4444", "Copenhagen");
+        Object out = template.requestBody("netty:tcp://localhost:{{port}}", "Copenhagen");
         assertEquals("Hello Claus", out);
     }
 
     @Test
     public void testNoResponse() throws Exception {
         try {
-            template.requestBody("netty:tcp://localhost:4444", "London");
+            template.requestBody("netty:tcp://localhost:{{port}}", "London");
             fail("Should throw an exception");
         } catch (RuntimeCamelException e) {
             assertTrue(e.getCause().getMessage().startsWith("No response"));
@@ -46,13 +45,7 @@ public class NettyInOutWithForcedNoRespo
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("netty:tcp://localhost:4444")
-                    .choice()
-                        .when(body().isEqualTo("Copenhagen")).transform(constant("Hello Claus"))
-                        .otherwise().transform(constant(null));
-
-                from("netty:tcp://localhost:4445?sync=true&disconnectOnNoReply=false&noReplyLogLevel=INFO")
-                    .to("log:foo")
+                from("netty:tcp://localhost:{{port}}")
                     .choice()
                         .when(body().isEqualTo("Copenhagen")).transform(constant("Hello Claus"))
                         .otherwise().transform(constant(null));

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyProducerAsyncEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyProducerAsyncEndpointTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyProducerAsyncEndpointTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyProducerAsyncEndpointTest.java Sun Jun 12 11:40:07 2011
@@ -19,13 +19,12 @@ package org.apache.camel.component.netty
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyProducerAsyncEndpointTest extends CamelTestSupport {
+public class NettyProducerAsyncEndpointTest extends BaseNettyTest {
 
     private static String beforeThreadName;
     private static String afterThreadName;
@@ -57,7 +56,7 @@ public class NettyProducerAsyncEndpointT
                                 beforeThreadName = Thread.currentThread().getName();
                             }
                         })
-                        .to("netty:tcp://localhost:5147?textline=true&sync=true")
+                        .to("netty:tcp://localhost:{{port}}?textline=true&sync=true")
                         .process(new Processor() {
                             public void process(Exchange exchange) throws Exception {
                                 afterThreadName = Thread.currentThread().getName();
@@ -67,7 +66,7 @@ public class NettyProducerAsyncEndpointT
                         .to("mock:after")
                         .to("mock:result");
 
-                from("netty:tcp://localhost:5147?textline=true&sync=true")
+                from("netty:tcp://localhost:{{port}}?textline=true&sync=true")
                     .delay(1000)
                     .validate(body().isInstanceOf(String.class))
                     .transform(body().regexReplaceAll("Hello", "Bye"));

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettySSLTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettySSLTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettySSLTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettySSLTest.java Sun Jun 12 11:40:07 2011
@@ -25,12 +25,11 @@ import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.test.CamelTestSupport;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NettySSLTest extends CamelTestSupport {
+public class NettySSLTest extends BaseNettyTest {
     private static final transient Logger LOG = LoggerFactory.getLogger(NettySSLTest.class);
   
     @Produce(uri = "direct:start")
@@ -38,7 +37,7 @@ public class NettySSLTest extends CamelT
     
     @Override
     protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry registry = new JndiRegistry(createJndiContext());
+        JndiRegistry registry = super.createRegistry();
         registry.bind("password", "changeit");
         registry.bind("ksf", new File("src/test/resources/keystore.jks"));
         registry.bind("tsf", new File("src/test/resources/keystore.jks"));
@@ -52,7 +51,7 @@ public class NettySSLTest extends CamelT
 
     private void sendRequest() throws Exception {
         String response = producerTemplate.requestBody(
-            "netty:tcp://localhost:5150?sync=true&ssl=true&passphrase=#password&keyStoreFile=#ksf&trustStoreFile=#tsf", 
+            "netty:tcp://localhost:{{port}}?sync=true&ssl=true&passphrase=#password&keyStoreFile=#ksf&trustStoreFile=#tsf",
             "Epitaph in Kohima, India marking the WWII Battle of Kohima and Imphal, Burma Campaign - Attributed to John Maxwell Edmonds", String.class);        
         assertEquals("When You Go Home, Tell Them Of Us And Say, For Your Tomorrow, We Gave Our Today.", response);
     }
@@ -67,7 +66,7 @@ public class NettySSLTest extends CamelT
 
         context.addRoutes(new RouteBuilder() {
             public void configure() {
-                from("netty:tcp://localhost:5150?sync=true&ssl=true&passphrase=#password&keyStoreFile=#ksf&trustStoreFile=#tsf")
+                from("netty:tcp://localhost:{{port}}?sync=true&ssl=true&passphrase=#password&keyStoreFile=#ksf&trustStoreFile=#tsf")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             exchange.getOut().setBody("When You Go Home, Tell Them Of Us And Say, For Your Tomorrow, We Gave Our Today.");                           
@@ -77,9 +76,7 @@ public class NettySSLTest extends CamelT
         });
         context.start();
         
-        LOG.debug("Beginning Test ---> testSSLInOutWithNettyConsumer()");       
         sendRequest();
-        LOG.debug("Completed Test ---> testSSLInOutWithNettyConsumer()");
         context.stop();
     }    
 

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPAsyncTest.java Sun Jun 12 11:40:07 2011
@@ -29,12 +29,11 @@ import org.apache.camel.ProducerTemplate
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.converter.IOConverter;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NettyTCPAsyncTest extends CamelTestSupport {
+public class NettyTCPAsyncTest extends BaseNettyTest {
     private static final transient Logger LOG = LoggerFactory.getLogger(NettyTCPAsyncTest.class);
     
     @EndpointInject(uri = "mock:result")
@@ -62,14 +61,11 @@ public class NettyTCPAsyncTest extends C
 
     @Test
     public void testTCPInOnlyWithNettyConsumer() throws Exception {
-        LOG.debug("Beginning Test ---> testTCPInOnlyWithNettyConsumer()");
-        
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
-        sendFile("netty:tcp://localhost:5150?sync=false");
+        sendFile("netty:tcp://localhost:{{port}}?sync=false");
         
         mock.assertIsSatisfied();
-        LOG.debug("Completed Test ---> testTCPInOnlyWithNettyConsumer()");           
     }
     
     @Override
@@ -77,7 +73,7 @@ public class NettyTCPAsyncTest extends C
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("netty:tcp://localhost:5150?sync=false")
+                from("netty:tcp://localhost:{{port}}?sync=false")
                     .to("log:result")
                     .to("mock:result");                
             }

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncNotLazyChannelTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncNotLazyChannelTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncNotLazyChannelTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncNotLazyChannelTest.java Sun Jun 12 11:40:07 2011
@@ -21,38 +21,26 @@ import org.apache.camel.Processor;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class NettyTCPSyncNotLazyChannelTest extends CamelTestSupport {
-    private static final transient Logger LOG = LoggerFactory.getLogger(NettyTCPSyncNotLazyChannelTest.class);
+public class NettyTCPSyncNotLazyChannelTest extends BaseNettyTest {
 
     @Produce(uri = "direct:start")
     protected ProducerTemplate producerTemplate;
 
     @Test
     public void testTCPStringInOutWithNettyConsumer() throws Exception {
-        LOG.debug("Beginning Test ---> testTCPInOutWithNettyConsumer()");
-
         String response = producerTemplate.requestBody(
-            "netty:tcp://localhost:5151?sync=true&lazyChannelCreation=false",
+            "netty:tcp://localhost:{{port}}?sync=true&lazyChannelCreation=false",
             "Epitaph in Kohima, India marking the WWII Battle of Kohima and Imphal, Burma Campaign - Attributed to John Maxwell Edmonds", String.class);
         assertEquals("When You Go Home, Tell Them Of Us And Say, For Your Tomorrow, We Gave Our Today.", response);
-
-        LOG.debug("Completed Test ---> testTCPInOutWithNettyConsumer()");
     }
 
     @Test
     public void testTCPObjectInOutWithNettyConsumer() throws Exception {
-        LOG.debug("Beginning Test ---> testUDPInOutWithNettyConsumer()");
-
         Poetry poetry = new Poetry();
-        Poetry response = (Poetry) producerTemplate.requestBody("netty:tcp://localhost:5151?sync=true&lazyChannelCreation=false", poetry);
+        Poetry response = (Poetry) producerTemplate.requestBody("netty:tcp://localhost:{{port}}?sync=true&lazyChannelCreation=false", poetry);
         assertEquals("Dr. Sarojini Naidu", response.getPoet());
-
-        LOG.debug("Completed Test ---> testUDPInOutWithNettyConsumer()");
     }
 
     @Override
@@ -60,7 +48,7 @@ public class NettyTCPSyncNotLazyChannelT
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("netty:tcp://localhost:5151?sync=true")
+                from("netty:tcp://localhost:{{port}}?sync=true")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             if (exchange.getIn().getBody() instanceof Poetry) {

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncTest.java Sun Jun 12 11:40:07 2011
@@ -21,10 +21,9 @@ import org.apache.camel.Processor;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class NettyTCPSyncTest extends CamelTestSupport {
+public class NettyTCPSyncTest extends BaseNettyTest {
     
     @Produce(uri = "direct:start")
     protected ProducerTemplate producerTemplate;
@@ -32,7 +31,7 @@ public class NettyTCPSyncTest extends Ca
     @Test
     public void testTCPStringInOutWithNettyConsumer() throws Exception {
         String response = producerTemplate.requestBody(
-            "netty:tcp://localhost:5150?sync=true", 
+            "netty:tcp://localhost:{{port}}?sync=true",
             "Epitaph in Kohima, India marking the WWII Battle of Kohima and Imphal, Burma Campaign - Attributed to John Maxwell Edmonds", String.class);        
         assertEquals("When You Go Home, Tell Them Of Us And Say, For Your Tomorrow, We Gave Our Today.", response);
     }
@@ -40,12 +39,12 @@ public class NettyTCPSyncTest extends Ca
     @Test
     public void testTCPStringInOutWithNettyConsumer2Times() throws Exception {
         String response = producerTemplate.requestBody(
-            "netty:tcp://localhost:5150?sync=true",
+            "netty:tcp://localhost:{{port}}?sync=true",
             "Epitaph in Kohima, India marking the WWII Battle of Kohima and Imphal, Burma Campaign - Attributed to John Maxwell Edmonds", String.class);
         assertEquals("When You Go Home, Tell Them Of Us And Say, For Your Tomorrow, We Gave Our Today.", response);
 
         response = producerTemplate.requestBody(
-            "netty:tcp://localhost:5150?sync=true",
+            "netty:tcp://localhost:{{port}}?sync=true",
             "Hello World", String.class);
         assertEquals("When You Go Home, Tell Them Of Us And Say, For Your Tomorrow, We Gave Our Today.", response);
     }
@@ -53,7 +52,7 @@ public class NettyTCPSyncTest extends Ca
     @Test
     public void testTCPObjectInOutWithNettyConsumer() throws Exception {
         Poetry poetry = new Poetry();
-        Poetry response = (Poetry) producerTemplate.requestBody("netty:tcp://localhost:5150?sync=true", poetry);        
+        Poetry response = (Poetry) producerTemplate.requestBody("netty:tcp://localhost:{{port}}?sync=true", poetry);
         assertEquals("Dr. Sarojini Naidu", response.getPoet());
     }
     
@@ -62,7 +61,7 @@ public class NettyTCPSyncTest extends Ca
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("netty:tcp://localhost:5150?sync=true")
+                from("netty:tcp://localhost:{{port}}?sync=true")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             if (exchange.getIn().getBody() instanceof Poetry) {

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTcpWithInOutUsingPlainSocketTest.java Sun Jun 12 11:40:07 2011
@@ -25,17 +25,12 @@ import java.net.Socket;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyTcpWithInOutUsingPlainSocketTest extends CamelTestSupport {
-
-    private static final int PORT = 6333;
-    // use parameter sync=true to force InOut pattern
-    protected String uri = "netty:tcp://localhost:" + PORT + "?textline=true&sync=true";
+public class NettyTcpWithInOutUsingPlainSocketTest extends BaseNettyTest {
 
     @Test
     public void testSendAndReceiveOnce() throws Exception {
@@ -82,7 +77,7 @@ public class NettyTcpWithInOutUsingPlain
         byte buf[] = new byte[128];
 
         Socket soc = new Socket();
-        soc.connect(new InetSocketAddress("localhost", PORT));
+        soc.connect(new InetSocketAddress("localhost", getPort()));
 
         // Send message using plain Socket to test if this works
         OutputStream os = null;
@@ -126,7 +121,7 @@ public class NettyTcpWithInOutUsingPlain
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from(uri).process(new Processor() {
+                from("netty:tcp://localhost:{{port}}?textline=true&sync=true").process(new Processor() {
                     public void process(Exchange e) {
                         String in = e.getIn().getBody(String.class);
                         if ("force-null-out-body".equals(in)) {

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyNullDelimiterTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyNullDelimiterTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyNullDelimiterTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyNullDelimiterTest.java Sun Jun 12 11:40:07 2011
@@ -17,19 +17,18 @@
 package org.apache.camel.component.netty;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyTextlineInOnlyNullDelimiterTest extends CamelTestSupport {
+public class NettyTextlineInOnlyNullDelimiterTest extends BaseNettyTest {
 
     @Test
     public void testTextlineInOnlyNull() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
 
-        template.sendBody("netty:tcp://localhost:5149?textline=true&delimiter=NULL&sync=false", "Hello World\u0000");
+        template.sendBody("netty:tcp://localhost:{{port}}?textline=true&delimiter=NULL&sync=false", "Hello World\u0000");
 
         assertMockEndpointsSatisfied();
     }
@@ -39,7 +38,7 @@ public class NettyTextlineInOnlyNullDeli
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("netty:tcp://localhost:5149?textline=true&delimiter=NULL&sync=false")
+                from("netty:tcp://localhost:{{port}}?textline=true&delimiter=NULL&sync=false")
                     // body should be a String when using textline codec
                     .validate(body().isInstanceOf(String.class))
                     .to("mock:result");

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOnlyTest.java Sun Jun 12 11:40:07 2011
@@ -17,19 +17,18 @@
 package org.apache.camel.component.netty;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyTextlineInOnlyTest extends CamelTestSupport {
+public class NettyTextlineInOnlyTest extends BaseNettyTest {
 
     @Test
     public void testTextlineInOnlyDual() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("Hello World", "how are you?");
 
-        template.sendBody("netty:tcp://localhost:5149?textline=true&sync=false", "Hello World\nhow are you?\n");
+        template.sendBody("netty:tcp://localhost:{{port}}?textline=true&sync=false", "Hello World\nhow are you?\n");
 
         assertMockEndpointsSatisfied();
     }
@@ -38,7 +37,7 @@ public class NettyTextlineInOnlyTest ext
     public void testTextlineInOnlyAutoAppend() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
 
-        template.sendBody("netty:tcp://localhost:5149?textline=true&sync=false", "Hello World");
+        template.sendBody("netty:tcp://localhost:{{port}}?textline=true&sync=false", "Hello World");
 
         assertMockEndpointsSatisfied();
     }
@@ -47,7 +46,7 @@ public class NettyTextlineInOnlyTest ext
     public void testTextlineInOnly() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
 
-        template.sendBody("netty:tcp://localhost:5149?textline=true&sync=false", "Hello World\n");
+        template.sendBody("netty:tcp://localhost:{{port}}?textline=true&sync=false", "Hello World\n");
 
         assertMockEndpointsSatisfied();
     }
@@ -57,7 +56,7 @@ public class NettyTextlineInOnlyTest ext
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("netty:tcp://localhost:5149?textline=true&sync=false")
+                from("netty:tcp://localhost:{{port}}?textline=true&sync=false")
                     // body should be a String when using textline codec
                     .validate(body().isInstanceOf(String.class))
                     .to("mock:result");

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousFalseTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousFalseTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousFalseTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousFalseTest.java Sun Jun 12 11:40:07 2011
@@ -19,17 +19,15 @@ package org.apache.camel.component.netty
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyTextlineInOutSynchronousFalseTest extends CamelTestSupport {
+public class NettyTextlineInOutSynchronousFalseTest extends BaseNettyTest {
 
     private static String beforeThreadName;
     private static String afterThreadName;
-    private String url = "netty:tcp://localhost:5148?textline=true&sync=true&synchronous=false";
 
     @Test
     public void testSynchronous() throws Exception {
@@ -55,7 +53,7 @@ public class NettyTextlineInOutSynchrono
                             beforeThreadName = Thread.currentThread().getName();
                         }
                     })
-                    .to(url)
+                    .to("netty:tcp://localhost:{{port}}?textline=true&sync=true&synchronous=false")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             afterThreadName = Thread.currentThread().getName();
@@ -64,7 +62,7 @@ public class NettyTextlineInOutSynchrono
                     .to("log:after")
                     .to("mock:result");
 
-                from(url)
+                from("netty:tcp://localhost:{{port}}?textline=true&sync=true&synchronous=false")
                     // body should be a String when using textline codec
                     .validate(body().isInstanceOf(String.class))
                     .transform(body().regexReplaceAll("Hello", "Bye"));

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutSynchronousTest.java Sun Jun 12 11:40:07 2011
@@ -19,17 +19,15 @@ package org.apache.camel.component.netty
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyTextlineInOutSynchronousTest extends CamelTestSupport {
+public class NettyTextlineInOutSynchronousTest extends BaseNettyTest {
 
     private static String beforeThreadName;
     private static String afterThreadName;
-    private String url = "netty:tcp://localhost:5148?textline=true&sync=true&synchronous=true";
 
     @Test
     public void testSynchronous() throws Exception {
@@ -55,7 +53,7 @@ public class NettyTextlineInOutSynchrono
                             beforeThreadName = Thread.currentThread().getName();
                         }
                     })
-                    .to(url)
+                    .to("netty:tcp://localhost:{{port}}?textline=true&sync=true&synchronous=true")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             afterThreadName = Thread.currentThread().getName();
@@ -64,7 +62,7 @@ public class NettyTextlineInOutSynchrono
                     .to("log:after")
                     .to("mock:result");
 
-                from(url)
+                from("netty:tcp://localhost:{{port}}?textline=true&sync=true&synchronous=true")
                     // body should be a String when using textline codec
                     .validate(body().isInstanceOf(String.class))
                     .transform(body().regexReplaceAll("Hello", "Bye"));

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTextlineInOutTest.java Sun Jun 12 11:40:07 2011
@@ -17,19 +17,18 @@
 package org.apache.camel.component.netty;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyTextlineInOutTest extends CamelTestSupport {
+public class NettyTextlineInOutTest extends BaseNettyTest {
 
     @Test
     public void testTextlineInOut() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
 
-        String reply = template.requestBody("netty:tcp://localhost:5148?textline=true&sync=true", "Hello World", String.class);
+        String reply = template.requestBody("netty:tcp://localhost:{{port}}?textline=true&sync=true", "Hello World", String.class);
         assertEquals("Bye World", reply);
 
         assertMockEndpointsSatisfied();
@@ -40,7 +39,7 @@ public class NettyTextlineInOutTest exte
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("netty:tcp://localhost:5148?textline=true&sync=true")
+                from("netty:tcp://localhost:{{port}}?textline=true&sync=true")
                     // body should be a String when using textline codec
                     .validate(body().isInstanceOf(String.class))
                     .to("mock:result")

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTransferExchangeOptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTransferExchangeOptionTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTransferExchangeOptionTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTransferExchangeOptionTest.java Sun Jun 12 11:40:07 2011
@@ -26,15 +26,12 @@ import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
 /**
  * @version 
  */
-public class NettyTransferExchangeOptionTest extends CamelTestSupport {
-
-    protected String uri = "netty:tcp://localhost:6321?transferExchange=true";
+public class NettyTransferExchangeOptionTest extends BaseNettyTest {
 
     @Test
     public void testNettyTransferExchangeOptionWithoutException() throws Exception {
@@ -49,7 +46,7 @@ public class NettyTransferExchangeOption
     }
 
     private Exchange sendExchange(boolean setException) throws Exception {
-        Endpoint endpoint = context.getEndpoint(uri);
+        Endpoint endpoint = context.getEndpoint("netty:tcp://localhost:{{port}}?transferExchange=true");
         Exchange exchange = endpoint.createExchange();
 
         Message message = exchange.getIn();
@@ -95,7 +92,7 @@ public class NettyTransferExchangeOption
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from(uri).process(new Processor() {
+                from("netty:tcp://localhost:{{port}}?transferExchange=true").process(new Processor() {
                     public void process(Exchange e) throws InterruptedException {
                         Assert.assertNotNull(e.getIn().getBody());
                         Assert.assertNotNull(e.getIn().getHeaders());

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPAsyncTest.java Sun Jun 12 11:40:07 2011
@@ -29,14 +29,10 @@ import org.apache.camel.ProducerTemplate
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.converter.IOConverter;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class NettyUDPAsyncTest extends CamelTestSupport {
-    private static final transient Logger LOG = LoggerFactory.getLogger(NettyUDPAsyncTest.class);
-    
+public class NettyUDPAsyncTest extends BaseNettyTest {
+
     @EndpointInject(uri = "mock:result")
     protected MockEndpoint resultEndpoint;
     @Produce(uri = "direct:start")
@@ -62,23 +58,18 @@ public class NettyUDPAsyncTest extends C
 
     @Test
     public void testUDPInOnlyWithNettyConsumer() throws Exception {
-        LOG.debug("Beginning Test ---> testUDPInOnlyWithNettyConsumer()");
-        
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
-        sendFile("netty:udp://localhost:5151?sync=false");
+        sendFile("netty:udp://localhost:{{port}}?sync=false");
         mock.assertIsSatisfied();
-
-        LOG.debug("Completed Test ---> testUDPInOnlyWithNettyConsumer()");   
     }
 
-    
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("netty:udp://localhost:5151?sync=false")
+                from("netty:udp://localhost:{{port}}?sync=false")
                     .to("mock:result")
                     .to("log:Message"); 
             }

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPObjectSyncTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPObjectSyncTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPObjectSyncTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPObjectSyncTest.java Sun Jun 12 11:40:07 2011
@@ -21,34 +21,26 @@ import org.apache.camel.Processor;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class NettyUDPObjectSyncTest extends CamelTestSupport {
-    private static final transient Logger LOG = LoggerFactory.getLogger(NettyUDPObjectSyncTest.class);
+public class NettyUDPObjectSyncTest extends BaseNettyTest {
 
     @Produce(uri = "direct:start")
     protected ProducerTemplate producerTemplate;
     
     @Test
     public void testUDPObjectInOutWithNettyConsumer() throws Exception {
-        LOG.debug("Beginning Test ---> testUDPInOutWithNettyConsumer()");
-        
         Poetry poetry = new Poetry();
-        Poetry response = producerTemplate.requestBody("netty:udp://localhost:5155?sync=true", poetry, Poetry.class);        
+        Poetry response = producerTemplate.requestBody("netty:udp://localhost:{{port}}?sync=true", poetry, Poetry.class);
         assertEquals("Dr. Sarojini Naidu", response.getPoet());
-        
-        LOG.debug("Completed Test ---> testUDPInOutWithNettyConsumer()");
-    }    
+    }
     
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {                
-                from("netty:udp://localhost:5155?sync=true")
+                from("netty:udp://localhost:{{port}}?sync=true")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             Poetry poetry = (Poetry) exchange.getIn().getBody();

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPSyncTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPSyncTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPSyncTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPSyncTest.java Sun Jun 12 11:40:07 2011
@@ -21,37 +21,29 @@ import org.apache.camel.Processor;
 import org.apache.camel.Produce;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-public class NettyUDPSyncTest extends CamelTestSupport {
-    private static final transient Logger LOG = LoggerFactory.getLogger(NettyUDPSyncTest.class);
+public class NettyUDPSyncTest extends BaseNettyTest {
 
     @Produce(uri = "direct:start")
     protected ProducerTemplate producerTemplate;
 
     @Test
     public void testUDPStringInOutWithNettyConsumer() throws Exception {
-        LOG.debug("Beginning Test ---> testUDPInOutWithNettyConsumer()");
-        
         for (int i = 0; i < 5; i++) {
             String response = producerTemplate.requestBody(
-                "netty:udp://localhost:5152?sync=true", 
+                "netty:udp://localhost:{{port}}?sync=true",
                 "After the Battle of Thermopylae in 480 BC - Simonides of Ceos (c. 556 BC-468 BC), Greek lyric poet wrote ?", String.class);        
             assertEquals("Go tell the Spartans, thou that passest by, That faithful to their precepts here we lie.", response);
         }
-        
-        LOG.debug("Completed Test ---> testUDPInOutWithNettyConsumer()");        
-    }   
+    }
     
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {                
-                from("netty:udp://localhost:5152?sync=true")
+                from("netty:udp://localhost:{{port}}?sync=true")
                     .process(new Processor() {
                         public void process(Exchange exchange) throws Exception {
                             exchange.getOut().setBody("Go tell the Spartans, thou that passest by, That faithful to their precepts here we lie.");                           

Modified: camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUdpWithInOutUsingPlainSocketTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUdpWithInOutUsingPlainSocketTest.java?rev=1134916&r1=1134915&r2=1134916&view=diff
==============================================================================
--- camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUdpWithInOutUsingPlainSocketTest.java (original)
+++ camel/trunk/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUdpWithInOutUsingPlainSocketTest.java Sun Jun 12 11:40:07 2011
@@ -23,7 +23,6 @@ import java.net.InetAddress;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,9 +30,8 @@ import org.slf4j.LoggerFactory;
 /**
  * @version 
  */
-public class NettyUdpWithInOutUsingPlainSocketTest extends CamelTestSupport {
+public class NettyUdpWithInOutUsingPlainSocketTest extends BaseNettyTest {
     private static final transient Logger LOG = LoggerFactory.getLogger(NettyUdpWithInOutUsingPlainSocketTest.class);
-    private static final int PORT = 4445;
 
     @Test
     public void testSendAndReceiveOnce() throws Exception {
@@ -49,14 +47,14 @@ public class NettyUdpWithInOutUsingPlain
         // must append delimiter
         byte[] data = (input + "\n").getBytes();
 
-        DatagramPacket packet = new DatagramPacket(data, data.length, address, PORT);
+        DatagramPacket packet = new DatagramPacket(data, data.length, address, getPort());
         LOG.debug("+++ Sending data +++");
         socket.send(packet);
 
         Thread.sleep(1000);
 
         byte[] buf = new byte[128];
-        DatagramPacket receive = new DatagramPacket(buf, buf.length, address, PORT);
+        DatagramPacket receive = new DatagramPacket(buf, buf.length, address, getPort());
         LOG.debug("+++ Receiving data +++");
         socket.receive(receive);
 
@@ -68,7 +66,7 @@ public class NettyUdpWithInOutUsingPlain
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from("netty:udp://127.0.0.1:" + PORT + "?textline=true&sync=true").process(new Processor() {
+                from("netty:udp://127.0.0.1:{{port}}?textline=true&sync=true").process(new Processor() {
                     public void process(Exchange exchange) throws Exception {
                         String s = exchange.getIn().getBody(String.class);
                         LOG.debug("Server got: " + s);