Merge "Bug 6110: Fixed bugs in statistics manager due to race condition." into stable...
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / device / DeviceManagerImplTest.java
index 33e54b4d7c313e1bab26b678954fc151a8c95a3c..17abab3ea32242b59b98c6f34a0415a90a985a79 100644 (file)
@@ -37,6 +37,8 @@ import org.mockito.stubbing.Answer;
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 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.clustering.EntityOwnershipListenerRegistration;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
@@ -107,6 +109,10 @@ public class DeviceManagerImplTest {
     @Mock
     private ClusterSingletonServiceProvider clusterSingletonServiceProvider;
     @Mock
+    private EntityOwnershipService entityOwnershipService;
+    @Mock
+    private EntityOwnershipListenerRegistration entityOwnershipListenerRegistration;
+    @Mock
     private ConvertorExecutor convertorExecutor;
     @Mock
     private KeyedInstanceIdentifier<Node, NodeKey> key;
@@ -143,6 +149,7 @@ public class DeviceManagerImplTest {
         when(mockedDataBroker.newWriteOnlyTransaction()).thenReturn(mockedWriteTransaction);
 
         when(mockedWriteTransaction.submit()).thenReturn(mockedFuture);
+        when(entityOwnershipService.registerListener(any(), any())).thenReturn(entityOwnershipListenerRegistration);
 
         final DeviceManagerImpl deviceManager = new DeviceManagerImpl(
                 mockedDataBroker,
@@ -153,10 +160,8 @@ public class DeviceManagerImplTest {
                 messageIntelligenceAgency,
                 true,
                 clusterSingletonServiceProvider,
-                null,
-                new HashedWheelTimer(),
-                convertorExecutor,
-                false);
+                entityOwnershipService, new HashedWheelTimer(), convertorExecutor, false, null
+        );
 
         deviceManager.setDeviceInitializationPhaseHandler(deviceInitPhaseHandler);
         deviceManager.setDeviceTerminationPhaseHandler(deviceTerminationPhaseHandler);