Search in sources :

Example 1 with Pool

use of org.springframework.boot.autoconfigure.data.redis.RedisProperties.Pool in project spring-boot by spring-projects.

the class RedisAutoConfigurationTests method testRedisConfigurationUsePoolByDefault.

@Test
void testRedisConfigurationUsePoolByDefault() {
    Pool defaultPool = new RedisProperties().getLettuce().getPool();
    this.contextRunner.withPropertyValues("spring.redis.host:foo").run((context) -> {
        LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
        assertThat(cf.getHostName()).isEqualTo("foo");
        GenericObjectPoolConfig<?> poolConfig = getPoolingClientConfiguration(cf).getPoolConfig();
        assertThat(poolConfig.getMinIdle()).isEqualTo(defaultPool.getMinIdle());
        assertThat(poolConfig.getMaxIdle()).isEqualTo(defaultPool.getMaxIdle());
        assertThat(poolConfig.getMaxTotal()).isEqualTo(defaultPool.getMaxActive());
        assertThat(poolConfig.getMaxWaitDuration()).isEqualTo(defaultPool.getMaxWait());
    });
}
Also used : LettuceConnectionFactory(org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory) Pool(org.springframework.boot.autoconfigure.data.redis.RedisProperties.Pool) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 Pool (org.springframework.boot.autoconfigure.data.redis.RedisProperties.Pool)1 LettuceConnectionFactory (org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory)1