Search in sources :

Example 1 with ReactiveRedisClusterConnection

use of org.springframework.data.redis.connection.ReactiveRedisClusterConnection in project spring-boot by spring-projects.

the class RedisReactiveHealthIndicatorTests method createClusterConnectionFactory.

private ReactiveRedisConnectionFactory createClusterConnectionFactory(String state) {
    Properties clusterProperties = new Properties();
    if (state != null) {
        clusterProperties.setProperty("cluster_state", state);
    }
    clusterProperties.setProperty("cluster_size", "4");
    boolean failure = "fail".equals(state);
    clusterProperties.setProperty("cluster_slots_ok", failure ? "3" : "4");
    clusterProperties.setProperty("cluster_slots_fail", failure ? "1" : "0");
    ReactiveRedisClusterConnection redisConnection = mock(ReactiveRedisClusterConnection.class);
    given(redisConnection.closeLater()).willReturn(Mono.empty());
    given(redisConnection.clusterGetClusterInfo()).willReturn(Mono.just(new ClusterInfo(clusterProperties)));
    ReactiveRedisConnectionFactory redisConnectionFactory = mock(ReactiveRedisConnectionFactory.class);
    given(redisConnectionFactory.getReactiveConnection()).willReturn(redisConnection);
    return redisConnectionFactory;
}
Also used : ClusterInfo(org.springframework.data.redis.connection.ClusterInfo) ReactiveRedisClusterConnection(org.springframework.data.redis.connection.ReactiveRedisClusterConnection) ReactiveRedisConnectionFactory(org.springframework.data.redis.connection.ReactiveRedisConnectionFactory) Properties(java.util.Properties)

Aggregations

Properties (java.util.Properties)1 ClusterInfo (org.springframework.data.redis.connection.ClusterInfo)1 ReactiveRedisClusterConnection (org.springframework.data.redis.connection.ReactiveRedisClusterConnection)1 ReactiveRedisConnectionFactory (org.springframework.data.redis.connection.ReactiveRedisConnectionFactory)1