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.ccsdk.sli.adaptors.ssh;
22 import org.junit.Before;
23 import org.junit.Test;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.assertFalse;
27 import static org.junit.Assert.assertNotNull;
29 public class TestSshAdaptorMock {
30 private SshAdaptorMock sshAdaptorMock;
34 sshAdaptorMock = new SshAdaptorMock();
38 public void testGetReturnStatus() {
39 sshAdaptorMock.setReturnStatus(200);
40 assertEquals(sshAdaptorMock.getReturnStatus(), 200);
44 public void testGetReturnStdout() {
45 sshAdaptorMock.setReturnStdout("success");
46 assertNotNull(sshAdaptorMock.getReturnStdout());
47 assertEquals(sshAdaptorMock.getReturnStdout(), "success");
51 public void testGetReturnStderr() {
52 sshAdaptorMock.setReturnStderr("error");
53 assertNotNull(sshAdaptorMock.getReturnStderr());
54 assertEquals(sshAdaptorMock.getReturnStderr(), "error");
58 public void testGetConnectionMocks() {
59 sshAdaptorMock.setReturnStatus(200);
60 sshAdaptorMock.setReturnStdout("success");
61 sshAdaptorMock.setReturnStderr("error");
62 sshAdaptorMock.getConnection("localhost", 8080, "myUser", "myPassword");
63 assertFalse(sshAdaptorMock.getConnectionMocks().isEmpty());
64 assertNotNull(sshAdaptorMock.getConnectionMocks());
68 public void testGetConnection() {
69 SshAdaptorMock sshAdaptorMock = new SshAdaptorMock();
70 sshAdaptorMock.setReturnStatus(200);
71 sshAdaptorMock.setReturnStdout("success");
72 sshAdaptorMock.setReturnStderr("error");
73 sshAdaptorMock.getConnection("localhost", 8080, "keyFile");
74 assertFalse(sshAdaptorMock.getConnectionMocks().isEmpty());