2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.openecomp.appc.adapter.ssh;
25 import java.util.ArrayList;
26 import java.util.List;
28 public class SshAdapterMock implements SshAdapter {
30 private List<SshConnectionMock> connectionMocks = new ArrayList<>();
32 private int returnStatus;
33 private String returnStdout;
34 private String returnStderr;
37 public SshConnection getConnection(String host, int port, String username, String password) {
38 SshConnectionMock sshConnectionMock = new SshConnectionMock(host, port, username, password);
39 sshConnectionMock.setReturnStatus(returnStatus);
40 sshConnectionMock.setReturnStdout(returnStdout);
41 sshConnectionMock.setReturnStderr(returnStderr);
42 connectionMocks.add(sshConnectionMock);
43 return sshConnectionMock;
46 public List<SshConnectionMock> getConnectionMocks() {
47 return connectionMocks;
50 public int getReturnStatus() {
54 public void setReturnStatus(int returnStatus) {
55 this.returnStatus = returnStatus;
58 public String getReturnStdout() {
62 public void setReturnStdout(String returnStdout) {
63 this.returnStdout = returnStdout;
66 public String getReturnStderr() {
70 public void setReturnStderr(String returnStderr) {
71 this.returnStderr = returnStderr;