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=========================================================
25 package org.onap.appc.dg;
27 import java.util.HashMap;
30 import org.junit.Test;
31 import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor;
32 import org.onap.appc.dg.mock.instance.MockSvcLogicJavaPlugin;
33 import org.onap.sdnc.config.generator.convert.ConvertNode;
34 import org.onap.sdnc.config.generator.merge.MergeNode;
35 /* move to open source
36 import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase;
37 import com.att.sdnctl.dgtestlibrary.DGTestCase;
38 import com.att.sdnctl.dgtestlibrary.GraphKey;
40 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
42 public class TestCommonConfig /* extends AbstractDGTestCase */ {
46 public String jsonPath = "src/main/resources/json";
47 public String xmlpath = "src/main/resources/xml";
50 public void testCommonConfig() {
52 //DGXMLGenerator generator = new DGXMLGenerator();
53 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
55 String propertyfileName = "APPC/CommonConfiguration/APPC_method_CommonConfiguration_TC2.properties";
57 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
58 String callGraph1XML = "src/main/resources/xml/APPC_GetConfigParams.xml";
59 String callGraph2XML = "src/main/resources/xml/APPC_Configure.xml";
60 String callGraph3XML = "src/main/resources/xml/APPC_SetStatus.xml";
61 String callGraph4XML = "src/main/resources/xml/APPC_DownloadRestconfConfig.xml";
62 String callGraph5XML = "src/main/resources/xml/APPC_GenerateConfig.xml";
63 String callGraph6XML = "src/main/resources/xml/APPC_DownloadXmlConfig.xml";
65 // Register Call graphs
66 String injectGraphXmls[] = new String[] { commonConfigureXML,
75 Map<String, Object> serviceReferences = new HashMap<String, Object>();
76 serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode",new org.onap.sdnc.config.generator.convert.ConvertNode());
77 serviceReferences.put("org.onap.sdnc.config.generator.merge.MergeNode", new org.onap.sdnc.config.generator.merge.MergeNode());
78 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
80 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
81 DGTestCase tc = new DGTestCase(graphKey);
82 tc.setInjectGraphXmls(injectGraphXmls);
83 tc.setServiceReferences(serviceReferences);
84 tc.setPropertyfileName(propertyfileName);
86 SvcLogicContext ctx = new SvcLogicContext();
87 processTestCase(tc, ctx);
90 } catch (Exception e) {
100 public void testGetConfigParamsFailure() {
102 //DGXMLGenerator generator = new DGXMLGenerator();
103 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
105 String propertyfileName = "APPC/CommonConfiguration/GetConfigParamsFail.properties";
107 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
110 // Register Call graphs
111 String injectGraphXmls[] = new String[] { commonConfigureXML };
113 Map<String, Object> serviceReferences = new HashMap<String, Object>();
117 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
118 DGTestCase tc = new DGTestCase(graphKey);
119 tc.setInjectGraphXmls(injectGraphXmls);
120 tc.setServiceReferences(serviceReferences);
121 tc.setPropertyfileName(propertyfileName);
125 SvcLogicContext ctx = new SvcLogicContext();
126 processTestCase(tc, ctx);
129 } catch (Exception e) {
137 public void testInvalidRequestAction() {
139 //DGXMLGenerator generator = new DGXMLGenerator();
140 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
142 String propertyfileName = "APPC/CommonConfiguration/InvalidRequestAction.properties";
144 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
147 // Register Call graphs
148 String injectGraphXmls[] = new String[] { commonConfigureXML };
150 Map<String, Object> serviceReferences = new HashMap<String, Object>();
154 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
155 DGTestCase tc = new DGTestCase(graphKey);
156 tc.setInjectGraphXmls(injectGraphXmls);
157 tc.setServiceReferences(serviceReferences);
158 tc.setPropertyfileName(propertyfileName);
160 SvcLogicContext ctx = new SvcLogicContext();
161 processTestCase(tc, ctx);
164 } catch (Exception e) {
171 public void testCommonConfigISBCTemplateSuccess() {
173 //DGXMLGenerator generator = new DGXMLGenerator();
174 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
176 String propertyfileName = "APPC/CommonConfiguration/ISBCTemplateSuccess.properties";
178 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
179 String callGraph1XML = "src/main/resources/xml/APPC_GetConfigParams.xml";
180 String callGraph2XML = "src/main/resources/xml/APPC_Configure.xml";
181 String callGraph3XML = "src/main/resources/xml/APPC_SetStatus.xml";
182 String callGraph4XML = "src/main/resources/xml/APPC_GenerateTemplateConfig.xml";
183 String callGraph5XML = "src/main/resources/xml/APPC_CheckConfigStatus.xml";
184 String callGraph6XML = "src/main/resources/xml/APPC_DownloadIsbcConfig.xml";
185 String callGraph7XML = "src/main/resources/xml/APPC_UpdateAaiInfo.xml";
186 String callGraph8XML = "src/main/resources/xml/APPC_GetVfModuleInfo.xml";
187 String callGraph9XML = "src/main/resources/xml/APPC_SaveRunningConfig.xml";
188 String callGraph10XML = "src/main/resources/xml/APPC_GetDeviceRunningConfig.xml";
190 // Register Call graphs
191 String injectGraphXmls[] = new String[] { commonConfigureXML,
203 Map<String, Object> serviceReferences = new HashMap<String, Object>();
204 serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode",new org.onap.sdnc.config.generator.convert.ConvertNode());
205 serviceReferences.put("org.onap.sdnc.config.generator.merge.MergeNode", new org.onap.sdnc.config.generator.merge.MergeNode());
209 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
210 DGTestCase tc = new DGTestCase(graphKey);
211 tc.setInjectGraphXmls(injectGraphXmls);
212 tc.setServiceReferences(serviceReferences);
213 tc.setPropertyfileName(propertyfileName);
215 Map<String, Object> resourceReferences = new HashMap<String, Object>();
216 tc.setResourceReferences(resourceReferences);
218 SvcLogicContext ctx = new SvcLogicContext();
219 processTestCase(tc, ctx);
222 } catch (Exception e) {