use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project spring-boot by spring-projects.
the class RedisAutoConfigurationTests method testRedisConfigurationWithTimeoutAndConnectTimeout.
@Test
void testRedisConfigurationWithTimeoutAndConnectTimeout() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.timeout:250", "spring.redis.connect-timeout:1000").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("foo");
assertThat(cf.getTimeout()).isEqualTo(250);
assertThat(cf.getClientConfiguration().getClientOptions().get().getSocketOptions().getConnectTimeout().toMillis()).isEqualTo(1000);
});
}
use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project spring-boot by spring-projects.
the class RedisAutoConfigurationTests method testPasswordInUrlWithColon.
@Test
void testPasswordInUrlWithColon() {
this.contextRunner.withPropertyValues("spring.redis.url:redis://:pass:word@example:33").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33);
assertThat(getUserName(cf)).isEqualTo("");
assertThat(cf.getPassword()).isEqualTo("pass:word");
});
}
use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project spring-boot by spring-projects.
the class RedisAutoConfigurationTests method testRedisUrlConfiguration.
@Test
void testRedisUrlConfiguration() {
this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.url:redis://user:password@example:33").run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.getHostName()).isEqualTo("example");
assertThat(cf.getPort()).isEqualTo(33);
assertThat(getUserName(cf)).isEqualTo("user");
assertThat(cf.getPassword()).isEqualTo("password");
assertThat(cf.isUseSsl()).isFalse();
});
}
use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project spring-boot by spring-projects.
the class RedisAutoConfigurationTests method testCustomizeRedisConfiguration.
@Test
void testCustomizeRedisConfiguration() {
this.contextRunner.withUserConfiguration(CustomConfiguration.class).run((context) -> {
LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
assertThat(cf.isUseSsl()).isTrue();
});
}
use of org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory in project jetcache by alibaba.
the class RedisSpringDataCacheTest method lettuceTest.
@Test
public void lettuceTest() throws Exception {
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(new RedisStandaloneConfiguration("127.0.0.1", 6379));
connectionFactory.afterPropertiesSet();
doTest(connectionFactory);
}
Aggregations