2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.appc.dg;
23 import java.util.HashMap;
26 import org.junit.Test;
27 import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor;
28 import org.onap.appc.dg.mock.instance.MockSvcLogicJavaPlugin;
29 import org.openecomp.sdnc.config.generator.convert.ConvertNode;
30 import org.openecomp.sdnc.config.generator.merge.MergeNode;
31 /* move to open source
32 import com.att.sdnctl.dgtestlibrary.AbstractDGTestCase;
33 import com.att.sdnctl.dgtestlibrary.DGTestCase;
34 import com.att.sdnctl.dgtestlibrary.GraphKey;
36 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
38 public class TestCommonConfig /* extends AbstractDGTestCase */ {
42 public String jsonPath = "src/main/resources/json";
43 public String xmlpath = "src/main/resources/xml";
46 public void testCommonConfig() {
48 //DGXMLGenerator generator = new DGXMLGenerator();
49 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
51 String propertyfileName = "APPC/CommonConfiguration/APPC_method_CommonConfiguration_TC2.properties";
53 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
54 String callGraph1XML = "src/main/resources/xml/APPC_GetConfigParams.xml";
55 String callGraph2XML = "src/main/resources/xml/APPC_Configure.xml";
56 String callGraph3XML = "src/main/resources/xml/APPC_SetStatus.xml";
57 String callGraph4XML = "src/main/resources/xml/APPC_DownloadRestconfConfig.xml";
58 String callGraph5XML = "src/main/resources/xml/APPC_GenerateConfig.xml";
59 String callGraph6XML = "src/main/resources/xml/APPC_DownloadXmlConfig.xml";
61 // Register Call graphs
62 String injectGraphXmls[] = new String[] { commonConfigureXML,
71 Map<String, Object> serviceReferences = new HashMap<String, Object>();
72 serviceReferences.put("org.openecomp.sdnc.config.generator.convert.ConvertNode",new org.openecomp.sdnc.config.generator.convert.ConvertNode());
73 serviceReferences.put("org.openecomp.sdnc.config.generator.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode());
74 //serviceReferences.put("com.att.appc.config.generator.node.ConfigResourceNode", new MockConfigResourceNode());
75 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
77 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
78 DGTestCase tc = new DGTestCase(graphKey);
79 tc.setInjectGraphXmls(injectGraphXmls);
80 tc.setServiceReferences(serviceReferences);
81 tc.setPropertyfileName(propertyfileName);
83 SvcLogicContext ctx = new SvcLogicContext();
84 processTestCase(tc, ctx);
87 } catch (Exception e) {
97 public void testGetConfigParamsFailure() {
99 //DGXMLGenerator generator = new DGXMLGenerator();
100 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
102 String propertyfileName = "APPC/CommonConfiguration/GetConfigParamsFail.properties";
104 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
107 // Register Call graphs
108 String injectGraphXmls[] = new String[] { commonConfigureXML };
110 Map<String, Object> serviceReferences = new HashMap<String, Object>();
114 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
115 DGTestCase tc = new DGTestCase(graphKey);
116 tc.setInjectGraphXmls(injectGraphXmls);
117 tc.setServiceReferences(serviceReferences);
118 tc.setPropertyfileName(propertyfileName);
122 SvcLogicContext ctx = new SvcLogicContext();
123 processTestCase(tc, ctx);
126 } catch (Exception e) {
134 public void testInvalidRequestAction() {
136 //DGXMLGenerator generator = new DGXMLGenerator();
137 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
139 String propertyfileName = "APPC/CommonConfiguration/InvalidRequestAction.properties";
141 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
144 // Register Call graphs
145 String injectGraphXmls[] = new String[] { commonConfigureXML };
147 Map<String, Object> serviceReferences = new HashMap<String, Object>();
151 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
152 DGTestCase tc = new DGTestCase(graphKey);
153 tc.setInjectGraphXmls(injectGraphXmls);
154 tc.setServiceReferences(serviceReferences);
155 tc.setPropertyfileName(propertyfileName);
157 SvcLogicContext ctx = new SvcLogicContext();
158 processTestCase(tc, ctx);
161 } catch (Exception e) {
168 public void testCommonConfigISBCTemplateSuccess() {
170 //DGXMLGenerator generator = new DGXMLGenerator();
171 //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
173 String propertyfileName = "APPC/CommonConfiguration/ISBCTemplateSuccess.properties";
175 String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
176 String callGraph1XML = "src/main/resources/xml/APPC_GetConfigParams.xml";
177 String callGraph2XML = "src/main/resources/xml/APPC_Configure.xml";
178 String callGraph3XML = "src/main/resources/xml/APPC_SetStatus.xml";
179 String callGraph4XML = "src/main/resources/xml/APPC_GenerateTemplateConfig.xml";
180 String callGraph5XML = "src/main/resources/xml/APPC_CheckConfigStatus.xml";
181 String callGraph6XML = "src/main/resources/xml/APPC_DownloadIsbcConfig.xml";
182 String callGraph7XML = "src/main/resources/xml/APPC_UpdateAaiInfo.xml";
183 String callGraph8XML = "src/main/resources/xml/APPC_GetVfModuleInfo.xml";
184 String callGraph9XML = "src/main/resources/xml/APPC_SaveRunningConfig.xml";
185 String callGraph10XML = "src/main/resources/xml/APPC_GetDeviceRunningConfig.xml";
187 // Register Call graphs
188 String injectGraphXmls[] = new String[] { commonConfigureXML,
200 Map<String, Object> serviceReferences = new HashMap<String, Object>();
201 serviceReferences.put("org.openecomp.sdnc.config.generator.convert.ConvertNode",new org.openecomp.sdnc.config.generator.convert.ConvertNode());
202 serviceReferences.put("org.openecomp.sdnc.config.generator.merge.MergeNode", new org.openecomp.sdnc.config.generator.merge.MergeNode());
206 GraphKey graphKey = new GraphKey("APPC", null, "CommonConfiguration", null);
207 DGTestCase tc = new DGTestCase(graphKey);
208 tc.setInjectGraphXmls(injectGraphXmls);
209 tc.setServiceReferences(serviceReferences);
210 tc.setPropertyfileName(propertyfileName);
212 Map<String, Object> resourceReferences = new HashMap<String, Object>();
213 tc.setResourceReferences(resourceReferences);
215 SvcLogicContext ctx = new SvcLogicContext();
216 processTestCase(tc, ctx);
219 } catch (Exception e) {