Add test suite method on tear down to clear all SSL System properties.

Add overloaded locateKeyStoreInFileSystem(keystoreFilename:String) method.
This commit is contained in:
John Blum
2018-05-27 01:56:51 -07:00
parent bc86c98285
commit 63a9a57b2c

View File

@@ -22,11 +22,14 @@ import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newI
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.geode.cache.GemFireCache;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -130,6 +133,10 @@ public class AutoConfiguredSslIntegrationTests extends ForkingClientServerIntegr
return locateKeyStoreInFileSystem(directory, TRUSTED_KEYSTORE_FILENAME);
}
private static Optional<File> locateKeyStoreInFileSystem(String keystoreFileName) {
return locateKeyStoreInFileSystem(FileSystemUtils.WORKING_DIRECTORY, keystoreFileName);
}
@SuppressWarnings("all")
private static Optional<File> locateKeyStoreInFileSystem(File directory, String keystoreFilename) {
@@ -162,6 +169,20 @@ public class AutoConfiguredSslIntegrationTests extends ForkingClientServerIntegr
return Optional.empty();
}
@AfterClass
public static void clearSslSystemProperties() {
List<String> sslSystemProperties = System.getProperties().keySet().stream()
.map(String::valueOf)
.map(String::toLowerCase)
.filter(property -> property.contains("ssl"))
.collect(Collectors.toList());
//System.err.printf("SSL System Properties [%s]%n", sslSystemProperties);
sslSystemProperties.forEach(System::clearProperty);
}
@javax.annotation.Resource(name = "Echo")
private Region<String, String> echo;