summaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main
diff options
context:
space:
mode:
authorGanesh Chandrasekaran <ganesh.c@samsung.com>2018-07-20 16:32:46 +0900
committerPatrick Brady <pb071s@att.com>2018-07-26 21:47:39 +0000
commit14175c4605745183a09dcd0fdc72c0d4e8a05b20 (patch)
tree0fa5e27c0207cc3da30f4acf3af9bc1020bff4aa /appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main
parentfdf7e648663e5770a431e9ba8088be6c3bbf1f5a (diff)
API to support getConnection with SSH KeyFile
Issue-ID: APPC-1097 Change-Id: Ic9baa3e43be55bc20aa974898c164cc8a590a78a Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Diffstat (limited to 'appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main')
-rw-r--r--appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshAdapterMock.java12
-rw-r--r--appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshConnectionMock.java16
2 files changed, 22 insertions, 6 deletions
diff --git a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshAdapterMock.java b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshAdapterMock.java
index 2ef49b832..55d77821a 100644
--- a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshAdapterMock.java
+++ b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshAdapterMock.java
@@ -36,7 +36,17 @@ public class SshAdapterMock implements SshAdapter {
@Override
public SshConnection getConnection(String host, int port, String username, String password) {
- SshConnectionMock sshConnectionMock = new SshConnectionMock(host, port, username, password);
+ SshConnectionMock sshConnectionMock = new SshConnectionMock(host, port, username, password, null);
+ sshConnectionMock.setReturnStatus(returnStatus);
+ sshConnectionMock.setReturnStdout(returnStdout);
+ sshConnectionMock.setReturnStderr(returnStderr);
+ connectionMocks.add(sshConnectionMock);
+ return sshConnectionMock;
+ }
+
+ @Override
+ public SshConnection getConnection(String host, int port, String keyFile) {
+ SshConnectionMock sshConnectionMock = new SshConnectionMock(host, port, null, null, keyFile);
sshConnectionMock.setReturnStatus(returnStatus);
sshConnectionMock.setReturnStdout(returnStdout);
sshConnectionMock.setReturnStderr(returnStderr);
diff --git a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshConnectionMock.java b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshConnectionMock.java
index e62274b60..b61fc136f 100644
--- a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshConnectionMock.java
+++ b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/main/java/org/onap/appc/adapter/ssh/SshConnectionMock.java
@@ -34,10 +34,11 @@ public class SshConnectionMock implements SshConnection {
private static final int DEF_SUCCESS_STATUS = 0;
- private String host;
- private int port;
- private String username;
- private String password;
+ private final String host;
+ private final int port;
+ private final String username;
+ private final String password;
+ private final String keyFile;
private long timeout;
private int returnStatus = DEF_SUCCESS_STATUS;
@@ -48,11 +49,12 @@ public class SshConnectionMock implements SshConnection {
private int disconnectCallCount = 0;
private List<String> executedCommands = new ArrayList<>();
- public SshConnectionMock(String host, int port, String username, String password) {
+ public SshConnectionMock(String host, int port, String username, String password, String keyFile) {
this.host = host;
this.port = port;
this.username = username;
this.password = password;
+ this.keyFile = keyFile;
}
@Override
@@ -124,6 +126,10 @@ public class SshConnectionMock implements SshConnection {
return password;
}
+ public String getKeyFile() {
+ return keyFile;
+ }
+
public int getConnectCallCount() {
return connectCallCount;
}