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");
36 public void testGetHost() {
37 assertNotNull(sshConnectionMock.getHost());
38 assertEquals(sshConnectionMock.getHost(), "localhost");
42 public void testGetPort() {
43 assertNotNull(sshConnectionMock.getPort());
44 assertEquals(sshConnectionMock.getPort(), 8080);
48 public void testGetUsername() {
49 assertNotNull(sshConnectionMock.getUsername());
50 assertEquals(sshConnectionMock.getUsername(), "myUser");
54 public void testGetPassword() {
55 assertNotNull(sshConnectionMock.getPassword());
56 assertEquals(sshConnectionMock.getPassword(), "myPassword");
59 public void testGetReturnStderr() {
60 sshConnectionMock.setReturnStderr("returnStderr");
61 assertNotNull(sshConnectionMock.getReturnStderr());
62 assertEquals(sshConnectionMock.getReturnStderr(), "returnStderr");
65 public void testGetReturnStdout() {
66 sshConnectionMock.setReturnStdout("returnStdout");
67 assertNotNull(sshConnectionMock.getReturnStdout());
68 assertEquals(sshConnectionMock.getReturnStdout(), "returnStdout");
71 public void testGetReturnStatus() {
72 sshConnectionMock.setReturnStatus(200);
73 assertNotNull(sshConnectionMock.getReturnStatus());
74 assertEquals(sshConnectionMock.getReturnStatus(), 200);
77 public void testGetExecutedCommands() {
78 sshConnectionMock.getExecutedCommands().add("cls");
79 sshConnectionMock.getExecutedCommands().add("pwd");
80 assertNotNull(sshConnectionMock.getExecutedCommands());
81 assertEquals(false, sshConnectionMock.getExecutedCommands().isEmpty());