074aa6ff97ff5f6c556d3f642c3f88e244d27518
[appc.git] / appc-directed-graph / appc-dgraph / provider / src / test / java / org / onap / appc / dg / TestGetConfigParams.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
28 import java.util.HashMap;
29 import java.util.Map;
30
31 import org.junit.Test;
32 import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor;
33 import org.onap.appc.dg.mock.instance.MockSvcLogicJavaPlugin;
34
35 /* move to open source
36 import org.onap.sdnc.dgtestlibrary.AbstractDGTestCase;
37 import org.onap.sdnc.dgtestlibrary.DGTestCase;
38 import org.onap.sdnc.dgtestlibrary.GraphKey;
39 */
40 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
41
42
43 public class TestGetConfigParams /* extends AbstractDGTestCase */ {
44
45
46 /*
47
48     public static String getConfigParamsXML = "src/main/resources/xml/APPC_GetConfigParams.xml";
49
50
51
52     @Test
53     public void testGetConfigParamsWithDefaultTemplate() {
54         try {
55
56             String propertyfileName = "APPC/GetConfigParams/DefaultTemplate.properties";
57             Map<String, Object> serviceReferences = new HashMap<String, Object>();
58
59
60             serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode", new org.onap.sdnc.config.generator.convert.ConvertNode());
61
62             // Register Call graphs
63             String injectGraphXmls[] = new String[] { getConfigParamsXML };
64
65
66             GraphKey  graphKey = new GraphKey("APPC", null, "GetConfigParams", null);
67             DGTestCase tc = new DGTestCase(graphKey);
68             tc.setInjectGraphXmls(injectGraphXmls);
69             tc.setServiceReferences(serviceReferences);
70             tc.setPropertyfileName(propertyfileName);
71
72             SvcLogicContext ctx = new SvcLogicContext();
73             processTestCase(tc, ctx);
74
75
76
77         } catch (Exception e) {
78             e.printStackTrace();
79         }
80
81     }
82
83
84
85
86     @Test
87     public void testGetConfigParamsWithTemplateName() {
88         try {
89
90
91             String propertyfileName = "APPC/GetConfigParams/TemplateName.properties";
92             Map<String, Object> serviceReferences = new HashMap<String, Object>();
93
94             serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode", new org.onap.sdnc.config.generator.convert.ConvertNode());
95
96             // Register Call graphs
97             String injectGraphXmls[] = new String[] { getConfigParamsXML };
98
99
100             GraphKey  graphKey = new GraphKey("APPC", null, "GetConfigParams", null);
101             DGTestCase tc = new DGTestCase(graphKey);
102             tc.setInjectGraphXmls(injectGraphXmls);
103             tc.setServiceReferences(serviceReferences);
104             tc.setPropertyfileName(propertyfileName);
105
106
107             SvcLogicContext ctx = new SvcLogicContext();
108             processTestCase(tc, ctx);
109
110
111
112
113         } catch (Exception e) {
114             e.printStackTrace();
115         }
116     }
117
118
119     @Test
120     public void testGetConfigParamsWithCliString() {
121         try {
122
123             String propertyfileName = "APPC/GetConfigParams/CliString.properties";
124             Map<String, Object> serviceReferences = new HashMap<String, Object>();
125             serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode", new org.onap.sdnc.config.generator.convert.ConvertNode());
126
127
128             // Register Call graphs
129             String injectGraphXmls[] = new String[] { getConfigParamsXML };
130
131
132             GraphKey  graphKey = new GraphKey("APPC", null, "GetConfigParams", null);
133             DGTestCase tc = new DGTestCase(graphKey);
134             tc.setInjectGraphXmls(injectGraphXmls);
135             tc.setServiceReferences(serviceReferences);
136             tc.setPropertyfileName(propertyfileName);
137
138
139             SvcLogicContext ctx = new SvcLogicContext();
140             processTestCase(tc, ctx);
141
142
143
144         } catch (Exception e) {
145             e.printStackTrace();
146         }
147     }
148
149     @Test
150     public void testGetConfigParamsWithCliJson() {
151         try {
152
153
154             String propertyfileName = "APPC/GetConfigParams/CliJson.properties";
155             Map<String, Object> serviceReferences = new HashMap<String, Object>();
156
157
158
159             serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode", new org.onap.sdnc.config.generator.convert.ConvertNode());
160
161             // Register Call graphs
162             String injectGraphXmls[] = new String[] { getConfigParamsXML };
163
164
165             GraphKey  graphKey = new GraphKey("APPC", null, "GetConfigParams", null);
166             DGTestCase tc = new DGTestCase(graphKey);
167             tc.setInjectGraphXmls(injectGraphXmls);
168             tc.setServiceReferences(serviceReferences);
169             tc.setPropertyfileName(propertyfileName);
170
171
172             SvcLogicContext ctx = new SvcLogicContext();
173             processTestCase(tc, ctx);
174
175
176
177
178         } catch (Exception e) {
179             e.printStackTrace();
180         }
181     }
182
183
184
185     @Test
186     public void testGetConfigParamsForRestore() {
187         try {
188             String propertyfileName = "APPC/GetConfigParams/Restore.properties";
189             Map<String, Object> serviceReferences = new HashMap<String, Object>();
190
191
192
193             serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode", new org.onap.sdnc.config.generator.convert.ConvertNode());
194
195             // Register Call graphs
196             String injectGraphXmls[] = new String[] { getConfigParamsXML };
197
198
199             GraphKey  graphKey = new GraphKey("APPC", null, "GetConfigParams", null);
200             DGTestCase tc = new DGTestCase(graphKey);
201             tc.setInjectGraphXmls(injectGraphXmls);
202             tc.setServiceReferences(serviceReferences);
203             tc.setPropertyfileName(propertyfileName);
204
205
206             SvcLogicContext ctx = new SvcLogicContext();
207             processTestCase(tc, ctx);
208
209
210         } catch (Exception e) {
211             e.printStackTrace();
212         }
213     }
214
215
216     @Test
217     public void testGetConfigParamsCommonConfigFail() {
218         try {
219             String propertyfileName = "APPC/GetConfigParams/CommonConfigFail.properties";
220             Map<String, Object> serviceReferences = new HashMap<String, Object>();
221
222
223             serviceReferences.put("org.onap.sdnc.config.generator.convert.ConvertNode", new org.onap.sdnc.config.generator.convert.ConvertNode());
224
225             // Register Call graphs
226             String injectGraphXmls[] = new String[] { getConfigParamsXML };
227
228
229             GraphKey  graphKey = new GraphKey("APPC", null, "GetConfigParams", null);
230             DGTestCase tc = new DGTestCase(graphKey);
231             tc.setInjectGraphXmls(injectGraphXmls);
232             tc.setServiceReferences(serviceReferences);
233             tc.setPropertyfileName(propertyfileName);
234
235
236             SvcLogicContext ctx = new SvcLogicContext();
237             processTestCase(tc, ctx);
238
239
240
241
242         } catch (Exception e) {
243             e.printStackTrace();
244         }
245     }
246
247
248
249     @Test
250     public void testGetConfigParamsJson2DGContextFail() {
251         try {
252             String propertyfileName = "APPC/GetConfigParams/Json2DGContextFail.properties";
253             Map<String, Object> serviceReferences = new HashMap<String, Object>();
254
255
256
257
258
259             // Register Call graphs
260             String injectGraphXmls[] = new String[] { getConfigParamsXML };
261
262
263             GraphKey  graphKey = new GraphKey("APPC", null, "GetConfigParams", null);
264             DGTestCase tc = new DGTestCase(graphKey);
265             tc.setInjectGraphXmls(injectGraphXmls);
266             tc.setServiceReferences(serviceReferences);
267             tc.setPropertyfileName(propertyfileName);
268
269
270             SvcLogicContext ctx = new SvcLogicContext();
271             processTestCase(tc, ctx);
272
273
274
275
276         } catch (Exception e) {
277             e.printStackTrace();
278         }
279     }
280 */
281 }