ServerLauncher extends AbstractLauncher<String> { Cache createCache(Properties gemfireProperties) { Iterable<ServerLauncherCacheProvider> loader = getServerLauncherCacheProviders(); for (ServerLauncherCacheProvider provider : loader) { Cache cache = provider.createCache(gemfireProperties, this); if (cache != null) { return cache; } } return DEFAULT_CACHE_PROVIDER.createCache(gemfireProperties, this); } 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 startWaitsForStartupTasksToComplete() { ServerLauncherCacheProvider cacheProvider = mock(ServerLauncherCacheProvider.class); InternalResourceManager internalResourceManager = mock(InternalResourceManager.class); InternalCache cacheFromBuilder = createCache(internalResourceManager); CompletableFuture<Void> startupTasks = spy(new CompletableFuture<>()); when(cacheProvider.createCache(any(), any())) .thenReturn(cacheFromBuilder); when(internalResourceManager.allOfStartupTasks()) .thenReturn(startupTasks); ServerLauncher serverLauncher = new Builder() .setControllableProcessFactory(() -> mock(ControllableProcess.class)) .setDisableDefaultServer(true) .setServerLauncherCacheProvider(cacheProvider) .build(); CompletableFuture<Void> serverLauncherStart = CompletableFuture.runAsync(serverLauncher::start); await().untilAsserted(() -> verify(startupTasks).thenRun(any())); assertThat(serverLauncherStart).isNotDone(); startupTasks.complete(null); await().untilAsserted(() -> assertThat(serverLauncherStart).isDone()); }