Interface D creation. NetworkModel->ServiceHandler
[transportpce.git] / servicehandler / src / test / java / org / opendaylight / transportpce / servicehandler / impl / ServicehandlerImplTest.java
index 470975d8fa42905889e7a16f41b8de3af1218788..f21715e9569840a8793ab70b8d5a9e119e07856c 100644 (file)
@@ -28,6 +28,7 @@ import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
+import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
@@ -78,6 +79,9 @@ public class ServicehandlerImplTest extends AbstractTest  {
     @Mock
     private RendererListenerImpl rendererListenerImpl;
 
+    @Mock
+    private NetworkModelListenerImpl networkModelListenerImpl;
+
     private ListeningExecutorService executorService;
     private CountDownLatch endSignal;
     private static final int NUM_THREADS = 5;
@@ -95,7 +99,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
     public void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceCreateOutput>> result =
             servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
         result.addListener(new Runnable() {
@@ -120,7 +124,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceCreateOutput>> result =  servicehandlerImpl.serviceCreate(input);
         result.addListener(new Runnable() {
             @Override
@@ -141,7 +145,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
     public void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result =
             servicehandlerImpl.serviceDelete(new ServiceDeleteInputBuilder()
                 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("").build()).build());
@@ -165,7 +169,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceDeleteOutput>> result = servicehandlerImpl.serviceDelete(input);
         result.addListener(new Runnable() {
             @Override
@@ -188,7 +192,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl =
             new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
-                notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
@@ -214,7 +218,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
     public void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
                 servicehandlerImpl.serviceFeasibilityCheck(new ServiceFeasibilityCheckInputBuilder().build());
         result.addListener(new Runnable() {
@@ -239,7 +243,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> result =
             servicehandlerImpl.serviceFeasibilityCheck(input);
         result.addListener(new Runnable() {
@@ -261,7 +265,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
     public void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceReconfigureOutput>> result =
                 servicehandlerImpl.serviceReconfigure(new ServiceReconfigureInputBuilder().setServiceName("").build());
         result.addListener(new Runnable() {
@@ -287,7 +291,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         //action -> service reconfigure
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceReconfigureOutput>> result = servicehandlerImpl.serviceReconfigure(input);
 
         result.addListener(new Runnable() {
@@ -316,7 +320,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         //create service to reconfigure
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
@@ -344,7 +348,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
     public void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
                 servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
         result.addListener(new Runnable() {
@@ -370,7 +374,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         //action -> service restore
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl.serviceRestoration(input);
 
         result.addListener(new Runnable() {
@@ -399,7 +403,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         //create service to restore
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
@@ -427,7 +431,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
     public void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result =
                 servicehandlerImpl.serviceReroute(new ServiceRerouteInputBuilder().setServiceName("").build());
         result.addListener(new Runnable() {
@@ -452,7 +456,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         //action -> service reconfigure
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(input);
 
         result.addListener(new Runnable() {
@@ -481,7 +485,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         //create service to be rerouted later
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
         ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
@@ -509,7 +513,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
     public void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<TempServiceDeleteOutput>> result =
                 servicehandlerImpl.tempServiceDelete(new TempServiceDeleteInputBuilder()
                         .setCommonId("").build());
@@ -536,7 +540,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput();
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<TempServiceDeleteOutput>> result = servicehandlerImpl.tempServiceDelete(input);
         result.addListener(new Runnable() {
             @Override
@@ -561,7 +565,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
         //create temp service to delete in the temp delete action
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(dataBroker, pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ServiceDataStoreOperationsImpl serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
         TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
         serviceDataStoreOperations.createTempService(createInput);
@@ -588,7 +592,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
     public void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
         ListenableFuture<RpcResult<TempServiceCreateOutput>> result =
                 servicehandlerImpl.tempServiceCreate(new TempServiceCreateInputBuilder().build());
         result.addListener(new Runnable() {
@@ -615,7 +619,7 @@ public class ServicehandlerImplTest extends AbstractTest  {
 
         ServicehandlerImpl servicehandlerImpl =
                 new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
-                        notificationPublishService, pceListenerImpl, rendererListenerImpl);
+                        notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl);
 
         ListenableFuture<RpcResult<TempServiceCreateOutput>> result =  servicehandlerImpl.tempServiceCreate(input);
         result.addListener(new Runnable() {