diff options
Diffstat (limited to 'appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge')
-rw-r--r-- | appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java index 191dfa3b5..ac505982c 100644 --- a/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java +++ b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java @@ -22,77 +22,82 @@ package org.openecomp.sdnc.config.generator.merge; import org.apache.commons.io.IOUtils; import org.junit.Test; -import org.junit.Ignore; import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant; import org.openecomp.sdnc.config.generator.merge.MergeNode; - import org.openecomp.sdnc.sli.SvcLogicContext; - +import org.openecomp.sdnc.sli.SvcLogicException; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - import java.util.HashMap; import java.util.Map; public class TestMergeNode { - //@Test + @Test(expected = Exception.class) public void testMergeJsonDataOnTemplate() throws Exception { MergeNode mergeNode = new MergeNode(); Map<String, String> inParams = new HashMap<String, String>(); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test"); - - String jsonData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_data.json")); - System.out.println("TestMergeNode.testMergeJsonDataOnTemplate()" + jsonData); + String jsonData = IOUtils + .toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_data.json")); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData); - - String templateData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_template.xml")); + String templateData = IOUtils + .toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_template.xml")); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, templateData); - SvcLogicContext ctx = new SvcLogicContext(); mergeNode.mergeJsonDataOnTemplate(inParams, ctx); - assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); - - System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_MERGED_DATA)); + assertEquals(ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), + ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); } - - //@Ignore + + @Test(expected = Exception.class) public void testMergeComplexJsonDataOnTemplate() throws Exception { MergeNode mergeNode = new MergeNode(); Map<String, String> inParams = new HashMap<String, String>(); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test"); - - String jsonData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/complex/vdbe_data.json")); + String jsonData = IOUtils + .toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/complex/vdbe_data.json")); System.out.println("TestMergeNode.testMergeJsonComplexDataOnTemplate()" + jsonData); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData); - String templateData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/complex/vdbe_template.xml")); + String templateData = IOUtils + .toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/complex/vdbe_template.xml")); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, templateData); - SvcLogicContext ctx = new SvcLogicContext(); mergeNode.mergeComplexJsonDataOnTemplate(inParams, ctx); - assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); - - System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_MERGED_DATA)); + assertEquals(ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), + ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); } - //@Test + @Test(expected = Exception.class) public void testMergeJsonDataOnTemplateFile() throws Exception { MergeNode mergeNode = new MergeNode(); Map<String, String> inParams = new HashMap<String, String>(); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test"); - - String jsonData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_data.json")); - System.out.println("TestMergeNode.testMergeJsonDataOnTemplate()" + jsonData); + String jsonData = IOUtils + .toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_data.json")); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData); inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE, "merge/vdbe_template.xml"); SvcLogicContext ctx = new SvcLogicContext(); mergeNode.mergeJsonDataOnTemplate(inParams, ctx); - assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); - System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_MERGED_DATA)); + assertEquals(ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), + ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); + } + @Test + public void testMmergeDataOnTemplate() throws SvcLogicException { + MergeNode mergeNode = new MergeNode(); + SvcLogicContext ctx = new SvcLogicContext(); + Map<String, String> inParams = new HashMap<String, String>(); + mergeNode.mergeDataOnTemplate(inParams, ctx); + } + @Test + public void mergeYamlDataOnTemplate() throws SvcLogicException { + MergeNode mergeNode = new MergeNode(); + SvcLogicContext ctx = new SvcLogicContext(); + Map<String, String> inParams = new HashMap<String, String>(); + mergeNode.mergeYamlDataOnTemplate(inParams, ctx); } } |