Change parent version to snapshot
[appc.git] / appc-config / appc-config-adaptor / provider / src / test / java / org / onap / appc / ccadaptor / ConfigComponentAdaptorTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Modifications Copyright (C) 2018-2019 IBM.
10  * =============================================================================
11  * Modifications Copyright (C) 2018-2019 Ericsson
12  * =============================================================================
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  *      http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  *
25  * ============LICENSE_END=========================================================
26  */
27
28 package org.onap.appc.ccadaptor;
29
30 import static org.junit.Assert.assertEquals;
31 import static org.junit.Assert.assertThat;
32 import com.sun.jersey.api.client.Client;
33 import com.sun.jersey.api.client.ClientResponse;
34 import com.sun.jersey.api.client.WebResource;
35 import java.io.IOException;
36 import java.util.HashMap;
37 import java.util.Map;
38 import java.util.Properties;
39 import org.hamcrest.CoreMatchers;
40 import org.junit.Before;
41 import org.junit.Test;
42 import org.junit.runner.RunWith;
43 import org.mockito.Mockito;
44 import org.mockito.runners.MockitoJUnitRunner;
45 import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor.ConfigStatus;
46 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
47
48 @RunWith(MockitoJUnitRunner.class)
49 public class ConfigComponentAdaptorTest {
50
51     private static final String TERMINATE_COMMAND = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
52             + "\n    <rpc message-id=\"terminateConnection\" xmlns:netconf=\"urn:ietf:params:xml:ns:netconf:base:1.0\" "
53             + "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n <close-session/> \n </rpc>\n ]]>]]>";
54     private SshJcraftWrapper mockWrapper;
55
56     @Before
57     public void setupForTests() {
58         mockWrapper = Mockito.mock(SshJcraftWrapper.class);
59     }
60
61     @Test
62     public void testGet() throws TimedOutException, IOException {
63         Properties props = null;
64         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
65         Mockito.doReturn("TEST\nDATA").when(mockWrapper).receiveUntil(Mockito.anyString(),
66                 Mockito.anyInt(), Mockito.anyString());
67         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
68         String key = "get";
69         Map<String, String> parameters = new HashMap<>();
70         parameters.put("Host_ip_address", "test");
71         SvcLogicContext ctx = new SvcLogicContext();
72         ctx.setAttribute(
73                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
74                 "test");
75         assertEquals(ConfigStatus.SUCCESS, cca.configure(key, parameters, ctx));
76     }
77
78     @Test
79     public void testPutExceptionFlow() throws TimedOutException, IOException {
80         Properties props = null;
81         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
82         Mockito.doThrow(new IOException()).when(mockWrapper).put(Mockito.anyObject(),
83                 Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
84         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
85         String key = "put";
86         Map<String, String> parameters = new HashMap<>();
87         parameters.put("data", "test");
88         SvcLogicContext ctx = new SvcLogicContext();
89         ctx.setAttribute(
90                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
91                 "test");
92         assertEquals(ConfigStatus.FAILURE, cca.configure(key, parameters, ctx));
93     }
94
95     @Test
96     public void testCli() throws TimedOutException, IOException {
97         Properties props = null;
98         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
99         Mockito.doReturn("TEST\nDATA").when(mockWrapper).receiveUntil(Mockito.anyString(),
100                 Mockito.anyInt(), Mockito.anyString());
101         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
102         String Get_config_template =
103                 ("get_config_template\nRequest: \"show config\"\nResponse: Ends_With \"RESPONSE\"");
104         String key = "cli";
105         Map<String, String> parameters = new HashMap<>();
106         loadSshParameters(parameters);
107         parameters.put("Get_config_template", Get_config_template);
108         parameters.put("config-component-configUrl", "testUrl");
109         parameters.put("config-component-configPassword", "testPassword");
110         parameters.put("config-component-configUser", "testUser");
111         SvcLogicContext ctx = new SvcLogicContext();
112         ctx.setAttribute(
113                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
114                 "test");
115         assertEquals(ConfigStatus.SUCCESS, cca.configure(key, parameters, ctx));
116     }
117
118     @Test
119     public void testCliExceptionFlow() throws TimedOutException, IOException {
120         Properties props = null;
121         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
122         Mockito.doThrow(new IOException()).when(mockWrapper).connect(Mockito.anyString(),
123                 Mockito.anyString(), Mockito.anyString(), Mockito.anyInt());
124         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
125         String Get_config_template =
126                 ("get_config_template\nRequest: \"show config\"\nResponse: Ends_With \"RESPONSE\"");
127         String key = "cli";
128         Map<String, String> parameters = new HashMap<>();
129         loadSshParameters(parameters);
130         parameters.put("Get_config_template", Get_config_template);
131         parameters.put("config-component-configUrl", "testUrl");
132         parameters.put("config-component-configPassword", "testPassword");
133         parameters.put("config-component-configUser", "testUser");
134         SvcLogicContext ctx = new SvcLogicContext();
135         ctx.setAttribute(
136                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
137                 "test");
138         assertEquals(ConfigStatus.FAILURE, cca.configure(key, parameters, ctx));
139     }
140
141     @Test
142     public void testEscapeSql() {
143         Properties props = null;
144         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
145         String testArtifactContents = ("\\ \\\\");
146         String key = "escapeSql";
147         Map<String, String> parameters = new HashMap<>();
148         loadSshParameters(parameters);
149         parameters.put("artifactContents", testArtifactContents);
150         SvcLogicContext ctx = new SvcLogicContext();
151         ctx.setAttribute(
152                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
153                 "test");
154         assertEquals(ConfigStatus.SUCCESS, cca.configure(key, parameters, ctx));
155         assertEquals("\\" + testArtifactContents + "\\\\", ctx.getAttribute("escapedData"));
156     }
157
158     @Test
159     public void testGetCliRunningConfig() throws TimedOutException, IOException {
160         Properties props = null;
161         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
162         Mockito.doReturn("TEST\nDATA").when(mockWrapper).receiveUntil(Mockito.anyString(),
163                 Mockito.anyInt(), Mockito.anyString());
164         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
165         String Get_config_template =
166                 ("get_config_template\nRequest: \"show config\"\nResponse: Ends_With \"RESPONSE\"");
167         String key = "GetCliRunningConfig";
168         Map<String, String> parameters = new HashMap<>();
169         loadSshParameters(parameters);
170         parameters.put("Get_config_template", Get_config_template);
171         parameters.put("config-component-configUrl", "testUrl");
172         parameters.put("config-component-configPassword", "testPassword");
173         parameters.put("config-component-configUser", "testUser");
174         SvcLogicContext ctx = new SvcLogicContext();
175         ctx.setAttribute(
176                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
177                 "test");
178         assertEquals(ConfigStatus.SUCCESS, cca.configure(key, parameters, ctx));
179     }
180
181     @Test
182     public void testGetCliRunningConfigExceptionFlow() throws TimedOutException, IOException {
183         Properties props = null;
184         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
185         Mockito.doThrow(new IOException()).when(mockWrapper).receiveUntil(Mockito.anyString(),
186                 Mockito.anyInt(), Mockito.anyString());
187         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
188         String Get_config_template =
189                 ("get_config_template\nRequest: \"show config\"\nResponse: Ends_With \"RESPONSE\"");
190         String key = "GetCliRunningConfig";
191         Map<String, String> parameters = new HashMap<>();
192         loadSshParameters(parameters);
193         parameters.put("Get_config_template", Get_config_template);
194         parameters.put("config-component-configUrl", "testUrl");
195         parameters.put("config-component-configPassword", "testPassword");
196         parameters.put("config-component-configUser", "testUser");
197         SvcLogicContext ctx = new SvcLogicContext();
198         ctx.setAttribute(
199                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
200                 "test");
201         assertEquals(ConfigStatus.FAILURE, cca.configure(key, parameters, ctx));
202     }
203
204     @Test
205     public void testXmlDownload() throws TimedOutException, IOException {
206         Properties props = null;
207         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
208         Mockito.doReturn("TEST\nDATA").when(mockWrapper).receiveUntil(Mockito.anyString(),
209                 Mockito.anyInt(), Mockito.anyString());
210         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
211         String Get_config_template = ("get_config_template");
212         String key = "xml-download";
213         Map<String, String> parameters = new HashMap<>();
214         loadSshParameters(parameters);
215         parameters.put("Get_config_template", Get_config_template);
216
217         SvcLogicContext ctx = new SvcLogicContext();
218         ctx.setAttribute(
219                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
220                 "test");
221         assertEquals(ConfigStatus.SUCCESS, cca.configure(key, parameters, ctx));
222     }
223
224     @Test
225     public void testXmlDownloadExceptionFlow() throws TimedOutException, IOException {
226         Properties props = null;
227         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
228         Mockito.doReturn("rpc-error").when(mockWrapper).receiveUntil("</rpc-reply>", 600000, "");
229         Mockito.doThrow(new IOException()).when(mockWrapper).send(TERMINATE_COMMAND);
230         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
231         String Get_config_template = ("get_config_template");
232         String key = "xml-download";
233         Map<String, String> parameters = new HashMap<>();
234         loadSshParameters(parameters);
235         parameters.put("Get_config_template", Get_config_template);
236
237         SvcLogicContext ctx = new SvcLogicContext();
238         ctx.setAttribute(
239                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
240                 "test");
241         assertEquals(ConfigStatus.FAILURE, cca.configure(key, parameters, ctx));
242     }
243
244     @Test
245     public void testXmlGetrunningconfig() throws TimedOutException, IOException {
246         Properties props = null;
247         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
248         Mockito.doReturn("<configuration xmlns=\"\">\"\n<data>\n</data>\n</configuration>")
249                 .when(mockWrapper)
250                 .receiveUntil(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString());
251         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
252         String key = "xml-getrunningconfig";
253         Map<String, String> parameters = new HashMap<>();
254         loadSshParameters(parameters);
255         SvcLogicContext ctx = new SvcLogicContext();
256         assertEquals(ConfigStatus.SUCCESS, cca.configure(key, parameters, ctx));
257     }
258
259     @Test
260     public void testXmlGetrunningconfigLongResponse() throws TimedOutException, IOException {
261         Properties props = null;
262         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
263         Mockito.doReturn("<configuration xmlns=\"\">\"\n<data>\nData line 1\nData line 2\nData line 3\nData line 4\n"
264                 + "Data line 5\nData line 6\nData line 7\nData line 8\nData line 9\n Data line 10\n"
265                 + "Data line 11\nData line 12\nData line 13\nData line 14\nData line 15\n"
266                 + "Data line 16\nData line 17\nData line 18\nData line 19\nData line 20</data>\n</configuration>")
267                 .when(mockWrapper)
268                 .receiveUntil(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString());
269         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
270         String key = "xml-getrunningconfig";
271         Map<String, String> parameters = new HashMap<>();
272         loadSshParameters(parameters);
273         SvcLogicContext ctx = new SvcLogicContext();
274         assertEquals(ConfigStatus.SUCCESS, cca.configure(key, parameters, ctx));
275     }
276
277     @Test
278     public void testXmlGetrunningconfigExceptionFlow() throws TimedOutException, IOException {
279         Properties props = new Properties();
280         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
281         Mockito.doThrow(new IOException()).when(mockWrapper).connect(Mockito.anyString(),
282                 Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyInt(),
283                 Mockito.anyInt(), Mockito.anyString());
284         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
285         String key = "xml-getrunningconfig";
286         Map<String, String> parameters = new HashMap<>();
287         loadSshParameters(parameters);
288         SvcLogicContext ctx = new SvcLogicContext();
289         assertEquals(ConfigStatus.FAILURE, cca.configure(key, parameters, ctx));
290     }
291
292     @Test
293     public void testDownloadCliConfig() throws TimedOutException, IOException {
294         Properties props = null;
295         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
296         Mockito.doReturn("TEST\nDATA").when(mockWrapper).receiveUntil(Mockito.anyString(),
297                 Mockito.anyInt(), Mockito.anyString());
298         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
299         String Download_config_template =
300                 ("get_config_template\nRequest: \"show config\"\nResponse: Ends_With \"RESPONSE\"");
301         String key = "DownloadCliConfig";
302         Map<String, String> parameters = new HashMap<>();
303         loadSshParameters(parameters);
304         parameters.put("Download_config_template", Download_config_template);
305         SvcLogicContext ctx = new SvcLogicContext();
306         ctx.setAttribute(
307                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
308                 "test");
309         assertEquals(ConfigStatus.SUCCESS, cca.configure(key, parameters, ctx));
310     }
311
312     @Test
313     public void testDownloadCliConfigExceptionFlow() throws TimedOutException, IOException {
314         Properties props = null;
315         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(props));
316         Mockito.doThrow(new IOException("ExceptionFromDownloadCli")).when(mockWrapper)
317                 .receiveUntil(Mockito.anyString(), Mockito.anyInt(), Mockito.anyString());
318         Mockito.doReturn(mockWrapper).when(cca).getSshJcraftWrapper();
319         String Download_config_template = ("get_config_template\nRequest: \"show config\""
320                 + "\n    Execute_config_contents Response: Ends_With\" \"RESPONSE\"\n");
321         String key = "DownloadCliConfig";
322         Map<String, String> parameters = new HashMap<>();
323         loadSshParameters(parameters);
324         parameters.put("Config_contents", "TEST\nDATA");
325         parameters.put("Download_config_template", Download_config_template);
326         SvcLogicContext ctx = new SvcLogicContext();
327         ctx.setAttribute(
328                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
329                 "test");
330         assertEquals(ConfigStatus.FAILURE, cca.configure(key, parameters, ctx));
331     }
332
333     @Test
334     public void testPrepare() {
335         Client mockClient = Mockito.mock(Client.class);
336         WebResource mockWebResource = Mockito.mock(WebResource.class);
337         ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class);
338         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null));
339         Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(),
340                 Mockito.anyString(), Mockito.anyString());
341         Mockito.doReturn(mockWebResource).when(mockClient).resource(Mockito.anyString());
342         Mockito.doReturn(mockClient).when(cca).getClient();
343         Map<String, String> parameters = new HashMap<>();
344         parameters.put("action", "prepare");
345         SvcLogicContext ctx = new SvcLogicContext();
346         ctx.setAttribute(
347                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
348                 "test");
349         assertEquals(ConfigStatus.SUCCESS, cca.configure("", parameters, ctx));
350     }
351
352     @Test
353     public void testPrepareExceptionFlow() {
354         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(null);
355         Map<String, String> parameters = new HashMap<>();
356         parameters.put("action", "prepare");
357         SvcLogicContext ctx = new SvcLogicContext();
358         ctx.setAttribute(
359                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].scale-configuration[0].network-type",
360                 "test");
361         assertEquals(ConfigStatus.FAILURE, cca.configure("", parameters, ctx));
362         assertEquals("500", ctx.getAttribute("error-code"));
363     }
364
365     /**
366      * Test method to add coverage to buildNetworkData2(..) and expandRepeats(..) methods in
367      * ConfigComponentAdaptor by inputting a more complex XML document
368      */
369     @Test
370     public void testPrepareComplexTemplate() {
371         Client mockClient = Mockito.mock(Client.class);
372         WebResource mockWebResource = Mockito.mock(WebResource.class);
373         ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class);
374         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null));
375         Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(),
376                 Mockito.anyString(), Mockito.anyString());
377         Mockito.doReturn(mockWebResource).when(mockClient).resource(Mockito.anyString());
378         Mockito.doReturn(mockClient).when(cca).getClient();
379         String complexTemplateString = cca.readFile("/prepare.xml");
380         Mockito.when(cca.readFile(Mockito.anyString())).thenReturn(complexTemplateString);
381         Map<String, String> parameters = new HashMap<>();
382         parameters.put("action", "prepare");
383         SvcLogicContext ctx = new SvcLogicContext();
384         ctx.setAttribute(
385                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
386                 "test");
387         assertEquals(ConfigStatus.SUCCESS, cca.configure("", parameters, ctx));
388     }
389
390     @Test
391     public void testAudit() {
392         Client mockClient = Mockito.mock(Client.class);
393         WebResource mockWebResource = Mockito.mock(WebResource.class);
394         ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class);
395         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null));
396         Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(),
397                 Mockito.anyString(), Mockito.anyString());
398         Mockito.doReturn(mockWebResource).when(mockClient).resource(Mockito.anyString());
399         Mockito.doReturn(mockClient).when(cca).getClient();
400         Map<String, String> parameters = new HashMap<>();
401         parameters.put("action", "audit");
402         SvcLogicContext ctx = new SvcLogicContext();
403         ctx.setAttribute(
404                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
405                 "test");
406         assertEquals(ConfigStatus.SUCCESS, cca.configure("", parameters, ctx));
407     }
408
409     @Test
410     public void testActivate() {
411         ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class);
412         ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null));
413         Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(),
414                 Mockito.anyString(), Mockito.anyString());
415         Map<String, String> parameters = new HashMap<>();
416         parameters.put("action", "activate");
417         SvcLogicContext ctx = new SvcLogicContext();
418         ctx.setAttribute(
419                 "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
420                 "test");
421         assertEquals(ConfigStatus.SUCCESS, cca.configure("", parameters, ctx));
422     }
423
424     @Test
425     public void testConstructorForNonNullProperties() throws Exception {
426         Properties props = new Properties();
427         props.setProperty("configComponent.url", "testConfigUrl");
428         props.setProperty("configComponent.user", "testConfigUser");
429         props.setProperty("configComponent.passwd", "testConfigPwd");
430         props.setProperty("auditComponent.url", "testAuditUrl");
431         props.setProperty("auditComponent.user", "testAuditUser");
432         props.setProperty("auditComponent.passwd", "testAuditPwd");
433         props.setProperty("service-configuration-notification-url", "testServiceNotificationUrl");
434         props.setProperty("audit-configuration-notification-url", "testAuditNotificationUrl");
435
436         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
437         assertEquals("testConfigUrl", cca.getConfigUrl());
438         assertEquals("testConfigUser", cca.getConfigUser());
439         assertEquals("testConfigPwd", cca.getConfigPassword());
440         assertEquals("testAuditUrl", cca.getAuditUrl());
441         assertEquals("testAuditUser", cca.getAuditUser());
442         assertEquals("testAuditPwd", cca.getAuditPassword());
443         assertEquals("testServiceNotificationUrl", cca.getConfigCallbackUrl());
444         assertEquals("testAuditNotificationUrl", cca.getAuditCallbackUrl());
445     }
446
447     @Test
448     public void testStaticReadFile() {
449         assertThat(ConfigComponentAdaptor._readFile("src/main/resources/config-base.xml"),
450                 CoreMatchers.containsString("<configure>"));
451     }
452
453     @Test
454     public void testActivateMethod() {
455         ConfigComponentAdaptor config= new ConfigComponentAdaptor(new Properties());
456         assertEquals(ConfigStatus.SUCCESS, config.activate("test", new SvcLogicContext()));
457     }
458     
459     @Test
460     public void testDeactivateMethod() {
461         ConfigComponentAdaptor config= new ConfigComponentAdaptor(new Properties());
462         assertEquals(ConfigStatus.SUCCESS, config.deactivate("test", new SvcLogicContext()));
463     }
464     
465     @Test
466     public void testStaticReadFileExceptionFlow() {
467         assertEquals("", ConfigComponentAdaptor._readFile("NON_EXISTENT_FILE"));
468     }
469
470     private void loadSshParameters(Map<String, String> map) {
471         map.put("Host_ip_address", "test");
472         map.put("User_name", "test");
473         map.put("Password", "password");
474         map.put("Port_number", "22");
475         map.put("portNumber", "22");
476     }
477 }