summaryrefslogtreecommitdiffstats
path: root/sliPluginUtils/provider
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-10-02 18:42:38 +0530
committerSandeep Jha <sandeejh@in.ibm.com>2018-10-03 07:41:44 +0000
commit5840e02a1eb4800be92ad632f1dd02469d64234d (patch)
tree6ec236010c5af89897d14c163a018aafa10c3a48 /sliPluginUtils/provider
parent6f094ba9114abf9983bb6de3b365919b88df3af3 (diff)
added test cases to CheckParametersTest
to increase code coverage Issue-ID: CCSDK-595 Change-Id: Ibf5316cc567cacf52806ef57e69749006fe8b204 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'sliPluginUtils/provider')
-rw-r--r--sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
index a7cc1bde5..21aa4a356 100644
--- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
+++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/CheckParametersTest.java
@@ -19,12 +19,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.onap.ccsdk.sli.core.slipluginutils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
@@ -32,8 +33,10 @@ import java.util.Map;
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils.LogLevel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
import com.google.gson.JsonObject;
@@ -183,4 +186,31 @@ public class CheckParametersTest {
assertEquals("27", ctx.getAttribute("root.age"));
assertEquals("600000", ctx.getAttribute("root.salary"));
}
+
+ @Test
+ public void testCtxKeyEmpty()
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("key", "");
+ assertTrue(SliPluginUtils.ctxKeyEmpty(ctx, "key"));
+ }
+
+ @Test
+ public void testGetArrayLength()
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("key_length", "test");
+ Logger log = LoggerFactory.getLogger(getClass());
+ SliPluginUtils.getArrayLength(ctx, "key", log , LogLevel.INFO, "invalid input");
+ }
+
+ @Test
+ public void testSetPropertiesForRoot()
+ {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> parameters= new HashMap<>();
+ parameters.put("root","RootVal");
+ parameters.put("valueRoot", "ValueRootVal");
+ assertEquals("success",SliPluginUtils.setPropertiesForRoot(parameters,ctx));
+ }
}