summaryrefslogtreecommitdiffstats
path: root/core/sliapi/provider
diff options
context:
space:
mode:
authorMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-01-18 05:41:16 +0100
committerMichael DÜrre <michael.duerre@highstreet-technologies.com>2021-02-02 07:28:40 +0100
commit56c27daf1656fd6436f8c818c771cf803079e1ea (patch)
treea2734caf88f1633d14db763281d2a03e4ec8aef5 /core/sliapi/provider
parent0e4e58bf061df695341ac250beb97a978cefdaf7 (diff)
migrate sli to alu-SR1
migrate ODL interfaces and fix code for changes in alu-SR1 Issue-ID: CCSDK-3089 Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com> Change-Id: Id48dcfc517585f2ce6b30047113cd1d173c3c9dc Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Diffstat (limited to 'core/sliapi/provider')
-rwxr-xr-xcore/sliapi/provider/pom.xml70
-rw-r--r--core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java148
-rw-r--r--core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml28
-rw-r--r--core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml9
-rw-r--r--core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java45
5 files changed, 132 insertions, 168 deletions
diff --git a/core/sliapi/provider/pom.xml b/core/sliapi/provider/pom.xml
index b9d1c9a67..5bccec9b6 100755
--- a/core/sliapi/provider/pom.xml
+++ b/core/sliapi/provider/pom.xml
@@ -17,58 +17,54 @@
<name>ccsdk-sli-core :: sliapi :: ${project.artifactId}</name>
<dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>dblib-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sliapi-model-yang</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-api</artifactId>
+ <scope>provided</scope>
</dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- </dependency>
-
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-dom-adapter</artifactId>
+ <scope>provided</scope>
</dependency>
-
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>yang-binding</artifactId>
+ <scope>provided</scope>
</dependency>
-
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-common-util</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-model-yang</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-common</artifactId>
<version>${project.version}</version>
</dependency>
@@ -82,27 +78,17 @@
<artifactId>sli-provider-base</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-core-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-data-impl</artifactId>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
diff --git a/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
index 449fc3822..a00131efb 100644
--- a/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
+++ b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
@@ -21,6 +21,8 @@
package org.onap.ccsdk.sli.core.sliapi;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
@@ -28,19 +30,14 @@ import java.io.IOException;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.Properties;
-
+import java.util.concurrent.ExecutionException;
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.OptimisticLockFailedException;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
@@ -50,14 +47,13 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.Hea
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.SLIAPIService;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -78,9 +74,6 @@ import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
/**
* Defines a base implementation for your provider. This class extends from a
* helper class which provides storage for the most commonly used components of
@@ -92,17 +85,17 @@ import com.google.common.util.concurrent.ListenableFuture;
* src/main/java in this project (created only once during first compilation):
*
* <pre>
- *
+ *
* &#64;Override
* public java.lang.AutoCloseable createInstance() {
- *
+ *
* final SliapiProvider provider = new SliapiProvider();
* provider.setDataBroker(getDataBrokerDependency());
* provider.setNotificationService(getNotificationServiceDependency());
* provider.setRpcRegistry(getRpcRegistryDependency());
* provider.initialize();
* return new AutoCloseable() {
- *
+ *
* &#64;Override
* public void close() throws Exception {
* // TODO: CLOSE ANY REGISTRATION OBJECTS CREATED USING ABOVE
@@ -112,7 +105,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* }
* };
* }
- *
+ *
* </pre>
*/
public class SliapiProvider implements AutoCloseable, SLIAPIService {
@@ -120,14 +113,14 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
private static final Logger LOG = LoggerFactory.getLogger(SliapiProvider.class);
private static final String appName = "slitester";
- protected DataBroker dataBroker;
+ //protected DataBroker dataBroker;
protected DOMDataBroker domDataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderRegistry rpcRegistry;
+ protected RpcProviderService rpcRegistry;
private SvcLogicService svcLogic;
- protected BindingAwareBroker.RpcRegistration<SLIAPIService> rpcRegistration;
+ protected ObjectRegistration<SLIAPIService> rpcRegistration;
private static String SLIAPI_NAMESPACE = "org:onap:ccsdk:sli:core:sliapi";
private static String SLIAPI_REVISION = "2016-11-10";
@@ -148,25 +141,26 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
RESULTS_QNAME = QName.create(TEST_RESULT_QNAME, "results");
}
- public SliapiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService,
- RpcProviderRegistry rpcProviderRegistry) {
+ public SliapiProvider(DOMDataBroker dataBroker, NotificationPublishService notificationPublishService,
+ RpcProviderService rpcProviderRegistry) {
this(dataBroker, notificationPublishService, rpcProviderRegistry, findSvcLogicService());
}
- public SliapiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService,
- RpcProviderRegistry rpcProviderRegistry, SvcLogicService svcLogic) {
+ public SliapiProvider(DOMDataBroker dataBroker, NotificationPublishService notificationPublishService,
+ RpcProviderService rpcProviderRegistry, SvcLogicService svcLogic) {
this.LOG.info("Creating provider for " + appName);
- this.dataBroker = dataBroker;
+ //this.dataBroker = dataBroker;
this.notificationService = notificationPublishService;
this.rpcRegistry = rpcProviderRegistry;
this.svcLogic = svcLogic;
+ this.domDataBroker = dataBroker;
initialize();
}
public void initialize() {
LOG.info("Initializing provider for " + appName);
// initialization code goes here.
- rpcRegistration = rpcRegistry.addRpcImplementation(SLIAPIService.class, this);
+ rpcRegistration = rpcRegistry.registerRpcImplementation(SLIAPIService.class, this);
sdncStatusFile = System.getenv(SDNC_STATUS_FILE);
LOG.info("SDNC STATUS FILE = " + sdncStatusFile);
@@ -186,11 +180,9 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
LOG.info("Successfully closed provider for " + appName);
}
- public void setDataBroker(DataBroker dataBroker) {
- this.dataBroker = dataBroker;
- if (dataBroker instanceof AbstractForwardedDataBroker) {
- domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate();
- }
+ public void setDataBroker(DOMDataBroker dataBroker) {
+ domDataBroker = dataBroker;
+
if (LOG.isDebugEnabled()) {
LOG.debug("DataBroker set to " + (dataBroker == null ? "null" : NON_NULL) + ".");
}
@@ -203,7 +195,7 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
}
}
- public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
+ public void setRpcRegistry(RpcProviderService rpcRegistry) {
this.rpcRegistry = rpcRegistry;
if (LOG.isDebugEnabled()) {
LOG.debug("RpcRegistry set to " + (rpcRegistry == null ? "null" : NON_NULL) + ".");
@@ -262,7 +254,7 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
Properties parms = new Properties();
// Pass properties using names from sli-parameters
- for (SliParameter sliParm : input.getSliParameter()) {
+ for (SliParameter sliParm : input.getSliParameter().values()) {
String propValue = "";
@@ -454,7 +446,8 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
return (Futures.immediateFuture(rpcResult));
}
- public ListenableFuture<RpcResult<VlbcheckOutput>> vlbcheck(VlbcheckInput vlbInput) {
+ @Override
+ public ListenableFuture<RpcResult<VlbcheckOutput>> vlbcheck(VlbcheckInput vlbInput) {
RpcResult<VlbcheckOutput> rpcResult = null;
SvcLogicService svcLogic = getSvcLogicService();
@@ -578,12 +571,12 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
YangInstanceIdentifier testResultsPid = YangInstanceIdentifier.builder().node(TEST_RESULTS_QNAME)
.node(QName.create(TEST_RESULTS_QNAME, "test-result")).build();
YangInstanceIdentifier testResultPid = testResultsPid
- .node(new NodeIdentifierWithPredicates(TEST_RESULT_QNAME, resultNode.getIdentifier().getKeyValues()));
+ .node(NodeIdentifierWithPredicates.of(TEST_RESULT_QNAME, resultNode.getIdentifier().asMap()));
int tries = 2;
while (true) {
try {
- DOMDataWriteTransaction wtx = domDataBroker.newWriteOnlyTransaction();
+ DOMDataTreeWriteTransaction wtx = domDataBroker.newWriteOnlyTransaction();
if (merge) {
LOG.info("Merging test identifier " + entry.getTestIdentifier());
wtx.merge(storeType, testResultPid, resultNode);
@@ -591,10 +584,10 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
LOG.info("Putting test identifier " + entry.getTestIdentifier());
wtx.put(storeType, testResultPid, resultNode);
}
- wtx.submit().checkedGet();
+ wtx.commit().get();
LOG.trace("Update DataStore succeeded");
break;
- } catch (final TransactionCommitFailedException e) {
+ } catch (final InterruptedException | ExecutionException e) {
if (e instanceof OptimisticLockFailedException) {
if (--tries <= 0) {
LOG.trace("Got OptimisticLockFailedException on last try - failing ");
@@ -610,40 +603,40 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
}
- private void SaveTestResult(final TestResult entry, boolean merge, LogicalDatastoreType storeType)
- throws IllegalStateException {
- // Each entry will be identifiable by a unique key, we have to create that
- // identifier
-
- InstanceIdentifier.InstanceIdentifierBuilder<TestResult> testResultIdBuilder = InstanceIdentifier
- .<TestResults>builder(TestResults.class).child(TestResult.class, entry.key());
- InstanceIdentifier<TestResult> path = testResultIdBuilder.build();
- int tries = 2;
- while (true) {
- try {
- WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
- if (merge) {
- tx.merge(storeType, path, entry);
- } else {
- tx.put(storeType, path, entry);
- }
- tx.submit().checkedGet();
- LOG.trace("Update DataStore succeeded");
- break;
- } catch (final TransactionCommitFailedException e) {
- if (e instanceof OptimisticLockFailedException) {
- if (--tries <= 0) {
- LOG.trace("Got OptimisticLockFailedException on last try - failing ");
- throw new IllegalStateException(e);
- }
- LOG.trace("Got OptimisticLockFailedException - trying again ");
- } else {
- LOG.trace("Update DataStore failed");
- throw new IllegalStateException(e);
- }
- }
- }
- }
+// private void SaveTestResult(final TestResult entry, boolean merge, LogicalDatastoreType storeType)
+// throws IllegalStateException {
+// // Each entry will be identifiable by a unique key, we have to create that
+// // identifier
+//
+// InstanceIdentifier.InstanceIdentifierBuilder<TestResult> testResultIdBuilder = InstanceIdentifier
+// .<TestResults>builder(TestResults.class).child(TestResult.class, entry.key());
+// InstanceIdentifier<TestResult> path = testResultIdBuilder.build();
+// int tries = 2;
+// while (true) {
+// try {
+// WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+// if (merge) {
+// tx.merge(storeType, path, entry);
+// } else {
+// tx.put(storeType, path, entry);
+// }
+// tx.submit().checkedGet();
+// LOG.trace("Update DataStore succeeded");
+// break;
+// } catch (final TransactionCommitFailedException e) {
+// if (e instanceof OptimisticLockFailedException) {
+// if (--tries <= 0) {
+// LOG.trace("Got OptimisticLockFailedException on last try - failing ");
+// throw new IllegalStateException(e);
+// }
+// LOG.trace("Got OptimisticLockFailedException - trying again ");
+// } else {
+// LOG.trace("Update DataStore failed");
+// throw new IllegalStateException(e);
+// }
+// }
+// }
+// }
private MapEntryNode toMapEntryNode(TestResult testResult) {
@@ -664,7 +657,8 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
// Construct test result ContainerNode with 2 children - test-identifier leaf
// and results leaf-set
MapEntryNode testResultNode = ImmutableNodes.mapEntryBuilder()
- .withNodeIdentifier(new NodeIdentifierWithPredicates(TEST_RESULT_QNAME, TEST_ID_QNAME,
+
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(TEST_RESULT_QNAME, TEST_ID_QNAME,
testResult.getTestIdentifier()))
.withChild(ImmutableNodes.leafNode(TEST_ID_QNAME, testResult.getTestIdentifier()))
.withChild(resultsNode).build();
diff --git a/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml b/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml
deleted file mode 100644
index 875027e63..000000000
--- a/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <reference id="svcLogicService"
- interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
-
-
- <reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
- odl:type="default" />
-
- <reference id="notificationService"
- interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
- odl:type="default" />
-
- <reference id="rpcRegistry"
- interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
- odl:type="default" />
-
- <bean id="provider" class="org.onap.ccsdk.sli.core.sliapi.SliapiProvider">
- <argument ref="dataBroker" />
- <argument ref="notificationService" />
- <argument ref="rpcRegistry" />
-
- </bean>
-</blueprint> \ No newline at end of file
diff --git a/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml b/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml
index 875027e63..8ec666d53 100644
--- a/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml
+++ b/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml
@@ -8,16 +8,13 @@
<reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
- odl:type="default" />
+ interface="org.opendaylight.mdsal.dom.api.DOMDataBroker" />
<reference id="notificationService"
- interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
- odl:type="default" />
+ interface="org.opendaylight.mdsal.binding.api.NotificationPublishService" />
<reference id="rpcRegistry"
- interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
- odl:type="default" />
+ interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
<bean id="provider" class="org.onap.ccsdk.sli.core.sliapi.SliapiProvider">
<argument ref="dataBroker" />
diff --git a/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
index f48cf783b..b731423c5 100644
--- a/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
+++ b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
@@ -1,15 +1,30 @@
-/**
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2018 IBM. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
*
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
*/
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.Matchers.any;
+import static org.mockito.ArgumentMatchers.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;
@@ -47,10 +62,9 @@ import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor;
import org.onap.ccsdk.sli.core.sli.provider.base.SwitchNodeExecutor;
import org.onap.ccsdk.sli.core.sli.provider.base.UpdateNodeExecutor;
import org.onap.ccsdk.sli.core.sli.provider.base.WhileNodeExecutor;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckInput;
@@ -58,6 +72,7 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.SLI
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
/**
* @author dt5972
@@ -99,12 +114,12 @@ public class TestSliapiProvider {
*/
@Before
public void setUp() throws Exception {
- DataBroker dataBroker = mock(DataBroker.class);
+ DOMDataBroker dataBroker = mock(DOMDataBroker.class);
NotificationPublishService notifyService = mock(NotificationPublishService.class);
- RpcProviderRegistry rpcRegistry = mock(RpcProviderRegistry.class);
- BindingAwareBroker.RpcRegistration<SLIAPIService> rpcRegistration = (BindingAwareBroker.RpcRegistration<SLIAPIService>) mock(
- BindingAwareBroker.RpcRegistration.class);
- when(rpcRegistry.addRpcImplementation(any(Class.class), any(SLIAPIService.class))).thenReturn(rpcRegistration);
+ RpcProviderService rpcRegistry = mock(RpcProviderService.class);
+ ObjectRegistration<SLIAPIService> rpcRegistration = mock(
+ ObjectRegistration.class);
+ when(rpcRegistry.registerRpcImplementation(any(Class.class), any(SLIAPIService.class))).thenReturn(rpcRegistration);
// Load svclogic.properties and get a SvcLogicStore
InputStream propStr = TestSliapiProvider.class.getResourceAsStream("/svclogic.properties");
@@ -172,8 +187,8 @@ public class TestSliapiProvider {
pList.add(pBuilder.build());
inputBuilder.setSliParameter(pList);
provider.executeGraph(inputBuilder.build());
-
-
+
+
// Invalid test - graph does not exist
inputBuilder.setMode(ExecuteGraphInput.Mode.Sync);
inputBuilder.setModuleName("sli");
@@ -193,7 +208,7 @@ public class TestSliapiProvider {
pList.add(pBuilder.build());
inputBuilder.setSliParameter(pList);
provider.executeGraph(inputBuilder.build());
-
+
assertTrue(provider.vlbcheck(mock(VlbcheckInput.class)) instanceof Future<?>);
}