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