INT-2316: xsd improve for reply- & error-channels

Now <header-enricher> <reply-channel> & <error-channel> are 'referenceOrValueHeaderType'.
Added tests for 'value' & 'expression' attributes on <reply-channel> element.
This commit is contained in:
Artem Bilan
2011-12-20 16:21:14 +02:00
committed by Mark Fisher
parent ba9041d641
commit d7851fef5a
3 changed files with 40 additions and 6 deletions

View File

@@ -11,6 +11,14 @@
<reply-channel ref="testReplyChannel"/>
</header-enricher>
<header-enricher input-channel="replyChannelNameInput" output-channel="echoInput">
<reply-channel value="testReplyChannel"/>
</header-enricher>
<header-enricher input-channel="replyChannelExpressionInput" output-channel="echoInput">
<reply-channel expression="@testReplyChannel" type="org.springframework.integration.MessageChannel"/>
</header-enricher>
<transformer input-channel="echoInput" expression="payload.toUpperCase()"/>
<channel id="testReplyChannel">

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 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.
@@ -60,6 +60,28 @@ public class HeaderEnricherTests {
assertEquals(replyChannel, result.getHeaders().getReplyChannel());
}
@Test //INT-2316
public void replyChannelName() {
PollableChannel replyChannel = context.getBean("testReplyChannel", PollableChannel.class);
MessageChannel inputChannel = context.getBean("replyChannelNameInput", MessageChannel.class);
inputChannel.send(new GenericMessage<String>("test"));
Message<?> result = replyChannel.receive(0);
assertNotNull(result);
assertEquals("TEST", result.getPayload());
assertEquals("testReplyChannel", result.getHeaders().getReplyChannel());
}
@Test //INT-2316
public void replyChannelExpression() {
PollableChannel replyChannel = context.getBean("testReplyChannel", PollableChannel.class);
MessageChannel inputChannel = context.getBean("replyChannelExpressionInput", MessageChannel.class);
inputChannel.send(new GenericMessage<String>("test"));
Message<?> result = replyChannel.receive(0);
assertNotNull(result);
assertEquals("TEST", result.getPayload());
assertEquals(replyChannel, result.getHeaders().getReplyChannel());
}
@Test
public void errorChannel() {
PollableChannel errorChannel = context.getBean("testErrorChannel", PollableChannel.class);