use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class AbstractMongoDbMessageStoreTests method testInt3153SequenceDetails.
@Test
@MongoDbAvailable
public void testInt3153SequenceDetails() throws Exception {
cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
MessageStore store = getMessageStore();
Message<?> messageToStore = MessageBuilder.withPayload("test").pushSequenceDetails(UUID.randomUUID(), 1, 1).pushSequenceDetails(UUID.randomUUID(), 1, 1).build();
store.addMessage(messageToStore);
Message<?> retrievedMessage = store.getMessage(messageToStore.getHeaders().getId());
assertNotNull(retrievedMessage);
assertEquals(messageToStore.getPayload(), retrievedMessage.getPayload());
assertEquals(messageToStore.getHeaders(), retrievedMessage.getHeaders());
assertEquals(messageToStore, retrievedMessage);
}
use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class AbstractMongoDbMessageStoreTests method testAddThenRemoveWithStringPayload.
@Test
@MongoDbAvailable
public void testAddThenRemoveWithStringPayload() throws Exception {
cleanupCollections(new SimpleMongoDbFactory(new MongoClient(), "test"));
MessageStore store = getMessageStore();
Message<?> messageToStore = MessageBuilder.withPayload("Hello").build();
store.addMessage(messageToStore);
Message<?> retrievedMessage = store.getMessage(messageToStore.getHeaders().getId());
assertNotNull(retrievedMessage);
store.removeMessage(retrievedMessage.getHeaders().getId());
retrievedMessage = store.getMessage(messageToStore.getHeaders().getId());
assertNull(retrievedMessage);
}
use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class AbstractMongoDbMessageStoreTests method testAdviceMessageAsPayload.
@Test
@MongoDbAvailable
public void testAdviceMessageAsPayload() throws Exception {
MessageStore store = this.getMessageStore();
Person p = new Person();
p.setFname("John");
p.setLname("Doe");
Message<Person> inputMessage = MessageBuilder.withPayload(p).build();
Message<?> messageToStore = new GenericMessage<Message<?>>(new AdviceMessage<String>("foo", inputMessage));
store.addMessage(messageToStore);
Message<?> retrievedMessage = store.getMessage(messageToStore.getHeaders().getId());
assertNotNull(retrievedMessage);
assertTrue(retrievedMessage.getPayload() instanceof AdviceMessage);
AdviceMessage<?> adviceMessage = (AdviceMessage<?>) retrievedMessage.getPayload();
assertEquals("foo", adviceMessage.getPayload());
assertEquals(messageToStore.getHeaders(), retrievedMessage.getHeaders());
assertEquals(inputMessage, adviceMessage.getInputMessage());
assertEquals(messageToStore, retrievedMessage);
}
use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class AbstractMongoDbMessageStoreTests method testInt3076MessageAsPayload.
@Test
@MongoDbAvailable
public void testInt3076MessageAsPayload() throws Exception {
MessageStore store = this.getMessageStore();
Person p = new Person();
p.setFname("John");
p.setLname("Doe");
Message<?> messageToStore = new GenericMessage<Message<?>>(MessageBuilder.withPayload(p).build());
store.addMessage(messageToStore);
Message<?> retrievedMessage = store.getMessage(messageToStore.getHeaders().getId());
assertNotNull(retrievedMessage);
assertTrue(retrievedMessage.getPayload() instanceof GenericMessage);
assertEquals(messageToStore.getPayload(), retrievedMessage.getPayload());
assertEquals(messageToStore.getHeaders(), retrievedMessage.getHeaders());
assertEquals(((Message<?>) messageToStore.getPayload()).getPayload(), p);
assertEquals(messageToStore, retrievedMessage);
}
use of org.springframework.integration.store.MessageStore in project spring-integration by spring-projects.
the class AbstractMongoDbMessageStoreTests method testInt3076AdviceMessage.
@Test
@MongoDbAvailable
public void testInt3076AdviceMessage() throws Exception {
MessageStore store = this.getMessageStore();
Person p = new Person();
p.setFname("John");
p.setLname("Doe");
Message<Person> inputMessage = MessageBuilder.withPayload(p).build();
Message<?> messageToStore = new AdviceMessage<String>("foo", inputMessage);
store.addMessage(messageToStore);
Message<?> retrievedMessage = store.getMessage(messageToStore.getHeaders().getId());
assertNotNull(retrievedMessage);
assertTrue(retrievedMessage instanceof AdviceMessage);
assertEquals(messageToStore.getPayload(), retrievedMessage.getPayload());
assertEquals(messageToStore.getHeaders(), retrievedMessage.getHeaders());
assertEquals(inputMessage, ((AdviceMessage<?>) retrievedMessage).getInputMessage());
assertEquals(messageToStore, retrievedMessage);
}
Aggregations