2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
6 *=================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.appc.adapter.ssh;
22 import static org.junit.Assert.*;
24 import org.junit.Before;
25 import org.junit.Test;
27 public class TestSshConnectionMock {
29 private SshConnectionMock sshConnectionMock;
32 sshConnectionMock=new SshConnectionMock("localhost", 8080, "myUser", "myPassword", "sampleKeyFile");
36 public void testGetHost() {
37 assertEquals("localhost", sshConnectionMock.getHost());
41 public void testGetPort() {
42 assertEquals(8080, sshConnectionMock.getPort());
46 public void testGetUsername() {
47 assertEquals("myUser", sshConnectionMock.getUsername());
51 public void testGetPassword() {
52 assertEquals("myPassword", sshConnectionMock.getPassword());
56 public void testKeyFile() {
57 assertEquals("sampleKeyFile", sshConnectionMock.getKeyFile());
61 public void testGetReturnStderr() {
62 sshConnectionMock.setReturnStderr("returnStderr");
63 assertEquals("returnStderr", sshConnectionMock.getReturnStderr());
66 public void testGetReturnStdout() {
67 sshConnectionMock.setReturnStdout("returnStdout");
68 assertEquals("returnStdout", sshConnectionMock.getReturnStdout());
71 public void testGetReturnStatus() {
72 sshConnectionMock.setReturnStatus(200);
73 assertEquals(200, sshConnectionMock.getReturnStatus());
76 public void testGetExecutedCommands() {
77 sshConnectionMock.getExecutedCommands().add("cls");
78 sshConnectionMock.getExecutedCommands().add("pwd");
79 assertNotNull(sshConnectionMock.getExecutedCommands());
80 assertEquals(false, sshConnectionMock.getExecutedCommands().isEmpty());