Added 'default-output-channel' attribute to the <router/> element (INT-367).
This commit is contained in:
@@ -50,4 +50,20 @@ public class RouterParserTests {
|
||||
assertNull(output1.receive(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRouterWithDefaultOutputChannel() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"routerParserTests.xml", this.getClass());
|
||||
context.start();
|
||||
MessageChannel input = (MessageChannel) context.getBean("inputForRouterWithDefaultOutput");
|
||||
PollableChannel output1 = (PollableChannel) context.getBean("output1");
|
||||
PollableChannel output2 = (PollableChannel) context.getBean("output2");
|
||||
PollableChannel defaultOutput = (PollableChannel) context.getBean("defaultOutput");
|
||||
input.send(new StringMessage("99"));
|
||||
assertNull(output1.receive(0));
|
||||
assertNull(output2.receive(0));
|
||||
Message<?> result = defaultOutput.receive(0);
|
||||
assertEquals("99", result.getPayload());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
<channel id="input"/>
|
||||
|
||||
<channel id="inputForRouterWithDefaultOutput"/>
|
||||
|
||||
<channel id="output1">
|
||||
<queue capacity="1"/>
|
||||
</channel>
|
||||
@@ -19,8 +21,16 @@
|
||||
<queue capacity="1"/>
|
||||
</channel>
|
||||
|
||||
<channel id="defaultOutput">
|
||||
<queue capacity="2"/>
|
||||
</channel>
|
||||
|
||||
<router id="router" ref="pojo" method="route" input-channel="input"/>
|
||||
|
||||
<router id="routerWithDefaultOutputChannel" ref="pojo" method="route"
|
||||
input-channel="inputForRouterWithDefaultOutput"
|
||||
default-output-channel="defaultOutput"/>
|
||||
|
||||
<beans:bean id="pojo" class="org.springframework.integration.router.config.TestRouter"/>
|
||||
|
||||
</beans:beans>
|
||||
|
||||
Reference in New Issue
Block a user