2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
24 package org.onap.appc.ccadaptor;
26 import java.util.HashMap;
28 import java.util.Properties;
30 import org.junit.Test;
31 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
33 public class TestConfigComponentAdaptor {
37 public void testGetCliRunningConfig(){
38 Properties props = null;
39 ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
40 String Get_config_template = ("get_config_template");
41 String key = "GetCliRunningConfig";
42 Map<String, String> parameters = new HashMap<String, String>();
43 parameters.put("Host_ip_address", "test");
44 parameters.put("User_name", "test");
45 parameters.put("Password", "password");
46 parameters.put("Port_number", "22");
47 parameters.put("Get_config_template", Get_config_template);
49 SvcLogicContext ctx = new SvcLogicContext();
50 ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
51 cca.configure(key, parameters, ctx);
56 public void testDownloadCliConfig(){
57 Properties props = null;
58 ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
59 String Get_config_template = ("get_config_template");
60 String key = "DownloadCliConfig";
61 Map<String, String> parameters = new HashMap<String, String>();
62 parameters.put("Host_ip_address", "test");
63 parameters.put("User_name", "test");
64 parameters.put("Password", "password");
65 parameters.put("Port_number", "22");
66 parameters.put("Get_config_template", Get_config_template);
68 SvcLogicContext ctx = new SvcLogicContext();
69 ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
70 cca.configure(key, parameters, ctx);
75 public void testXmlDownload(){
76 Properties props = null;
77 ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
78 String Get_config_template = ("get_config_template");
79 String key = "xml-download";
80 Map<String, String> parameters = new HashMap<String, String>();
81 parameters.put("Host_ip_address", "test");
82 parameters.put("User_name", "test");
83 parameters.put("Password", "password");
84 parameters.put("Port_number", "22");
85 parameters.put("Get_config_template", Get_config_template);
87 SvcLogicContext ctx = new SvcLogicContext();
88 ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
89 cca.configure(key, parameters, ctx);
93 public void testXmlGetrunningconfig(){
94 Properties props = null;
95 ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
96 String Get_config_template = ("get_config_template");
97 String key = "xml-getrunningconfig";
98 Map<String, String> parameters = new HashMap<String, String>();
99 parameters.put("Host_ip_address", "test");
100 parameters.put("User_name", "test");
101 parameters.put("Password", "password");
102 parameters.put("Port_number", "22");
103 parameters.put("Get_config_template", Get_config_template);
105 SvcLogicContext ctx = new SvcLogicContext();
106 ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
107 cca.configure(key, parameters, ctx);
112 public void testEscapeSql(){
113 Properties props = null;
114 ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
115 String Get_config_template = ("get_config_template");
116 String key = "escapeSql";
117 Map<String, String> parameters = new HashMap<String, String>();
118 parameters.put("Host_ip_address", "test");
119 parameters.put("User_name", "test");
120 parameters.put("Password", "password");
121 parameters.put("Port_number", "22");
122 parameters.put("Get_config_template", Get_config_template);
124 SvcLogicContext ctx = new SvcLogicContext();
125 ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
126 cca.configure(key, parameters, ctx);
130 public void testAll(){
131 Properties props = null;
132 ConfigComponentAdaptor cca = new ConfigComponentAdaptor(props);
133 String Get_config_template = ("test");
134 String Download_config_template = ("test");
135 String key = "GetCliRunningConfig";
136 Map<String, String> parameters = new HashMap<String,String>();
137 parameters.put("Host_ip_address", "test");
138 parameters.put("User_name", "test");
139 parameters.put("Password", "password");
140 parameters.put("Port_number", "22");
141 parameters.put("Protocol", "netconf");
142 parameters.put("Contents", "Contents");
143 parameters.put("Get_config_template", Get_config_template);
144 parameters.put("Download_config_template", Download_config_template);
145 parameters.put("Config_contents", "config\nsystem\nservice-interface serv1\nipv4\ngateway-ip-address 192.168.30.44");
147 SvcLogicContext ctx = new SvcLogicContext();
148 ctx.setAttribute("service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name", "test");
149 cca.configure(key, parameters, ctx);