Skip to content

Commit 4956998

Browse files
committed
Refactor the conditonal logic used to decide whether to remove the (test) working directory of a forked Process in ForkingClientServerIntegrationTests.
Edit Javadoc.
1 parent b81c00a commit 4956998

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/integration/ClientServerIntegrationTestsSupport.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,18 @@
4242
import org.springframework.lang.Nullable;
4343

4444
/**
45-
* The {@link ClientServerIntegrationTestsSupport} class is a abstract base class encapsulating common functionality
46-
* to support the implementation of GemFire client/server tests.
45+
* Abstract base class encapsulating common functionality used to support the implementation of Apache Geode
46+
* client/server based integration tests.
4747
*
4848
* @author John Blum
4949
* @see java.io.File
5050
* @see java.lang.Process
5151
* @see java.net.InetSocketAddress
5252
* @see java.net.ServerSocket
5353
* @see java.net.Socket
54-
* @see java.time.LocalDateTime
54+
* @see java.util.Scanner
5555
* @see java.util.concurrent.TimeUnit
5656
* @see org.apache.geode.cache.server.CacheServer
57-
* @see org.springframework.context.ApplicationContext
5857
* @see org.springframework.context.annotation.AnnotationConfigApplicationContext
5958
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
6059
* @see org.springframework.data.gemfire.tests.process.ProcessExecutor

spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/integration/ForkingClientServerIntegrationTestsSupport.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@
5151
import org.springframework.lang.Nullable;
5252

5353
/**
54-
* The {@link ForkingClientServerIntegrationTestsSupport} class is an abstract base class used to configure
55-
* and bootstrap Apache Geode or VMware GemFire Server {@link Cache} and {@link ClientCache} applications.
54+
* Abstract base class used to bootstrap Apache Geode {@link Cache} and/or {@link ClientCache} applications
55+
* as independent (forked), {@link Process child processes}.
5656
*
5757
* @author John Blum
5858
* @see java.io.File
5959
* @see java.net.InetAddress
60+
* @see java.util.concurrent.Executors
61+
* @see java.util.concurrent.ThreadFactory
6062
* @see org.apache.geode.cache.Cache
6163
* @see org.apache.geode.cache.client.ClientCache
6264
* @see org.springframework.context.ApplicationContext
@@ -66,11 +68,9 @@
6668
* @see org.springframework.context.event.EventListener
6769
* @see org.springframework.data.gemfire.config.annotation.CacheServerApplication
6870
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
69-
* @see org.springframework.data.gemfire.config.annotation.EnablePdx
7071
* @see org.springframework.data.gemfire.tests.integration.ClientServerIntegrationTestsSupport
7172
* @see org.springframework.data.gemfire.tests.integration.config.ClientServerIntegrationTestsConfiguration
7273
* @see org.springframework.data.gemfire.tests.process.JavaProcessRunner
73-
* @see org.springframework.data.gemfire.tests.process.ProcessRunner
7474
* @see org.springframework.data.gemfire.tests.process.ProcessWrapper
7575
* @since 1.0.0
7676
*/
@@ -234,7 +234,7 @@ public static void stopGemFireServer() {
234234

235235
getGemFireServerProcess().ifPresent(ForkingClientServerIntegrationTestsSupport::stop);
236236

237-
if (Boolean.parseBoolean(System.getProperty(REMOVE_TEST_DIRECTORY_PROPERTY, Boolean.TRUE.toString()))) {
237+
if (isTestDirectoryRemovalEnabled()) {
238238
getGemFireServerProcess()
239239
.map(ProcessWrapper::getWorkingDirectory)
240240
.ifPresent(IntegrationTestsSupport::removeRecursiveDirectory);
@@ -243,6 +243,11 @@ public static void stopGemFireServer() {
243243
setGemFireServerProcess(null);
244244
}
245245

246+
private static boolean isTestDirectoryRemovalEnabled() {
247+
return !System.getProperties().containsKey(REMOVE_TEST_DIRECTORY_PROPERTY)
248+
|| Boolean.getBoolean(REMOVE_TEST_DIRECTORY_PROPERTY);
249+
}
250+
246251
@AfterClass
247252
public static void clearCacheServerPortAndPoolPortProperties() {
248253
System.clearProperty(GEMFIRE_CACHE_SERVER_PORT_PROPERTY);

spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/process/JavaProcessRunner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
package org.springframework.data.gemfire.tests.process;
1717

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

spring-data-geode-test/src/main/java/org/springframework/data/gemfire/tests/process/ProcessRunner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import org.springframework.data.gemfire.tests.util.FileSystemUtils;
2323

2424
/**
25-
* The {@link ProcessRunner} interface is a {@link FunctionalInterface} encapsulating the contract, logic and strategy
26-
* for running (executing) an Operating System (OS) [JVM] {@link Process}.
25+
* A {@link FunctionalInterface} encapsulating the contract, logic and strategy for running (executing)
26+
* an Operating System (OS) [JVM] {@link Process}.
2727
*
2828
* @author John Blum
2929
* @see java.io.File

0 commit comments

Comments
 (0)