diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-10-02 02:24:14 +0530 |
---|---|---|
committer | Sandeep J <sandeejh@in.ibm.com> | 2018-10-02 02:25:24 +0530 |
commit | e679025082286f86e983d999084605326c540547 (patch) | |
tree | 9aa137a71ca86d5714c569085065563b4f80467c | |
parent | 6f094ba9114abf9983bb6de3b365919b88df3af3 (diff) |
added test case to TestSlipapiprovider
to increase code coverage
Issue-ID: CCSDK-595
Change-Id: If835e05bfd08db9c60ae15e924a9750c78d67763
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rw-r--r-- | sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java | 25 |
1 files changed, 15 insertions, 10 deletions
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<SLIAPIService> rpcRegistration = (BindingAwareBroker.RpcRegistration<SLIAPIService>) mock(BindingAwareBroker.RpcRegistration.class); + BindingAwareBroker.RpcRegistration<SLIAPIService> rpcRegistration = (BindingAwareBroker.RpcRegistration<SLIAPIService>) 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() { |