ServerLauncher extends AbstractLauncher<String> { boolean isWaiting(final Cache cache) { return isRunning() && (cache.getDistributedSystem().isConnected() || cache.isReconnecting()); } private  ServerLauncher(final Builder builder); static void main(final String... args); static ServerLauncher getInstance(); static ServerState getServerState(); Cache getCache(); CacheConfig getCacheConfig(); String getId(); Command getCommand(); boolean isAssignBuckets(); boolean isDisableDefaultServer(); boolean isForcing(); boolean isHelping(); boolean isRebalancing(); boolean isRedirectingOutput(); @Override String getLogFileName(); @Override String getMemberName(); @Override Integer getPid(); Properties getProperties(); InetAddress getServerBindAddress(); String getServerBindAddressAsString(); Integer getServerPort(); String getServerPortAsString(); @Override String getServiceName(); String getSpringXmlLocation(); boolean isSpringXmlLocationSpecified(); @Override String getWorkingDirectory(); Float getCriticalHeapPercentage(); Float getEvictionHeapPercentage(); Float getCriticalOffHeapPercentage(); Float getEvictionOffHeapPercentage(); String getHostNameForClients(); Integer getMaxConnections(); Integer getMaxMessageCount(); Integer getMessageTimeToLive(); Integer getMaxThreads(); Integer getSocketBufferSize(); void help(final Command command); void usage(); @Override void run(); ServerState start(); void waitOnServer(); ServerState status(); ServerState stop();  }
@Test public void isWaitingReturnsTrueWhenSystemIsConnected() { Cache cache = mock(Cache.class, "Cache"); DistributedSystem system = mock(DistributedSystem.class, "DistributedSystem"); when(cache.getDistributedSystem()).thenReturn(system); when(system.isConnected()).thenReturn(true); ServerLauncher launcher = new Builder().build(); launcher.running.set(true); assertThat(launcher.isWaiting(cache)).isTrue(); }
@Test public void isWaitingReturnsFalseWhenSystemIsNotConnected() { Cache cache = mock(Cache.class, "Cache"); DistributedSystem system = mock(DistributedSystem.class, "DistributedSystem"); when(cache.getDistributedSystem()).thenReturn(system); when(system.isConnected()).thenReturn(false); when(cache.isReconnecting()).thenReturn(false); ServerLauncher launcher = new Builder().setMemberName("serverOne").build(); launcher.running.set(true); assertThat(launcher.isWaiting(cache)).isFalse(); }
@Test public void isWaitingReturnsFalseByDefault() { ServerLauncher launcher = new Builder().build(); assertThat(launcher.isWaiting(null)).isFalse(); }
@Test public void isWaitingReturnsFalseWhenNotRunning() { ServerLauncher launcher = new Builder().build(); launcher.running.set(false); assertThat(launcher.isWaiting(null)).isFalse(); }