use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-boot by spring-projects.
the class RedisHealthIndicatorTests method redisIsUp.
@Test
public void redisIsUp() throws Exception {
Properties info = new Properties();
info.put("redis_version", "2.8.9");
RedisConnection redisConnection = mock(RedisConnection.class);
RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class);
given(redisConnectionFactory.getConnection()).willReturn(redisConnection);
given(redisConnection.info()).willReturn(info);
RedisHealthIndicator healthIndicator = new RedisHealthIndicator(redisConnectionFactory);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().get("version")).isEqualTo("2.8.9");
verify(redisConnectionFactory).getConnection();
verify(redisConnection).info();
}
use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-cloud-connectors by spring-cloud.
the class RedisConnectionFactoryConfigWithServiceConfig method cloudRedisConnectionFactoryWithTimeout.
@Test
public void cloudRedisConnectionFactoryWithTimeout() {
ApplicationContext testContext = getTestApplicationContext(RedisConnectionFactoryConfigWithServiceConfig.class, createService("my-service"));
RedisConnectionFactory connector = testContext.getBean("timeout10", getConnectorType());
RedisConnectionFactoryCloudConfigTestHelper.assertConnectionProperties(connector, 10);
}
use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-integration by spring-projects.
the class RedisMetadataStoreTests method testPersistWithNullKeyToMetadataStore.
@Test
@RedisAvailable
public void testPersistWithNullKeyToMetadataStore() {
RedisConnectionFactory jcf = this.getConnectionFactoryForTest();
RedisMetadataStore metadataStore = new RedisMetadataStore(jcf, "testMetadata");
try {
metadataStore.put(null, "something");
} catch (IllegalArgumentException e) {
assertEquals("'key' must not be null.", e.getMessage());
return;
}
fail("Expected an IllegalArgumentException to be thrown.");
}
use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-integration by spring-projects.
the class RedisMetadataStoreTests method testPersistEmptyStringToMetadataStore.
@Test
@RedisAvailable
public void testPersistEmptyStringToMetadataStore() {
RedisConnectionFactory jcf = this.getConnectionFactoryForTest();
RedisMetadataStore metadataStore = new RedisMetadataStore(jcf, "testMetadata");
metadataStore.put("RedisMetadataStoreTests-PersistEmpty", "");
String retrievedValue = metadataStore.get("RedisMetadataStoreTests-PersistEmpty");
assertEquals("", retrievedValue);
}
use of org.springframework.data.redis.connection.RedisConnectionFactory in project spring-integration by spring-projects.
the class RedisMessageStoreTests method testGetNonExistingMessage.
@Test
@RedisAvailable
public void testGetNonExistingMessage() {
RedisConnectionFactory jcf = this.getConnectionFactoryForTest();
RedisMessageStore store = new RedisMessageStore(jcf);
Message<?> message = store.getMessage(UUID.randomUUID());
assertNull(message);
}
Aggregations