Fix autorelease - stub channel and eventLoop 84/51084/1
authorAlexis de Talhouët <adetalhouet89@gmail.com>
Thu, 26 Jan 2017 18:21:39 +0000 (13:21 -0500)
committerAlexis de Talhouët <adetalhouet89@gmail.com>
Thu, 26 Jan 2017 18:21:39 +0000 (13:21 -0500)
Since netty version has been bumped, change are required in the unit test.

Change-Id: I7ff42c9538f4fdfadf1c1677ced81b1afa767e31
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java

index dbde8a140d36ebfbbe96d2617136253b69613f7f..4f11465dd2e66bc4e138b3f63d8a93fe7effd616 100644 (file)
@@ -33,6 +33,7 @@ import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelPromise;
 import io.netty.channel.DefaultChannelPromise;
+import io.netty.channel.EventLoop;
 import java.io.IOException;
 import java.net.SocketAddress;
 import org.apache.sshd.ClientChannel;
@@ -75,6 +76,8 @@ public class AsyncSshHandlerTest {
     private SocketAddress remoteAddress;
     @Mock
     private SocketAddress localAddress;
+    @Mock
+    private EventLoop eventLoop;
 
     private AsyncSshHandler asyncSshHandler;
 
@@ -90,6 +93,7 @@ public class AsyncSshHandlerTest {
         stubAuth();
         stubSshClient();
         stubChannel();
+        stubEventLoop();
         stubCtx();
         stubRemoteAddress();
 
@@ -152,6 +156,11 @@ public class AsyncSshHandlerTest {
         doReturn("channel").when(channel).toString();
     }
 
+    private void stubEventLoop() {
+        doReturn(eventLoop).when(channel).eventLoop();
+        doReturn(Boolean.TRUE).when(eventLoop).inEventLoop();
+    }
+
     private void stubSshClient() {
         doNothing().when(sshClient).start();
         final ConnectFuture connectFuture = mock(ConnectFuture.class);