Example usage for org.springframework.data.redis.connection.lettuce LettuceConnectionFactory getPort

List of usage examples for org.springframework.data.redis.connection.lettuce LettuceConnectionFactory getPort

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection.lettuce LettuceConnectionFactory getPort.

Prototype

public int getPort() 

Source Link

Document

Returns the current port.

Usage

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  w w  w. j a  va2  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) -> {//from  w  w  w  . j a v  a  2  s  .  c o 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()).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  w  w  .j a 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) -> {//  www. j  av a 2  s  .  co  m
                LettuceConnectionFactory cf = context.getBean(LettuceConnectionFactory.class);
                assertThat(cf.getHostName()).isEqualTo("example");
                assertThat(cf.getPort()).isEqualTo(33);
                assertThat(cf.getPassword()).isEqualTo(":pass:word");
            });
}