use of org.springframework.integration.redis.rules.RedisAvailable in project spring-integration by spring-projects.
the class RedisInboundChannelAdapterParserTests method testInboundChannelAdapterMessaging.
@Test
@RedisAvailable
public void testInboundChannelAdapterMessaging() throws Exception {
RedisInboundChannelAdapter adapter = context.getBean("adapter", RedisInboundChannelAdapter.class);
this.awaitContainerSubscribedWithPatterns(TestUtils.getPropertyValue(adapter, "container", RedisMessageListenerContainer.class));
RedisConnectionFactory connectionFactory = this.getConnectionFactoryForTest();
connectionFactory.getConnection().publish("foo".getBytes(), "Hello Redis from foo".getBytes());
connectionFactory.getConnection().publish("bar".getBytes(), "Hello Redis from bar".getBytes());
QueueChannel receiveChannel = context.getBean("receiveChannel", QueueChannel.class);
for (int i = 0; i < 3; i++) {
Message<?> receive = receiveChannel.receive(10000);
assertNotNull(receive);
assertThat(receive.getPayload(), Matchers.<Object>isOneOf("Hello Redis from foo", "Hello Redis from bar"));
}
}
use of org.springframework.integration.redis.rules.RedisAvailable in project spring-integration by spring-projects.
the class PersistentAcceptOnceFileListFilterExternalStoreTests method testFileSystemWithRedisMetadataStore.
@Test
@RedisAvailable
public void testFileSystemWithRedisMetadataStore() throws Exception {
RedisTemplate<String, ?> template = new RedisTemplate<String, Object>();
template.setConnectionFactory(this.getConnectionFactoryForTest());
template.setKeySerializer(new StringRedisSerializer());
template.afterPropertiesSet();
template.delete("persistentAcceptOnceFileListFilterRedisTests");
try {
this.testFileSystem(new RedisMetadataStore(this.getConnectionFactoryForTest(), "persistentAcceptOnceFileListFilterRedisTests"));
} finally {
template.delete("persistentAcceptOnceFileListFilterRedisTests");
}
}
use of org.springframework.integration.redis.rules.RedisAvailable in project spring-integration by spring-projects.
the class RedisMetadataStoreTests method testGetNonExistingKeyValue.
@Test
@RedisAvailable
public void testGetNonExistingKeyValue() {
RedisConnectionFactory jcf = this.getConnectionFactoryForTest();
RedisMetadataStore metadataStore = new RedisMetadataStore(jcf);
String retrievedValue = metadataStore.get("does-not-exist");
assertNull(retrievedValue);
}
use of org.springframework.integration.redis.rules.RedisAvailable in project spring-integration by spring-projects.
the class RedisMetadataStoreTests method testGetValueFromMetadataStore.
@Test
@RedisAvailable
public void testGetValueFromMetadataStore() {
RedisConnectionFactory jcf = this.getConnectionFactoryForTest();
RedisMetadataStore metadataStore = new RedisMetadataStore(jcf, "testMetadata");
metadataStore.put("RedisMetadataStoreTests-GetValue", "Hello Redis");
String retrievedValue = metadataStore.get("RedisMetadataStoreTests-GetValue");
assertEquals("Hello Redis", retrievedValue);
}
use of org.springframework.integration.redis.rules.RedisAvailable in project spring-integration by spring-projects.
the class RedisMetadataStoreTests method testGetValueWithNullKeyFromMetadataStore.
@Test
@RedisAvailable
public void testGetValueWithNullKeyFromMetadataStore() {
RedisConnectionFactory jcf = this.getConnectionFactoryForTest();
RedisMetadataStore metadataStore = new RedisMetadataStore(jcf, "testMetadata");
try {
metadataStore.get(null);
} catch (IllegalArgumentException e) {
assertEquals("'key' must not be null.", e.getMessage());
return;
}
fail("Expected an IllegalArgumentException to be thrown.");
}
Aggregations