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.openecomp.sdnc.config.audit.node;
23 import java.util.HashMap;
25 import org.junit.Test;
26 import org.openecomp.sdnc.config.audit.node.CompareNode;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
30 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
31 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
33 public class TestCompareNodeCli {
34 private static final Logger log = LoggerFactory.getLogger(TestCompareNodeCli.class);
37 public void TestCompareCliForSamePayload() throws SvcLogicException {
38 SvcLogicContext ctx = new SvcLogicContext();
39 HashMap<String, String> testMap = new HashMap<String, String>();
40 CompareNode cmp = new CompareNode();
41 testMap.put("compareDataType", "Cli");
42 testMap.put("sourceData", "This is a Text Configuration of Device");
43 testMap.put("targetData", "This is a Text Configuration of Device");
44 cmp.compare(testMap, ctx);
45 assert (ctx.getAttribute("STATUS").equals("SUCCESS"));
49 public void TestCompareCliFordifferentPayload() throws SvcLogicException {
50 SvcLogicContext ctx = new SvcLogicContext();
51 HashMap<String, String> testMap = new HashMap<String, String>();
52 CompareNode cmp = new CompareNode();
53 testMap.put("compareDataType", "Cli");
54 testMap.put("sourceData", "This is a Text Negative test Configuration of Device");
55 testMap.put("targetData", "This is a Text Configuration of Device");
56 cmp.compare(testMap, ctx);
57 assert (ctx.getAttribute("STATUS").equals("FAILURE"));
61 public void TestCompareForMissingInput() throws SvcLogicException {
62 SvcLogicContext ctx = new SvcLogicContext();
63 HashMap<String, String> testMap = new HashMap<String, String>();
64 CompareNode cmp = new CompareNode();
65 testMap.put("sourceData", "This is a Text Negative test Configuration of Device");
66 testMap.put("targetData.configuration-data", "This is a Text Configuration of Device");
67 cmp.compare(testMap, ctx);
68 assert (ctx.getAttribute("STATUS").equals("FAILURE"));