Changed to unmaintained
[appc.git] / appc-config / appc-config-adaptor / provider / src / main / test / org / onap / appc / ccadaptor / TestConfigComponentAdaptor.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  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * ============LICENSE_END=========================================================
22  */
23 package org.onap.appc.ccadaptor;
24
25 import java.util.HashMap;
26 import java.util.Map;
27 import java.util.Properties;
28
29 import org.junit.Test;
30 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
31
32 public class TestConfigComponentAdaptor {
33     
34     
35     @Test
36     public void testGetCliRunningConfig(){
37         Properties props = null;
38         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
39         String Get_config_template = ("get_config_template");
40         String key = "GetCliRunningConfig";
41         Map<String, String> parameters = new HashMap<String, String>();
42         parameters.put("Host_ip_address", "test");
43         parameters.put("User_name", "test");
44         parameters.put("Password", "password");
45         parameters.put("Port_number", "22");
46         parameters.put("Get_config_template", Get_config_template);
47
48         SvcLogicContext ctx = new SvcLogicContext();
49         ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
50         cca.configure(key, parameters, ctx);
51         
52     }
53     
54     @Test
55     public void testDownloadCliConfig(){
56         Properties props = null;
57         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
58         String Get_config_template = ("get_config_template");
59         String key = "DownloadCliConfig";
60         Map<String, String> parameters = new HashMap<String, String>();
61         parameters.put("Host_ip_address", "test");
62         parameters.put("User_name", "test");
63         parameters.put("Password", "password");
64         parameters.put("Port_number", "22");
65         parameters.put("Get_config_template", Get_config_template);
66
67         SvcLogicContext ctx = new SvcLogicContext();
68         ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
69         cca.configure(key, parameters, ctx);
70         
71     }
72     
73     @Test
74     public void testXmlDownload(){
75         Properties props = null;
76         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
77         String Get_config_template = ("get_config_template");
78         String key = "xml-download";
79         Map<String, String> parameters = new HashMap<String, String>();
80         parameters.put("Host_ip_address", "test");
81         parameters.put("User_name", "test");
82         parameters.put("Password", "password");
83         parameters.put("Port_number", "22");
84         parameters.put("Get_config_template", Get_config_template);
85
86         SvcLogicContext ctx = new SvcLogicContext();
87         ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
88         cca.configure(key, parameters, ctx);
89     }
90     
91     @Test
92     public void testXmlGetrunningconfig(){
93         Properties props = null;
94         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
95         String Get_config_template = ("get_config_template");
96         String key = "xml-getrunningconfig";
97         Map<String, String> parameters = new HashMap<String, String>();
98         parameters.put("Host_ip_address", "test");
99         parameters.put("User_name", "test");
100         parameters.put("Password", "password");
101         parameters.put("Port_number", "22");
102         parameters.put("Get_config_template", Get_config_template);
103
104         SvcLogicContext ctx = new SvcLogicContext();
105         ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
106         cca.configure(key, parameters, ctx);
107         
108     }
109     
110     @Test
111     public void testEscapeSql(){
112         Properties props = null;
113         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
114         String Get_config_template = ("get_config_template");
115         String key = "escapeSql";
116         Map<String, String> parameters = new HashMap<String, String>();
117         parameters.put("Host_ip_address", "test");
118         parameters.put("User_name", "test");
119         parameters.put("Password", "password");
120         parameters.put("Port_number", "22");
121         parameters.put("Get_config_template", Get_config_template);
122
123         SvcLogicContext ctx = new SvcLogicContext();
124         ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
125         cca.configure(key, parameters, ctx);
126     }
127     
128     @Test
129     public void testAll(){
130         Properties props = null;
131         ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
132         String Get_config_template = ("test");
133         String Download_config_template = ("test");
134         String key = "GetCliRunningConfig";
135         Map<String, String> parameters = new HashMap<String,String>();
136         parameters.put("Host_ip_address", "test");
137         parameters.put("User_name", "test");
138         parameters.put("Password", "password");
139         parameters.put("Port_number", "22");
140         parameters.put("Protocol", "netconf");
141         parameters.put("Contents", "Contents");
142         parameters.put("Get_config_template", Get_config_template);
143         parameters.put("Download_config_template", Download_config_template);
144         parameters.put("Config_contents", "config\nsystem\nservice-interface serv1\nipv4\ngateway-ip-address 192.168.30.44");
145
146         SvcLogicContext ctx = new SvcLogicContext();
147         ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
148         cca.configure(key, parameters, ctx);
149         
150         
151     }
152     
153
154 }