fb28c525f3cf4f76ce964e3a721063881a2d42f4
[appc.git] / appc-directed-graph / appc-dgraph / provider / src / test / java / org / onap / appc / dg / TestCommonConfig.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
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
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
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.
20  * 
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.appc.dg;
25
26 import java.util.HashMap;
27 import java.util.Map;
28
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;
38 */
39 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
40
41 public class TestCommonConfig /* extends AbstractDGTestCase */ {
42
43 /*
44
45     public String jsonPath = "src/main/resources/json";
46     public String xmlpath = "src/main/resources/xml";
47
48     @Test
49     public void testCommonConfig() {
50         try {
51             //DGXMLGenerator generator = new DGXMLGenerator();
52             //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
53
54             String propertyfileName = "APPC/CommonConfiguration/APPC_method_CommonConfiguration_TC2.properties";
55
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";
63
64             // Register Call graphs
65             String injectGraphXmls[] = new String[] { commonConfigureXML,
66                     callGraph1XML,
67                     callGraph2XML,
68                     callGraph3XML,
69                     callGraph4XML,
70                     callGraph5XML,
71                     callGraph6XML };
72
73
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());
78
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);
84
85             SvcLogicContext ctx = new SvcLogicContext();
86             processTestCase(tc, ctx);
87
88
89         } catch (Exception e) {
90             e.printStackTrace();
91         }
92
93     }
94
95
96
97
98     @Test
99     public void testGetConfigParamsFailure() {
100         try {
101             //DGXMLGenerator generator = new DGXMLGenerator();
102             //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
103
104             String propertyfileName = "APPC/CommonConfiguration/GetConfigParamsFail.properties";
105
106             String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
107
108
109             // Register Call graphs
110             String injectGraphXmls[] = new String[] { commonConfigureXML };
111
112             Map<String, Object> serviceReferences = new HashMap<String, Object>();
113
114
115
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);
121
122
123
124             SvcLogicContext ctx = new SvcLogicContext();
125             processTestCase(tc, ctx);
126
127
128         } catch (Exception e) {
129             e.printStackTrace();
130         }
131
132     }
133
134
135     @Test
136     public void testInvalidRequestAction() {
137         try {
138             //DGXMLGenerator generator = new DGXMLGenerator();
139             //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
140
141             String propertyfileName = "APPC/CommonConfiguration/InvalidRequestAction.properties";
142
143             String commonConfigureXML = "src/main/resources/xml/APPC_CommonConfiguration.xml";
144
145
146             // Register Call graphs
147             String injectGraphXmls[] = new String[] { commonConfigureXML };
148
149             Map<String, Object> serviceReferences = new HashMap<String, Object>();
150
151
152
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);
158
159             SvcLogicContext ctx = new SvcLogicContext();
160             processTestCase(tc, ctx);
161
162
163         } catch (Exception e) {
164             e.printStackTrace();
165         }
166
167     }
168
169     @Test
170     public void testCommonConfigISBCTemplateSuccess() {
171         try {
172             //DGXMLGenerator generator = new DGXMLGenerator();
173             //generator.generateXMLFromJSON(jsonPath, xmlpath, null);
174
175             String propertyfileName = "APPC/CommonConfiguration/ISBCTemplateSuccess.properties";
176
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";
188
189             // Register Call graphs
190             String injectGraphXmls[] = new String[] { commonConfigureXML,
191                     callGraph1XML,
192                     callGraph2XML,
193                     callGraph3XML,
194                     callGraph4XML,
195                     callGraph5XML,
196                     callGraph6XML,
197                     callGraph7XML,
198                     callGraph8XML,
199                     callGraph9XML,
200                     callGraph10XML };
201
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());
205
206
207
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);
213
214             Map<String, Object> resourceReferences = new HashMap<String, Object>();
215             tc.setResourceReferences(resourceReferences);
216
217             SvcLogicContext ctx = new SvcLogicContext();
218             processTestCase(tc, ctx);
219
220
221         } catch (Exception e) {
222             e.printStackTrace();
223         }
224
225     }
226 */
227 }
228
229
230
231
232