diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml index 9510341478..36ee9b377d 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests-context.xml @@ -11,14 +11,22 @@ + + + + - - - + + + + + +
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java index 5a3f2e30d2..17f7674fd4 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelAdapterParserTests.java @@ -78,6 +78,7 @@ public class ChannelAdapterParserTests { message = channel.receive(100); assertNull(message); } + @Test public void methodInvokingSourceStoppedByApplicationContextInner() { String beanName = "methodInvokingSource"; @@ -148,6 +149,25 @@ public class ChannelAdapterParserTests { ((SourcePollingChannelAdapter) adapter).stop(); } + @Test + public void methodInvokingSourceWithHeaders() { + String beanName = "methodInvokingSourceWithHeaders"; + PollableChannel channel = (PollableChannel) this.applicationContext.getBean("queueChannelForHeadersTest"); + TestBean testBean = (TestBean) this.applicationContext.getBean("testBean"); + testBean.store("source test"); + Object adapter = this.applicationContext.getBean(beanName); + assertNotNull(adapter); + assertTrue(adapter instanceof SourcePollingChannelAdapter); + ((SourcePollingChannelAdapter) adapter).start(); + Message message = channel.receive(100); + ((SourcePollingChannelAdapter) adapter).stop(); + assertNotNull(message); + assertEquals("source test", testBean.getMessage()); + assertEquals("source test", message.getPayload()); + assertEquals("ABC", message.getHeaders().get("foo")); + assertEquals(123, message.getHeaders().get("bar")); + } + @Test public void methodInvokingSourceNotStarted() { String beanName = "methodInvokingSource";