e8d917a0eb7143b80022bfaa9fcc66d258333505
[appc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * APPC
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
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
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.
21  */
22
23 package org.openecomp.appc.adapter.ssh;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 public class SshAdapterMock implements SshAdapter {
29
30         private List<SshConnectionMock> connectionMocks = new ArrayList<>();
31
32         private int returnStatus;
33         private String returnStdout;
34         private String returnStderr;
35
36         @Override
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;
44         }
45
46         public List<SshConnectionMock> getConnectionMocks() {
47                 return connectionMocks;
48         }
49
50         public int getReturnStatus() {
51                 return returnStatus;
52         }
53
54         public void setReturnStatus(int returnStatus) {
55                 this.returnStatus = returnStatus;
56         }
57
58         public String getReturnStdout() {
59                 return returnStdout;
60         }
61
62         public void setReturnStdout(String returnStdout) {
63                 this.returnStdout = returnStdout;
64         }
65
66         public String getReturnStderr() {
67                 return returnStderr;
68         }
69
70         public void setReturnStderr(String returnStderr) {
71                 this.returnStderr = returnStderr;
72         }
73 }