Refactor the conditonal logic used to decide whether to remove the (test) working directory of a forked Process in ForkingClientServerIntegrationTests.

Edit Javadoc.
This commit is contained in:
John Blum
2022-10-17 10:04:44 -07:00
parent b81c00acec
commit 4956998dbe
4 changed files with 17 additions and 13 deletions

View File

@@ -42,8 +42,8 @@ import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
/**
* The {@link ClientServerIntegrationTestsSupport} class is a abstract base class encapsulating common functionality
* to support the implementation of GemFire client/server tests.
* Abstract base class encapsulating common functionality used to support the implementation of Apache Geode
* client/server based integration tests.
*
* @author John Blum
* @see java.io.File
@@ -51,10 +51,9 @@ import org.springframework.lang.Nullable;
* @see java.net.InetSocketAddress
* @see java.net.ServerSocket
* @see java.net.Socket
* @see java.time.LocalDateTime
* @see java.util.Scanner
* @see java.util.concurrent.TimeUnit
* @see org.apache.geode.cache.server.CacheServer
* @see org.springframework.context.ApplicationContext
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
* @see org.springframework.data.gemfire.tests.process.ProcessExecutor

View File

@@ -51,12 +51,14 @@ import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
/**
* The {@link ForkingClientServerIntegrationTestsSupport} class is an abstract base class used to configure
* and bootstrap Apache Geode or VMware GemFire Server {@link Cache} and {@link ClientCache} applications.
* Abstract base class used to bootstrap Apache Geode {@link Cache} and/or {@link ClientCache} applications
* as independent (forked), {@link Process child processes}.
*
* @author John Blum
* @see java.io.File
* @see java.net.InetAddress
* @see java.util.concurrent.Executors
* @see java.util.concurrent.ThreadFactory
* @see org.apache.geode.cache.Cache
* @see org.apache.geode.cache.client.ClientCache
* @see org.springframework.context.ApplicationContext
@@ -66,11 +68,9 @@ import org.springframework.lang.Nullable;
* @see org.springframework.context.event.EventListener
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
* @see org.springframework.data.gemfire.config.annotation.EnablePdx
* @see org.springframework.data.gemfire.tests.integration.ClientServerIntegrationTestsSupport
* @see org.springframework.data.gemfire.tests.integration.config.ClientServerIntegrationTestsConfiguration
* @see org.springframework.data.gemfire.tests.process.JavaProcessRunner
* @see org.springframework.data.gemfire.tests.process.ProcessRunner
* @see org.springframework.data.gemfire.tests.process.ProcessWrapper
* @since 1.0.0
*/
@@ -234,7 +234,7 @@ public abstract class ForkingClientServerIntegrationTestsSupport extends ClientS
getGemFireServerProcess().ifPresent(ForkingClientServerIntegrationTestsSupport::stop);
if (Boolean.parseBoolean(System.getProperty(REMOVE_TEST_DIRECTORY_PROPERTY, Boolean.TRUE.toString()))) {
if (isTestDirectoryRemovalEnabled()) {
getGemFireServerProcess()
.map(ProcessWrapper::getWorkingDirectory)
.ifPresent(IntegrationTestsSupport::removeRecursiveDirectory);
@@ -243,6 +243,11 @@ public abstract class ForkingClientServerIntegrationTestsSupport extends ClientS
setGemFireServerProcess(null);
}
private static boolean isTestDirectoryRemovalEnabled() {
return !System.getProperties().containsKey(REMOVE_TEST_DIRECTORY_PROPERTY)
|| Boolean.getBoolean(REMOVE_TEST_DIRECTORY_PROPERTY);
}
@AfterClass
public static void clearCacheServerPortAndPoolPortProperties() {
System.clearProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY);

View File

@@ -16,8 +16,8 @@
package org.springframework.data.gemfire.tests.process;
/**
* The {@link JavaProcessRunner} interface is a {@link FunctionalInterface} and extension of the {@link ProcessRunner}
* interface to encapsulate the runtime parameters for running (executing) a Java/JVM {@link Process}.
* A {@link FunctionalInterface} and extension of the {@link ProcessRunner} interface used to encapsulate
* the runtime parameters for running (executing) a Java/JVM {@link Process}.
*
* @author John Blum
* @see org.springframework.data.gemfire.tests.process.ProcessRunner

View File

@@ -22,8 +22,8 @@ import java.util.List;
import org.springframework.data.gemfire.tests.util.FileSystemUtils;
/**
* The {@link ProcessRunner} interface is a {@link FunctionalInterface} encapsulating the contract, logic and strategy
* for running (executing) an Operating System (OS) [JVM] {@link Process}.
* A {@link FunctionalInterface} encapsulating the contract, logic and strategy for running (executing)
* an Operating System (OS) [JVM] {@link Process}.
*
* @author John Blum
* @see java.io.File