INT-2605: add SmartLifecycle support for 'chain'

* polishing TCP test to use SmartLifecycle from 'chain'
* polishing XSD to exclude using 'poller' element inside 'nested-chain'

INT-2605: eliminate breaking change in the XSD
This commit is contained in:
Artem Bilan
2012-06-19 16:02:56 +03:00
committed by Gary Russell
parent 6fea731809
commit de73c39488
8 changed files with 210 additions and 77 deletions

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd">
<chain id="chain"
input-channel="input"
auto-startup="false"
phase="256"
send-timeout="3000">
<service-activator expression="payload"/>
</chain>
</beans:beans>

View File

@@ -39,14 +39,14 @@
</chain>
<chain input-channel="pollableInput1" output-channel="output">
<poller fixed-delay="10000" />
<filter ref="typeSelector" />
<poller fixed-delay="10000" />
<service-activator ref="testHandler" />
</chain>
<chain input-channel="pollableInput2" output-channel="output">
<poller ref="topLevelPoller"/>
<service-activator ref="testHandler" />
<poller ref="topLevelPoller"/>
</chain>
<poller id="topLevelPoller" fixed-delay="5000" />
@@ -86,7 +86,7 @@
<claim-check-in/>
<claim-check-out/>
</chain>
<channel id="claimCheckOutput">
<queue/>
</channel>
@@ -132,7 +132,7 @@
<beans:constructor-arg value="1" />
<beans:property name="replyMessageText" value="foo" />
</beans:bean>
<beans:bean id="messageStore" class="org.springframework.integration.store.SimpleMessageStore"/>
</beans:beans>

View File

@@ -34,6 +34,7 @@ import org.springframework.integration.handler.AbstractReplyProducingMessageHand
import org.springframework.integration.handler.MessageHandlerChain;
import org.springframework.integration.message.MessageMatcher;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.integration.test.util.TestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.StringUtils;
@@ -289,6 +290,16 @@ public class ChainParserTests {
}
}
@Test //INT-2605
public void checkSmartLifecycleConfig() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("ChainParserSmartLifecycleAttributesTest.xml", this.getClass());
MessageHandlerChain handlerChain = ctx.getBean(MessageHandlerChain.class);
assertEquals(false, handlerChain.isAutoStartup());
assertEquals(256, handlerChain.getPhase());
assertEquals(3000L, TestUtils.getPropertyValue(handlerChain, "sendTimeout"));
assertEquals(false, TestUtils.getPropertyValue(handlerChain, "running"));
}
public static class StubHandler extends AbstractReplyProducingMessageHandler {
@Override
protected Object handleRequestMessage(Message<?> requestMessage) {