INT-1708, INT-1709 added test to make sure that 'errorChannel' header takes precedence over 'error-channel' attribute

This commit is contained in:
Oleg Zhurakousky
2011-01-11 19:37:53 -05:00
parent 4bd0cb2c4b
commit f7acb3df94
3 changed files with 22 additions and 3 deletions

View File

@@ -22,7 +22,6 @@ import org.springframework.beans.BeanMetadataElement;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.channel.MessagePublishingErrorHandler;
import org.springframework.util.StringUtils;
import org.springframework.util.xml.DomUtils;

View File

@@ -17,9 +17,19 @@
<int:poller fixed-rate="1000"/>
</int:inbound-channel-adapter>
<int:inbound-channel-adapter id="withErrorChannelAndHeader" expression="5/0"
channel="serviceChannel" auto-startup="false" error-channel="eChannel">
<int:poller fixed-rate="1000"/>
<int:header name="errorChannel" value="errChannel"/>
</int:inbound-channel-adapter>
<int:channel id="serviceChannel"/>
<int:channel id="eChannel">
<int:queue/>
</int:channel>
<int:channel id="errChannel">
<int:queue/>
</int:channel>
</beans>

View File

@@ -36,7 +36,7 @@ public class PollerWithErrorChannel {
SourcePollingChannelAdapter adapter = ac.getBean("withErrorHeader", SourcePollingChannelAdapter.class);
adapter.start();
PollableChannel errorChannel = ac.getBean("eChannel", PollableChannel.class);
assertNotNull(errorChannel.receive(100000));
assertNotNull(errorChannel.receive(1000));
adapter.stop();
}
@@ -46,7 +46,17 @@ public class PollerWithErrorChannel {
SourcePollingChannelAdapter adapter = ac.getBean("withErrorChannel", SourcePollingChannelAdapter.class);
adapter.start();
PollableChannel errorChannel = ac.getBean("eChannel", PollableChannel.class);
assertNotNull(errorChannel.receive(100000));
assertNotNull(errorChannel.receive(1000));
adapter.stop();
}
@Test
public void testWithErrorChannelAndHeader() throws Exception{
ApplicationContext ac = new ClassPathXmlApplicationContext("PollerWithErrorChannel-context.xml", this.getClass());
SourcePollingChannelAdapter adapter = ac.getBean("withErrorChannelAndHeader", SourcePollingChannelAdapter.class);
adapter.start();
PollableChannel errorChannel = ac.getBean("errChannel", PollableChannel.class);
assertNotNull(errorChannel.receive(1000));
adapter.stop();
}