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