use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsInboundGatewayParserTests method testGatewayWithContainerSettings.
@Test
public void testGatewayWithContainerSettings() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsGatewayWithContainerSettings.xml", this.getClass());
JmsMessageDrivenEndpoint gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithConcurrentConsumers");
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
assertEquals(3, new DirectFieldAccessor(container).getPropertyValue("concurrentConsumers"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithMaxConcurrentConsumers");
container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
assertEquals(22, new DirectFieldAccessor(container).getPropertyValue("maxConcurrentConsumers"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithMaxMessagesPerTask");
container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
assertEquals(99, new DirectFieldAccessor(container).getPropertyValue("maxMessagesPerTask"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithReceiveTimeout");
container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
assertEquals(1111L, new DirectFieldAccessor(container).getPropertyValue("receiveTimeout"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithRecoveryInterval");
container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
Object recoveryInterval;
try {
recoveryInterval = TestUtils.getPropertyValue(container, "recoveryInterval");
} catch (NotReadablePropertyException e) {
recoveryInterval = TestUtils.getPropertyValue(container, "backOff.interval");
}
assertEquals(2222L, recoveryInterval);
gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithIdleTaskExecutionLimit");
container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
assertEquals(7, new DirectFieldAccessor(container).getPropertyValue("idleTaskExecutionLimit"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithIdleConsumerLimit");
container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
assertEquals(33, new DirectFieldAccessor(container).getPropertyValue("idleConsumerLimit"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithMessageSelector");
container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
String messageSelector = (String) new DirectFieldAccessor(container).getPropertyValue("messageSelector");
assertEquals("TestProperty = 'foo'", messageSelector);
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsInboundGatewayParserTests method testGatewayWithExtractPayloadAttributes.
@Test
public void testGatewayWithExtractPayloadAttributes() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsGatewaysWithExtractPayloadAttributes.xml", this.getClass());
JmsMessageDrivenEndpoint gateway = (JmsMessageDrivenEndpoint) context.getBean("defaultGateway");
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("listener"));
assertEquals(Boolean.TRUE, accessor.getPropertyValue("extractReplyPayload"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("extractReplyPayloadTrue");
accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("listener"));
assertEquals(Boolean.TRUE, accessor.getPropertyValue("extractReplyPayload"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("extractReplyPayloadFalse");
accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("listener"));
assertEquals(Boolean.FALSE, accessor.getPropertyValue("extractReplyPayload"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("extractRequestPayloadTrue");
accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("listener"));
assertEquals(Boolean.TRUE, accessor.getPropertyValue("extractRequestPayload"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("extractRequestPayloadFalse");
accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("listener"));
assertEquals(Boolean.FALSE, accessor.getPropertyValue("extractRequestPayload"));
context.close();
}
Aggregations