X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-ssh%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fssh%2Fauthentication%2FSSHServerTest.java;h=edcf19380d6e04d765e6599c6009d13ea32db172;hb=be9e646f67e160652f89d78c7dd2377fc36c7d1d;hp=7af4598997cc6254906f387fa7d809f8c0092ee0;hpb=7aa14fc90d0344b9645c5c6ddd64315a1c2dc748;p=netconf.git diff --git a/netconf/netconf-ssh/src/test/java/org/opendaylight/netconf/ssh/authentication/SSHServerTest.java b/netconf/netconf-ssh/src/test/java/org/opendaylight/netconf/ssh/authentication/SSHServerTest.java index 7af4598997..edcf19380d 100644 --- a/netconf/netconf-ssh/src/test/java/org/opendaylight/netconf/ssh/authentication/SSHServerTest.java +++ b/netconf/netconf-ssh/src/test/java/org/opendaylight/netconf/ssh/authentication/SSHServerTest.java @@ -7,8 +7,8 @@ */ package org.opendaylight.netconf.ssh.authentication; -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.doNothing; import static org.mockito.Mockito.doReturn; @@ -21,19 +21,18 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import org.apache.sshd.ClientSession; -import org.apache.sshd.SshClient; +import org.apache.sshd.client.SshClient; import org.apache.sshd.client.future.AuthFuture; import org.apache.sshd.client.future.ConnectFuture; -import org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider; +import org.apache.sshd.client.session.ClientSession; +import org.apache.sshd.common.util.security.SecurityUtils; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.opendaylight.netconf.auth.AuthProvider; import org.opendaylight.netconf.ssh.SshProxyServer; import org.opendaylight.netconf.ssh.SshProxyServerConfigurationBuilder; -import org.opendaylight.netconf.util.osgi.NetconfConfiguration; +import org.opendaylight.netconf.util.NetconfConfiguration; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceListener; import org.osgi.framework.ServiceReference; @@ -74,13 +73,8 @@ public class SSHServerTest { server = new SshProxyServer(minaTimerEx, clientGroup, nioExec); server.bind(new SshProxyServerConfigurationBuilder() .setBindingAddress(addr).setLocalAddress(NetconfConfiguration.NETCONF_LOCAL_ADDRESS) - .setAuthenticator(new AuthProvider() { - @Override - public boolean authenticated(final String username, final String password) { - return true; - } - }) - .setKeyPairProvider(new PEMGeneratorHostKeyProvider(sshKeyPair.toPath().toAbsolutePath().toString())) + .setAuthenticator((username, password) -> true) + .setKeyPairProvider(SecurityUtils.createGeneratorHostKeyProvider(sshKeyPair.toPath())) .setIdleTimeout(Integer.MAX_VALUE).createSshProxyServerConfiguration()); LOG.info("SSH server started on {}", PORT); }