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