This commit is contained in:
Phillip Webb
2018-02-16 15:38:16 -08:00
parent d2039128b5
commit 9e75680e6f
32 changed files with 208 additions and 198 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -74,7 +74,8 @@ public class DefaultServletWebServerFactoryCustomizer
map.from(this.serverProperties::getAddress).to(factory::setAddress);
map.from(this.serverProperties.getServlet()::getContextPath)
.to(factory::setContextPath);
map.from(this.serverProperties.getServlet()::getApplicationDisplayName).to(factory::setDisplayName);
map.from(this.serverProperties.getServlet()::getApplicationDisplayName)
.to(factory::setDisplayName);
map.from(this.serverProperties.getServlet()::getSession).to(factory::setSession);
map.from(this.serverProperties::getSsl).to(factory::setSsl);
map.from(this.serverProperties::getServlet).as(ServerProperties.Servlet::getJsp)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -295,7 +295,8 @@ public class CacheAutoConfigurationTests {
.isEqualTo(java.time.Duration.ofSeconds(15));
assertThat(redisCacheConfiguration.getAllowCacheNullValues())
.isFalse();
assertThat(redisCacheConfiguration.getKeyPrefixFor("keyName")).isEqualTo("prefix");
assertThat(redisCacheConfiguration.getKeyPrefixFor("keyName"))
.isEqualTo("prefix");
assertThat(redisCacheConfiguration.usePrefix()).isTrue();
});
}
@@ -342,7 +343,8 @@ public class CacheAutoConfigurationTests {
.isEqualTo(java.time.Duration.ofMinutes(0));
assertThat(redisCacheConfiguration.getAllowCacheNullValues())
.isTrue();
assertThat(redisCacheConfiguration.getKeyPrefixFor("test")).isEqualTo("test::");
assertThat(redisCacheConfiguration.getKeyPrefixFor("test"))
.isEqualTo("test::");
assertThat(redisCacheConfiguration.usePrefix()).isTrue();
});
}

View File

@@ -42,12 +42,12 @@ import static org.assertj.core.api.Assertions.assertThat;
@ClassPathExclusions("lettuce-core-*.jar")
public class RedisAutoConfigurationJedisTests {
private final ApplicationContextRunner runner = new ApplicationContextRunner()
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(RedisAutoConfiguration.class));
@Test
public void testOverrideRedisConfiguration() {
this.runner.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1")
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1")
.run((context) -> {
JedisConnectionFactory cf = context
.getBean(JedisConnectionFactory.class);
@@ -60,7 +60,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testCustomizeRedisConfiguration() {
this.runner.withUserConfiguration(CustomConfiguration.class).run((context) -> {
this.contextRunner.withUserConfiguration(CustomConfiguration.class).run((context) -> {
JedisConnectionFactory cf = context.getBean(JedisConnectionFactory.class);
assertThat(cf.isUseSsl()).isTrue();
});
@@ -68,7 +68,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testRedisUrlConfiguration() {
this.runner
this.contextRunner
.withPropertyValues("spring.redis.host:foo",
"spring.redis.url:redis://user:password@example:33")
.run((context) -> {
@@ -83,7 +83,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testOverrideUrlRedisConfiguration() {
this.runner
this.contextRunner
.withPropertyValues("spring.redis.host:foo", "spring.redis.password:xyz",
"spring.redis.port:1000", "spring.redis.ssl:false",
"spring.redis.url:rediss://user:password@example:33")
@@ -99,7 +99,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testPasswordInUrlWithColon() {
this.runner.withPropertyValues("spring.redis.url:redis://:pass:word@example:33")
this.contextRunner.withPropertyValues("spring.redis.url:redis://:pass:word@example:33")
.run((context) -> {
assertThat(
context.getBean(JedisConnectionFactory.class).getHostName())
@@ -114,7 +114,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testPasswordInUrlStartsWithColon() {
this.runner
this.contextRunner
.withPropertyValues("spring.redis.url:redis://user::pass:word@example:33")
.run((context) -> {
assertThat(
@@ -130,7 +130,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testRedisConfigurationWithPool() {
this.runner.withPropertyValues("spring.redis.host:foo",
this.contextRunner.withPropertyValues("spring.redis.host:foo",
"spring.redis.jedis.pool.min-idle:1",
"spring.redis.jedis.pool.max-idle:4",
"spring.redis.jedis.pool.max-active:16",
@@ -147,7 +147,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testRedisConfigurationWithTimeout() {
this.runner
this.contextRunner
.withPropertyValues("spring.redis.host:foo", "spring.redis.timeout:100")
.run((context) -> {
JedisConnectionFactory cf = context
@@ -159,7 +159,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testRedisConfigurationWithSentinel() {
this.runner
this.contextRunner
.withPropertyValues("spring.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:127.0.0.1:26379,127.0.0.1:26380")
.withUserConfiguration(JedisConnectionFactoryCaptorConfiguration.class)
@@ -172,7 +172,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testRedisConfigurationWithSentinelAndPassword() {
this.runner
this.contextRunner
.withPropertyValues("spring.redis.password=password",
"spring.redis.sentinel.master:mymaster",
"spring.redis.sentinel.nodes:127.0.0.1:26379,127.0.0.1:26380")
@@ -189,7 +189,7 @@ public class RedisAutoConfigurationJedisTests {
@Test
public void testRedisConfigurationWithCluster() {
this.runner
this.contextRunner
.withPropertyValues(
"spring.redis.cluster.nodes=127.0.0.1:27379,127.0.0.1:27380")
.run((context) -> assertThat(context.getBean(JedisConnectionFactory.class)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.