summaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-params/provider
diff options
context:
space:
mode:
Diffstat (limited to 'appc-config/appc-config-params/provider')
-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 {