Adapt TransportPCE code to Sulfur
[transportpce.git] / tapi / src / test / java / org / opendaylight / transportpce / tapi / connectivity / TapiConnectivityImplTest.java
index e4718c30e4c4f01b259082143a16757b80e8e2af..66b1348250052033d9dc4b7830221b0670d35040 100644 (file)
@@ -47,15 +47,15 @@ import org.opendaylight.transportpce.tapi.utils.TapiLink;
 import org.opendaylight.transportpce.tapi.utils.TapiTopologyDataUtils;
 import org.opendaylight.transportpce.test.AbstractTest;
 import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.CreateConnectivityServiceOutput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInput;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceOutput;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -100,7 +100,6 @@ public class TapiConnectivityImplTest extends AbstractTest {
     private ListeningExecutorService executorService;
     private CountDownLatch endSignal;
     private static final int NUM_THREADS = 5;
-    private boolean callbackRan;
 
     @Before
     public void setUp() throws InterruptedException, ExecutionException {
@@ -116,7 +115,6 @@ public class TapiConnectivityImplTest extends AbstractTest {
         TopologyDataUtils.writePortmappingFromFileToDatastore(getDataStoreContextUtil(),
             TapiTopologyDataUtils.PORTMAPPING_FILE);
 
-        callbackRan = false;
         MockitoAnnotations.openMocks(this);
 
         networkTransactionService = new NetworkTransactionImpl(
@@ -126,7 +124,8 @@ public class TapiConnectivityImplTest extends AbstractTest {
         tapiContext = new TapiContext(networkTransactionService);
         topologyUtils = new TopologyUtils(networkTransactionService, getDataStoreContextUtil().getDataBroker(),
             tapilink);
-        connectivityUtils = new ConnectivityUtils(serviceDataStoreOperations, new HashMap<>(), tapiContext);
+        connectivityUtils = new ConnectivityUtils(serviceDataStoreOperations, new HashMap<>(), tapiContext,
+            networkTransactionService);
         tapiInitialORMapping = new TapiInitialORMapping(topologyUtils, connectivityUtils,
             tapiContext, serviceDataStoreOperations);
         tapiInitialORMapping.performTopoInitialMapping();
@@ -140,14 +139,13 @@ public class TapiConnectivityImplTest extends AbstractTest {
             networkModelListenerImpl, serviceDataStoreOperations);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
-            tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+            tapipceListenerImpl, tapirendererListenerImpl);
 
         ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
             tapiConnectivity.createConnectivityService(new CreateConnectivityServiceInputBuilder().build());
         result.addListener(new Runnable() {
             @Override
             public void run() {
-                callbackRan = true;
                 endSignal.countDown();
             }
         }, executorService);
@@ -155,8 +153,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
         endSignal.await();
 
         RpcResult<CreateConnectivityServiceOutput> rpcResult = result.get();
-        Assert.assertEquals(
-            RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+        Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
     }
 
     @Test
@@ -170,13 +167,12 @@ public class TapiConnectivityImplTest extends AbstractTest {
         Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
-            tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+            tapipceListenerImpl, tapirendererListenerImpl);
         ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
             tapiConnectivity.createConnectivityService(input);
         result.addListener(new Runnable() {
             @Override
             public void run() {
-                callbackRan = true;
                 endSignal.countDown();
             }
         }, executorService);
@@ -194,14 +190,13 @@ public class TapiConnectivityImplTest extends AbstractTest {
             networkModelListenerImpl, serviceDataStoreOperations);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
-            tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+            tapipceListenerImpl, tapirendererListenerImpl);
 
         ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
             tapiConnectivity.deleteConnectivityService(new DeleteConnectivityServiceInputBuilder().build());
         result.addListener(new Runnable() {
             @Override
             public void run() {
-                callbackRan = true;
                 endSignal.countDown();
             }
         }, executorService);
@@ -209,8 +204,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
         endSignal.await();
 
         RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
-        Assert.assertEquals(
-            RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+        Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
     }
 
     @Test
@@ -221,13 +215,12 @@ public class TapiConnectivityImplTest extends AbstractTest {
             networkModelListenerImpl, serviceDataStoreOperations);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
-            tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+            tapipceListenerImpl, tapirendererListenerImpl);
         ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
             tapiConnectivity.deleteConnectivityService(input);
         result.addListener(new Runnable() {
             @Override
             public void run() {
-                callbackRan = true;
                 endSignal.countDown();
             }
         }, executorService);
@@ -235,8 +228,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
         endSignal.await();
 
         RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
-        Assert.assertEquals(
-            RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+        Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
     }
 
     @Test
@@ -248,7 +240,7 @@ public class TapiConnectivityImplTest extends AbstractTest {
             networkModelListenerImpl, serviceDataStoreOperations);
 
         TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
-            tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+            tapipceListenerImpl, tapirendererListenerImpl);
 
         ServiceCreateInput createInput = TapiConnectivityDataUtils.buildServiceCreateInput();
         serviceDataStoreOperations.createService(createInput);
@@ -260,7 +252,6 @@ public class TapiConnectivityImplTest extends AbstractTest {
         result.addListener(new Runnable() {
             @Override
             public void run() {
-                callbackRan = true;
                 endSignal.countDown();
             }
         }, executorService);