Move netconf-dom-api
[netconf.git] / netconf / netconf-client / src / test / java / org / opendaylight / netconf / client / SshClientChannelInitializerTest.java
index 2bfe717403472ff663743d8daefe805ff7652ece..73599e3af005477c4defaa002da2585310d680bf 100644 (file)
@@ -5,24 +5,23 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.client;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
 import io.netty.channel.Channel;
+import io.netty.channel.ChannelConfig;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelPipeline;
 import io.netty.util.concurrent.Promise;
 import org.junit.Test;
+import org.opendaylight.netconf.api.NetconfSessionListenerFactory;
 import org.opendaylight.netconf.nettyutil.handler.ssh.authentication.AuthenticationHandler;
-import org.opendaylight.protocol.framework.SessionListenerFactory;
-import org.opendaylight.protocol.framework.SessionNegotiator;
 
 public class SshClientChannelInitializerTest {
     @Test
@@ -32,10 +31,10 @@ public class SshClientChannelInitializerTest {
         NetconfClientSessionNegotiatorFactory negotiatorFactory = mock(NetconfClientSessionNegotiatorFactory.class);
         NetconfClientSessionListener sessionListener = mock(NetconfClientSessionListener.class);
 
-        SessionNegotiator<?> sessionNegotiator = mock(SessionNegotiator.class);
+        NetconfClientSessionNegotiator sessionNegotiator = mock(NetconfClientSessionNegotiator.class);
         doReturn("").when(sessionNegotiator).toString();
-        doReturn(sessionNegotiator).when(negotiatorFactory).getSessionNegotiator(any(SessionListenerFactory.class),
-                any(Channel.class), any(Promise.class));
+        doReturn(sessionNegotiator).when(negotiatorFactory).getSessionNegotiator(
+            any(NetconfSessionListenerFactory.class), any(Channel.class), any(Promise.class));
         ChannelPipeline pipeline = mock(ChannelPipeline.class);
         doReturn(pipeline).when(pipeline).addAfter(anyString(), anyString(), any(ChannelHandler.class));
         Channel channel = mock(Channel.class);
@@ -43,6 +42,10 @@ public class SshClientChannelInitializerTest {
         doReturn("").when(channel).toString();
         doReturn(pipeline).when(pipeline).addFirst(any(ChannelHandler.class));
         doReturn(pipeline).when(pipeline).addLast(anyString(), any(ChannelHandler.class));
+        ChannelConfig channelConfig = mock(ChannelConfig.class);
+        doReturn(channelConfig).when(channel).config();
+        doReturn(1L).when(negotiatorFactory).getConnectionTimeoutMillis();
+        doReturn(channelConfig).when(channelConfig).setConnectTimeoutMillis(1);
 
         Promise<NetconfClientSession> promise = mock(Promise.class);
         doReturn("").when(promise).toString();