use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class SpringData1RedisServiceConnectorCreatorTest method cloudRedisCreationNoConfig.
@Test
public void cloudRedisCreationNoConfig() throws Exception {
RedisServiceInfo serviceInfo = createServiceInfo();
RedisConnectionFactory dataSource = testCreator.create(serviceInfo, null);
assertConnectorProperties(serviceInfo, dataSource);
}
use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RedisConnectionFactoryXmlConfigTest method cloudRedisConnectionFactoryWithMaxPoolAndTimeout.
@Test
public void cloudRedisConnectionFactoryWithMaxPoolAndTimeout() {
ApplicationContext testContext = getTestApplicationContext("cloud-redis-with-config.xml", createService("my-service"));
RedisConnectionFactory connector = testContext.getBean("service-pool30-wait300-timeout20", getConnectorType());
RedisConnectionFactoryCloudConfigTestHelper.assertPoolProperties(connector, 30, 0, 300);
RedisConnectionFactoryCloudConfigTestHelper.assertConnectionProperties(connector, 20);
}
use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RedisConnectionFactoryXmlConfigTest method cloudRedisConnectionFactoryWithTimeout.
@Test
public void cloudRedisConnectionFactoryWithTimeout() {
ApplicationContext testContext = getTestApplicationContext("cloud-redis-with-config.xml", createService("my-service"));
RedisConnectionFactory connector = testContext.getBean("service-timeout10", getConnectorType());
RedisConnectionFactoryCloudConfigTestHelper.assertConnectionProperties(connector, 10);
}
use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RedisConnectionFactoryConfigWithServiceConfig method cloudRedisConnectionFactoryWithWithMaxPoolAndTimeout.
@Test
public void cloudRedisConnectionFactoryWithWithMaxPoolAndTimeout() {
ApplicationContext testContext = getTestApplicationContext(RedisConnectionFactoryConfigWithServiceConfig.class, createService("my-service"));
RedisConnectionFactory connector = testContext.getBean("pool30Wait300_timeout20", getConnectorType());
RedisConnectionFactoryCloudConfigTestHelper.assertPoolProperties(connector, 30, 0, 300);
RedisConnectionFactoryCloudConfigTestHelper.assertConnectionProperties(connector, 20);
}
use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-boot by spring-projects.
the class RedisHealthIndicatorTests method redisClusterIsUp.
@Test
public void redisClusterIsUp() throws Exception {
Properties clusterProperties = new Properties();
clusterProperties.setProperty("cluster_size", "4");
clusterProperties.setProperty("cluster_slots_ok", "4");
clusterProperties.setProperty("cluster_slots_fail", "0");
List<RedisClusterNode> redisMasterNodes = Arrays.asList(new RedisClusterNode("127.0.0.1", 7001), new RedisClusterNode("127.0.0.2", 7001));
RedisClusterConnection redisConnection = mock(RedisClusterConnection.class);
given(redisConnection.clusterGetNodes()).willReturn(redisMasterNodes);
given(redisConnection.clusterGetClusterInfo()).willReturn(new ClusterInfo(clusterProperties));
RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class);
given(redisConnectionFactory.getConnection()).willReturn(redisConnection);
RedisHealthIndicator healthIndicator = new RedisHealthIndicator(redisConnectionFactory);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().get("cluster_size")).isEqualTo(4L);
assertThat(health.getDetails().get("slots_up")).isEqualTo(4L);
assertThat(health.getDetails().get("slots_fail")).isEqualTo(0L);
verify(redisConnectionFactory, atLeastOnce()).getConnection();
}
Aggregations