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=========================================================
24 package org.onap.appc.dg;
26 import java.util.HashMap;
29 import org.junit.Test;
30 import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor;
31 import org.onap.appc.dg.mock.instance.MockSvcLogicJavaPlugin;
32 import org.onap.sdnc.config.generator.convert.ConvertNode;
33 import org.onap.sdnc.config.generator.merge.MergeNode;
34 /* move to open source
35 import org.onap.sdnc.dgtestlibrary.AbstractDGTestCase;
36 import org.onap.sdnc.dgtestlibrary.DGTestCase;
37 import org.onap.sdnc.dgtestlibrary.GraphKey;
39 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
41 public class TestCommonConfig /* extends AbstractDGTestCase */ {
45 public String jsonPath = "src/main/resources/json";
46 public String xmlpath = "src/main/resources/xml";
49 public void testCommonConfig() {
51 //DGXMLGenerator generator = new DGXMLGenerator();
52 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
54 String propertyfileName = "APPC/CommonConfiguration/APPC_method_CommonConfiguration_TC2.properties";
56 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
57 String callGraph1XML = "src/main/resources/xml/APPC_GetConfigParams.xml";
58 String callGraph2XML = "src/main/resources/xml/APPC_Configure.xml";
59 String callGraph3XML = "src/main/resources/xml/APPC_SetStatus.xml";
60 String callGraph4XML = "src/main/resources/xml/APPC_DownloadRestconfConfig.xml";
61 String callGraph5XML = "src/main/resources/xml/APPC_GenerateConfig.xml";
62 String callGraph6XML = "src/main/resources/xml/APPC_DownloadXmlConfig.xml";
64 // Register Call graphs
65 String injectGraphXmls[] = new String[] { commonConfigureXML,
74 Map<String, Object> serviceReferences = new HashMap<String, Object>();
75 serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode",new org.onap.sdnc.config.generator.convert.ConvertNode());
76 serviceReferences.put("org.onap.sdnc.config.generator.merge.MergeNode", new org.onap.sdnc.config.generator.merge.MergeNode());
77 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
79 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
80 DGTestCase tc = new DGTestCase(graphKey);
81 tc.setInjectGraphXmls(injectGraphXmls);
82 tc.setServiceReferences(serviceReferences);
83 tc.setPropertyfileName(propertyfileName);
85 SvcLogicContext ctx = new SvcLogicContext();
86 processTestCase(tc, ctx);
89 } catch (Exception e) {
99 public void testGetConfigParamsFailure() {
101 //DGXMLGenerator generator = new DGXMLGenerator();
102 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
104 String propertyfileName = "APPC/CommonConfiguration/GetConfigParamsFail.properties";
106 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
109 // Register Call graphs
110 String injectGraphXmls[] = new String[] { commonConfigureXML };
112 Map<String, Object> serviceReferences = new HashMap<String, Object>();
116 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
117 DGTestCase tc = new DGTestCase(graphKey);
118 tc.setInjectGraphXmls(injectGraphXmls);
119 tc.setServiceReferences(serviceReferences);
120 tc.setPropertyfileName(propertyfileName);
124 SvcLogicContext ctx = new SvcLogicContext();
125 processTestCase(tc, ctx);
128 } catch (Exception e) {
136 public void testInvalidRequestAction() {
138 //DGXMLGenerator generator = new DGXMLGenerator();
139 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
141 String propertyfileName = "APPC/CommonConfiguration/InvalidRequestAction.properties";
143 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
146 // Register Call graphs
147 String injectGraphXmls[] = new String[] { commonConfigureXML };
149 Map<String, Object> serviceReferences = new HashMap<String, Object>();
153 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
154 DGTestCase tc = new DGTestCase(graphKey);
155 tc.setInjectGraphXmls(injectGraphXmls);
156 tc.setServiceReferences(serviceReferences);
157 tc.setPropertyfileName(propertyfileName);
159 SvcLogicContext ctx = new SvcLogicContext();
160 processTestCase(tc, ctx);
163 } catch (Exception e) {
170 public void testCommonConfigISBCTemplateSuccess() {
172 //DGXMLGenerator generator = new DGXMLGenerator();
173 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
175 String propertyfileName = "APPC/CommonConfiguration/ISBCTemplateSuccess.properties";
177 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
178 String callGraph1XML = "src/main/resources/xml/APPC_GetConfigParams.xml";
179 String callGraph2XML = "src/main/resources/xml/APPC_Configure.xml";
180 String callGraph3XML = "src/main/resources/xml/APPC_SetStatus.xml";
181 String callGraph4XML = "src/main/resources/xml/APPC_GenerateTemplateConfig.xml";
182 String callGraph5XML = "src/main/resources/xml/APPC_CheckConfigStatus.xml";
183 String callGraph6XML = "src/main/resources/xml/APPC_DownloadIsbcConfig.xml";
184 String callGraph7XML = "src/main/resources/xml/APPC_UpdateAaiInfo.xml";
185 String callGraph8XML = "src/main/resources/xml/APPC_GetVfModuleInfo.xml";
186 String callGraph9XML = "src/main/resources/xml/APPC_SaveRunningConfig.xml";
187 String callGraph10XML = "src/main/resources/xml/APPC_GetDeviceRunningConfig.xml";
189 // Register Call graphs
190 String injectGraphXmls[] = new String[] { commonConfigureXML,
202 Map<String, Object> serviceReferences = new HashMap<String, Object>();
203 serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode",new org.onap.sdnc.config.generator.convert.ConvertNode());
204 serviceReferences.put("org.onap.sdnc.config.generator.merge.MergeNode", new org.onap.sdnc.config.generator.merge.MergeNode());
208 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
209 DGTestCase tc = new DGTestCase(graphKey);
210 tc.setInjectGraphXmls(injectGraphXmls);
211 tc.setServiceReferences(serviceReferences);
212 tc.setPropertyfileName(propertyfileName);
214 Map<String, Object> resourceReferences = new HashMap<String, Object>();
215 tc.setResourceReferences(resourceReferences);
217 SvcLogicContext ctx = new SvcLogicContext();
218 processTestCase(tc, ctx);
221 } catch (Exception e) {