This commit is contained in:
Mark Fisher
2010-03-12 02:35:46 +00:00
parent 76e8876afe
commit 0ad859461c
3 changed files with 55 additions and 4 deletions

View File

@@ -744,12 +744,20 @@
<xsd:element ref="service-activator" />
<xsd:element ref="header-enricher" />
<xsd:element ref="transformer" />
<xsd:element ref="payload-serializing-transformer" />
<xsd:element ref="payload-deserializing-transformer" />
<xsd:element ref="object-to-string-transformer" />
<xsd:element ref="filter" />
<xsd:element ref="splitter" />
<xsd:element ref="aggregator" />
<xsd:element ref="router" />
<xsd:element ref="resequencer" />
<xsd:element ref="delayer" />
<xsd:element ref="chain" />
<xsd:element ref="bridge" />
<xsd:element ref="router" />
<xsd:element ref="header-value-router" />
<xsd:element ref="payload-type-router" />
<xsd:element ref="recipient-list-router" />
<xsd:element name="gateway" type="innerGatewayType" />
<xsd:element name="poller" type="innerPollerType" />
</xsd:choice>

View File

@@ -67,6 +67,21 @@
</chain>
</chain>
<chain input-channel="payloadTypeRouterInput">
<payload-type-router>
<mapping type="java.lang.String" channel="strings"/>
<mapping type="java.lang.Number" channel="numbers"/>
</payload-type-router>
</chain>
<channel id="strings">
<queue/>
</channel>
<channel id="numbers">
<queue/>
</channel>
<beans:bean id="aggregatorBean"
class="org.springframework.integration.config.ChainParserTests$StubAggregator" />
@@ -83,5 +98,8 @@
class="org.springframework.integration.config.TestHandler">
<beans:constructor-arg value="1" />
<beans:property name="replyMessageText" value="foo" />
</beans:bean>
</beans:bean>
<beans:bean id="testOutbound" class="org.springframework.integration.config.TestOutboundAdapter"/>
</beans:beans>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 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.
@@ -71,10 +71,21 @@ public class ChainParserTests {
@Autowired
@Qualifier("beanInput")
private MessageChannel beanInput;
@Autowired
@Qualifier("aggregatorInput")
private MessageChannel aggregatorInput;
@Autowired
private MessageChannel payloadTypeRouterInput;
@Autowired
private PollableChannel strings;
@Autowired
private PollableChannel numbers;
public static Message<?> successMessage = MessageBuilder.withPayload("success").build();
@@ -144,7 +155,21 @@ public class ChainParserTests {
assertNotNull(reply);
assertEquals("foo", reply.getPayload());
}
@Test
public void chainWithPayloadTypeRouter() throws Exception {
Message<?> message1 = MessageBuilder.withPayload("test").build();
Message<?> message2 = MessageBuilder.withPayload(123).build();
this.payloadTypeRouterInput.send(message1);
this.payloadTypeRouterInput.send(message2);
Message<?> reply1 = this.strings.receive(0);
Message<?> reply2 = this.numbers.receive(0);
assertNotNull(reply1);
assertNotNull(reply2);
assertEquals("test", reply1.getPayload());
assertEquals(123, reply2.getPayload());
}
public static class StubHandler extends AbstractReplyProducingMessageHandler {
@Override