use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class ClaimCheckParserTests method checkMessageStoreReferenceOnCheckOut.
@Test
public void checkMessageStoreReferenceOnCheckOut() {
ClaimCheckOutTransformer transformer = (ClaimCheckOutTransformer) new DirectFieldAccessor(new DirectFieldAccessor(checkout).getPropertyValue("handler")).getPropertyValue("transformer");
MessageStore messageStore = (MessageStore) new DirectFieldAccessor(transformer).getPropertyValue("messageStore");
assertEquals(context.getBean("testMessageStore"), messageStore);
}
use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class ClaimCheckTransformerTests method unknown.
@Test(expected = MessageTransformationException.class)
public void unknown() {
MessageStore store = new SimpleMessageStore(10);
ClaimCheckOutTransformer transformer = new ClaimCheckOutTransformer(store);
transformer.transform(MessageBuilder.withPayload(UUID.randomUUID()).build());
}
use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class AbstractMongoDbMessageGroupStoreTests method testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader.
@Test
@MongoDbAvailable
public void testMessageGroupWithAddedMessageUUIDGroupIdAndUUIDHeader() throws Exception {
this.cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
MessageGroupStore store = this.getMessageGroupStore();
MessageStore messageStore = this.getMessageStore();
Object id = UUID.randomUUID();
MessageGroup messageGroup = store.getMessageGroup(id);
UUID uuidA = UUID.randomUUID();
Message<?> messageA = MessageBuilder.withPayload("A").setHeader("foo", uuidA).build();
UUID uuidB = UUID.randomUUID();
Message<?> messageB = MessageBuilder.withPayload("B").setHeader("foo", uuidB).build();
store.addMessagesToGroup(id, messageA);
messageGroup = store.addMessageToGroup(id, messageB);
assertNotNull(messageGroup);
assertEquals(2, messageGroup.size());
Message<?> retrievedMessage = messageStore.getMessage(messageA.getHeaders().getId());
assertNotNull(retrievedMessage);
assertEquals(retrievedMessage.getHeaders().getId(), messageA.getHeaders().getId());
// ensure that 'message_group' header that is only used internally is not propagated
assertNull(retrievedMessage.getHeaders().get("message_group"));
Object fooHeader = retrievedMessage.getHeaders().get("foo");
assertTrue(fooHeader instanceof UUID);
assertEquals(uuidA, fooHeader);
}
use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class JdbcMessageStoreParserTests method testSimpleMessageStoreWithSerializer.
@Test
public void testSimpleMessageStoreWithSerializer() {
setUp("serializerJdbcMessageStore.xml", getClass());
MessageStore store = context.getBean("messageStore", MessageStore.class);
Object serializer = TestUtils.getPropertyValue(store, "serializer.serializer");
assertTrue(serializer instanceof EnhancedSerializer);
Object deserializer = TestUtils.getPropertyValue(store, "deserializer.deserializer");
assertTrue(deserializer instanceof EnhancedSerializer);
}
use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class AbstractMongoDbMessageStoreTests method testMutableMessageAsPayload.
@Test
@MongoDbAvailable
public void testMutableMessageAsPayload() throws Exception {
MessageStore store = this.getMessageStore();
Person p = new Person();
p.setFname("John");
p.setLname("Doe");
Message<?> messageToStore = new GenericMessage<Message<?>>(MutableMessageBuilder.withPayload(p).build());
store.addMessage(messageToStore);
Message<?> retrievedMessage = store.getMessage(messageToStore.getHeaders().getId());
assertNotNull(retrievedMessage);
assertThat(retrievedMessage.getPayload(), instanceOf(MutableMessage.class));
assertEquals(messageToStore.getPayload(), retrievedMessage.getPayload());
assertEquals(messageToStore.getHeaders(), retrievedMessage.getHeaders());
assertEquals(((Message<?>) messageToStore.getPayload()).getPayload(), p);
assertEquals(messageToStore, retrievedMessage);
}
Aggregations