You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2015/03/04 03:02:55 UTC

camel git commit: CAMEL-8350 fixed the NettyUdpConnectedSendTest

Repository: camel
Updated Branches:
  refs/heads/master 93117a1b2 -> 4e7ec8f79


CAMEL-8350 fixed the NettyUdpConnectedSendTest


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

Branch: refs/heads/master
Commit: 4e7ec8f79b6f4cfc92e41e9f976b1c6fa4d8fcae
Parents: 93117a1
Author: Willem Jiang <wi...@gmail.com>
Authored: Wed Mar 4 10:02:40 2015 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Wed Mar 4 10:02:40 2015 +0800

----------------------------------------------------------------------
 .../netty4/NettyUdpConnectedSendTest.java          | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/4e7ec8f7/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java
----------------------------------------------------------------------
diff --git a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java
index 579e46b..e876404 100644
--- a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java
+++ b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUdpConnectedSendTest.java
@@ -30,17 +30,20 @@ import io.netty.channel.socket.DatagramPacket;
 import io.netty.channel.socket.nio.NioDatagramChannel;
 import io.netty.handler.codec.MessageToMessageDecoder;
 import io.netty.util.CharsetUtil;
-
 import org.apache.camel.builder.RouteBuilder;
+import org.junit.FixMethodOrder;
 import org.junit.Test;
+import org.junit.runners.MethodSorters;
 
-
+//We need to run the tests with fix order
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
 public class NettyUdpConnectedSendTest extends BaseNettyTest {
     private static final String SEND_STRING = "***<We all love camel>***";
     private static final int SEND_COUNT = 20;
     private volatile int receivedCount;
     private EventLoopGroup group;
     private Bootstrap bootstrap;
+    private Channel serverChannel;
 
     public void createNettyUdpReceiver() {
         group = new NioEventLoopGroup();
@@ -58,15 +61,17 @@ public class NettyUdpConnectedSendTest extends BaseNettyTest {
 
 
     public void bind() {
-        bootstrap.bind().syncUninterruptibly();
+        serverChannel = bootstrap.bind().syncUninterruptibly().channel();
     }
 
     public void stop() {
-        group.shutdownGracefully();
+        // Just make sure we shutdown the listener after the call
+        serverChannel.close().syncUninterruptibly();
+        group.shutdownGracefully().syncUninterruptibly();
     }
 
     @Test
-    public void sendConnectedUdp() throws Exception {
+    public void sendConnectedUdpWithServer() throws Exception {
         createNettyUdpReceiver();
         bind();
         for (int i = 0; i < SEND_COUNT; ++i) {
@@ -77,7 +82,7 @@ public class NettyUdpConnectedSendTest extends BaseNettyTest {
     }
 
     @Test
-    public void sendConnectedWithoutReceiver() throws Exception {
+    public void sendBodyWithoutReceiver() throws Exception {
         int exceptionCount = 0;
         for (int i = 0; i < SEND_COUNT; ++i) {
             try {