|
a/src/test/java/net/timbusproject/extractors/util/SSHManagerTest.java |
|
b/src/test/java/net/timbusproject/extractors/util/SSHManagerTest.java |
1 |
package net.timbusproject.extractors.util;
|
1 |
package net.timbusproject.extractors.util;
|
2 |
|
2 |
|
3 |
import com.jcraft.jsch.Session;
|
3 |
import com.jcraft.jsch.Session;
|
4 |
import net.timbusproject.extractors.modules.tavernaextractor.utils.SSHManager;
|
4 |
import net.timbusproject.extractors.modules.tavernaextractor.utils.SSHManager;
|
|
|
5 |
import org.junit.Ignore;
|
5 |
import org.junit.Test;
|
6 |
import org.junit.Test;
|
6 |
|
7 |
|
7 |
import java.io.File;
|
8 |
import java.io.File;
|
8 |
|
9 |
|
9 |
public class SSHManagerTest{
|
10 |
public class SSHManagerTest{
|
10 |
|
11 |
|
11 |
|
12 |
@Ignore
|
12 |
@Test
|
13 |
@Test
|
13 |
public void test_communication()throws Exception{
|
14 |
public void test_communication()throws Exception{
|
14 |
|
15 |
|
15 |
SSHManager ssh = new SSHManager("172.16.1.42",22, "timbus", "timbus");
|
16 |
SSHManager ssh = new SSHManager("172.16.1.42",22, "timbus", "timbus");
|
16 |
Session session = ssh.createSession(60000);
|
17 |
Session session = ssh.createSession(60000);
|
|
... |
|
... |
23 |
|
24 |
|
24 |
while(session.isConnected()){
|
25 |
while(session.isConnected()){
|
25 |
;
|
26 |
;
|
26 |
}
|
27 |
}
|
27 |
|
28 |
|
28 |
// receiving file
|
29 |
/* receiving file
|
29 |
|
30 |
|
30 |
/*
|
|
|
31 |
IMPORTANT: session.disconnect sends session object into the void.
|
31 |
IMPORTANT: session.disconnect sends session object into the void.
|
32 |
Therefore it is necessary to create a new session after a sessions.disconnect() call.
|
32 |
Therefore it is necessary to create a new session after a sessions.disconnect() call.
|
33 |
*/
|
33 |
*/
|
34 |
session = ssh.createSession(60000);
|
34 |
session = ssh.createSession(60000);
|
35 |
ssh.sendFile(session, file.getAbsolutePath(), "/home/timbus/Documents/opencv.sh.new");
|
35 |
ssh.sendFile(session, file.getAbsolutePath(), "/home/timbus/Documents/opencv.sh.new");
|