2 * ============LICENSE_START=======================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.dg;
28 import java.util.HashMap;
31 import org.junit.Test;
32 import org.onap.appc.dg.mock.instance.MockConfigureNodeExecutor;
33 import org.onap.appc.dg.mock.instance.MockSvcLogicJavaPlugin;
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;
40 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
41 import com.att.eelf.configuration.EELFLogger;
42 import com.att.eelf.configuration.EELFManager;
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";
52 public void testCheckConfigStatusSuccess() {
55 String propertyfileName = "APPC/CheckConfigStatus/CheckConfigStatus_Success.properties";
57 // Register Call graphs
58 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
60 Map<String, Object> serviceReferences = new HashMap<String, Object>();
62 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
63 DGTestCase tc = new DGTestCase(graphKey);
66 tc.setInjectGraphXmls(injectGraphXmls);
67 tc.setServiceReferences(serviceReferences);
68 tc.setPropertyfileName(propertyfileName);
72 SvcLogicContext ctx = new SvcLogicContext();
73 processTestCase(tc, ctx);
78 } catch (Exception e) {
85 public void testCheckConfigStatusFailure() {
88 String propertyfileName = "APPC/CheckConfigStatus/CheckConfigStatus_Failure.properties";
90 // Register Call graphs
91 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
93 Map<String, Object> serviceReferences = new HashMap<String, Object>();
96 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
97 DGTestCase tc = new DGTestCase(graphKey);
100 tc.setInjectGraphXmls(injectGraphXmls);
101 tc.setServiceReferences(serviceReferences);
102 tc.setPropertyfileName(propertyfileName);
106 SvcLogicContext ctx = new SvcLogicContext();
107 processTestCase(tc, ctx);
112 } catch (Exception e) {
121 public void testParseErrorLogFail() {
124 String propertyfileName = "APPC/CheckConfigStatus/ParseErrorLogFail.properties";
126 // Register Call graphs
127 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
129 Map<String, Object> serviceReferences = new HashMap<String, Object>();
130 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
132 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
133 DGTestCase tc = new DGTestCase(graphKey);
136 tc.setInjectGraphXmls(injectGraphXmls);
137 tc.setServiceReferences(serviceReferences);
138 tc.setPropertyfileName(propertyfileName);
142 SvcLogicContext ctx = new SvcLogicContext();
143 processTestCase(tc, ctx);
145 //System.out.println("error-message "+ ctx.getAttribute("error-message"));
148 } catch (Exception e) {
154 public void testParseErrorLogSuccess() {
157 String propertyfileName = "APPC/CheckConfigStatus/ParseErrorLogSuccess.properties";
159 // Register Call graphs
160 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
162 Map<String, Object> serviceReferences = new HashMap<String, Object>();
163 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
165 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
166 DGTestCase tc = new DGTestCase(graphKey);
169 tc.setInjectGraphXmls(injectGraphXmls);
170 tc.setServiceReferences(serviceReferences);
171 tc.setPropertyfileName(propertyfileName);
175 SvcLogicContext ctx = new SvcLogicContext();
176 processTestCase(tc, ctx);
181 } catch (Exception e) {
188 public void testMaxRetries() {
191 String propertyfileName = "APPC/CheckConfigStatus/MaxRetries.properties";
193 // Register Call graphs
194 String injectGraphXmls[] = new String[] { CheckConfigStatusXML };
196 Map<String, Object> serviceReferences = new HashMap<String, Object>();
197 serviceReferences.put("org.onap.appc.ccadaptor.ConfigComponentAdaptor", new MockConfigureNodeExecutor());
199 GraphKey graphKey = new GraphKey("APPC", null, "CheckConfigStatus", null);
200 DGTestCase tc = new DGTestCase(graphKey);
203 tc.setInjectGraphXmls(injectGraphXmls);
204 tc.setServiceReferences(serviceReferences);
205 tc.setPropertyfileName(propertyfileName);
209 SvcLogicContext ctx = new SvcLogicContext();
210 processTestCase(tc, ctx);
215 } catch (Exception e) {