use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class AggregatingMessageGroupProcessorHeaderTests method twoMessagesWithConflicts.
private void twoMessagesWithConflicts(MessageGroupProcessor processor) {
Map<String, Object> headers1 = new HashMap<String, Object>();
headers1.put("k1", "foo");
headers1.put("k2", new Integer(123));
Message<?> message1 = correlatedMessage(1, 2, 1, headers1);
Map<String, Object> headers2 = new HashMap<String, Object>();
headers2.put("k1", "bar");
headers2.put("k2", new Integer(123));
Message<?> message2 = correlatedMessage(1, 2, 2, headers2);
List<Message<?>> messages = Arrays.<Message<?>>asList(message1, message2);
MessageGroup group = new SimpleMessageGroup(messages, 1);
Object result = processor.processMessageGroup(group);
assertNotNull(result);
assertTrue(result instanceof Message<?>);
Message<?> resultMessage = (Message<?>) result;
assertNull(resultMessage.getHeaders().get("k1"));
assertEquals(123, resultMessage.getHeaders().get("k2"));
}
use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class ResequencingMessageGroupProcessorTests method shouldPartiallProcessIncompleteSequence.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void shouldPartiallProcessIncompleteSequence() {
Message prototypeMessage = MessageBuilder.withPayload("foo").setCorrelationId("x").setSequenceNumber(1).setSequenceSize(4).build();
List<Message<?>> messages = new ArrayList<Message<?>>();
Message message2 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(4).build();
Message message1 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(1).build();
Message message3 = MessageBuilder.fromMessage(prototypeMessage).setSequenceNumber(3).build();
messages.add(message1);
messages.add(message2);
messages.add(message3);
SimpleMessageGroup group = new SimpleMessageGroup(messages, "x");
List<Message> processedMessages = (List<Message>) processor.processMessageGroup(group);
assertThat(processedMessages, hasItems(message1));
assertThat(processedMessages.size(), is(1));
}
use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class TimeoutCountSequenceSizeReleaseStrategyTests method testCompleteList.
@Test
public void testCompleteList() {
Message<String> message1 = MessageBuilder.withPayload("test1").setSequenceSize(2).build();
Message<String> message2 = MessageBuilder.withPayload("test2").setSequenceSize(2).build();
SimpleMessageGroup messages = new SimpleMessageGroup("FOO");
messages.add(message1);
messages.add(message2);
SequenceSizeReleaseStrategy releaseStrategy = new SequenceSizeReleaseStrategy();
assertTrue(releaseStrategy.canRelease(messages));
}
use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class TimeoutCountSequenceSizeReleaseStrategyTests method testIncompleteListWithCount.
@Test
public void testIncompleteListWithCount() {
Message<String> message = MessageBuilder.withPayload("test1").setSequenceSize(2).build();
SimpleMessageGroup messages = new SimpleMessageGroup("FOO");
messages.add(message);
TimeoutCountSequenceSizeReleaseStrategy releaseStrategy = new TimeoutCountSequenceSizeReleaseStrategy(1, TimeoutCountSequenceSizeReleaseStrategy.DEFAULT_TIMEOUT);
assertTrue(releaseStrategy.canRelease(messages));
}
use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class GemfireGroupStoreTests method testNonExistingEmptyMessageGroup.
@Test
public void testNonExistingEmptyMessageGroup() throws Exception {
GemfireMessageStore store = new GemfireMessageStore(region);
MessageGroup messageGroup = store.getMessageGroup(1);
assertNotNull(messageGroup);
assertTrue(messageGroup instanceof SimpleMessageGroup);
assertEquals(0, messageGroup.size());
}
Aggregations