@Test public void reconnectingDistributedSystemIsDisconnectedOnStop() { Cache cache = mock(Cache.class, "Cache"); DistributedSystem system = mock(DistributedSystem.class, "DistributedSystem"); Cache reconnectedCache = mock(Cache.class, "ReconnectedCache"); when(cache.isReconnecting()).thenReturn(true); when(cache.getReconnectedCache()).thenReturn(reconnectedCache); when(reconnectedCache.isReconnecting()).thenReturn(true); when(reconnectedCache.getReconnectedCache()).thenReturn(null); when(reconnectedCache.getDistributedSystem()).thenReturn(system); ServerLauncher launcher = new Builder().setCache(cache).build(); launcher.running.set(true); launcher.stop(); verify(cache, times(1)).isReconnecting(); verify(cache, times(1)).getReconnectedCache(); verify(cache, times(1)).isReconnecting(); verify(cache, times(1)).getReconnectedCache(); verify(reconnectedCache, times(1)).getDistributedSystem(); verify(system, times(1)).stopReconnecting(); verify(reconnectedCache, times(1)).close(); }
break; case STOP: info(stop()); break; case VERSION:
serverLauncher.stop();