INT-825 the <chain> element now accepts an inner poller with a 'ref' attribute

This commit is contained in:
Mark Fisher
2009-10-06 23:15:43 +00:00
parent edd20ce126
commit 5e5b037bde
3 changed files with 36 additions and 12 deletions

View File

@@ -6,7 +6,11 @@
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
<channel id="pollableInput">
<channel id="pollableInput1">
<queue />
</channel>
<channel id="pollableInput2">
<queue />
</channel>
@@ -32,7 +36,7 @@
<service-activator ref="testHandler" />
</chain>
<chain input-channel="pollableInput" output-channel="output">
<chain input-channel="pollableInput1" output-channel="output">
<poller>
<interval-trigger interval="10000" />
</poller>
@@ -40,6 +44,15 @@
<service-activator ref="testHandler" />
</chain>
<chain input-channel="pollableInput2" output-channel="output">
<poller ref="topLevelPoller"/>
<service-activator ref="testHandler" />
</chain>
<poller id="topLevelPoller">
<interval-trigger interval="5000" />
</poller>
<chain input-channel="beanInput" output-channel="output">
<beans:bean
class="org.springframework.integration.config.ChainParserTests$StubHandler" />
@@ -69,5 +82,5 @@
class="org.springframework.integration.config.TestHandler">
<beans:constructor-arg value="1" />
<beans:property name="replyMessageText" value="foo" />
</beans:bean>
</beans:bean>
</beans:beans>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,11 +16,9 @@
package org.springframework.integration.config;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import java.util.List;
@@ -52,8 +50,12 @@ public class ChainParserTests {
private MessageChannel filterInput;
@Autowired
@Qualifier("pollableInput")
private MessageChannel pollableInput;
@Qualifier("pollableInput1")
private MessageChannel pollableInput1;
@Autowired
@Qualifier("pollableInput2")
private MessageChannel pollableInput2;
@Autowired
@Qualifier("headerEnricherInput")
@@ -107,14 +109,23 @@ public class ChainParserTests {
}
@Test
public void chainWithPollableInput() {
public void chainWithPollableInput() {
Message<?> message = MessageBuilder.withPayload("test").build();
this.pollableInput.send(message);
this.pollableInput1.send(message);
Message<?> reply = this.output.receive(3000);
assertNotNull(reply);
assertEquals("foo", reply.getPayload());
}
@Test
public void chainWithPollerReference() {
Message<?> message = MessageBuilder.withPayload("test").build();
this.pollableInput2.send(message);
Message<?> reply = this.output.receive(3000);
assertNotNull(reply);
assertEquals("foo", reply.getPayload());
}
@Test
@SuppressWarnings("unchecked")
public void chainHandlerBean() throws Exception {