List of usage examples for org.springframework.data.redis.connection.lettuce LettuceConnectionFactory getHostName
public String getHostName()
From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java
@Test public void testOverrideRedisConfiguration() { this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.database:1", "spring.redis.lettuce.shutdown-timeout:500").run((context) -> { LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getDatabase()).isEqualTo(1); assertThat(cf.getPassword()).isNull(); assertThat(cf.isUseSsl()).isFalse(); assertThat(cf.getShutdownTimeout()).isEqualTo(500); });//w w w.ja va 2 s .c o m }
From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java
@Test public void testRedisUrlConfiguration() { this.contextRunner .withPropertyValues("spring.redis.host:foo", "spring.redis.url:redis://user:password@example:33") .run((context) -> {/*from ww w . j a v a2 s. co m*/ LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPassword()).isEqualTo("password"); assertThat(cf.isUseSsl()).isFalse(); }); }
From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java
@Test public void testOverrideUrlRedisConfiguration() { 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") .run((context) -> {// w w w . j a va2 s . c om LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPassword()).isEqualTo("password"); assertThat(cf.isUseSsl()).isTrue(); }); }
From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java
@Test public 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(cf.getPassword()).isEqualTo("pass:word"); });/*from w ww.ja va2 s. c o m*/ }
From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java
@Test public void testPasswordInUrlStartsWithColon() { this.contextRunner.withPropertyValues("spring.redis.url:redis://user::pass:word@example:33") .run((context) -> {// ww w.ja v a 2 s .c om LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); assertThat(cf.getHostName()).isEqualTo("example"); assertThat(cf.getPort()).isEqualTo(33); assertThat(cf.getPassword()).isEqualTo(":pass:word"); }); }
From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java
@Test public void testRedisConfigurationWithPool() { this.contextRunner .withPropertyValues("spring.redis.host:foo", "spring.redis.lettuce.pool.min-idle:1", "spring.redis.lettuce.pool.max-idle:4", "spring.redis.lettuce.pool.max-active:16", "spring.redis.lettuce.pool.max-wait:2000", "spring.redis.lettuce.shutdown-timeout:1000") .run((context) -> {/*from ww w . j a va 2 s . co m*/ LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); assertThat(cf.getHostName()).isEqualTo("foo"); GenericObjectPoolConfig<?> poolConfig = getPoolingClientConfiguration(cf).getPoolConfig(); assertThat(poolConfig.getMinIdle()).isEqualTo(1); assertThat(poolConfig.getMaxIdle()).isEqualTo(4); assertThat(poolConfig.getMaxTotal()).isEqualTo(16); assertThat(poolConfig.getMaxWaitMillis()).isEqualTo(2000); assertThat(cf.getShutdownTimeout()).isEqualTo(1000); }); }
From source file:org.springframework.boot.autoconfigure.data.redis.RedisAutoConfigurationTests.java
@Test public void testRedisConfigurationWithTimeout() { this.contextRunner.withPropertyValues("spring.redis.host:foo", "spring.redis.timeout:100") .run((context) -> {//from w w w .j a v a2 s .com LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class); assertThat(cf.getHostName()).isEqualTo("foo"); assertThat(cf.getTimeout()).isEqualTo(100); }); }