From f7acb3df946fa9e3a603a5af5755bba1827f3add Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Tue, 11 Jan 2011 19:37:53 -0500 Subject: [PATCH] INT-1708, INT-1709 added test to make sure that 'errorChannel' header takes precedence over 'error-channel' attribute --- ...AbstractPollingInboundChannelAdapterParser.java | 1 - .../config/xml/PollerWithErrorChannel-context.xml | 10 ++++++++++ .../config/xml/PollerWithErrorChannel.java | 14 ++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractPollingInboundChannelAdapterParser.java b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractPollingInboundChannelAdapterParser.java index d04a9d4851..146a04c6ab 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractPollingInboundChannelAdapterParser.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/xml/AbstractPollingInboundChannelAdapterParser.java @@ -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; diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel-context.xml index 93cc274774..e0fe737657 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel-context.xml @@ -17,9 +17,19 @@ + + + + + + + + + diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel.java b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel.java index 96459f6bf2..3a135f0d25 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/xml/PollerWithErrorChannel.java @@ -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(); }