Polish formatting

This commit is contained in:
Phillip Webb 2015-04-06 18:03:59 -07:00
parent 5789665447
commit 59692cd938
4 changed files with 17 additions and 11 deletions

View File

@ -20,6 +20,7 @@ import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import javax.cache.CacheManager; import javax.cache.CacheManager;
import javax.cache.Caching; import javax.cache.Caching;
import javax.cache.configuration.MutableConfiguration; import javax.cache.configuration.MutableConfiguration;
@ -85,7 +86,8 @@ class JCacheCacheConfiguration {
Resource configLocation = this.cacheProperties.resolveConfigLocation(); Resource configLocation = this.cacheProperties.resolveConfigLocation();
if (configLocation != null) { if (configLocation != null) {
return cachingProvider.getCacheManager(configLocation.getURI(), return cachingProvider.getCacheManager(configLocation.getURI(),
cachingProvider.getDefaultClassLoader(), createCacheManagerProperties(configLocation)); cachingProvider.getDefaultClassLoader(),
createCacheManagerProperties(configLocation));
} }
return cachingProvider.getCacheManager(); return cachingProvider.getCacheManager();
} }
@ -97,10 +99,12 @@ class JCacheCacheConfiguration {
return Caching.getCachingProvider(); return Caching.getCachingProvider();
} }
private Properties createCacheManagerProperties(Resource configLocation) throws IOException { private Properties createCacheManagerProperties(Resource configLocation)
throws IOException {
Properties properties = new Properties(); Properties properties = new Properties();
// Hazelcast does not use the URI as a mean to specify a custom config. // Hazelcast does not use the URI as a mean to specify a custom config.
properties.setProperty("hazelcast.config.location", configLocation.getURI().toString()); properties.setProperty("hazelcast.config.location", configLocation.getURI()
.toString());
return properties; return properties;
} }

View File

@ -269,9 +269,9 @@ public class CacheAutoConfigurationTests {
public void jCacheCacheWithWrongConfig() { public void jCacheCacheWithWrongConfig() {
String cachingProviderFqn = MockCachingProvider.class.getName(); String cachingProviderFqn = MockCachingProvider.class.getName();
String configLocation = "org/springframework/boot/autoconfigure/cache/does-not-exist.xml"; String configLocation = "org/springframework/boot/autoconfigure/cache/does-not-exist.xml";
thrown.expect(BeanCreationException.class); this.thrown.expect(BeanCreationException.class);
thrown.expectMessage("spring.cache.config"); this.thrown.expectMessage("spring.cache.config");
thrown.expectMessage(configLocation); this.thrown.expectMessage(configLocation);
load(JCacheCustomConfiguration.class, "spring.cache.type=jcache", load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
"spring.cache.jcache.provider=" + cachingProviderFqn, "spring.cache.jcache.provider=" + cachingProviderFqn,
"spring.cache.config=" + configLocation); "spring.cache.config=" + configLocation);
@ -371,7 +371,8 @@ public class CacheAutoConfigurationTests {
cacheManager = validateCacheManager(JCacheCacheManager.class); cacheManager = validateCacheManager(JCacheCacheManager.class);
Resource configResource = new ClassPathResource(configLocation); Resource configResource = new ClassPathResource(configLocation);
assertThat(cacheManager.getCacheManager().getURI(), is(configResource.getURI())); assertThat(cacheManager.getCacheManager().getURI(),
is(configResource.getURI()));
} }
finally { finally {
if (cacheManager != null) { if (cacheManager != null) {

View File

@ -42,7 +42,8 @@ public class CommandLineIT {
InterruptedException { InterruptedException {
Invocation cli = this.cli.invoke("hint"); Invocation cli = this.cli.invoke("hint");
assertThat(cli.await(), equalTo(0)); assertThat(cli.await(), equalTo(0));
assertThat("Unexpected error: \n" + cli.getErrorOutput(), cli.getErrorOutput().length(), equalTo(0)); assertThat("Unexpected error: \n" + cli.getErrorOutput(), cli.getErrorOutput()
.length(), equalTo(0));
assertThat(cli.getStandardOutputLines().size(), equalTo(10)); assertThat(cli.getStandardOutputLines().size(), equalTo(10));
} }