aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-audit
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-09-10 02:08:25 +0530
committerTakamune Cho <tc012c@att.com>2018-09-11 15:02:03 +0000
commit91a12713611ef604a5e301315ad0896e829cd6c0 (patch)
tree1009b5c87dee96895cff0fc56320106b84e6cee3 /appc-config/appc-config-audit
parent464324b918120636fb17d6316d8010342d7adf7e (diff)
refactored code for TestCompareNodeJson
added object creation to setup method using before annotation Issue-ID: APPC-1086 Change-Id: I136191ab61d7b39751ccffa63a711d9ef14add7d Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
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.java32
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");