Example usage for org.springframework.data.redis.connection.jedis JedisConnectionFactory getPort

List of usage examples for org.springframework.data.redis.connection.jedis JedisConnectionFactory getPort

Introduction

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

Prototype

public int getPort() 

Source Link

Document

Returns the port used to connect to the Redis instance.

Usage

From source file:org.cloudfoundry.reconfiguration.spring.RedisCloudServiceBeanFactoryPostProcessorTest.java

private void assertConfiguration(JedisConnectionFactory factory, String password, String host, int port) {
    assertEquals(password, factory.getPassword());
    assertEquals(host, factory.getHostName());
    assertEquals(port, factory.getPort());
}

From source file:com.snowstore.mercury.indicator.RedisHealthIndicator.java

@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
    if (valid) {/*from   w w  w . j a v  a 2  s .c  om*/
        RedisConnection connection = RedisConnectionUtils.getConnection(this.redisConnectionFactory);
        try {
            Properties info = connection.info();
            builder.up().withDetail("version", info.getProperty("redis_version"));
            if (redisConnectionFactory instanceof JedisConnectionFactory) {
                JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) redisConnectionFactory;
                builder.withDetail(SERVER, jedisConnectionFactory.getHostName() + ":"
                        + jedisConnectionFactory.getPort() + ":" + jedisConnectionFactory.getDatabase());
            }
            addBuilder(builder);
        } finally {
            RedisConnectionUtils.releaseConnection(connection, this.redisConnectionFactory);
        }
    } else {
        builder.none();
    }
}

From source file:com.gopivotal.cloudfoundry.test.core.RedisUtils.java

public String getUrl(RedisConnectionFactory redisConnectionFactory) {
    if (isClass(redisConnectionFactory, "com.gopivotal.cloudfoundry.test.core.FakeRedisConnectionFactory")) {
        return "redis://fake";
    } else if (isClass(redisConnectionFactory,
            "org.springframework.data.redis.connection.jedis" + ".JedisConnectionFactory")) {
        org.springframework.data.redis.connection.jedis.JedisConnectionFactory jedisConnectionFactory = (org.springframework.data.redis.connection.jedis.JedisConnectionFactory) redisConnectionFactory;
        String host = jedisConnectionFactory.getHostName();
        int port = jedisConnectionFactory.getPort();

        return String.format("redis://%s:%d", host, port);
    }/*from ww w.j a  v a 2s  .  c  o  m*/

    return String.format("Unable to determine URL for RedisConnectionFactory of type %s",
            redisConnectionFactory.getClass().getName());
}

From source file:org.cloudfoundry.test.ServiceController.java

@RequestMapping(value = "/redis/host", method = RequestMethod.GET)
public ResponseEntity<String> getRedisHostAddress() {
    if (serviceHolder.getRedisConnectionFactory() == null) {
        return new ResponseEntity<String>(HttpStatus.NOT_FOUND);
    }/*from   w  w w .  ja v a2 s.  c o m*/
    // Jedis is the only client we currently support
    JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) serviceHolder
            .getRedisConnectionFactory();
    return new ResponseEntity<String>(
            jedisConnectionFactory.getHostName() + ':' + jedisConnectionFactory.getPort(), HttpStatus.OK);
}