From 8d91a2a31dd83a376e885918408db1bbc3b3cb71 Mon Sep 17 00:00:00 2001 From: John Blum Date: Tue, 29 May 2018 19:20:03 -0700 Subject: [PATCH] Add test suite setup logic to clear any existing Apache Geode/Pivotal GemFire network Socket configuration. Rename clearAllSpringPrefixedSystemProperties() to clearAllSpringDotPrefixedSystemProperties. --- .../integration/IntegrationTestsSupport.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/spring-test-data-geode/src/main/java/org/springframework/data/gemfire/tests/integration/IntegrationTestsSupport.java b/spring-test-data-geode/src/main/java/org/springframework/data/gemfire/tests/integration/IntegrationTestsSupport.java index 7218f12..c7982cb 100644 --- a/spring-test-data-geode/src/main/java/org/springframework/data/gemfire/tests/integration/IntegrationTestsSupport.java +++ b/spring-test-data-geode/src/main/java/org/springframework/data/gemfire/tests/integration/IntegrationTestsSupport.java @@ -24,6 +24,7 @@ import java.util.stream.Collectors; import org.apache.geode.cache.CacheClosedException; import org.apache.geode.cache.GemFireCache; +import org.apache.geode.internal.net.SocketCreatorFactory; import org.junit.BeforeClass; import org.springframework.data.gemfire.GemfireUtils; @@ -48,12 +49,7 @@ public abstract class IntegrationTestsSupport { protected static final String TEST_GEMFIRE_LOG_LEVEL = "error"; @BeforeClass - public static void closeAnyExistingGemFireCacheInstanceBeforeTestExecution() { - closeGemFireCacheWaitOnCloseEvent(); - } - - @BeforeClass - public static void clearAllSpringPrefixedSystemProperties() { + public static void clearAllSpringDotPrefixedSystemProperties() { List springSystemProperties = System.getProperties().stringPropertyNames().stream() .filter(it -> it.toLowerCase().startsWith("spring")) @@ -62,6 +58,17 @@ public abstract class IntegrationTestsSupport { springSystemProperties.forEach(System::clearProperty); } + @BeforeClass + public static void closeAnyExistingGemFireCacheInstanceBeforeTestExecution() { + closeGemFireCacheWaitOnCloseEvent(); + } + + @BeforeClass + public static void closeAnyExistingSocketConfigurationBeforeTestExecution() { + SocketCreatorFactory.close(); + //SSLConfigurationFactory.close(); + } + public static void closeGemFireCacheWaitOnCloseEvent() { closeGemFireCacheWaitOnCloseEvent(DEFAULT_WAIT_DURATION); }