fix toBean

This commit is contained in:
Looly
2019-10-17 17:37:20 +08:00
parent ff65a8cc0c
commit 61ba892b49
17 changed files with 190 additions and 210 deletions

View File

@@ -157,7 +157,7 @@ public class JschUtil {
*/
public static Session createSession(String sshHost, int sshPort, String sshUser, String privateKeyPath, byte[] passphrase) {
Assert.notEmpty(sshHost, "SSH Host must be not empty!");
Assert.isTrue(sshPort < 0, "SSH Host must be not empty!");
Assert.isTrue(sshPort > 0, "SSH port must be > 0");
Assert.notEmpty(privateKeyPath, "PrivateKey Path must be not empty!");
// 默认root用户

View File

@@ -1,5 +1,6 @@
package cn.hutool.extra.ssh;
import com.jcraft.jsch.JSch;
import org.junit.Ignore;
import org.junit.Test;
@@ -61,4 +62,9 @@ public class JschUtilTest {
IoUtil.close(sftp);
}
@Test
public void getSessionTest(){
JschUtil.getSession("192.168.1.134", 22, "root", "aaa", null);
}
}