diff options
Diffstat (limited to 'appc-config/appc-config-audit')
-rw-r--r-- | appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeJson.java | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeJson.java b/appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeJson.java index 2cb1976a5..8ebe3b538 100644 --- a/appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeJson.java +++ b/appc-config/appc-config-audit/provider/src/test/java/org/onap/sdnc/config/audit/node/TestCompareNodeJson.java @@ -24,9 +24,10 @@ */ package org.onap.sdnc.config.audit.node; - + import java.util.HashMap; +import org.junit.Before; import org.junit.Test; import org.onap.sdnc.config.audit.node.CompareNode; import org.slf4j.Logger; @@ -38,12 +39,21 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException; public class TestCompareNodeJson { private static final Logger log = LoggerFactory.getLogger(TestCompareNodeJson.class); - + private CompareNode cmp; + private SvcLogicContext ctx; + private HashMap<String, String> testMap; + + @Before + public void setUp() + { + cmp = new CompareNode(); + ctx = new SvcLogicContext(); + testMap = new HashMap<String, String>(); + + } + @Test public void TestCompareJsonForSamePayload() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); String controlJson = "{\n\"input\": {\n \"appc-request-header\": {\n \"svc-request-id\": \"000000000\", \n \"svc-action\": \"prepare\" \n }, \n\"request-information\": {\n \"request-id\": \"000000000\", \n\"request-action\": \"VsbgServiceActivateRequest\", \n\"request-sub-action\": \"PREPARE\", \n \"source\": \"Version2\" \n} \n} \n}"; String testJson = "{\n\"input\": {\n \"appc-request-header\": {\n \"svc-request-id\": \"000000000\", \n \"svc-action\": \"prepare\" \n }, \n\"request-information\": {\n \"request-id\": \"000000000\", \n\"request-action\": \"VsbgServiceActivateRequest\", \n\"request-sub-action\": \"PREPARE\", \n \"source\": \"Version2\" \n} \n} \n}"; testMap.put("compareDataType", "RestConf"); @@ -55,18 +65,12 @@ public class TestCompareNodeJson { @Test public void TestCompareCliForNoPayload() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); cmp.compare(testMap, ctx); assertEquals ("FAILURE",ctx.getAttribute("STATUS")); } @Test public void TestCompareCliForNullCompareType() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); testMap.put("compareDataType", "RestConf"); cmp.compare(testMap, ctx); assertEquals ("FAILURE",ctx.getAttribute("STATUS")); @@ -74,9 +78,6 @@ public class TestCompareNodeJson { @Test public void TestCompareJsonFordifferentPayload() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); String controlJson = "{\n\"input\": {\n \"appc-request-header\": {\n \"svc-request-id\": \"000000000\", \n \"svc-action\": \"prepare\" \n }, \n\"request-information\": {\n \"request-id\": \"000000000\", \n\"request-action\": \"VsbgServiceActivateRequest\", \n\"request-sub-action\": \"PREPARE\", \n \"source\": \"Version2\" \n} \n} \n}"; String testJson = "{\n\"input\": {\n \"appc-request-header\": { \n \"svc-action\": \"prepare\" \n }, \n\"request-information\": {\n \"request-id\": \"0000000000\", \n\"request-action\": \"VsbgServiceActivateRequest\", \n\"request-sub-action\": \"PREPARE\", \n \"source\": \"Version2\" \n} \n} \n}"; testMap.put("compareDataType", "RestConf"); @@ -88,9 +89,6 @@ public class TestCompareNodeJson { @Test public void TestCompareJsonFordifferentPayloadWithXMLDataType() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - HashMap<String, String> testMap = new HashMap<String, String>(); - CompareNode cmp = new CompareNode(); String controlJson = "{\n\"input\": {\n \"appc-request-header\": {\n \"svc-request-id\": \"000000000\", \n \"svc-action\": \"prepare\" \n }, \n\"request-information\": {\n \"request-id\": \"000000000\", \n\"request-action\": \"VsbgServiceActivateRequest\", \n\"request-sub-action\": \"PREPARE\", \n \"source\": \"Version2\" \n} \n} \n}"; String testJson = "{\n\"input\": {\n \"appc-request-header\": { \n \"svc-action\": \"prepare\" \n }, \n\"request-information\": {\n \"request-id\": \"0000000000\", \n\"request-action\": \"VsbgServiceActivateRequest\", \n\"request-sub-action\": \"PREPARE\", \n \"source\": \"Version2\" \n} \n} \n}"; testMap.put("compareDataType", "XML"); |