Skip to content

Commit a4e8dcb

Browse files
fix unit test
1 parent bc62760 commit a4e8dcb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/test/java/org/embulk/input/sftp/TestSftpFileInputPlugin.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.apache.sshd.server.SshServer;
1818
import org.apache.sshd.server.auth.password.PasswordAuthenticator;
1919
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
20+
import org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider;
2021
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
2122
import org.apache.sshd.server.scp.ScpCommandFactory;
2223
import org.apache.sshd.server.session.ServerSession;
@@ -46,8 +47,10 @@
4647
import org.littleshoot.proxy.impl.DefaultHttpProxyServer;
4748
import org.slf4j.Logger;
4849

50+
import java.io.File;
4951
import java.io.IOException;
5052
import java.lang.reflect.Method;
53+
import java.nio.file.Paths;
5154
import java.security.PublicKey;
5255
import java.util.ArrayList;
5356
import java.util.Arrays;
@@ -514,7 +517,10 @@ private SshServer createSshServer(String host, int port, final String sshUsernam
514517
sshServer.setPort(port);
515518
sshServer.setSubsystemFactories(Collections.<NamedFactory<Command>>singletonList(new SftpSubsystemFactory()));
516519
sshServer.setCommandFactory(new ScpCommandFactory());
517-
sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
520+
File file = new File(SECRET_KEY_FILE);
521+
AbstractGeneratorHostKeyProvider hostKeyProvider = new SimpleGeneratorHostKeyProvider(file);
522+
hostKeyProvider.setAlgorithm("RSA");
523+
sshServer.setKeyPairProvider(hostKeyProvider);
518524
sshServer.setPasswordAuthenticator(new PasswordAuthenticator()
519525
{
520526
@Override

0 commit comments

Comments
 (0)