use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class InnerDefinitionHandlerAwareEndpointParserTests method testSADefinitionSuccess.
private void testSADefinitionSuccess(String configProperty) {
ApplicationContext ac = this.bootStrap(configProperty);
EventDrivenConsumer splitter = (EventDrivenConsumer) ac.getBean("testServiceActivator");
Assert.assertNotNull(splitter);
MessageBuilder<String> inChannelMessageBuilder = MessageBuilder.withPayload("1");
Message<String> inMessage = inChannelMessageBuilder.build();
DirectChannel inChannel = (DirectChannel) ac.getBean("inChannel");
inChannel.send(inMessage);
PollableChannel channel1 = (PollableChannel) ac.getBean("outChannel");
Assert.assertTrue(channel1.receive().getPayload().equals("1"));
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class InnerDefinitionHandlerAwareEndpointParserTests method testTransformerDefinitionSuccess.
private void testTransformerDefinitionSuccess(String configProperty) {
ApplicationContext ac = this.bootStrap(configProperty);
EventDrivenConsumer transformer = (EventDrivenConsumer) ac.getBean("testTransformer");
Assert.assertNotNull(transformer);
MessageBuilder<String[]> inChannelMessageBuilder = MessageBuilder.withPayload(new String[] { "One", "Two" });
Message<String[]> inMessage = inChannelMessageBuilder.build();
DirectChannel inChannel = (DirectChannel) ac.getBean("inChannel");
inChannel.send(inMessage);
PollableChannel outChannel = (PollableChannel) ac.getBean("outChannel");
String payload = (String) outChannel.receive().getPayload();
Assert.assertTrue(payload.equals("One,Two"));
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class FilterAnnotationPostProcessorTests method filterAnnotationWithAdviceArray.
@Test
public void filterAnnotationWithAdviceArray() {
TestAdvice advice = new TestAdvice();
context.registerBean("adviceChain", new TestAdvice[] { advice });
testValidFilter(new TestFilterWithAdviceDiscardWithin());
EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("testFilter.filter.filter");
assertSame(advice, TestUtils.getPropertyValue(endpoint, "handler.adviceChain", List.class).get(0));
assertTrue(TestUtils.getPropertyValue(endpoint, "handler.postProcessWithinAdvice", Boolean.class));
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class FilterAnnotationPostProcessorTests method filterAnnotationWithAdviceArrayTwice.
@Test
public void filterAnnotationWithAdviceArrayTwice() {
TestAdvice advice1 = new TestAdvice();
TestAdvice advice2 = new TestAdvice();
context.registerBean("adviceChain1", new TestAdvice[] { advice1, advice2 });
TestAdvice advice3 = new TestAdvice();
TestAdvice advice4 = new TestAdvice();
context.registerBean("adviceChain2", new TestAdvice[] { advice3, advice4 });
testValidFilter(new TestFilterWithAdviceDiscardWithinTwice());
EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("testFilter.filter.filter");
List<?> adviceList = TestUtils.getPropertyValue(endpoint, "handler.adviceChain", List.class);
assertEquals(4, adviceList.size());
assertSame(advice1, adviceList.get(0));
assertSame(advice2, adviceList.get(1));
assertSame(advice3, adviceList.get(2));
assertSame(advice4, adviceList.get(3));
assertTrue(TestUtils.getPropertyValue(endpoint, "handler.postProcessWithinAdvice", Boolean.class));
}
use of org.springframework.integration.endpoint.EventDrivenConsumer in project spring-integration by spring-projects.
the class FilterAnnotationPostProcessorTests method filterAnnotationWithAdviceDiscardWithinTwice.
@Test
public void filterAnnotationWithAdviceDiscardWithinTwice() {
TestAdvice advice1 = new TestAdvice();
TestAdvice advice2 = new TestAdvice();
context.registerBean("adviceChain1", advice1);
context.registerBean("adviceChain2", advice2);
testValidFilter(new TestFilterWithAdviceDiscardWithinTwice());
EventDrivenConsumer endpoint = (EventDrivenConsumer) context.getBean("testFilter.filter.filter");
List<?> adviceList = TestUtils.getPropertyValue(endpoint, "handler.adviceChain", List.class);
assertEquals(2, adviceList.size());
assertSame(advice1, adviceList.get(0));
assertSame(advice2, adviceList.get(1));
assertTrue(TestUtils.getPropertyValue(endpoint, "handler.postProcessWithinAdvice", Boolean.class));
}
Aggregations