diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-08-03 19:11:30 +0530 |
---|---|---|
committer | Takamune Cho <tc012c@att.com> | 2018-08-03 20:57:11 +0000 |
commit | 1a015a6ca222e1bf94050ea9a98ef9ec1577209c (patch) | |
tree | 4990174cbc6703337af60736cb62c95455b85406 /appc-config/appc-config-params/provider/src/test/java | |
parent | f556f166a8d277c312ddba03c49c29822ec7736b (diff) |
added test case to TestPropertyDefinitionNode.java
to increase code coverage
Issue-ID: APPC-1086
Change-Id: I74760fd2d97c4ef429e5f9d6f6eff0297ccec17e
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'appc-config/appc-config-params/provider/src/test/java')
-rw-r--r-- | appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java | 23 |
1 files changed, 20 insertions, 3 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 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<String, String> inParams = new HashMap<String, String>(); + 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 { |