summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-generator/provider
diff options
context:
space:
mode:
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));
+ }
+
}