Merge "BUG-1617 Extract AuthProvider from netconf ssh"
authorTony Tkacik <ttkacik@cisco.com>
Thu, 28 Aug 2014 15:47:25 +0000 (15:47 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 28 Aug 2014 15:47:25 +0000 (15:47 +0000)
1  2 
opendaylight/netconf/netconf-ssh/src/test/java/org/opendaylight/controller/netconf/netty/SSHTest.java

index b3478c36931a7286f06a7eea4d9bc56bd6ccc7eb,80107943644c2f19fadb9804c1f63c30281fb610..ce1400bbcb24a5d455ad179a93da6098530c5790
@@@ -27,12 -27,11 +27,11 @@@ import java.util.concurrent.TimeUnit
  import org.junit.After;
  import org.junit.Before;
  import org.junit.Test;
+ import org.opendaylight.controller.netconf.auth.AuthProvider;
  import org.opendaylight.controller.netconf.netty.EchoClientHandler.State;
  import org.opendaylight.controller.netconf.nettyutil.handler.ssh.authentication.LoginPassword;
  import org.opendaylight.controller.netconf.nettyutil.handler.ssh.client.AsyncSshHandler;
  import org.opendaylight.controller.netconf.ssh.NetconfSSHServer;
- import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider;
- import org.opendaylight.controller.netconf.ssh.authentication.AuthProviderImpl;
  import org.opendaylight.controller.netconf.ssh.authentication.PEMGenerator;
  import org.opendaylight.controller.netconf.util.osgi.NetconfConfigUtil;
  import org.slf4j.Logger;
@@@ -59,13 -58,11 +58,13 @@@ public class SSHTest 
      @Test
      public void test() throws Exception {
          new Thread(new EchoServer(), "EchoServer").start();
-         AuthProvider authProvider = mock(AuthProviderImpl.class);
-         doReturn(PEMGenerator.generate().toCharArray()).when(authProvider).getPEMAsCharArray();
+         AuthProvider authProvider = mock(AuthProvider.class);
          doReturn(true).when(authProvider).authenticated(anyString(), anyString());
 +        doReturn("auth").when(authProvider).toString();
 +
          NetconfSSHServer netconfSSHServer = NetconfSSHServer.start(10831, NetconfConfigUtil.getNetconfLocalAddress(),
-                 authProvider, new NioEventLoopGroup());
+                 new NioEventLoopGroup(), PEMGenerator.generate().toCharArray());
+         netconfSSHServer.setAuthProvider(authProvider);
  
          InetSocketAddress address = netconfSSHServer.getLocalSocketAddress();
          final EchoClientHandler echoClientHandler = connectClient(address);