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

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

Introduction

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

Prototype

@Deprecated
public void setPort(int port) 

Source Link

Document

Sets the port used to connect to the Redis instance.

Usage

From source file:org.springframework.integration.redis.rules.RedisAvailableRule.java

public Statement apply(final Statement base, final FrameworkMethod method, Object target) {
    return new Statement() {

        @Override/*from   w  w w. j a  v  a 2s  .c  o m*/
        public void evaluate() throws Throwable {
            RedisAvailable redisAvailable = method.getAnnotation(RedisAvailable.class);
            if (redisAvailable != null) {
                try {

                    JedisConnectionFactory connectionFactory = new JedisConnectionFactory();
                    connectionFactory.setPort(REDIS_PORT);
                    connectionFactory.afterPropertiesSet();
                    connectionFactory.getConnection();
                } catch (Exception e) {
                    if (logger.isWarnEnabled()) {
                        logger.warn(String.format(
                                "Redis is not available on " + "port '%s'. Skipping the test.", REDIS_PORT));
                    }
                    return;
                }
            }
            base.evaluate();
        }
    };

}