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