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.openecomp.sdnc.sli.SvcLogicContext;
31 import org.openecomp.sdnc.sli.SvcLogicException;
33 public class TestCompareNodeCli
35 private static final Logger log = LoggerFactory.getLogger(TestCompareNodeCli.class);
39 public void TestCompareCliForSamePayload()
41 SvcLogicContext ctx = new SvcLogicContext();
42 HashMap<String, String> testMap = new HashMap<String, String>();
43 CompareNode cmp = new CompareNode();
46 testMap.put("compareDataType", "Cli");
47 testMap.put("sourceData", "This is a Text Configuration of Device");
48 testMap.put("targetData", "This is a Text Configuration of Device");
49 cmp.compare(testMap, ctx);
50 assert(ctx.getAttribute("STATUS").equals("SUCCESS"));
52 catch (SvcLogicException e)
54 // TODO Auto-generated catch block
60 public void TestCompareCliFordifferentPayload()
62 SvcLogicContext ctx = new SvcLogicContext();
63 HashMap<String, String> testMap = new HashMap<String, String>();
64 CompareNode cmp = new CompareNode();
67 testMap.put("compareDataType", "Cli");
68 testMap.put("sourceData", "This is a Text Negative test Configuration of Device");
69 testMap.put("targetData", "This is a Text Configuration of Device");
70 cmp.compare(testMap, ctx);
71 assert(ctx.getAttribute("STATUS").equals("FAILURE"));
73 catch (SvcLogicException e)
75 // TODO Auto-generated catch block
81 public void TestCompareForMissingInput()
83 SvcLogicContext ctx = new SvcLogicContext();
84 HashMap<String, String> testMap = new HashMap<String, String>();
85 CompareNode cmp = new CompareNode();
88 // testMap.put("compareDataType", "Cli"); Missing compareDataType from the input
89 testMap.put("sourceData", "This is a Text Negative test Configuration of Device");
90 testMap.put("targetData.configuration-data", "This is a Text Configuration of Device");
91 cmp.compare(testMap, ctx);
92 assert(ctx.getAttribute("STATUS").equals("FAILURE"));
94 catch (SvcLogicException e)
96 assert(ctx.getAttribute("STATUS").equals("FAILURE"));