From a0ab49e6c1ea41af18656d6e9efb3377051f2528 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Sat, 24 Mar 2018 19:11:10 -0400 Subject: Add unit tests for sli Added unit tests for ccsdk/sli/core/sli Change-Id: I0d2408c43b9e56a78f3e01e87985aedb6cad5953 Issue-ID: CCSDK-213 Signed-off-by: Timoney, Dan (dt5972) --- .../onap/ccsdk/sli/core/sliapi/sliapiProvider.java | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'sliapi/provider/src/main') diff --git a/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/sliapiProvider.java b/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/sliapiProvider.java index 3ff2f52d..e9a2b8eb 100644 --- a/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/sliapiProvider.java +++ b/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/sliapiProvider.java @@ -114,14 +114,16 @@ import com.google.common.util.concurrent.Futures; */ public class sliapiProvider implements AutoCloseable, SLIAPIService{ - private final Logger LOG = LoggerFactory.getLogger( sliapiProvider.class ); - private final String appName = "slitester"; + private static final Logger LOG = LoggerFactory.getLogger( sliapiProvider.class ); + private static final String appName = "slitester"; protected DataBroker dataBroker; protected DOMDataBroker domDataBroker; protected NotificationPublishService notificationService; protected RpcProviderRegistry rpcRegistry; + private SvcLogicService svcLogic; + protected BindingAwareBroker.RpcRegistration rpcRegistration; private static String SLIAPI_NAMESPACE = "org:onap:ccsdk:sli:core:sliapi"; @@ -142,15 +144,23 @@ public class sliapiProvider implements AutoCloseable, SLIAPIService{ RESULTS_QNAME = QName.create(TEST_RESULT_QNAME, "results"); } + public sliapiProvider( + DataBroker dataBroker, + NotificationPublishService notificationPublishService, + RpcProviderRegistry rpcProviderRegistry) { + this(dataBroker, notificationPublishService, rpcProviderRegistry, findSvcLogicService()); + } public sliapiProvider( DataBroker dataBroker, NotificationPublishService notificationPublishService, - RpcProviderRegistry rpcProviderRegistry) { + RpcProviderRegistry rpcProviderRegistry, + SvcLogicService svcLogic) { this.LOG.info( "Creating provider for " + appName ); this.dataBroker = dataBroker; this.notificationService = notificationPublishService; this.rpcRegistry = rpcProviderRegistry; + this.svcLogic = svcLogic; initialize(); } @@ -357,6 +367,13 @@ public class sliapiProvider implements AutoCloseable, SLIAPIService{ private SvcLogicService getSvcLogicService() { + if (svcLogic == null) { + svcLogic = findSvcLogicService(); + } + + return(svcLogic); + } + private static SvcLogicService findSvcLogicService() { BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext(); SvcLogicService svcLogic = null; -- cgit 1.2.3-korg