added test case to TestMergeNode.java 59/59659/3
authorSandeep J <sandeejh@in.ibm.com>
Wed, 8 Aug 2018 12:04:04 +0000 (17:34 +0530)
committerTakamune Cho <tc012c@att.com>
Thu, 9 Aug 2018 15:21:07 +0000 (15:21 +0000)
to increase code coverage

Issue-ID: APPC-1086
Change-Id: If9a93361b275df98412dc23410a2094e340b7c9c
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
appc-config/appc-config-generator/provider/src/test/java/org/onap/sdnc/config/generator/merge/TestMergeNode.java

index 20cad53..e56b29b 100644 (file)
@@ -6,6 +6,8 @@
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * =============================================================================
+ * Modification 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.
  * You may obtain a copy of the License at
@@ -24,6 +26,8 @@
 package org.onap.sdnc.config.generator.merge;
 
 import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.commons.io.IOUtils;
@@ -98,6 +102,21 @@ public class TestMergeNode {
         Map<String, String> inParams = new HashMap<String, String>();
         mergeNode.mergeDataOnTemplate(inParams, ctx);
     }
+    
+    @Test
+    public void testMmergeDataOnTemplateWithTemplateData() throws SvcLogicException, IOException {
+        MergeNode mergeNode = new MergeNode();
+        Map<String, String> inParams = new HashMap<String, String>();
+        inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+        String jsonData = "{name1:value1,name2:value2}";
+        inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData);
+        String templateData = "testTemplateData";
+        inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, templateData);
+        SvcLogicContext ctx = new SvcLogicContext();
+        mergeNode.mergeJsonDataOnTemplate(inParams, ctx);
+        assertEquals(ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS,ctx.getAttribute("test." + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS));
+
+    }
 
     @Test
     public void mergeYamlDataOnTemplate() throws SvcLogicException {