2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.appc.dg;
24 import java.util.HashMap;
27 import org.junit.Test;
28 import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor;
29 import org.onap.appc.dg.mock.instance.MockSvcLogicJavaPlugin;
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;
36 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
37 import com.att.eelf.configuration.EELFLogger;
38 import com.att.eelf.configuration.EELFManager;
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";
48 public void testCheckConfigStatusSuccess() {
51 String propertyfileName = "APPC/CheckConfigStatus/CheckConfigStatus_Success.properties";
53 // Register Call graphs
54 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
56 Map<String, Object> serviceReferences = new HashMap<String, Object>();
58 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
59 DGTestCase tc = new DGTestCase(graphKey);
62 tc.setInjectGraphXmls(injectGraphXmls);
63 tc.setServiceReferences(serviceReferences);
64 tc.setPropertyfileName(propertyfileName);
68 SvcLogicContext ctx = new SvcLogicContext();
69 processTestCase(tc, ctx);
74 } catch (Exception e) {
81 public void testCheckConfigStatusFailure() {
84 String propertyfileName = "APPC/CheckConfigStatus/CheckConfigStatus_Failure.properties";
86 // Register Call graphs
87 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
89 Map<String, Object> serviceReferences = new HashMap<String, Object>();
92 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
93 DGTestCase tc = new DGTestCase(graphKey);
96 tc.setInjectGraphXmls(injectGraphXmls);
97 tc.setServiceReferences(serviceReferences);
98 tc.setPropertyfileName(propertyfileName);
102 SvcLogicContext ctx = new SvcLogicContext();
103 processTestCase(tc, ctx);
108 } catch (Exception e) {
117 public void testParseErrorLogFail() {
120 String propertyfileName = "APPC/CheckConfigStatus/ParseErrorLogFail.properties";
122 // Register Call graphs
123 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
125 Map<String, Object> serviceReferences = new HashMap<String, Object>();
126 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
128 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
129 DGTestCase tc = new DGTestCase(graphKey);
132 tc.setInjectGraphXmls(injectGraphXmls);
133 tc.setServiceReferences(serviceReferences);
134 tc.setPropertyfileName(propertyfileName);
138 SvcLogicContext ctx = new SvcLogicContext();
139 processTestCase(tc, ctx);
141 //System.out.println("error-message "+ ctx.getAttribute("error-message"));
144 } catch (Exception e) {
150 public void testParseErrorLogSuccess() {
153 String propertyfileName = "APPC/CheckConfigStatus/ParseErrorLogSuccess.properties";
155 // Register Call graphs
156 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
158 Map<String, Object> serviceReferences = new HashMap<String, Object>();
159 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
161 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
162 DGTestCase tc = new DGTestCase(graphKey);
165 tc.setInjectGraphXmls(injectGraphXmls);
166 tc.setServiceReferences(serviceReferences);
167 tc.setPropertyfileName(propertyfileName);
171 SvcLogicContext ctx = new SvcLogicContext();
172 processTestCase(tc, ctx);
177 } catch (Exception e) {
184 public void testMaxRetries() {
187 String propertyfileName = "APPC/CheckConfigStatus/MaxRetries.properties";
189 // Register Call graphs
190 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
192 Map<String, Object> serviceReferences = new HashMap<String, Object>();
193 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
195 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
196 DGTestCase tc = new DGTestCase(graphKey);
199 tc.setInjectGraphXmls(injectGraphXmls);
200 tc.setServiceReferences(serviceReferences);
201 tc.setPropertyfileName(propertyfileName);
205 SvcLogicContext ctx = new SvcLogicContext();
206 processTestCase(tc, ctx);
211 } catch (Exception e) {