2 * ============LICENSE_START=======================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * ============LICENSE_END=========================================================
23 package org.onap.appc.ccadaptor;
25 import java.util.HashMap;
27 import java.util.Properties;
29 import org.junit.Test;
30 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
32 public class TestConfigComponentAdaptor {
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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");
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);