994fbc7b2d7ee5e41a20b7535fe5a04927e689d0
[appc.git] / appc-directed-graph / appc-dgraph / provider / src / test / java / org / onap / appc / dg / TestCheckConfigStatus.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 /* TODO:  move the dgtest to opensource
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 import com.att.eelf.configuration.EELFLogger;
42 import com.att.eelf.configuration.EELFManager;
43
44 public class TestCheckConfigStatus /* extends AbstractDGTestCase */ {
45     private static final EELFLogger logger = EELFManager.getInstance().getLogger(TestCheckConfigStatus.class);
46     public static String CheckConfigStatusXML = "src/main/resources/xml/APPC_CheckConfigStatus.xml";
47
48
49
50 /*
51     @Test
52     public void testCheckConfigStatusSuccess() {
53         try {
54
55             String propertyfileName = "APPC/CheckConfigStatus/CheckConfigStatus_Success.properties";
56
57             // Register Call graphs
58             String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
59
60             Map<String, Object> serviceReferences = new HashMap<String, Object>();
61
62             GraphKey  graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
63             DGTestCase tc = new DGTestCase(graphKey);
64
65
66             tc.setInjectGraphXmls(injectGraphXmls);
67             tc.setServiceReferences(serviceReferences);
68             tc.setPropertyfileName(propertyfileName);
69
70
71
72             SvcLogicContext ctx = new SvcLogicContext();
73             processTestCase(tc, ctx);
74
75
76
77
78         } catch (Exception e) {
79             e.printStackTrace();
80         }
81     }
82
83
84     @Test
85     public void testCheckConfigStatusFailure() {
86         try {
87
88             String propertyfileName = "APPC/CheckConfigStatus/CheckConfigStatus_Failure.properties";
89
90             // Register Call graphs
91             String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
92
93             Map<String, Object> serviceReferences = new HashMap<String, Object>();
94
95
96             GraphKey  graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
97             DGTestCase tc = new DGTestCase(graphKey);
98
99
100             tc.setInjectGraphXmls(injectGraphXmls);
101             tc.setServiceReferences(serviceReferences);
102             tc.setPropertyfileName(propertyfileName);
103
104
105
106             SvcLogicContext ctx = new SvcLogicContext();
107             processTestCase(tc, ctx);
108
109
110
111
112         } catch (Exception e) {
113             e.printStackTrace();
114         }
115     }
116
117
118
119
120     @Test
121     public void testParseErrorLogFail() {
122         try {
123
124             String propertyfileName = "APPC/CheckConfigStatus/ParseErrorLogFail.properties";
125
126             // Register Call graphs
127             String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
128
129             Map<String, Object> serviceReferences = new HashMap<String, Object>();
130             serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
131
132             GraphKey  graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
133             DGTestCase tc = new DGTestCase(graphKey);
134
135
136             tc.setInjectGraphXmls(injectGraphXmls);
137             tc.setServiceReferences(serviceReferences);
138             tc.setPropertyfileName(propertyfileName);
139
140
141
142             SvcLogicContext ctx = new SvcLogicContext();
143             processTestCase(tc, ctx);
144
145             //System.out.println("error-message "+  ctx.getAttribute("error-message"));
146
147
148         } catch (Exception e) {
149             e.printStackTrace();
150         }
151     }
152
153     @Test
154     public void testParseErrorLogSuccess() {
155         try {
156
157             String propertyfileName = "APPC/CheckConfigStatus/ParseErrorLogSuccess.properties";
158
159             // Register Call graphs
160             String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
161
162             Map<String, Object> serviceReferences = new HashMap<String, Object>();
163             serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
164
165             GraphKey  graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
166             DGTestCase tc = new DGTestCase(graphKey);
167
168
169             tc.setInjectGraphXmls(injectGraphXmls);
170             tc.setServiceReferences(serviceReferences);
171             tc.setPropertyfileName(propertyfileName);
172
173
174
175             SvcLogicContext ctx = new SvcLogicContext();
176             processTestCase(tc, ctx);
177
178
179
180
181         } catch (Exception e) {
182             e.printStackTrace();
183         }
184     }
185
186
187     @Test
188     public void testMaxRetries() {
189         try {
190
191             String propertyfileName = "APPC/CheckConfigStatus/MaxRetries.properties";
192
193             // Register Call graphs
194             String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
195
196             Map<String, Object> serviceReferences = new HashMap<String, Object>();
197             serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
198
199             GraphKey  graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
200             DGTestCase tc = new DGTestCase(graphKey);
201
202
203             tc.setInjectGraphXmls(injectGraphXmls);
204             tc.setServiceReferences(serviceReferences);
205             tc.setPropertyfileName(propertyfileName);
206
207
208
209             SvcLogicContext ctx = new SvcLogicContext();
210             processTestCase(tc, ctx);
211
212
213
214
215         } catch (Exception e) {
216             e.printStackTrace();
217         }
218     }
219
220 */
221 }