From e679025082286f86e983d999084605326c540547 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Tue, 2 Oct 2018 02:24:14 +0530 Subject: added test case to TestSlipapiprovider to increase code coverage Issue-ID: CCSDK-595 Change-Id: If835e05bfd08db9c60ae15e924a9750c78d67763 Signed-off-by: Sandeep J --- .../ccsdk/sli/core/sliapi/TestSliapiProvider.java | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'sliapi/provider/src/test') diff --git a/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java b/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java index 38cbd40c9..287f2f206 100644 --- a/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java +++ b/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java @@ -4,8 +4,12 @@ package org.onap.ccsdk.sli.core.sliapi; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import static org.mockito.Mockito.*; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + import java.io.InputStream; import java.net.URL; import java.util.HashMap; @@ -13,6 +17,8 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.concurrent.Future; + import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -86,7 +92,6 @@ public class TestSliapiProvider { } }; - /** * @throws java.lang.Exception */ @@ -95,10 +100,10 @@ public class TestSliapiProvider { DataBroker dataBroker = mock(DataBroker.class); NotificationPublishService notifyService = mock(NotificationPublishService.class); RpcProviderRegistry rpcRegistry = mock(RpcProviderRegistry.class); - BindingAwareBroker.RpcRegistration rpcRegistration = (BindingAwareBroker.RpcRegistration) mock(BindingAwareBroker.RpcRegistration.class); + BindingAwareBroker.RpcRegistration rpcRegistration = (BindingAwareBroker.RpcRegistration) mock( + BindingAwareBroker.RpcRegistration.class); when(rpcRegistry.addRpcImplementation(any(Class.class), any(SLIAPIService.class))).thenReturn(rpcRegistration); - // Load svclogic.properties and get a SvcLogicStore InputStream propStr = TestSliapiProvider.class.getResourceAsStream("/svclogic.properties"); Properties svcprops = new Properties(); @@ -111,7 +116,7 @@ public class TestSliapiProvider { // Load the DG for the healthcheck api URL testCaseUrl = TestSliapiProvider.class.getClassLoader().getResource(HEALTHCHECK_DG); if (testCaseUrl == null) { - fail("Cannot find "+HEALTHCHECK_DG); + fail("Cannot find " + HEALTHCHECK_DG); } SvcLogicParser.load(testCaseUrl.getPath(), store); SvcLogicParser.activate("sli", "healthcheck", "1.0.0", "sync", store); @@ -138,7 +143,8 @@ public class TestSliapiProvider { } /** - * Test method for {@link org.onap.ccsdk.sli.core.sliapi.sliapiProvider#executeGraph(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput)}. + * Test method for + * {@link org.onap.ccsdk.sli.core.sliapi.sliapiProvider#executeGraph(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput)}. */ @Test public void testExecuteGraph() { @@ -154,14 +160,13 @@ public class TestSliapiProvider { pList.add(pBuilder.build()); inputBuilder.setSliParameter(pList); - - - provider.executeGraph(inputBuilder.build()); + assertTrue(provider.vlbcheck() instanceof Future); } /** - * Test method for {@link org.onap.ccsdk.sli.core.sliapi.sliapiProvider#healthcheck()}. + * Test method for + * {@link org.onap.ccsdk.sli.core.sliapi.sliapiProvider#healthcheck()}. */ @Test public void testHealthcheck() { -- cgit 1.2.3-korg