use of org.springframework.integration.aggregator.ReleaseStrategy in project spring-integration by spring-projects.
the class ReleaseStrategyFactoryBeanTests method testRefWithNoMethodWithAnnotation.
@Test
public void testRefWithNoMethodWithAnnotation() throws Exception {
Bar bar = new Bar();
ReleaseStrategyFactoryBean factory = new ReleaseStrategyFactoryBean();
factory.setTarget(bar);
factory.afterPropertiesSet();
ReleaseStrategy delegate = factory.getObject();
assertThat(delegate, instanceOf(MethodInvokingReleaseStrategy.class));
assertThat(TestUtils.getPropertyValue(delegate, "adapter.delegate.targetObject", Bar.class), is(bar));
}
use of org.springframework.integration.aggregator.ReleaseStrategy in project spring-integration by spring-projects.
the class ReleaseStrategyFactoryBeanTests method testRefThatImplements.
@Test
public void testRefThatImplements() throws Exception {
Baz baz = new Baz();
ReleaseStrategyFactoryBean factory = new ReleaseStrategyFactoryBean();
factory.setTarget(baz);
factory.afterPropertiesSet();
ReleaseStrategy delegate = factory.getObject();
assertThat(delegate, is(baz));
}
use of org.springframework.integration.aggregator.ReleaseStrategy in project spring-integration by spring-projects.
the class ReleaseStrategyFactoryBeanTests method testRefWithNoMethodNoAnnotation.
@Test
public void testRefWithNoMethodNoAnnotation() throws Exception {
Foo foo = new Foo();
ReleaseStrategyFactoryBean factory = new ReleaseStrategyFactoryBean();
factory.setTarget(foo);
factory.afterPropertiesSet();
ReleaseStrategy delegate = factory.getObject();
assertThat(delegate, instanceOf(SequenceSizeReleaseStrategy.class));
}
use of org.springframework.integration.aggregator.ReleaseStrategy in project spring-integration by spring-projects.
the class ReleaseStrategyFactoryBeanTests method testNoRefNoMethod.
@Test
public void testNoRefNoMethod() throws Exception {
ReleaseStrategyFactoryBean factory = new ReleaseStrategyFactoryBean();
factory.afterPropertiesSet();
ReleaseStrategy delegate = factory.getObject();
assertThat(delegate, instanceOf(SequenceSizeReleaseStrategy.class));
}
use of org.springframework.integration.aggregator.ReleaseStrategy in project spring-integration by spring-projects.
the class AggregatorParserTests method testAggregatorWithPojoReleaseStrategy.
@Test
@SuppressWarnings("unchecked")
public void testAggregatorWithPojoReleaseStrategy() {
MessageChannel input = this.context.getBean("aggregatorWithPojoReleaseStrategyInput", MessageChannel.class);
EventDrivenConsumer endpoint = this.context.getBean("aggregatorWithPojoReleaseStrategy", EventDrivenConsumer.class);
ReleaseStrategy releaseStrategy = TestUtils.getPropertyValue(endpoint, "handler.releaseStrategy", ReleaseStrategy.class);
Assert.assertTrue(releaseStrategy instanceof MethodInvokingReleaseStrategy);
MessagingMethodInvokerHelper<Long> methodInvokerHelper = TestUtils.getPropertyValue(releaseStrategy, "adapter.delegate", MessagingMethodInvokerHelper.class);
Object handlerMethods = TestUtils.getPropertyValue(methodInvokerHelper, "handlerMethods");
assertNull(handlerMethods);
Object handlerMethod = TestUtils.getPropertyValue(methodInvokerHelper, "handlerMethod");
assertTrue(handlerMethod.toString().contains("checkCompleteness"));
input.send(createMessage(1L, "correlationId", 4, 0, null));
input.send(createMessage(2L, "correlationId", 4, 1, null));
input.send(createMessage(3L, "correlationId", 4, 2, null));
PollableChannel outputChannel = (PollableChannel) context.getBean("outputChannel");
Message<?> reply = outputChannel.receive(0);
Assert.assertNull(reply);
input.send(createMessage(5L, "correlationId", 4, 3, null));
reply = outputChannel.receive(0);
Assert.assertNotNull(reply);
assertEquals(11L, reply.getPayload());
}
Aggregations