summaryrefslogtreecommitdiffstats
path: root/northbound/daexim-offsite-backup/provider/src
diff options
context:
space:
mode:
Diffstat (limited to 'northbound/daexim-offsite-backup/provider/src')
-rwxr-xr-xnorthbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java34
-rwxr-xr-xnorthbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml20
-rwxr-xr-xnorthbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml6
-rw-r--r--northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java21
4 files changed, 53 insertions, 28 deletions
diff --git a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
index 7ee2a91d7..09c8f92f4 100755
--- a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
+++ b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
@@ -21,9 +21,6 @@
package org.onap.ccsdk.sli.northbound.daeximoffsitebackup;
-import com.google.common.util.concurrent.FluentFuture;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -47,22 +44,27 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import javax.annotation.Nonnull;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.CommitInfo;
+
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+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 org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.DaeximOffsiteBackupService;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutputBuilder;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -84,11 +86,11 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite
private final ExecutorService executor;
private Properties properties;
private DataBroker dataBroker;
- private RpcProviderService rpcRegistry;
- private ObjectRegistration<DaeximOffsiteBackupService> rpcRegistration;
+ private RpcProviderRegistry rpcRegistry;
+ private BindingAwareBroker.RpcRegistration<DaeximOffsiteBackupService> rpcRegistration;
public DaeximOffsiteBackupProvider(DataBroker dataBroker,
- RpcProviderService rpcProviderRegistry) {
+ RpcProviderRegistry rpcProviderRegistry) {
LOG.info("Creating provider for " + appName);
this.executor = Executors.newFixedThreadPool(1);
this.dataBroker = dataBroker;
@@ -105,7 +107,7 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite
} catch (Exception e) {
LOG.error("Caught Exception while trying to load properties file", e);
}
- rpcRegistration = rpcRegistry.registerRpcImplementation(DaeximOffsiteBackupService.class, this);
+ rpcRegistration = rpcRegistry.addRpcImplementation(DaeximOffsiteBackupService.class, this);
LOG.info("Initialization complete for " + appName);
}
@@ -171,7 +173,7 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite
private void createContainers() {
final WriteTransaction t = dataBroker.newReadWriteTransaction();
try {
- FluentFuture<? extends @NonNull CommitInfo> checkedFuture = t.commit();
+ CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit();
checkedFuture.get();
LOG.info("Create Containers succeeded!: ");
} catch (InterruptedException | ExecutionException e) {
diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml b/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml
new file mode 100755
index 000000000..8e2101ad3
--- /dev/null
+++ b/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml
@@ -0,0 +1,20 @@
+<?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="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ 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.northbound.daeximoffsitebackup.DaeximOffsiteBackupProvider">
+ <argument ref="dataBroker" />
+ <argument ref="rpcRegistry" />
+ </bean>
+
+ <odl:rpc-implementation ref="provider"/>
+</blueprint>
diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml b/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml
index 6118f28c3..8e2101ad3 100755
--- a/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml
+++ b/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml
@@ -4,10 +4,12 @@
odl:use-default-for-reference-types="true">
<reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" />
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
<reference id="rpcRegistry"
- interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
<bean id="provider" class="org.onap.ccsdk.sli.northbound.daeximoffsitebackup.DaeximOffsiteBackupProvider">
<argument ref="dataBroker" />
diff --git a/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java
index 03fe37513..0f0cee288 100644
--- a/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java
+++ b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.CheckedFuture;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -38,9 +38,10 @@ import java.util.concurrent.ExecutionException;
import org.eclipse.jdt.annotation.Nullable;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.DaeximOffsiteBackupService;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput;
import org.opendaylight.yangtools.yang.binding.Augmentation;
@@ -48,8 +49,8 @@ import org.opendaylight.yangtools.yang.binding.Augmentation;
public class DaeximOffsiteBackupProviderTest {
public DataBroker dataBroker;
public ReadWriteTransaction writeTransaction;
- public FluentFuture checkedFuture;
- public RpcProviderService rpcRegistry;
+ public CheckedFuture<Void, TransactionCommitFailedException> checkedFuture;
+ public RpcProviderRegistry rpcRegistry;
public DaeximOffsiteBackupProvider provider;
public Properties resProps;
@@ -60,16 +61,16 @@ public class DaeximOffsiteBackupProviderTest {
resProps.put("error-message", "Success");
dataBroker = mock(DataBroker.class);
writeTransaction = mock(ReadWriteTransaction.class);
- checkedFuture = mock(FluentFuture.class);
- rpcRegistry = mock(RpcProviderService.class);
- when(rpcRegistry.registerRpcImplementation(any(), any(DaeximOffsiteBackupService.class))).thenReturn(null);
+ checkedFuture = mock(CheckedFuture.class);
+ rpcRegistry = mock(RpcProviderRegistry.class);
+ when(rpcRegistry.addRoutedRpcImplementation(any(), any(DaeximOffsiteBackupService.class))).thenReturn(null);
try {
when(checkedFuture.get()).thenReturn(null);
}
catch(InterruptedException | ExecutionException e) {
e.printStackTrace();
}
- when(writeTransaction.commit()).thenReturn(checkedFuture);
+ when(writeTransaction.submit()).thenReturn(checkedFuture);
when(dataBroker.newReadWriteTransaction()).thenReturn(writeTransaction);
provider = new DaeximOffsiteBackupProvider(dataBroker, rpcRegistry);