summaryrefslogtreecommitdiffstats
path: root/generic-resource-api/provider/src/test
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/src/test
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/src/test')
-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
14 files changed, 99 insertions, 98 deletions
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();
}