use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsMessageDrivenChannelAdapterParserTests method testAdapterWithIdleConsumerLimit.
@Test
public void testAdapterWithIdleConsumerLimit() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsInboundWithContainerSettings.xml", this.getClass());
JmsMessageDrivenEndpoint adapter = (JmsMessageDrivenEndpoint) context.getBean("adapterWithIdleConsumerLimit.adapter");
adapter.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer) new DirectFieldAccessor(adapter).getPropertyValue("listenerContainer");
assertEquals(33, new DirectFieldAccessor(container).getPropertyValue("idleConsumerLimit"));
assertEquals(3, new DirectFieldAccessor(container).getPropertyValue("cacheLevel"));
adapter.stop();
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsMessageDrivenChannelAdapterParserTests method adapterWithDurableSubscription.
@Test
public void adapterWithDurableSubscription() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsInboundWithDurableSubscription.xml", this.getClass());
JmsMessageDrivenEndpoint endpoint = context.getBean("messageDrivenAdapter", JmsMessageDrivenEndpoint.class);
DefaultMessageListenerContainer container = (DefaultMessageListenerContainer) new DirectFieldAccessor(endpoint).getPropertyValue("listenerContainer");
assertEquals(Boolean.TRUE, container.isPubSubDomain());
assertEquals(Boolean.TRUE, container.isSubscriptionDurable());
assertEquals("testDurableSubscriptionName", container.getDurableSubscriptionName());
assertEquals("testClientId", container.getClientId());
assertTrue(container.isSubscriptionShared());
endpoint.stop();
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsMessageDrivenChannelAdapterParserTests method testAdapterWithRecoveryInterval.
@Test
public void testAdapterWithRecoveryInterval() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsInboundWithContainerSettings.xml", this.getClass());
JmsMessageDrivenEndpoint adapter = (JmsMessageDrivenEndpoint) context.getBean("adapterWithRecoveryInterval.adapter");
adapter.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer) new DirectFieldAccessor(adapter).getPropertyValue("listenerContainer");
Object recoveryInterval;
try {
recoveryInterval = TestUtils.getPropertyValue(container, "recoveryInterval");
} catch (NotReadablePropertyException e) {
recoveryInterval = TestUtils.getPropertyValue(container, "backOff.interval");
}
assertEquals(2222L, recoveryInterval);
adapter.stop();
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsMessageDrivenChannelAdapterParserTests method testAdapterWithContainerClass.
@Test
public void testAdapterWithContainerClass() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsInboundWithContainerClass.xml", this.getClass());
JmsMessageDrivenEndpoint adapter = context.getBean("adapterWithIdleConsumerLimit.adapter", JmsMessageDrivenEndpoint.class);
MessageChannel channel = context.getBean("adapterWithIdleConsumerLimit", MessageChannel.class);
assertSame(channel, TestUtils.getPropertyValue(adapter, "listener.gatewayDelegate.requestChannel"));
adapter.start();
FooContainer container = TestUtils.getPropertyValue(adapter, "listenerContainer", FooContainer.class);
assertSame(container, context.getBean("adapterWithIdleConsumerLimit.container"));
assertEquals(33, new DirectFieldAccessor(container).getPropertyValue("idleConsumerLimit"));
assertEquals(3, new DirectFieldAccessor(container).getPropertyValue("cacheLevel"));
assertSame(context.getBean("adapterWithIdleConsumerLimit.listener"), TestUtils.getPropertyValue(container, "messageListener"));
adapter.stop();
adapter = context.getBean("adapterWithIdleConsumerLimit2.adapter", JmsMessageDrivenEndpoint.class);
channel = context.getBean("adapterWithIdleConsumerLimit2", MessageChannel.class);
assertSame(channel, TestUtils.getPropertyValue(adapter, "listener.gatewayDelegate.requestChannel"));
adapter.start();
container = TestUtils.getPropertyValue(adapter, "listenerContainer", FooContainer.class);
assertSame(container, context.getBean("adapterWithIdleConsumerLimit2.container"));
assertEquals(33, new DirectFieldAccessor(container).getPropertyValue("idleConsumerLimit"));
assertEquals(3, new DirectFieldAccessor(container).getPropertyValue("cacheLevel"));
adapter.stop();
adapter = context.getBean("org.springframework.integration.jms.JmsMessageDrivenEndpoint#0", JmsMessageDrivenEndpoint.class);
channel = context.getBean("in", MessageChannel.class);
assertSame(channel, TestUtils.getPropertyValue(adapter, "listener.gatewayDelegate.requestChannel"));
adapter.start();
container = TestUtils.getPropertyValue(adapter, "listenerContainer", FooContainer.class);
assertSame(container, context.getBean("org.springframework.integration.jms.JmsMessageDrivenEndpoint#0.container"));
assertEquals(33, new DirectFieldAccessor(container).getPropertyValue("idleConsumerLimit"));
assertEquals(3, new DirectFieldAccessor(container).getPropertyValue("cacheLevel"));
adapter.stop();
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsInboundGatewayParserTests method testGatewayWithMessageConverter.
@Test
public void testGatewayWithMessageConverter() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsGatewayWithMessageConverter.xml", this.getClass());
PollableChannel channel = (PollableChannel) context.getBean("requestChannel");
JmsMessageDrivenEndpoint gateway = (JmsMessageDrivenEndpoint) context.getBean("jmsGateway");
assertEquals(JmsMessageDrivenEndpoint.class, gateway.getClass());
context.start();
Message<?> message = channel.receive(10000);
assertNotNull("message should not be null", message);
assertEquals("converted-test-message", message.getPayload());
context.close();
}
Aggregations