From 1a015a6ca222e1bf94050ea9a98ef9ec1577209c Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Fri, 3 Aug 2018 19:11:30 +0530 Subject: added test case to TestPropertyDefinitionNode.java to increase code coverage Issue-ID: APPC-1086 Change-Id: I74760fd2d97c4ef429e5f9d6f6eff0297ccec17e Signed-off-by: Sandeep J --- .../params/parser/TestPropertyDefinitionNode.java | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'appc-config/appc-config-params') 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 40cc00c67..dbadef85a 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 @@ -6,7 +6,7 @@ * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= - * Modifications Copyright (C) 2018 IBM + * 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. @@ -25,10 +25,10 @@ package org.onap.sdnc.config.params.parser; - - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; + +import java.io.IOException; import java.nio.charset.Charset; import java.util.HashMap; import java.util.Map; @@ -37,6 +37,7 @@ import org.apache.commons.lang.StringUtils; import org.junit.Ignore; import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.sdnc.config.params.ParamsHandlerConstant; import org.onap.sdnc.config.params.data.PropertyDefinition; import org.onap.sdnc.config.params.transformer.ArtificatTransformer; @@ -116,6 +117,22 @@ public class TestPropertyDefinitionNode { assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS); } + + @Test + public void mergeJsonDataForEmptyParams() throws SvcLogicException, IOException { + + PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode(); + Map inParams = new HashMap(); + inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test"); + 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); + String status= ctx.getAttribute("test.status"); + assertEquals(ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS,status); + + } @Test public void testArtificatTransformer() throws Exception { -- cgit 1.2.3-korg