diff options
author | Ganesh <ganesh.c@samsung.com> | 2021-10-06 15:51:36 +0530 |
---|---|---|
committer | Ganesh <ganesh.c@samsung.com> | 2021-10-06 15:52:20 +0530 |
commit | cef711e2a291ab1779052d36cf5b21ccd9ed498b (patch) | |
tree | bebfbb4b44a7bbfbcc0261cc5bffd8166cd342e3 /adaptors/saltstack-adaptor | |
parent | a66d29f4ba5f5d5636f3de84ab184dad844f027b (diff) |
saltstack adaptor test cases added
Signed-off-by: Ganesh <ganesh.c@samsung.com>
Issue-ID: CCSDK-3476
Change-Id: Ie0fe8d6848aab36ffe4c5018d5e2b6df0c4c09de
Diffstat (limited to 'adaptors/saltstack-adaptor')
-rw-r--r-- | adaptors/saltstack-adaptor/saltstack-adaptor-provider/src/test/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/TestSshConnection.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/adaptors/saltstack-adaptor/saltstack-adaptor-provider/src/test/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/TestSshConnection.java b/adaptors/saltstack-adaptor/saltstack-adaptor-provider/src/test/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/TestSshConnection.java index 89b0ecf4b..b7a06ae12 100644 --- a/adaptors/saltstack-adaptor/saltstack-adaptor-provider/src/test/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/TestSshConnection.java +++ b/adaptors/saltstack-adaptor/saltstack-adaptor-provider/src/test/java/org/onap/ccsdk/sli/adaptors/saltstack/impl/TestSshConnection.java @@ -22,7 +22,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.adapter.impl; +package org.onap.ccsdk.sli.adaptors.saltstack.impl; import org.junit.Before; import org.junit.Test; @@ -32,12 +32,14 @@ import org.onap.ccsdk.sli.adaptors.saltstack.impl.SshConnection; import java.io.FileOutputStream; import java.io.OutputStream; +import java.util.Properties; import static org.junit.Assert.assertEquals; public class TestSshConnection { private SshConnection sshConnection; +private Properties params; @Before @@ -47,9 +49,9 @@ private SshConnection sshConnection; String User = "test"; String Password = "test"; sshConnection = new SshConnection(HostName, Port, User, Password); + params = new Properties(); } - @Test(expected=NullPointerException.class) public void reqConnect_exitStatusFailed() { sshConnection.setExecTimeout(10); @@ -61,6 +63,12 @@ private SshConnection sshConnection; sshConnection.setExecTimeout(10); int outcome = 999; try { + params.put("org.onap.appc.adaptor.saltstack.clientType", "SSH_CERT"); + params.put("org.onap.appc.adaptor.saltstack.host", "test"); + params.put("org.onap.appc.adaptor.saltstack.port", "10"); + params.put("org.onap.appc.adaptor.saltstack.userName", "test"); + params.put("org.onap.appc.adaptor.saltstack.userPasswd", "test"); + params.put("org.onap.appc.adaptor.saltstack.sshKey", "test"); OutputStream res = new FileOutputStream("test.out"); outcome = sshConnection.execCommandWithPty("ls",res); assertEquals(1,outcome); @@ -71,6 +79,12 @@ private SshConnection sshConnection; @Test(expected=NullPointerException.class) public void reqDisconnect_exitStatusFailed() { + params.put("org.onap.appc.adaptor.saltstack.clientType", "SSH_CERT"); + params.put("org.onap.appc.adaptor.saltstack.host", "test"); + params.put("org.onap.appc.adaptor.saltstack.port", "10"); + params.put("org.onap.appc.adaptor.saltstack.userName", "test"); + params.put("org.onap.appc.adaptor.saltstack.userPasswd", "test"); + params.put("org.onap.appc.adaptor.saltstack.sshKey", "test"); sshConnection.setExecTimeout(10); sshConnection.disconnect(); } @@ -80,6 +94,12 @@ private SshConnection sshConnection; sshConnection.setExecTimeout(10); int outcome=999; try { + params.put("org.onap.appc.adaptor.saltstack.clientType", "SSH_CERT"); + params.put("org.onap.appc.adaptor.saltstack.host", "test"); + params.put("org.onap.appc.adaptor.saltstack.port", "10"); + params.put("org.onap.appc.adaptor.saltstack.userName", "test"); + params.put("org.onap.appc.adaptor.saltstack.userPasswd", "test"); + params.put("org.onap.appc.adaptor.saltstack.sshKey", "test"); OutputStream res = new FileOutputStream("test.out"); OutputStream resErr = new FileOutputStream("test.out"); outcome = sshConnection.execCommand("ls",res, resErr); |