Bump upstreams
[openflowplugin.git] / applications / forwardingrules-manager / src / test / java / org / opendaylight / openflowplugin / applications / frm / impl / DeviceMastershipManagerTest.java
index c4d509d6bd8cff29e65a12272bd5a6705c9fa72c..e3efc8e0755328baa186516428efe20c0ced04cb 100644 (file)
@@ -1,30 +1,28 @@
-/**
+/*
  * Copyright (c) 2016, 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.applications.frm.impl;
 
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Matchers;
+import org.mockito.ArgumentMatchers;
 import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.mdsal.singleton.api.ClusterSingletonServiceProvider;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeServiceManager;
 import org.opendaylight.openflowplugin.applications.frm.FlowNodeReconciliation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yangtools.concepts.Registration;
 
 /**
  * Test for {@link DeviceMastershipManager}.
@@ -33,7 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 public class DeviceMastershipManagerTest {
     private DeviceMastershipManager deviceMastershipManager;
     @Mock
-    private ClusterSingletonServiceRegistration registration;
+    private Registration registration;
     @Mock
     private ClusterSingletonServiceProvider clusterSingletonService;
     @Mock
@@ -41,27 +39,27 @@ public class DeviceMastershipManagerTest {
     @Mock
     private DataBroker dataBroker;
     @Mock
-    private RoutedRpcRegistration routedRpcReg;
-    @Mock
     private MastershipChangeServiceManager mastershipChangeServiceManager;
     @Mock
     private DeviceInfo deviceInfo;
     @Mock
     private NodeId nodeId;
+    @Mock
+    private RpcProviderService rpcProviderService;
 
     @Before
-    public void setUp() throws Exception {
-        deviceMastershipManager = new DeviceMastershipManager(clusterSingletonService, reconciliationAgent, dataBroker,
-                mastershipChangeServiceManager);
-        deviceMastershipManager.setRoutedRpcReg(routedRpcReg);
-        Mockito.when(clusterSingletonService.registerClusterSingletonService(Matchers.<ClusterSingletonService>any()))
+    public void setUp() {
+        deviceMastershipManager = new DeviceMastershipManager(reconciliationAgent, dataBroker,
+                mastershipChangeServiceManager, rpcProviderService);
+        Mockito.lenient().when(clusterSingletonService
+                .registerClusterSingletonService(ArgumentMatchers.any()))
                 .thenReturn(registration);
         Mockito.when(deviceInfo.getNodeId()).thenReturn(nodeId);
         Mockito.when(nodeId.getValue()).thenReturn("dummyValue");
     }
 
     @Test
-    public void testOnDeviceConnectedAndDisconnected() throws Exception {
+    public void testOnDeviceConnectedAndDisconnected() {
         // no context
         Assert.assertNull(deviceMastershipManager.getDeviceMasterships().get(deviceInfo.getNodeId()));
         deviceMastershipManager.onBecomeOwner(deviceInfo);