summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-generator/provider
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-11-27 16:34:58 +0530
committerTakamune Cho <takamune.cho@att.com>2018-11-28 01:44:01 +0000
commit7a63f7756894e17b00e6adfa751ca90564d02ade (patch)
tree659d1bb27f4aadbfb87454af266842c9b1203331 /appc-config/appc-config-generator/provider
parent3e499b7b1d969159016acc0c77e4f3d06efab94a (diff)
added test case to TestConvertNode.java
to increase code coverage Issue-ID: APPC-1086 Change-Id: Ia5890e45849fad0a17753fe03c217a60777a8945 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-config/appc-config-generator/provider')
-rw-r--r--appc-config/appc-config-generator/provider/src/test/java/org/onap/sdnc/config/generator/convert/TestConvertNode.java53
1 files changed, 52 insertions, 1 deletions
diff --git a/appc-config/appc-config-generator/provider/src/test/java/org/onap/sdnc/config/generator/convert/TestConvertNode.java b/appc-config/appc-config-generator/provider/src/test/java/org/onap/sdnc/config/generator/convert/TestConvertNode.java
index b084ba3bb..c9cdad7fa 100644
--- a/appc-config/appc-config-generator/provider/src/test/java/org/onap/sdnc/config/generator/convert/TestConvertNode.java
+++ b/appc-config/appc-config-generator/provider/src/test/java/org/onap/sdnc/config/generator/convert/TestConvertNode.java
@@ -6,7 +6,7 @@
* ================================================================================
* Copyright (C) 2017 Amdocs
* =============================================================================
- * Modification Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2018 IBM.
* =============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -162,6 +162,29 @@ public class TestConvertNode {
}
+ @Test(expected = SvcLogicException.class)
+ public void testunEscapeDataForInvalidDataType() throws Exception {
+ ConvertNode convertNode = new ConvertNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ SvcLogicContext ctx = new SvcLogicContext();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "tmp");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_UNESCAPE_DATA, "//");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE, "TXT");
+ convertNode.escapeData(inParams, ctx);
+
+ }
+
+ @Test(expected = SvcLogicException.class)
+ public void testunEscapeDataForEmptyDataType() throws Exception {
+ ConvertNode convertNode = new ConvertNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ SvcLogicContext ctx = new SvcLogicContext();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "tmp");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_UNESCAPE_DATA, "//");
+ convertNode.escapeData(inParams, ctx);
+
+ }
+
@Test
public void testEscapeDataForValidUnescapeDataString() throws Exception {
SvcLogicContext ctx = new SvcLogicContext();
@@ -175,4 +198,32 @@ public class TestConvertNode {
convertNode.escapeData(inParams, ctx);
assertEquals(unescapeData, ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_ESCAPE_DATA));
}
+
+ @Test
+ public void testunEscapeDataForJsonDataType() throws Exception {
+ ConvertNode convertNode = new ConvertNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ SvcLogicContext ctx = new SvcLogicContext();
+ log.trace("Received unEscapeData call with params : " + inParams);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "tmp");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_ESCAPE_DATA, "//");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE, "JSON");
+ convertNode.unEscapeData(inParams, ctx);
+ assertEquals(ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,ctx.getAttribute("tmp." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
+
+ }
+
+ @Test
+ public void testunEscapeDataForXmlDataType() throws Exception {
+ ConvertNode convertNode = new ConvertNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ SvcLogicContext ctx = new SvcLogicContext();
+ log.trace("Received unEscapeData call with params : " + inParams);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "tmp");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_ESCAPE_DATA, "//");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE, "XML");
+ convertNode.unEscapeData(inParams, ctx);
+ assertEquals(ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,ctx.getAttribute("tmp." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
+ }
+
}