*/
package org.opendaylight.openflowplugin.impl.mastership;
+import com.google.common.util.concurrent.Futures;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
@Mock
private ReconciliationFrameworkEvent secondEvent;
- final private MastershipChangeServiceManager manager = new MastershipChangeServiceManagerImpl();
+ private final MastershipChangeServiceManager manager = new MastershipChangeServiceManagerImpl();
private MastershipChangeRegistration registration;
private ReconciliationFrameworkRegistration registrationRF;
public void setUp() throws Exception {
registration = manager.register(service);
registrationRF = manager.reconciliationFrameworkRegistration(event);
+
+ Mockito.when(event.onDeviceDisconnected(Mockito.any())).thenReturn(Futures.immediateFuture(null));
}
@Test
- public void register() throws Exception {
+ public void register() {
Assert.assertNotNull(registration);
}
@Test
- public void registerTwice() throws Exception {
+ public void registerTwice() {
MastershipChangeRegistration registration2;
registration2 = manager.register(secondService);
Assert.assertNotNull(registration);
}
@Test
- public void reconciliationFrameworkRegistration() throws Exception {
+ public void reconciliationFrameworkRegistration() {
Assert.assertNotNull(registrationRF);
}
}
@Test
- public void becomeMaster() throws Exception {
+ public void becomeMaster() {
manager.becomeMaster(deviceInfo);
Mockito.verify(service).onBecomeOwner(deviceInfo);
manager.becomeSlaveOrDisconnect(deviceInfo);
}
@Test
- public void becomeMasterBeforeDS() throws Exception {
+ public void becomeMasterBeforeDS() {
manager.becomeMasterBeforeSubmittedDS(deviceInfo);
Mockito.verify(event).onDevicePrepared(deviceInfo);
}
}
@Test
- public void evokeEventAfterRegistration() throws Exception {
+ public void evokeEventAfterRegistration() {
List<DeviceInfo> deviceInfos = new ArrayList<>();
deviceInfos.add(deviceInfo);
manager.setMasterChecker(masterChecker);