INT-959 added test for concurrency settings on a JMS-backed channel
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
<jms:publish-subscribe-channel id="topicNameWithResolverChannel" topic-name="foo"
|
||||
destination-resolver="destinationResolver" connection-factory="connFact"/>
|
||||
|
||||
<jms:channel id="channelWithConcurrencySettings" queue-name="foo" concurrency="11-55"/>
|
||||
|
||||
<bean id="testQueue" class="org.apache.activemq.command.ActiveMQQueue">
|
||||
<property name="physicalName" value="test.queue"/>
|
||||
</bean>
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.jms.JmsDestinationBackedMessageChannel;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.jms.listener.AbstractMessageListenerContainer;
|
||||
import org.springframework.jms.listener.DefaultMessageListenerContainer;
|
||||
import org.springframework.jms.support.destination.DestinationResolver;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -65,6 +66,9 @@ public class JmsChannelParserTests {
|
||||
@Autowired
|
||||
private MessageChannel topicNameWithResolverChannel;
|
||||
|
||||
@Autowired
|
||||
private MessageChannel channelWithConcurrencySettings;
|
||||
|
||||
@Autowired
|
||||
private Topic topic;
|
||||
|
||||
@@ -135,6 +139,16 @@ public class JmsChannelParserTests {
|
||||
assertEquals("foo", container.getDestinationName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void channelWithConcurrencySettings() {
|
||||
assertEquals(JmsDestinationBackedMessageChannel.class, channelWithConcurrencySettings.getClass());
|
||||
JmsDestinationBackedMessageChannel channel = (JmsDestinationBackedMessageChannel) channelWithConcurrencySettings;
|
||||
DirectFieldAccessor accessor = new DirectFieldAccessor(channel);
|
||||
DefaultMessageListenerContainer container = (DefaultMessageListenerContainer) accessor.getPropertyValue("container");
|
||||
assertEquals(11, container.getConcurrentConsumers());
|
||||
assertEquals(55, container.getMaxConcurrentConsumers());
|
||||
}
|
||||
|
||||
|
||||
static class TestDestinationResolver implements DestinationResolver {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user