use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class MethodInvokingMessageGroupProcessorTests method testHeaderParameters.
@Test
public void testHeaderParameters() throws Exception {
class SingleAnnotationTestBean {
@Aggregator
public String method1(List<String> input, @Header("foo") String foo) {
return input.get(0) + foo;
}
}
SingleAnnotationTestBean bean = new SingleAnnotationTestBean();
MethodInvokingMessageGroupProcessor aggregator = new MethodInvokingMessageGroupProcessor(bean);
SimpleMessageGroup group = new SimpleMessageGroup("FOO");
group.add(MessageBuilder.withPayload("foo").setHeader("foo", "bar").build());
group.add(MessageBuilder.withPayload("bar").setHeader("foo", "bar").build());
assertEquals("foobar", aggregator.aggregatePayloads(group, aggregator.aggregateHeaders(group)));
}
use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class MethodInvokingMessageGroupProcessorTests method noAnnotations.
@Test
public void noAnnotations() throws Exception {
@SuppressWarnings("unused")
class NoAnnotationTestBean {
public String method1(List<String> input) {
return input.get(0);
}
String method2(List<String> input) {
return input.get(1);
}
}
NoAnnotationTestBean bean = new NoAnnotationTestBean();
MethodInvokingMessageGroupProcessor aggregator = new MethodInvokingMessageGroupProcessor(bean);
SimpleMessageGroup group = new SimpleMessageGroup("FOO");
group.add(new GenericMessage<String>("foo"));
group.add(new GenericMessage<String>("bar"));
assertEquals("foo", aggregator.aggregatePayloads(group, null));
}
use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class MethodInvokingMessageGroupProcessorTests method singleAnnotation.
@Test
public void singleAnnotation() throws Exception {
@SuppressWarnings("unused")
class SingleAnnotationTestBean {
@Aggregator
public String method1(List<String> input) {
return input.get(0);
}
public String method2(List<String> input) {
return input.get(1);
}
}
SingleAnnotationTestBean bean = new SingleAnnotationTestBean();
MethodInvokingMessageGroupProcessor aggregator = new MethodInvokingMessageGroupProcessor(bean);
SimpleMessageGroup group = new SimpleMessageGroup("FOO");
group.add(new GenericMessage<String>("foo"));
group.add(new GenericMessage<String>("bar"));
assertEquals("foo", aggregator.aggregatePayloads(group, null));
}
use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class MethodInvokingMessageGroupProcessorTests method testHeadersParameters.
@Test
public void testHeadersParameters() throws Exception {
class SingleAnnotationTestBean {
@Aggregator
public String method1(List<String> input, @Headers Map<String, ?> map) {
return input.get(0) + map.get("foo");
}
}
SingleAnnotationTestBean bean = new SingleAnnotationTestBean();
MethodInvokingMessageGroupProcessor aggregator = new MethodInvokingMessageGroupProcessor(bean);
SimpleMessageGroup group = new SimpleMessageGroup("FOO");
group.add(MessageBuilder.withPayload("foo").setHeader("foo", "bar").build());
group.add(MessageBuilder.withPayload("bar").setHeader("foo", "bar").build());
assertEquals("foobar", aggregator.aggregatePayloads(group, aggregator.aggregateHeaders(group)));
}
use of org.springframework.integration.store.SimpleMessageGroup in project spring-integration by spring-projects.
the class SequenceSizeReleaseStrategyTests method groupWithLastAndFirstMessagesOfIncompleteSequence.
private MessageGroup groupWithLastAndFirstMessagesOfIncompleteSequence() {
SimpleMessageGroup messages = new SimpleMessageGroup("FOO");
Message<String> message1 = MessageBuilder.withPayload("test1").setSequenceSize(3).setSequenceNumber(3).build();
Message<String> message2 = MessageBuilder.withPayload("test2").setSequenceSize(3).setSequenceNumber(1).build();
messages.add(message1);
messages.add(message2);
return messages;
}
Aggregations