aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java
diff options
context:
space:
mode:
authorChaturvedi, Anand (ac204h) <ac204h@att.com>2017-09-01 17:00:25 -0400
committerPatrick Brady <pb071s@att.com>2017-09-01 21:27:25 +0000
commitf1475ee6324f761c1eec7109e9e2321c01fae9e5 (patch)
tree2e144e3d65cda04674784ca4ddfd8b30ff5fb7ac /appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java
parent93b8052261b76312c4273962639960ccb46a9fc0 (diff)
Junit Changes for APPC Params Bundle
Issue-ID: APPC-168 Change-Id: Ie0ddf5905f90a409db111a1cfdf728a44737a158 Signed-off-by: Chaturvedi, Anand (ac204h) <ac204h@att.com>
Diffstat (limited to 'appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java')
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java113
1 files changed, 48 insertions, 65 deletions
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java
index 1f982b8e6..c6d58c09a 100644
--- a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java
+++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java
@@ -50,84 +50,67 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class TestPropertyDefinitionNode {
-@Ignore
- public void testProcessMissingParamKeys() throws Exception {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
- Map<String, String> inParams = new HashMap<String, String>();
- inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+ @Ignore
+ public void testProcessMissingParamKeys() throws Exception {
+ PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+ 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 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);
+ 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();
- propertyDefinitionNode.processMissingParamKeys(inParams, ctx);
- assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.processMissingParamKeys(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
- }
+ }
- public void testProcessExternalSystemParamKeys() throws Exception {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
- Map<String, String> inParams = new HashMap<String, String>();
- inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+ @Test
+ public void testProcessExternalSystemParamKeys() throws Exception {
+ PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+ 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 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);
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
- inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "INSTAR");
+ 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);
-
- System.out.println("Result: " + ctx.getAttributeKeySet());
- System.out.println("INSTAR.keys : " + ctx.getAttribute("INSTAR.keys"));
- System.out.println("INSTAR.LOCAL_CORE_ALT_IP_ADDR.request-logic : " + ctx.getAttribute("INSTAR.LOCAL_ACCESS_IP_ADDR"));
- System.out.println("INSTAR.LOCAL_CORE_ALT_IP_ADDR.request-logic : " + ctx.getAttribute("INSTAR.LOCAL_CORE_ALT_IP_ADDR"));
-
- }
-
- public void mergeJsonData() throws Exception {
- PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
- Map<String, String> inParams = new HashMap<String, String>();
- inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
-
- String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
- inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
-
- String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
- inParams.put(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA, mergeJsonData);
-
- SvcLogicContext ctx = new SvcLogicContext();
- propertyDefinitionNode.mergeJsonData(inParams, ctx);
- assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
-
- System.out.println("Result: " + ctx.getAttributeKeySet());
- System.out.println("Merged Value : " + ctx.getAttribute("test." +ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER) );
-
-
- }
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.processExternalSystemParamKeys(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+}
-// @Test
- public void testArtificatTransformer() throws Exception {
- ArtificatTransformer transformer = new ArtificatTransformer();
- String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+ @Test
+ public void mergeJsonData() throws Exception {
+ PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
- PropertyDefinition propertyDefinition = transformer.convertYAMLToPD(yamlData);
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
- // String json = transformer.transformYamlToJson(yamlData);
- // System.out.println("TestPropertyDefinitionNode.testArtificatTransformer()" + json);
- String yaml = transformer.convertPDToYaml(propertyDefinition);
- System.out.println("TestPropertyDefinitionNode.testArtificatTransformer():\n" + yaml);
+ String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA, mergeJsonData);
- }
-
-
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.mergeJsonData(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+ }
+ @Test
+ public void testArtificatTransformer() throws Exception {
+ ArtificatTransformer transformer = new ArtificatTransformer();
+ String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+ PropertyDefinition propertyDefinition = transformer.convertYAMLToPD(yamlData);
+ String yaml = transformer.convertPDToYaml(propertyDefinition);
+ }
+
}