From 14175c4605745183a09dcd0fdc72c0d4e8a05b20 Mon Sep 17 00:00:00 2001 From: Ganesh Chandrasekaran Date: Fri, 20 Jul 2018 16:32:46 +0900 Subject: API to support getConnection with SSH KeyFile Issue-ID: APPC-1097 Change-Id: Ic9baa3e43be55bc20aa974898c164cc8a590a78a Signed-off-by: Ganesh Chandrasekaran --- .../appc/adapter/ssh/TestSshConnectionMock.java | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/test') diff --git a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/test/java/org/onap/appc/adapter/ssh/TestSshConnectionMock.java b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/test/java/org/onap/appc/adapter/ssh/TestSshConnectionMock.java index 182e0d7c7..750a3bafa 100644 --- a/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/test/java/org/onap/appc/adapter/ssh/TestSshConnectionMock.java +++ b/appc-adapters/appc-ssh-adapter/appc-ssh-adapter-tests/src/test/java/org/onap/appc/adapter/ssh/TestSshConnectionMock.java @@ -29,49 +29,48 @@ public class TestSshConnectionMock { private SshConnectionMock sshConnectionMock; @Before public void setUp() { - sshConnectionMock=new SshConnectionMock("localhost", 8080, "myUser", "myPassword"); + sshConnectionMock=new SshConnectionMock("localhost", 8080, "myUser", "myPassword", "sampleKeyFile"); } @Test public void testGetHost() { - assertNotNull(sshConnectionMock.getHost()); - assertEquals(sshConnectionMock.getHost(), "localhost"); + assertEquals("localhost", sshConnectionMock.getHost()); } @Test public void testGetPort() { - assertNotNull(sshConnectionMock.getPort()); - assertEquals(sshConnectionMock.getPort(), 8080); + assertEquals(8080, sshConnectionMock.getPort()); } @Test public void testGetUsername() { - assertNotNull(sshConnectionMock.getUsername()); - assertEquals(sshConnectionMock.getUsername(), "myUser"); + assertEquals("myUser", sshConnectionMock.getUsername()); } @Test public void testGetPassword() { - assertNotNull(sshConnectionMock.getPassword()); - assertEquals(sshConnectionMock.getPassword(), "myPassword"); + assertEquals("myPassword", sshConnectionMock.getPassword()); } + + @Test + public void testKeyFile() { + assertEquals("sampleKeyFile", sshConnectionMock.getKeyFile()); + } + @Test public void testGetReturnStderr() { sshConnectionMock.setReturnStderr("returnStderr"); - assertNotNull(sshConnectionMock.getReturnStderr()); - assertEquals(sshConnectionMock.getReturnStderr(), "returnStderr"); + assertEquals("returnStderr", sshConnectionMock.getReturnStderr()); } @Test public void testGetReturnStdout() { sshConnectionMock.setReturnStdout("returnStdout"); - assertNotNull(sshConnectionMock.getReturnStdout()); - assertEquals(sshConnectionMock.getReturnStdout(), "returnStdout"); + assertEquals("returnStdout", sshConnectionMock.getReturnStdout()); } @Test public void testGetReturnStatus() { sshConnectionMock.setReturnStatus(200); - assertNotNull(sshConnectionMock.getReturnStatus()); - assertEquals(sshConnectionMock.getReturnStatus(), 200); + assertEquals(200, sshConnectionMock.getReturnStatus()); } @Test public void testGetExecutedCommands() { -- cgit 1.2.3-korg