Adjust to yangtools-2.0.0/odlparent-3.0.0 changes
[netconf.git] / netconf / callhome-protocol / src / test / java / org / opendaylight / netconf / callhome / protocol / MinaSshNettyChannelTest.java
index 17193a238281311e1e4c794b04aaa9a68901fe89..5832780f4bd4593aecc63234ba4930b306e18492 100644 (file)
@@ -21,36 +21,34 @@ import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelOutboundHandlerAdapter;
 import io.netty.channel.ChannelPromise;
-import org.apache.sshd.ClientChannel;
-import org.apache.sshd.ClientSession;
-import org.apache.sshd.common.future.SshFutureListener;
+import org.apache.sshd.client.channel.ClientChannel;
+import org.apache.sshd.client.session.ClientSession;
 import org.apache.sshd.common.io.IoInputStream;
 import org.apache.sshd.common.io.IoOutputStream;
 import org.apache.sshd.common.io.IoReadFuture;
 import org.apache.sshd.common.io.IoWriteFuture;
-import org.apache.sshd.common.util.Buffer;
+import org.apache.sshd.common.util.buffer.Buffer;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
 
-
 public class MinaSshNettyChannelTest {
-    CallHomeSessionContext mockContext;
-    ClientSession mockSession;
-    ClientChannel mockChannel;
-    MinaSshNettyChannel instance;
+    private CallHomeSessionContext mockContext;
+    private ClientSession mockSession;
+    private ClientChannel mockChannel;
+    private MinaSshNettyChannel instance;
 
     @Before
     public void setup() {
         IoReadFuture mockFuture = mock(IoReadFuture.class);
         IoInputStream mockIn = mock(IoInputStream.class);
         Mockito.doReturn(mockFuture).when(mockIn).read(any(Buffer.class));
-        IoOutputStream mockOut = mock(IoOutputStream.class);
         mockContext = mock(CallHomeSessionContext.class);
         mockSession = mock(ClientSession.class);
         mockChannel = mock(ClientChannel.class);
         Mockito.doReturn(mockIn).when(mockChannel).getAsyncOut();
+
+        IoOutputStream mockOut = mock(IoOutputStream.class);
         Mockito.doReturn(mockOut).when(mockChannel).getAsyncIn();
 
         IoWriteFuture mockWrFuture = mock(IoWriteFuture.class);
@@ -80,9 +78,6 @@ public class MinaSshNettyChannelTest {
         Mockito.doReturn(mockHandler).when(ctx).handler();
         ChannelPromise promise = mock(ChannelPromise.class);
 
-        ByteBufAllocator mockAlloc = mock(ByteBufAllocator.class);
-        ByteBuf bytes = new EmptyByteBuf(mockAlloc);
-
         // we would really like to just verify that the async handler write() was
         // called but it is a final class, so no mocking. instead we set up the
         // mock channel to have no async input, which will cause a failure later
@@ -97,6 +92,8 @@ public class MinaSshNettyChannelTest {
 
         // when
         ChannelOutboundHandlerAdapter outadapter = (ChannelOutboundHandlerAdapter) instance.pipeline().first();
+        ByteBufAllocator mockAlloc = mock(ByteBufAllocator.class);
+        ByteBuf bytes = new EmptyByteBuf(mockAlloc);
         outadapter.write(ctx, bytes, promise);
 
         // then