From 81589fab222dbc5e06110fa579f4d5580a8b4406 Mon Sep 17 00:00:00 2001 From: John Blum Date: Thu, 28 Oct 2021 14:08:26 -0700 Subject: [PATCH] Set the host & port on the ProcessWrapper representing the GemFire/Geode JVM server process forked by the STDG framework. Return the ProcessWrapper representing the forked GemFire/Geode JVM server process from the startGemFireServer(..) and startGeodeServer(..) methods. Resolves gh-14. --- ...kingClientServerIntegrationTestsSupport.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/integration/ForkingClientServerIntegrationTestsSupport.java b/spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/integration/ForkingClientServerIntegrationTestsSupport.java index 324669c..19b4bd1 100644 --- a/spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/integration/ForkingClientServerIntegrationTestsSupport.java +++ b/spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/integration/ForkingClientServerIntegrationTestsSupport.java @@ -16,6 +16,7 @@ package org.springframework.data.gemfire.tests.integration; import java.io.IOException; +import java.net.InetAddress; import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -67,7 +68,7 @@ public abstract class ForkingClientServerIntegrationTestsSupport extends ClientS private static ProcessWrapper gemfireServer; - public static void startGemFireServer(@NonNull Class gemfireServerConfigurationClass, String... arguments) + public static ProcessWrapper startGemFireServer(@NonNull Class gemfireServerConfigurationClass, String... arguments) throws IOException { int availablePort = setAndGetPoolPortProperty(setAndGetCacheServerPortProperty(findAndReserveAvailablePort())); @@ -76,15 +77,23 @@ public abstract class ForkingClientServerIntegrationTestsSupport extends ClientS argumentList.add(String.format("-D%s=%d", GEMFIRE_CACHE_SERVER_PORT_PROPERTY, availablePort)); - setGemFireServerProcess(run(gemfireServerConfigurationClass, argumentList.toArray(new String[0]))); + ProcessWrapper gemfireServerProcessWrapper = + run(gemfireServerConfigurationClass, argumentList.toArray(new String[0])); + gemfireServerProcessWrapper = gemfireServerProcessWrapper + .runningOn(InetAddress.getLocalHost().getHostAddress()) + .listeningOn(availablePort); + + setGemFireServerProcess(gemfireServerProcessWrapper); waitForServerToStart("localhost", availablePort); + + return gemfireServerProcessWrapper; } - public static void startGeodeServer(@NonNull Class geodeServerConfigurationClass, String... arguments) + public static ProcessWrapper startGeodeServer(@NonNull Class geodeServerConfigurationClass, String... arguments) throws IOException { - startGemFireServer(geodeServerConfigurationClass, arguments); + return startGemFireServer(geodeServerConfigurationClass, arguments); } protected static int setAndGetCacheServerPortProperty(int port) {