Change getIsOnlineFuture() return type 30/111830/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 23 May 2024 11:57:03 +0000 (13:57 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 23 May 2024 12:34:22 +0000 (14:34 +0200)
Provising a Boolean is superfluous -- we are just reporting
success/failure. Clean this up by using Void as the return type.

Change-Id: I7e292941a59f255d27df25828f6848bfc6b8059e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5a64f2402b8af587dec4c692c57b44563368b463)

12 files changed:
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OnlineProvider.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SwitchConnectionProviderImpl.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpConnectionInitializer.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandler.java
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/UdpHandler.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/TcpHandlerTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImpl02Test.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SwitchConnectionProviderImplTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/UdpHandlerTest.java
openflowjava/openflow-protocol-spi/src/main/java/org/opendaylight/openflowjava/protocol/spi/connection/SwitchConnectionProvider.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImpl.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImplTest.java

index c167dfb7f469dd72b1976dcd341dee312c6f0a58..370ea160a924c8a4f9169a0f3537c06f72a35e74 100644 (file)
@@ -5,8 +5,6 @@
  * 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.openflowjava.protocol.impl.core;
 
 import com.google.common.util.concurrent.ListenableFuture;
@@ -18,5 +16,5 @@ import com.google.common.util.concurrent.ListenableFuture;
  */
 public interface OnlineProvider {
 
-    ListenableFuture<Boolean> getIsOnlineFuture();
+    ListenableFuture<Void> getIsOnlineFuture();
 }
index 0cf73dd31cc74e780a00488310587af47954bb20..abd3af6eb8b14d5e3c3718a22a11b458f6997178 100755 (executable)
@@ -153,7 +153,7 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C
 
     @Override
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public ListenableFuture<Boolean> startup() {
+    public ListenableFuture<Void> startup() {
         LOG.debug("Startup summoned");
         try {
             serverFacade = createAndConfigureServer();
index 869f92d62d40831b33f794c7941b405ae3edb28e..35495408890cfd2c0d64a1dfa1f549811b588bb3 100644 (file)
@@ -24,12 +24,11 @@ import org.slf4j.LoggerFactory;
  * @author martin.uhlir
  */
 public class TcpConnectionInitializer implements ServerFacade, ConnectionInitializer {
-
     private static final Logger LOG = LoggerFactory.getLogger(TcpConnectionInitializer.class);
 
+    private final SettableFuture<Void> hasRun = SettableFuture.create();
     private final EventLoopGroup workerGroup;
     private final boolean isEpollEnabled;
-    private final SettableFuture<Boolean> hasRun = SettableFuture.create();
 
     private TcpChannelInitializer channelInitializer;
     private Bootstrap bootstrap;
@@ -52,18 +51,18 @@ public class TcpConnectionInitializer implements ServerFacade, ConnectionInitial
         } else {
             bootstrap.group(workerGroup).channel(NioSocketChannel.class).handler(channelInitializer);
         }
-        hasRun.set(true);
+        hasRun.set(null);
     }
 
     @Override
     public ListenableFuture<Boolean> shutdown() {
-        final SettableFuture<Boolean> result = SettableFuture.create();
+        final var result = SettableFuture.<Boolean>create();
         workerGroup.shutdownGracefully();
         return result;
     }
 
     @Override
-    public ListenableFuture<Boolean> getIsOnlineFuture() {
+    public ListenableFuture<Void> getIsOnlineFuture() {
         return hasRun;
     }
 
index f4b0e162edfc6f8d84aa509d1136810083203362..ca797a4d12236636fa5ba908fd2267893488814f 100644 (file)
@@ -48,13 +48,14 @@ public class TcpHandler implements ServerFacade {
 
     private static final Logger LOG = LoggerFactory.getLogger(TcpHandler.class);
 
-    private int port;
-    private String address;
+    private final SettableFuture<Void> isOnlineFuture = SettableFuture.create();
     private final InetAddress startupAddress;
     private final Runnable readyRunnable;
+
+    private int port;
+    private String address;
     private EventLoopGroup workerGroup;
     private EventLoopGroup bossGroup;
-    private final SettableFuture<Boolean> isOnlineFuture = SettableFuture.create();
 
     private TcpChannelInitializer channelInitializer;
 
@@ -136,7 +137,7 @@ public class TcpHandler implements ServerFacade {
             LOG.debug("address from tcphandler: {}", address);
             LOG.info("Switch listener started and ready to accept incoming tcp/tls connections on port: {}", port);
             readyRunnable.run();
-            isOnlineFuture.set(true);
+            isOnlineFuture.set(null);
 
             // This waits until this channel is closed, and rethrows the cause of the failure if this future failed.
             f.channel().closeFuture().sync();
@@ -174,7 +175,7 @@ public class TcpHandler implements ServerFacade {
     }
 
     @Override
-    public ListenableFuture<Boolean> getIsOnlineFuture() {
+    public ListenableFuture<Void> getIsOnlineFuture() {
         return isOnlineFuture;
     }
 
index 2856549d48f68a97e596adf13fe9276c9f7505fb..1c59efd7cd154c53e7e03741b63422c2de6d8c23 100644 (file)
@@ -31,15 +31,14 @@ import org.slf4j.LoggerFactory;
  * @author michal.polkorab
  */
 public final class UdpHandler implements ServerFacade {
-
     private static final Logger LOG = LoggerFactory.getLogger(UdpHandler.class);
 
-    private int port;
-    private EventLoopGroup group;
+    private final SettableFuture<Void> isOnlineFuture = SettableFuture.create();
     private final InetAddress startupAddress;
     private final Runnable readyRunnable;
-    private final SettableFuture<Boolean> isOnlineFuture = SettableFuture.create();
 
+    private int port;
+    private EventLoopGroup group;
     private UdpChannelInitializer channelInitializer;
     private Class<? extends DatagramChannel> datagramChannelClass;
 
@@ -96,7 +95,7 @@ public final class UdpHandler implements ServerFacade {
             LOG.debug("Address from udpHandler: {}", address);
             LOG.info("Switch listener started and ready to accept incoming udp connections on port: {}", port);
             readyRunnable.run();
-            isOnlineFuture.set(true);
+            isOnlineFuture.set(null);
 
             // This waits until this channel is closed, and rethrows the cause of the failure if this future failed.
             f.channel().closeFuture().sync();
@@ -120,7 +119,7 @@ public final class UdpHandler implements ServerFacade {
     }
 
     @Override
-    public ListenableFuture<Boolean> getIsOnlineFuture() {
+    public ListenableFuture<Void> getIsOnlineFuture() {
         return isOnlineFuture;
     }
 
index a767bfa8c0e0992a5681025e3b835578e4233995..700b376f2077047df24242eb708315b7a877d07f 100644 (file)
@@ -146,14 +146,12 @@ public class TcpHandlerTest {
         int serverPort = 28001;
         Socket firstBinder = new Socket();
 
-        try {
+        try (firstBinder) {
             firstBinder.bind(new InetSocketAddress(serverAddress, serverPort));
             tcpHandler = new TcpHandler(serverAddress, serverPort, () -> { });
             tcpHandler.setChannelInitializer(mockChannelInitializer);
             tcpHandler.initiateEventLoopGroups(null, false);
             tcpHandler.run();
-        } finally {
-            firstBinder.close();
         }
     }
 
@@ -165,7 +163,7 @@ public class TcpHandlerTest {
         int serverPort = 28001;
         Socket firstBinder = new Socket();
 
-        try {
+        try (firstBinder) {
             firstBinder.bind(new InetSocketAddress(serverAddress, serverPort));
 
             tcpHandler = new TcpHandler(serverAddress, serverPort, () -> { });
@@ -176,8 +174,6 @@ public class TcpHandlerTest {
             fail("Expected BindException or Errors.NativeIoException");
         } catch (BindException | Errors.NativeIoException e) {
             // expected
-        } finally {
-            firstBinder.close();
         }
     }
 
@@ -192,8 +188,8 @@ public class TcpHandlerTest {
         assertEquals("shutdown failed", true, shutdownRet.get());
     }
 
-    private Boolean startupServer(boolean isEpollEnabled) throws InterruptedException {
-        ListenableFuture<Boolean> online = tcpHandler.getIsOnlineFuture();
+    private Boolean startupServer(final boolean isEpollEnabled) throws InterruptedException {
+        final var online = tcpHandler.getIsOnlineFuture();
         /**
          * Test EPoll based native transport if isEpollEnabled is true.
          * Else use Nio based transport.
@@ -204,10 +200,10 @@ public class TcpHandlerTest {
         while (online.isDone() != true && retry++ < 20) {
             Thread.sleep(100);
         }
-        return online.isDone() ;
+        return online.isDone();
     }
 
-    private static Boolean clientConnection(int port) throws IOException {
+    private static Boolean clientConnection(final int port) throws IOException {
         // Connect, and disconnect
         Socket socket = new Socket(InetAddress.getLoopbackAddress(), port);
         Boolean result = socket.isConnected();
index 035efd39ab6308e69fc61ce24ca7769e37144050..a2b0daa16620fb6f7ccf8aff4fc98e66d8628d93 100755 (executable)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.core.connection;
 
-import com.google.common.util.concurrent.ListenableFuture;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.List;
@@ -36,7 +38,6 @@ import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.openflowjava.protocol.impl.core.ServerFacade;
 import org.opendaylight.openflowjava.protocol.impl.core.SwitchConnectionProviderImpl;
 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.ExperimenterActionSubType;
@@ -115,9 +116,9 @@ public class SwitchConnectionProviderImpl02Test {
     @Test
     public void testServerFacade() throws UnknownHostException {
         startUp(TransportProtocol.TCP);
-        final ListenableFuture<Boolean> future = provider.startup();
-        final ServerFacade serverFacade = provider.getServerFacade();
-        Assert.assertNotNull("Wrong -- getServerFacade return null",serverFacade);
+        final var future = provider.startup();
+        final var serverFacade = provider.getServerFacade();
+        assertNotNull("Wrong -- getServerFacade return null", serverFacade);
     }
 
     /**
@@ -135,12 +136,10 @@ public class SwitchConnectionProviderImpl02Test {
     @Test
     public void testUnregisterWrongKeys() throws UnknownHostException {
         startUp(TransportProtocol.TCP);
-        final ExperimenterInstructionSerializerKey testSerKey
-            = new ExperimenterInstructionSerializerKey(EncodeConstants.OF_VERSION_1_0, 42L);
-        Assert.assertFalse("Wrong -- unregisterSerializer",provider.unregisterSerializer(testSerKey));
-        final ExperimenterInstructionDeserializerKey tesDeserKey
-            = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF_VERSION_1_0, 24L);
-        Assert.assertFalse("Wrong -- unregisterDeserializer",provider.unregisterDeserializer(tesDeserKey));
+        final var testSerKey = new ExperimenterInstructionSerializerKey(EncodeConstants.OF_VERSION_1_0, 42L);
+        assertFalse("Wrong -- unregisterSerializer",provider.unregisterSerializer(testSerKey));
+        final var tesDeserKey = new ExperimenterInstructionDeserializerKey(EncodeConstants.OF_VERSION_1_0, 24L);
+        assertFalse("Wrong -- unregisterDeserializer",provider.unregisterDeserializer(tesDeserKey));
     }
 
     /**
index 972970603a60cacd2615931a241786b34ac0a884..f5fbe8bf36b15c1c2339a81e9cc3fe101ba3825e 100644 (file)
@@ -16,7 +16,6 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
-import com.google.common.util.concurrent.ListenableFuture;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.List;
@@ -94,7 +93,7 @@ public class SwitchConnectionProviderImplTest {
     @Test
     public void testStartup1() throws UnknownHostException {
         startUp(null);
-        final ListenableFuture<Boolean> future = provider.startup();
+        final var future = provider.startup();
 
         final var cause = assertThrows(ExecutionException.class, () -> future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS))
             .getCause();
@@ -109,7 +108,7 @@ public class SwitchConnectionProviderImplTest {
     public void testStartup2() throws UnknownHostException {
         startUp(null);
         provider.setSwitchConnectionHandler(handler);
-        final ListenableFuture<Boolean> future = provider.startup();
+        final var future = provider.startup();
 
         final var cause = assertThrows(ExecutionException.class, () -> future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS))
             .getCause();
@@ -123,7 +122,7 @@ public class SwitchConnectionProviderImplTest {
     @Test
     public void testStartup3() throws UnknownHostException {
         startUp(TransportProtocol.TCP);
-        final ListenableFuture<Boolean> future = provider.startup();
+        final var future = provider.startup();
 
         final var cause = assertThrows(ExecutionException.class, () -> future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS))
             .getCause();
@@ -139,7 +138,7 @@ public class SwitchConnectionProviderImplTest {
         startUp(TransportProtocol.TCP);
         provider.setSwitchConnectionHandler(handler);
 
-        assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+        provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
     }
 
     /**
@@ -150,7 +149,7 @@ public class SwitchConnectionProviderImplTest {
         startUp(TransportProtocol.TLS);
         provider.setSwitchConnectionHandler(handler);
 
-        assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+        provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
     }
 
     /**
@@ -161,7 +160,7 @@ public class SwitchConnectionProviderImplTest {
         startUp(TransportProtocol.UDP);
         provider.setSwitchConnectionHandler(handler);
 
-        assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+        provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
     }
 
     /**
@@ -172,7 +171,7 @@ public class SwitchConnectionProviderImplTest {
         startUp(TransportProtocol.TCP);
         provider.setSwitchConnectionHandler(handler);
 
-        assertTrue("Failed to start", provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
+        provider.startup().get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
         assertTrue("Failed to stop", provider.shutdown().get(5 * WAIT_TIMEOUT, TimeUnit.MILLISECONDS));
     }
 }
index 871e2adf6aab7d61dd928d17e5b68c6fa203f464..cb2e53fb8cfdc1776acab482ad8d079ca97d7cd2 100644 (file)
@@ -7,12 +7,14 @@
  */
 package org.opendaylight.openflowjava.protocol.impl.core.connection;
 
-import com.google.common.util.concurrent.ListenableFuture;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.net.InetAddress;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -43,13 +45,9 @@ public class UdpHandlerTest {
     public void testWithEmptyAddress() throws Exception {
         udpHandler = new UdpHandler(null, 0, () -> { });
         udpHandler.setChannelInitializer(udpChannelInitializerMock);
-        Assert.assertTrue("Wrong - start server", startupServer(false));
-        try {
-            Assert.assertTrue(udpHandler.getIsOnlineFuture().get(1500, TimeUnit.MILLISECONDS));
-        } catch (TimeoutException e) {
-            Assert.fail("Wrong - getIsOnlineFuture timed out");
-        }
-        Assert.assertFalse("Wrong - port has been set to zero", udpHandler.getPort() == 0);
+        assertTrue("Wrong - start server", startupServer(false));
+        udpHandler.getIsOnlineFuture().get(1500, TimeUnit.MILLISECONDS);
+        assertFalse("Wrong - port has been set to zero", udpHandler.getPort() == 0);
         shutdownServer();
     }
 
@@ -60,13 +58,9 @@ public class UdpHandlerTest {
     public void testWithEmptyAddressOnEpoll() throws Exception {
         udpHandler = new UdpHandler(null, 0, () -> { });
         udpHandler.setChannelInitializer(udpChannelInitializerMock);
-        Assert.assertTrue("Wrong - start server", startupServer(true));
-        try {
-            Assert.assertTrue(udpHandler.getIsOnlineFuture().get(1500,TimeUnit.MILLISECONDS));
-        } catch (TimeoutException e) {
-            Assert.fail("Wrong - getIsOnlineFuture timed out");
-        }
-        Assert.assertFalse("Wrong - port has been set to zero", udpHandler.getPort() == 0);
+        assertTrue("Wrong - start server", startupServer(true));
+        udpHandler.getIsOnlineFuture().get(1500,TimeUnit.MILLISECONDS);
+        assertFalse("Wrong - port has been set to zero", udpHandler.getPort() == 0);
         shutdownServer();
     }
 
@@ -78,13 +72,9 @@ public class UdpHandlerTest {
         int port = 9874;
         udpHandler = new UdpHandler(InetAddress.getLocalHost(), port, () -> { });
         udpHandler.setChannelInitializer(udpChannelInitializerMock);
-        Assert.assertTrue("Wrong - start server", startupServer(false));
-        try {
-            Assert.assertTrue(udpHandler.getIsOnlineFuture().get(1500,TimeUnit.MILLISECONDS));
-        } catch (TimeoutException e) {
-            Assert.fail("Wrong - getIsOnlineFuture timed out");
-        }
-        Assert.assertEquals("Wrong - bad port number has been set", port, udpHandler.getPort());
+        assertTrue("Wrong - start server", startupServer(false));
+        udpHandler.getIsOnlineFuture().get(1500,TimeUnit.MILLISECONDS);
+        assertEquals("Wrong - bad port number has been set", port, udpHandler.getPort());
         shutdownServer();
     }
 
@@ -96,19 +86,15 @@ public class UdpHandlerTest {
         int port = 9874;
         udpHandler = new UdpHandler(InetAddress.getLocalHost(), port, () -> { });
         udpHandler.setChannelInitializer(udpChannelInitializerMock);
-        Assert.assertTrue("Wrong - start server", startupServer(true));
-        try {
-            Assert.assertTrue(udpHandler.getIsOnlineFuture().get(1500,TimeUnit.MILLISECONDS));
-        } catch (TimeoutException e) {
-            Assert.fail("Wrong - getIsOnlineFuture timed out");
-        }
-        Assert.assertEquals("Wrong - bad port number has been set", port, udpHandler.getPort());
+        assertTrue("Wrong - start server", startupServer(true));
+        udpHandler.getIsOnlineFuture().get(1500,TimeUnit.MILLISECONDS);
+        assertEquals("Wrong - bad port number has been set", port, udpHandler.getPort());
         shutdownServer();
     }
 
     private Boolean startupServer(final boolean isEpollEnabled)
             throws InterruptedException, ExecutionException {
-        ListenableFuture<Boolean> online = udpHandler.getIsOnlineFuture();
+        final var online = udpHandler.getIsOnlineFuture();
         /**
          * Test EPoll based native transport if isEpollEnabled is true.
          * Else use Nio based transport.
@@ -126,8 +112,7 @@ public class UdpHandlerTest {
     }
 
     private void shutdownServer() throws InterruptedException, ExecutionException, TimeoutException {
-        ListenableFuture<Boolean> shutdownRet = udpHandler.shutdown() ;
-        final Boolean shutdownSucceeded = shutdownRet.get(10, TimeUnit.SECONDS);
-        Assert.assertTrue("Wrong - shutdown failed", shutdownSucceeded);
+        final var shutdownRet = udpHandler.shutdown() ;
+        assertTrue("Wrong - shutdown failed", shutdownRet.get(10, TimeUnit.SECONDS));
     }
 }
index f63e21c9e84acce0e2a47587a784ebd909b6644a..cab8051c16d2994a73173be58bc830cee9b9e3d2 100644 (file)
@@ -33,9 +33,9 @@ public interface SwitchConnectionProvider extends AutoCloseable,
      * Start listening to switches, but please don't forget to do
      * {@link #setSwitchConnectionHandler(SwitchConnectionHandler)} first.
      *
-     * @return future, triggered to true, when listening channel is up and running
+     * @return future completing when the channel has been resolved
      */
-    ListenableFuture<Boolean> startup();
+    ListenableFuture<Void> startup();
 
     /**
      * Stop listening to switches.
index 95246cc6266b1ad26315c01b8c68198a9c1872c9..b841e72c8229b7c34619cec8182bf0566f48622a 100644 (file)
@@ -215,9 +215,9 @@ public final class OpenFlowPluginProviderImpl
             // Set handler of incoming connections and start switch connection provider
             switchConnectionProvider.setSwitchConnectionHandler(connectionManager);
             return switchConnectionProvider.startup();
-        }).collect(Collectors.toSet())), new FutureCallback<List<Boolean>>() {
+        }).collect(Collectors.toSet())), new FutureCallback<List<Void>>() {
             @Override
-            public void onSuccess(final List<Boolean> result) {
+            public void onSuccess(final List<Void> result) {
                 LOG.info("All switchConnectionProviders are up and running ({}).", result.size());
                 diagStatusProvider.reportStatus(ServiceState.OPERATIONAL);
                 fullyStarted.set(null);
index 2c421e6ff49b352e69d055b3ecf33128a3aded43..9480822833d06a9d39026b669edf9eab528a39db 100644 (file)
@@ -77,7 +77,7 @@ public class OpenFlowPluginProviderImplTest {
         when(dataBroker.newWriteOnlyTransaction()).thenReturn(writeTransaction);
         doReturn(CommitInfo.emptyFluentFuture()).when(writeTransaction).commit();
         when(entityOwnershipService.registerListener(any(), any())).thenReturn(entityOwnershipListenerRegistration);
-        when(switchConnectionProvider.startup()).thenReturn(Futures.immediateFuture(true));
+        when(switchConnectionProvider.startup()).thenReturn(Futures.immediateFuture(null));
         when(switchConnectionProvider.shutdown()).thenReturn(Futures.immediateFuture(true));
         when(configurationService.getProperty(eq(ConfigurationProperty.USE_SINGLE_LAYER_SERIALIZATION.toString()),
                 any())).thenReturn(USE_SINGLE_LAYER_SERIALIZATION);