Rename trusted.keystore to test-trusted-keystore.

This commit is contained in:
John Blum
2018-05-28 19:25:39 -07:00
parent 5d1dcb4b44
commit f96e7ab59b
4 changed files with 27 additions and 33 deletions

View File

@@ -148,45 +148,38 @@ public class SslAutoConfiguration {
new File(new ClassPathResource(keystoreName).getURL().toURI())).getAbsolutePath());
*/
return locateKeyStoreInClassPath(environment).map(resource -> {
return locateKeyStoreInClassPath(environment)
.map(resource -> {
File trustedKeyStore = null;
File trustedKeyStore = null;
try {
try {
URL url = resource.getURL();
URL url = resource.getURL();
if (ResourceUtils.isFileURL(url)) {
trustedKeyStore = new File(url.toURI());
}
else if (ResourceUtils.isJarURL(url)) {
trustedKeyStore = new File(CURRENT_WORKING_DIRECTORY, resolveTrustedKeystoreName(environment));
FileCopyUtils.copy(url.openStream(), new FileOutputStream(trustedKeyStore));
}
}
catch (IOException | URISyntaxException cause) {
if (logger.isWarnEnabled()) {
logger.warn("Trusted KeyStore {} found in Class Path but is not resolvable as a File: {}",
resource, cause.getMessage());
if (logger.isTraceEnabled()) {
logger.trace("Caused by:", cause);
if (ResourceUtils.isFileURL(url)) {
trustedKeyStore = new File(url.toURI());
}
else if (ResourceUtils.isJarURL(url)) {
trustedKeyStore = new File(CURRENT_WORKING_DIRECTORY, resolveTrustedKeystoreName(environment));
FileCopyUtils.copy(url.openStream(), new FileOutputStream(trustedKeyStore));
}
}
}
catch (IOException | URISyntaxException cause) {
return trustedKeyStore;
});
if (logger.isWarnEnabled()) {
/*
return locateKeyStoreInClassPath()
.map(it -> ObjectUtils.doOperationSafely(it::getURL))
.map(url -> ObjectUtils.doOperationSafely(url::toURI))
.map(uri -> ObjectUtils.doOperationSafely(() -> new File(uri)))
.filter(File::isFile);
*/
logger.warn("Trusted KeyStore {} found in Class Path but is not resolvable as a File: {}",
resource, cause.getMessage());
if (logger.isTraceEnabled()) {
logger.trace("Caused by:", cause);
}
}
}
return trustedKeyStore;
});
}
private static Optional<ClassPathResource> locateKeyStoreInClassPath(Environment environment) {

View File

@@ -84,7 +84,7 @@ import example.geode.cache.EchoCacheLoader;
public class AutoConfiguredSslIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
private static final String GEMFIRE_LOG_LEVEL = "error";
private static final String TRUSTED_KEYSTORE_FILENAME = "trusted.keystore";
private static final String TRUSTED_KEYSTORE_FILENAME = "test-trusted.keystore";
@BeforeClass
public static void startGemFireServer() throws IOException {
@@ -216,9 +216,9 @@ public class AutoConfiguredSslIntegrationTests extends ForkingClientServerIntegr
}
}
@EnableSsl
@CacheServerApplication(name = "AutoConfiguredSslIntegrationTests", logLevel = GEMFIRE_LOG_LEVEL)
@PropertySource(name = "gemfire-ssl", value = "application-ssl.properties")
@EnableSsl
static class GemFireServerConfiguration {
public static void main(String[] args) {

View File

@@ -1,4 +1,5 @@
# Spring Boot application.properties for testing Apache Geode/Pivotal GemFire SSL
spring.boot.data.gemfire.security.ssl.keystore.name=test-trusted.keystore
spring.data.gemfire.security.ssl.keystore.password=s3cr3t
spring.data.gemfire.security.ssl.truststore.password=s3cr3t