2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 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 * ============LICENSE_END=========================================================
24 package org.onap.sdnc.config.audit.node;
26 import java.util.HashMap;
28 import org.junit.Test;
29 import org.onap.sdnc.config.audit.node.CompareNode;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
33 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
34 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
36 public class TestCompareNodeCli {
37 private static final Logger log = LoggerFactory.getLogger(TestCompareNodeCli.class);
40 public void TestCompareCliForSamePayload() throws SvcLogicException {
41 SvcLogicContext ctx = new SvcLogicContext();
42 HashMap<String, String> testMap = new HashMap<String, String>();
43 CompareNode cmp = new CompareNode();
44 testMap.put("compareDataType", "Cli");
45 testMap.put("sourceData", "This is a Text Configuration of Device");
46 testMap.put("targetData", "This is a Text Configuration of Device");
47 cmp.compare(testMap, ctx);
48 assert (ctx.getAttribute("STATUS").equals("SUCCESS"));
52 public void TestCompareCliFordifferentPayload() throws SvcLogicException {
53 SvcLogicContext ctx = new SvcLogicContext();
54 HashMap<String, String> testMap = new HashMap<String, String>();
55 CompareNode cmp = new CompareNode();
56 testMap.put("compareDataType", "Cli");
57 testMap.put("sourceData", "This is a Text Negative test Configuration of Device");
58 testMap.put("targetData", "This is a Text Configuration of Device");
59 cmp.compare(testMap, ctx);
60 assert (ctx.getAttribute("STATUS").equals("FAILURE"));
64 public void TestCompareForMissingInput() throws SvcLogicException {
65 SvcLogicContext ctx = new SvcLogicContext();
66 HashMap<String, String> testMap = new HashMap<String, String>();
67 CompareNode cmp = new CompareNode();
68 testMap.put("sourceData", "This is a Text Negative test Configuration of Device");
69 testMap.put("targetData.configuration-data", "This is a Text Configuration of Device");
70 cmp.compare(testMap, ctx);
71 assert (ctx.getAttribute("STATUS").equals("FAILURE"));