use of org.springframework.integration.redis.rules.RedisAvailable 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.integration.redis.rules.RedisAvailable 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.integration.redis.rules.RedisAvailable in project spring-integration by spring-projects.
the class RedisStoreOutboundChannelAdapterIntegrationTests method testMapToMapNoKey.
// key is not provided
@Test(expected = MessageHandlingException.class)
@RedisAvailable
public void testMapToMapNoKey() {
RedisTemplate<String, Map<String, Map<String, String>>> redisTemplate = new RedisTemplate<String, Map<String, Map<String, String>>>();
redisTemplate.setKeySerializer(new StringRedisSerializer());
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
redisTemplate.setConnectionFactory(getConnectionFactoryForTest());
redisTemplate.afterPropertiesSet();
RedisMap<String, Map<String, String>> redisMap = new DefaultRedisMap<String, Map<String, String>>("pepboys", redisTemplate);
assertEquals(0, redisMap.size());
Map<String, String> pepboys = new HashMap<String, String>();
pepboys.put("1", "Manny");
pepboys.put("2", "Moe");
pepboys.put("3", "Jack");
Message<Map<String, String>> message = MessageBuilder.withPayload(pepboys).build();
this.mapToMapBChannel.send(message);
}
use of org.springframework.integration.redis.rules.RedisAvailable 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);
}
use of org.springframework.integration.redis.rules.RedisAvailable in project spring-integration by spring-projects.
the class RedisMessageStoreTests method testAddNonSerializableObjectMessage.
@Test(expected = IllegalArgumentException.class)
@RedisAvailable
public void testAddNonSerializableObjectMessage() {
RedisConnectionFactory jcf = this.getConnectionFactoryForTest();
RedisMessageStore store = new RedisMessageStore(jcf);
Message<Foo> objectMessage = new GenericMessage<Foo>(new Foo());
store.addMessage(objectMessage);
}
Aggregations