import java.util.HashMap;
+import org.junit.Before;
import org.junit.Test;
import org.onap.sdnc.config.audit.node.CompareNode;
import org.slf4j.Logger;
public class TestCompareNodeCli {
private static final Logger log = LoggerFactory.getLogger(TestCompareNodeCli.class);
-
+ private CompareNode cmp;
+ SvcLogicContext ctx;
+ HashMap<String, String> testMap;
+
+
+ @Before
+ public void setUp()
+ {
+ cmp = new CompareNode();
+ ctx = new SvcLogicContext();
+ testMap = new HashMap<String, String>();
+ }
+
@Test
public void TestCompareCliForSamePayload() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
- HashMap<String, String> testMap = new HashMap<String, String>();
- CompareNode cmp = new CompareNode();
testMap.put("compareDataType", "Cli");
testMap.put("sourceData", "This is a Text Configuration of Device");
testMap.put("targetData", "This is a Text Configuration of Device");
@Test
public void TestCompareCliForNoPayload() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
- HashMap<String, String> testMap = new HashMap<String, String>();
- CompareNode cmp = new CompareNode();
testMap.put("compareDataType", "Cli");
cmp.compare(testMap, ctx);
assertEquals ("FAILURE",ctx.getAttribute("STATUS"));
@Test
public void TestCompareCliFordifferentPayload() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
- HashMap<String, String> testMap = new HashMap<String, String>();
- CompareNode cmp = new CompareNode();
testMap.put("compareDataType", "Cli");
testMap.put("sourceData", "This is a Text Negative test Configuration of Device");
testMap.put("targetData", "This is a Text Configuration of Device");
@Test
public void TestCompareForMissingInput() throws SvcLogicException {
- SvcLogicContext ctx = new SvcLogicContext();
- HashMap<String, String> testMap = new HashMap<String, String>();
- CompareNode cmp = new CompareNode();
testMap.put("sourceData", "This is a Text Negative test Configuration of Device");
testMap.put("targetData.configuration-data", "This is a Text Configuration of Device");
cmp.compare(testMap, ctx);