summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-params/provider/src
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-11-23 16:44:36 +0530
committerTakamune Cho <takamune.cho@att.com>2018-11-29 01:24:42 +0000
commit0f47d062f99fcc67f0cc0f2b4ff13ded67a552f5 (patch)
tree0ef15651007e5b1fe6dc675856a56750943e815c /appc-config/appc-config-params/provider/src
parentaf8f1395f7d6a87b413d1445f145ea2ec149d3eb (diff)
added test cases to TestPropertyDefinitionNode
to increase code coverage Issue-ID: APPC-1086 Change-Id: Ib2e6bcd3a479ed9c8335461ddbfe4e3fd36a7bab Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-config/appc-config-params/provider/src')
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
index 569fb9eb2..2a0999783 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
@@ -36,7 +36,9 @@ import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.sdnc.config.params.ParamsHandlerConstant;
@@ -116,6 +118,50 @@ public class TestPropertyDefinitionNode {
assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
}
+
+ @Test
+ public void testProcessExternalSystemParamKeysForEmptyParamData() throws Exception {
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String yamlData = IOUtils.toString(
+ TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"),
+ Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "SOURCE");
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.processExternalSystemParamKeys(inParams, ctx);
+ assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+ ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+
+
+ }
+
+ @Rule
+ public ExpectedException expectedEx = ExpectedException.none();
+
+ @Test
+ public void testProcessExternalSystemParamKeysForEmptySystemName() throws Exception {
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String yamlData = IOUtils.toString(
+ TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"),
+ Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
+
+ String jsonData = IOUtils.toString(
+ TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"),
+ Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ expectedEx.expect(SvcLogicException.class);
+ expectedEx.expectMessage("Request Param (systemName) is Missing ..");
+ propertyDefinitionNode.processExternalSystemParamKeys(inParams, ctx);
+
+ }
@Test(expected = SvcLogicException.class)
public void testProcessExternalSystemParamKeysForEmptyPdContent() throws Exception {