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

View File

@@ -84,7 +84,7 @@ import example.geode.cache.EchoCacheLoader;
public class AutoConfiguredSslIntegrationTests extends ForkingClientServerIntegrationTestsSupport { public class AutoConfiguredSslIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
private static final String GEMFIRE_LOG_LEVEL = "error"; 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 @BeforeClass
public static void startGemFireServer() throws IOException { public static void startGemFireServer() throws IOException {
@@ -216,9 +216,9 @@ public class AutoConfiguredSslIntegrationTests extends ForkingClientServerIntegr
} }
} }
@EnableSsl
@CacheServerApplication(name = "AutoConfiguredSslIntegrationTests", logLevel = GEMFIRE_LOG_LEVEL) @CacheServerApplication(name = "AutoConfiguredSslIntegrationTests", logLevel = GEMFIRE_LOG_LEVEL)
@PropertySource(name = "gemfire-ssl", value = "application-ssl.properties") @PropertySource(name = "gemfire-ssl", value = "application-ssl.properties")
@EnableSsl
static class GemFireServerConfiguration { static class GemFireServerConfiguration {
public static void main(String[] args) { 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 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.keystore.password=s3cr3t
spring.data.gemfire.security.ssl.truststore.password=s3cr3t spring.data.gemfire.security.ssl.truststore.password=s3cr3t