summaryrefslogtreecommitdiffstats
path: root/generic-resource-api/provider
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-02-04 10:30:40 -0500
committerDan Timoney <dtimoney@att.com>2021-02-04 10:30:40 -0500
commit2e63f133b29f1bb7fccaf6e35d11488f042a5855 (patch)
tree8f95c37abe39ba61b21fb8b6bafe1cb4780580d0 /generic-resource-api/provider
parent20ca6ead983ca534e1ce93abbeaa23a2e4aac0f1 (diff)
Upgrade to ODL Aluminum
Updated code to conform to OpenDaylight Aluminum release. Change-Id: I3ef7daebc689a5d2e344fc7b96ce885bda77a7f8 Issue-ID: SDNC-1474 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'generic-resource-api/provider')
-rw-r--r--generic-resource-api/provider/pom.xml48
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java101
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java6
-rw-r--r--generic-resource-api/provider/src/main/resources/OSGI-INF/blueprint/generic-resource-api-blueprint.xml34
-rw-r--r--generic-resource-api/provider/src/main/resources/org/opendaylight/blueprint/generic-resource-api-blueprint.xml9
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java11
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java11
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java20
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java17
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClientTest.java8
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java19
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java16
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java13
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java17
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java11
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java10
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java12
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java8
-rw-r--r--generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java24
19 files changed, 184 insertions, 211 deletions
diff --git a/generic-resource-api/provider/pom.xml b/generic-resource-api/provider/pom.xml
index 30323ba3..86760ff8 100644
--- a/generic-resource-api/provider/pom.xml
+++ b/generic-resource-api/provider/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.1.0</version>
+ <version>2.1.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -19,11 +19,11 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-core-artifacts</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <type>pom</type>
- <scope>import</scope>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-core-artifacts</artifactId>
+ <version>${ccsdk.sli.core.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
@@ -47,31 +47,22 @@
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-api</artifactId>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-test-model</artifactId>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-test-model</artifactId>
<scope>test</scope>
</dependency>
-
-
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-test-utils</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- <type>test-jar</type>
- <classifier>tests</classifier>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-dom-adapter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@@ -82,8 +73,17 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>1.10.19</version>
<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <forceJavacCompilerUse>true</forceJavacCompilerUse>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
index 583c6335..98e7d7ff 100644
--- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
@@ -1,29 +1,29 @@
package org.onap.sdnc.northbound;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Optional;
import java.util.Properties;
import java.util.TimeZone;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-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.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-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.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.common.api.OptimisticLockFailedException;
+import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.BrgTopologyOperationOutput;
@@ -52,6 +52,10 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PolicyUpdateNotifyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PolicyUpdateNotifyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PolicyUpdateNotifyOperationOutput;
@@ -96,15 +100,12 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationInput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.brg.response.information.BrgResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.connection.attachment.response.information.ConnectionAttachmentResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.contrail.route.response.information.ContrailRouteResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.gc.response.information.GcResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.pnf.response.information.PnfResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.port.mirror.response.information.PortMirrorResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadData;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder;
@@ -127,7 +128,7 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.re
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.tunnelxconn.response.information.TunnelxconnResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.response.information.VfModuleResponseInformationBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.response.information.VnfResponseInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.pnf.response.information.PnfResponseInformationBuilder;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -153,7 +154,7 @@ import org.slf4j.LoggerFactory;
* final GenericResourceApiProvider provider = new GenericResourceApiProvider();
* provider.setDataBroker(getDataBrokerDependency());
* provider.setNotificationService(getNotificationServiceDependency());
- * provider.setRpcRegistry(getRpcRegistryDependency());
+ * provider.setRpcService(getRpcServiceDependency());
* provider.initialize();
* return new AutoCloseable() {
*
@@ -214,16 +215,16 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
protected DataBroker dataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderRegistry rpcRegistry;
- protected BindingAwareBroker.RpcRegistration<GENERICRESOURCEAPIService> rpcRegistration;
+ protected RpcProviderService rpcService;
+ protected ObjectRegistration<GENERICRESOURCEAPIService> rpcRegistration;
public GenericResourceApiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService,
- RpcProviderRegistry rpcProviderRegistry, GenericResourceApiSvcLogicServiceClient client) {
+ RpcProviderService rpcProviderService, GenericResourceApiSvcLogicServiceClient client) {
log.info("Creating provider for {}", APP_NAME);
executor = Executors.newFixedThreadPool(1);
setDataBroker(dataBroker);
setNotificationService(notificationPublishService);
- setRpcRegistry(rpcProviderRegistry);
+ setRpcService(rpcProviderService);
svcLogicClient = client;
initialize();
@@ -239,6 +240,12 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
log.error("Caught Exception while trying to load properties file", e);
}
+ if (rpcRegistration == null) {
+ if (rpcService != null) {
+ rpcRegistration = rpcService.registerRpcImplementation(GENERICRESOURCEAPIService.class, this);
+ }
+ }
+
log.info("Initialization complete for {}", APP_NAME);
}
@@ -285,10 +292,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
}
}
- public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
- this.rpcRegistry = rpcRegistry;
+ public void setRpcService(RpcProviderService rpcService) {
+ this.rpcService = rpcService;
if (log.isDebugEnabled()) {
- log.debug("RpcRegistry set to {}", rpcRegistry == null ? NULL_PARAM : NON_NULL_PARAM);
+ log.debug("rpcService set to {}", rpcService == null ? NULL_PARAM : NON_NULL_PARAM);
}
}
@@ -309,7 +316,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
new PreloadInformationBuilder().build());
try {
- CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit();
+ FluentFuture<? extends @NonNull CommitInfo> checkedFuture = t.commit();
checkedFuture.get();
log.info("Create containers succeeded!");
@@ -367,12 +374,13 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder, LogicalDatastoreType type) {
// See if any data exists yet for this siid, if so grab it.
- InstanceIdentifier<Service> serviceInstanceIdentifier = InstanceIdentifier.builder(Services.class)
+ InstanceIdentifier<Service> serviceInstanceIdentifier = InstanceIdentifier.<Services>builder(Services.class)
.child(Service.class, new ServiceKey(siid)).build();
- Optional<Service> data = Optional.absent();
- try (final ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
- data = readTx.read(type, serviceInstanceIdentifier).get();
+ Optional<Service> data = null;
+
+ try (final ReadTransaction readTx = dataBroker.newReadOnlyTransaction()) {
+ data = (Optional<Service>) readTx.read(type, serviceInstanceIdentifier).get();
} catch (final InterruptedException | ExecutionException e) {
log.error("Caught Exception reading MD-SAL ({}) data for [{}] ", type, siid, e);
}
@@ -426,7 +434,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
throw new IllegalStateException(e);
}
log.debug("Got OptimisticLockFailedException - trying again ");
- } catch (TransactionCommitFailedException ex) {
+ } catch (TransactionCommitFailedException|InterruptedException|ExecutionException ex) {
log.debug("Update DataStore failed");
throw new IllegalStateException(ex);
}
@@ -434,14 +442,15 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
}
private <T extends DataObject> void save(T entry, boolean merge, LogicalDatastoreType storeType,
- InstanceIdentifier<T> path) throws TransactionCommitFailedException {
+ InstanceIdentifier<T> path) throws TransactionCommitFailedException, InterruptedException,
+ ExecutionException {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
if (merge) {
tx.merge(storeType, path, entry);
} else {
tx.put(storeType, path, entry);
}
- tx.submit().checkedGet();
+ tx.commit().get();
log.debug("Update DataStore succeeded");
}
@@ -466,7 +475,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
throw new IllegalStateException(e);
}
log.debug("Got OptimisticLockFailedException - trying again ");
- } catch (TransactionCommitFailedException ex) {
+ } catch (TransactionCommitFailedException|InterruptedException|ExecutionException ex) {
log.debug("Update DataStore failed");
throw new IllegalStateException(ex);
}
@@ -474,10 +483,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
}
private void delete(LogicalDatastoreType storeType, InstanceIdentifier<Service> path)
- throws TransactionCommitFailedException {
+ throws TransactionCommitFailedException, InterruptedException, ExecutionException {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.delete(storeType, path);
- tx.submit().checkedGet();
+ tx.commit().get();
log.debug("DataStore delete succeeded");
}
@@ -494,7 +503,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
.child(PreloadList.class, new PreloadListKey(preloadName, preloadType)).build();
Optional<PreloadList> data = null;
- try (final ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
+ try (final ReadTransaction readTx = dataBroker.newReadOnlyTransaction()) {
data = (Optional<PreloadList>) readTx.read(type, preloadInstanceIdentifier).get();
} catch (final InterruptedException | ExecutionException e) {
log.error("Caught Exception reading MD-SAL ({}) for [{},{}] ", type, preloadName, preloadType, e);
@@ -535,10 +544,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
} else {
tx.put(storeType, path, entry);
}
- tx.submit().checkedGet();
+ tx.commit().get();
log.debug("Update DataStore succeeded");
break;
- } catch (final TransactionCommitFailedException e) {
+ } catch (final InterruptedException | ExecutionException e) {
if (e instanceof OptimisticLockFailedException) {
if (--tries <= 0) {
log.debug("Got OptimisticLockFailedException on last try - failing ");
@@ -574,7 +583,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
throw new IllegalStateException(e);
}
log.debug("Got OptimisticLockFailedException - trying again ");
- } catch (TransactionCommitFailedException ex) {
+ } catch (TransactionCommitFailedException|InterruptedException|ExecutionException ex) {
log.debug("Update DataStore failed");
throw new IllegalStateException(ex);
}
@@ -582,10 +591,10 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
}
private void deletePreloadList(LogicalDatastoreType storeType, InstanceIdentifier<PreloadList> path)
- throws TransactionCommitFailedException {
+ throws TransactionCommitFailedException, InterruptedException, ExecutionException {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.delete(storeType, path);
- tx.submit().checkedGet();
+ tx.commit().get();
log.debug("DataStore delete succeeded");
}
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java
index b84fa3ef..225f8e61 100644
--- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java
@@ -35,10 +35,10 @@ public class GenericResourceApiSvcLogicServiceClient {
static final String SVC_LOGIC_STATUS_KEY = "SvcLogic.status";
static final String SKIP_MDSAL_UPDATE_PROP = "skip-mdsal-update";
- private final Logger LOG = LoggerFactory
+ // Next 2 fields protected so they can be overridden in jUnit without resorting to Java reflection
+ protected Logger LOG = LoggerFactory
.getLogger(GenericResourceApiSvcLogicServiceClient.class);
-
- private SvcLogicService svcLogic = null;
+ protected SvcLogicService svcLogic = null;
public GenericResourceApiSvcLogicServiceClient(SvcLogicService svcLogic)
{
diff --git a/generic-resource-api/provider/src/main/resources/OSGI-INF/blueprint/generic-resource-api-blueprint.xml b/generic-resource-api/provider/src/main/resources/OSGI-INF/blueprint/generic-resource-api-blueprint.xml
deleted file mode 100644
index 80d35574..00000000
--- a/generic-resource-api/provider/src/main/resources/OSGI-INF/blueprint/generic-resource-api-blueprint.xml
+++ /dev/null
@@ -1,34 +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" />
-
- <bean id="client" class="org.onap.sdnc.northbound.GenericResourceApiSvcLogicServiceClient">
- <argument ref="svcLogicService" />
- </bean>
-
- <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.sdnc.northbound.GenericResourceApiProvider">
- <argument ref="dataBroker" />
- <argument ref="notificationService" />
- <argument ref="rpcRegistry" />
- <argument ref="client" />
- </bean>
-
- <odl:rpc-implementation ref="provider"/>
-
-</blueprint> \ No newline at end of file
diff --git a/generic-resource-api/provider/src/main/resources/org/opendaylight/blueprint/generic-resource-api-blueprint.xml b/generic-resource-api/provider/src/main/resources/org/opendaylight/blueprint/generic-resource-api-blueprint.xml
index 80d35574..aee0acb2 100644
--- a/generic-resource-api/provider/src/main/resources/org/opendaylight/blueprint/generic-resource-api-blueprint.xml
+++ b/generic-resource-api/provider/src/main/resources/org/opendaylight/blueprint/generic-resource-api-blueprint.xml
@@ -11,16 +11,13 @@
</bean>
<reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
- odl:type="default" />
+ interface="org.opendaylight.mdsal.binding.api.DataBroker" />
<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.sdnc.northbound.GenericResourceApiProvider">
<argument ref="dataBroker" />
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java
index 091f2de2..7c6082bd 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ConnectionAttachmentTopologyOperationRPCTest.java
@@ -22,16 +22,17 @@ import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation
import static org.onap.sdnc.northbound.util.MDSALUtil.serviceStatus;
import java.time.Instant;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ConnectionAttachmentTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ConnectionAttachmentTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastAction;
@@ -151,7 +152,7 @@ public class ConnectionAttachmentTopologyOperationRPCTest extends GenericResourc
svcClient.mockExecute(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java
index 55b7db44..06c66870 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ContrailRouteTopologyOperationRPCTest.java
@@ -22,16 +22,17 @@ import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation
import static org.onap.sdnc.northbound.util.MDSALUtil.serviceStatus;
import java.time.Instant;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastAction;
@@ -151,7 +152,7 @@ public class ContrailRouteTopologyOperationRPCTest extends GenericResourceApiPro
svcClient.mockExecute(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java
index 629b485c..c77455d4 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericConfigurationTopologyOperationRPCTest.java
@@ -1,29 +1,19 @@
package org.onap.sdnc.northbound;
+import static org.junit.Assert.assertEquals;
+import static org.onap.sdnc.northbound.util.MDSALUtil.GenericConfigurationTopologyOperationInput;
+import static org.onap.sdnc.northbound.util.MDSALUtil.build;
+import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GenericConfigurationTopologyOperationOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.configuration.information.ConfigurationInformationBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
-import static org.onap.sdnc.northbound.GenericResourceApiProvider.NO_SERVICE_LOGIC_ACTIVE;
-import static org.onap.sdnc.northbound.util.MDSALUtil.*;
-
@RunWith(MockitoJUnitRunner.class)
public class GenericConfigurationTopologyOperationRPCTest extends GenericResourceApiProviderTest {
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java
index 6bf6959e..62976378 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiProviderTest.java
@@ -27,21 +27,21 @@ import org.mockito.Mock;
import org.onap.sdnc.northbound.util.DataBrokerUtil;
import org.onap.sdnc.northbound.util.GenericResourceApiSvcLogicServiceClientMockUtil;
import org.onap.sdnc.northbound.util.PropBuilder;
-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.test.AbstractConcurrentDataBrokerTest;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class GenericResourceApiProviderTest extends AbstractConcurrentDataBrokerTest {
+public class GenericResourceApiProviderTest {
protected static final Logger LOG = LoggerFactory.getLogger(GenericResourceApiProvider.class);
protected GenericResourceApiProvider genericResourceApiProvider;
protected DataBroker dataBroker;
protected @Mock NotificationPublishService mockNotificationPublishService;
- protected @Mock RpcProviderRegistry mockRpcProviderRegistry;
+ protected @Mock RpcProviderService mockRpcProviderService;
protected @Mock GenericResourceApiSvcLogicServiceClient mockGenericResourceApiSvcLogicServiceClient;
@@ -59,7 +59,7 @@ public class GenericResourceApiProviderTest extends AbstractConcurrentDataBroker
genericResourceApiProvider = new GenericResourceApiProvider(
dataBroker,
mockNotificationPublishService,
- mockRpcProviderRegistry,
+ mockRpcProviderService,
mockGenericResourceApiSvcLogicServiceClient
);
} catch (Exception e) {
@@ -68,6 +68,9 @@ public class GenericResourceApiProviderTest extends AbstractConcurrentDataBroker
}
}
+ public DataBroker getDataBroker() {
+ return DataBrokerTestModule.dataBroker();
+ }
public static PropBuilder prop(){
return (new PropBuilder());
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClientTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClientTest.java
index 30015720..22e75014 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClientTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClientTest.java
@@ -26,7 +26,6 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import org.mockito.internal.util.reflection.Whitebox;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder;
@@ -54,9 +53,8 @@ public class GenericResourceApiSvcLogicServiceClientTest {
@Before
public void setUp() throws Exception {
svcClient = spy(new GenericResourceApiSvcLogicServiceClient(mockSvcLogic));
-
- Whitebox.setInternalState(svcClient, "LOG", mockLog);
- Whitebox.setInternalState(svcClient, "svcLogic", mockSvcLogic);
+ svcClient.LOG = mockLog;
+ svcClient.svcLogic = mockSvcLogic;
}
@After
@@ -67,7 +65,7 @@ public class GenericResourceApiSvcLogicServiceClientTest {
public void testConstructorWithoutSvcLogicBundle() throws Exception {
GenericResourceApiSvcLogicServiceClient client = new GenericResourceApiSvcLogicServiceClient(mockSvcLogic);
Assert.assertEquals("Should have set mockSvcLogic",
- mockSvcLogic, Whitebox.getInternalState(client, "svcLogic"));
+ mockSvcLogic, client.svcLogic);
}
@Test (expected = SvcLogicException.class)
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java
index 29436415..b5b0a336 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/NetworkTopologyOperationRPCTest.java
@@ -42,24 +42,25 @@ import static org.onap.sdnc.northbound.util.MDSALUtil.serviceInformationBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.serviceLevelOperStatus;
import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.serviceStatus;
-import static org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastAction;
-import static org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastOrderStatus;
-import static org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastRpcAction;
-import static org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.OrderStatus;
import java.time.Instant;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastAction;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastOrderStatus;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastRpcAction;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.OrderStatus;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
@@ -168,7 +169,7 @@ public class NetworkTopologyOperationRPCTest extends GenericResourceApiProviderT
svcClient.mockExecute(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java
index 60a0e1fc..29d48857 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PnfTopologyOperationRPCTest.java
@@ -8,14 +8,14 @@ import static org.onap.sdnc.northbound.GenericResourceApiProvider.NO_SERVICE_LOG
import static org.onap.sdnc.northbound.GenericResourceApiProvider.NULL_OR_EMPTY_ERROR_PARAM;
import static org.onap.sdnc.northbound.util.MDSALUtil.build;
import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
-import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation;
-import static org.onap.sdnc.northbound.util.MDSALUtil.sdncRequestHeader;
-import static org.onap.sdnc.northbound.util.MDSALUtil.serviceInformationBuilder;
-import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.pnfDetailsBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.pnfResponseInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.pnfTopologyOperationInput;
import static org.onap.sdnc.northbound.util.MDSALUtil.pnfTopologyOperationOutput;
+import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation;
+import static org.onap.sdnc.northbound.util.MDSALUtil.sdncRequestHeader;
+import static org.onap.sdnc.northbound.util.MDSALUtil.serviceInformationBuilder;
+import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation;
import org.junit.Before;
import org.junit.Test;
@@ -23,9 +23,9 @@ import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PnfTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
@@ -128,7 +128,7 @@ public class PnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
svcClient.mockExecute(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java
index 6e0f1a2e..e6565e30 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadNetworkTopologyRPCTest.java
@@ -1,6 +1,7 @@
package org.onap.sdnc.northbound;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
@@ -18,18 +19,18 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
import org.opendaylight.yangtools.yang.common.RpcResult;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.Silent.class)
public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTest {
private static final String SVC_OPERATION = "preload-network-topology-operation";
@@ -102,7 +103,7 @@ public class PreloadNetworkTopologyRPCTest extends GenericResourceApiProviderTes
svcClient.mockExecuteWoServiceData(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java
index 7f7ff821..3a0e6265 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/PreloadVnfTopologyOperationRPCTest.java
@@ -1,37 +1,38 @@
package org.onap.sdnc.northbound;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.onap.sdnc.northbound.GenericResourceApiProvider.APP_NAME;
import static org.onap.sdnc.northbound.GenericResourceApiProvider.NO_SERVICE_LOGIC_ACTIVE;
import static org.onap.sdnc.northbound.util.MDSALUtil.build;
import static org.onap.sdnc.northbound.util.MDSALUtil.exec;
+import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyInformationBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyOperationInput;
import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyOperationOutput;
import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.sdncRequestHeader;
-import static org.onap.sdnc.northbound.util.MDSALUtil.vnfTopologyIdentifierStructureBuilder;
-import static org.onap.sdnc.northbound.util.MDSALUtil.preloadVfModuleTopologyInformationBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleTopologyBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleTopologyIdentifierBuilder;
+import static org.onap.sdnc.northbound.util.MDSALUtil.vnfTopologyIdentifierStructureBuilder;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVfModuleTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVfModuleTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction;
import org.opendaylight.yangtools.yang.common.RpcResult;
-@RunWith(MockitoJUnitRunner.class)
+@RunWith(MockitoJUnitRunner.Silent.class)
public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProviderTest {
private static final String SVC_OPERATION = "preload-vf-module-topology-operation";
@@ -146,7 +147,7 @@ public class PreloadVnfTopologyOperationRPCTest extends GenericResourceApiProvid
svcClient.mockExecuteWoServiceData(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java
index e7618937..c572ab6f 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/SecurityZoneTopologyOperationRPCTest.java
@@ -22,16 +22,17 @@ import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation
import static org.onap.sdnc.northbound.util.MDSALUtil.serviceStatus;
import java.time.Instant;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastAction;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastOrderStatus;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.OperStatusData.LastRpcAction;
@@ -152,7 +153,7 @@ public class SecurityZoneTopologyOperationRPCTest extends GenericResourceApiProv
svcClient.mockExecute(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
index cce03cc2..25f3fc7e 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/ServiceTopologyOperationRPCTest.java
@@ -45,10 +45,10 @@ import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
@@ -231,7 +231,7 @@ public class ServiceTopologyOperationRPCTest extends GenericResourceApiProviderT
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
index 927eee34..81adeb87 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VfModuleTopologyOperationRPCTest.java
@@ -12,12 +12,12 @@ import static org.onap.sdnc.northbound.util.MDSALUtil.requestInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.sdncRequestHeader;
import static org.onap.sdnc.northbound.util.MDSALUtil.serviceInformationBuilder;
import static org.onap.sdnc.northbound.util.MDSALUtil.serviceResponseInformation;
-import static org.onap.sdnc.northbound.util.MDSALUtil.vnfResponseInformation;
-import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleResponseInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleInformationBuilder;
+import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleResponseInformation;
import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleTopologyOperationInput;
import static org.onap.sdnc.northbound.util.MDSALUtil.vfModuleTopologyOperationOutput;
import static org.onap.sdnc.northbound.util.MDSALUtil.vnfInformationBuilder;
+import static org.onap.sdnc.northbound.util.MDSALUtil.vnfResponseInformation;
import org.junit.Before;
import org.junit.Test;
@@ -25,9 +25,9 @@ import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
@@ -154,7 +154,7 @@ public class VfModuleTopologyOperationRPCTest extends GenericResourceApiProvider
svcClient.mockExecute(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java
index 3c7b6ff7..c1564c39 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/VnfTopologyOperationRPCTest.java
@@ -23,9 +23,9 @@ import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.sdnc.northbound.util.PropBuilder;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.TransactionChainClosedException;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation;
@@ -128,7 +128,7 @@ public class VnfTopologyOperationRPCTest extends GenericResourceApiProviderTest
svcClient.mockExecute(svcResultProp);
svcClient.mockHasGraph(true);
WriteTransaction mockWriteTransaction = mock(WriteTransaction.class);
- when(mockWriteTransaction.submit()).thenThrow(new TransactionChainClosedException("test exception"));
+ when(mockWriteTransaction.commit()).thenThrow(new TransactionChainClosedException("test exception"));
DataBroker spyDataBroker = Mockito.spy(dataBroker);
when(spyDataBroker.newWriteOnlyTransaction()).thenReturn(mockWriteTransaction);
diff --git a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java
index 878487cf..8bfea834 100644
--- a/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java
+++ b/generic-resource-api/provider/src/test/java/org/onap/sdnc/northbound/util/DataBrokerUtil.java
@@ -21,13 +21,18 @@
package org.onap.sdnc.northbound.util;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import java.util.Optional;
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.ReadTransaction;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.Services;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.level.oper.status.ServiceLevelOperStatusBuilder;
@@ -57,7 +62,7 @@ public class DataBrokerUtil {
public Service read(String serviceKey, LogicalDatastoreType logicalDatastoreType) throws Exception {
InstanceIdentifier serviceInstanceIdentifier = InstanceIdentifier.<Services>builder(Services.class)
.child(Service.class, new ServiceKey(serviceKey)).build();
- ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ ReadTransaction readTx = dataBroker.newReadOnlyTransaction();
Optional<Service> data = (Optional<Service>) readTx.read(logicalDatastoreType, serviceInstanceIdentifier).get();
if(!data.isPresent()){
return null;
@@ -96,8 +101,7 @@ public class DataBrokerUtil {
} else {
tx.put(logicalDatastoreType, path, service);
}
- CheckedFuture<Void,TransactionCommitFailedException> cf = tx.submit();
- cf.checkedGet();
+ tx.commit().get();
}