diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelParserTests.java
index c0b1f00e31..e25623cbff 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelParserTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/ChannelParserTests.java
@@ -29,6 +29,7 @@ import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.dispatcher.DefaultMessageDispatcher;
+import org.springframework.integration.dispatcher.DispatcherPolicy;
import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
@@ -108,6 +109,32 @@ public class ChannelParserTests {
assertEquals(2, counter.get());
}
+ @Test
+ public void testDefaultDispatcherPolicy() throws InterruptedException {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ "channelParserTests.xml", this.getClass());
+ MessageChannel channel = (MessageChannel) context.getBean("pointToPointChannelByDefault");
+ DispatcherPolicy dispatcherPolicy = channel.getDispatcherPolicy();
+ assertFalse(dispatcherPolicy.isPublishSubscribe());
+ assertEquals(DispatcherPolicy.DEFAULT_MAX_MESSAGES_PER_TASK, dispatcherPolicy.getMaxMessagesPerTask());
+ assertEquals(DispatcherPolicy.DEFAULT_RECEIVE_TIMEOUT, dispatcherPolicy.getReceiveTimeout());
+ assertEquals(DispatcherPolicy.DEFAULT_REJECTION_LIMIT, dispatcherPolicy.getRejectionLimit());
+ assertEquals(DispatcherPolicy.DEFAULT_RETRY_INTERVAL, dispatcherPolicy.getRetryInterval());
+ }
+
+ @Test
+ public void testDispatcherPolicyConfiguration() throws InterruptedException {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ "channelParserTests.xml", this.getClass());
+ MessageChannel channel = (MessageChannel) context.getBean("channelWithDispatcherPolicy");
+ DispatcherPolicy dispatcherPolicy = channel.getDispatcherPolicy();
+ assertTrue(dispatcherPolicy.isPublishSubscribe());
+ assertEquals(7, dispatcherPolicy.getMaxMessagesPerTask());
+ assertEquals(77, dispatcherPolicy.getReceiveTimeout());
+ assertEquals(777, dispatcherPolicy.getRejectionLimit());
+ assertEquals(7777, dispatcherPolicy.getRetryInterval());
+ }
+
private static class TestHandler implements MessageHandler {
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/EndpointParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/config/EndpointParserTests.java
index cfc87b8e3d..77786271df 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/EndpointParserTests.java
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/EndpointParserTests.java
@@ -25,6 +25,8 @@ import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.channel.MessageChannel;
+import org.springframework.integration.endpoint.ConcurrencyPolicy;
+import org.springframework.integration.endpoint.DefaultMessageEndpoint;
import org.springframework.integration.message.GenericMessage;
/**
@@ -58,4 +60,28 @@ public class EndpointParserTests {
assertEquals("test", bean.getMessage());
}
+ @Test
+ public void testDefaultConcurrency() throws InterruptedException {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ "endpointConcurrencyTests.xml", this.getClass());
+ DefaultMessageEndpoint endpoint = (DefaultMessageEndpoint) context.getBean("defaultConcurrencyEndpoint");
+ ConcurrencyPolicy concurrencyPolicy = endpoint.getConcurrencyPolicy();
+ assertEquals(ConcurrencyPolicy.DEFAULT_CORE_SIZE, concurrencyPolicy.getCoreSize());
+ assertEquals(ConcurrencyPolicy.DEFAULT_MAX_SIZE, concurrencyPolicy.getMaxSize());
+ assertEquals(ConcurrencyPolicy.DEFAULT_QUEUE_CAPACITY, concurrencyPolicy.getQueueCapacity());
+ assertEquals(ConcurrencyPolicy.DEFAULT_KEEP_ALIVE_SECONDS, concurrencyPolicy.getKeepAliveSeconds());
+ }
+
+ @Test
+ public void testConfiguredConcurrency() throws InterruptedException {
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ "endpointConcurrencyTests.xml", this.getClass());
+ DefaultMessageEndpoint endpoint = (DefaultMessageEndpoint) context.getBean("configuredConcurrencyEndpoint");
+ ConcurrencyPolicy concurrencyPolicy = endpoint.getConcurrencyPolicy();
+ assertEquals(7, concurrencyPolicy.getCoreSize());
+ assertEquals(77, concurrencyPolicy.getMaxSize());
+ assertEquals(777, concurrencyPolicy.getQueueCapacity());
+ assertEquals(7777, concurrencyPolicy.getKeepAliveSeconds());
+ }
+
}
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/channelParserTests.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/channelParserTests.xml
index fa89cefff3..4ab0159f98 100644
--- a/spring-integration-core/src/test/java/org/springframework/integration/config/channelParserTests.xml
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/channelParserTests.xml
@@ -15,4 +15,8 @@
+
+
+
+
diff --git a/spring-integration-core/src/test/java/org/springframework/integration/config/endpointConcurrencyTests.xml b/spring-integration-core/src/test/java/org/springframework/integration/config/endpointConcurrencyTests.xml
new file mode 100644
index 0000000000..c30332be5b
--- /dev/null
+++ b/spring-integration-core/src/test/java/org/springframework/integration/config/endpointConcurrencyTests.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+