use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsInboundGatewayParserTests method testTransactionManager.
@Test
public void testTransactionManager() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsGatewayTransactionManagerTests.xml", this.getClass());
JmsMessageDrivenEndpoint gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithoutTransactionManager");
DirectFieldAccessor accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("listenerContainer"));
assertNull(accessor.getPropertyValue("transactionManager"));
gateway = (JmsMessageDrivenEndpoint) context.getBean("gatewayWithTransactionManager");
accessor = new DirectFieldAccessor(gateway);
accessor = new DirectFieldAccessor(accessor.getPropertyValue("listenerContainer"));
Object txManager = accessor.getPropertyValue("transactionManager");
assertEquals(JmsTransactionManager.class, txManager.getClass());
assertEquals(context.getBean("txManager"), txManager);
assertEquals(context.getBean("testConnectionFactory"), ((JmsTransactionManager) txManager).getConnectionFactory());
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsInboundGatewayParserTests method testGatewayWithContainerReference.
@Test
public void testGatewayWithContainerReference() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("inboundGatewayWithContainerReference.xml", this.getClass());
JmsMessageDrivenEndpoint gateway = context.getBean("gatewayWithContainerReference", JmsMessageDrivenEndpoint.class);
AbstractMessageListenerContainer messageListenerContainer = context.getBean("messageListenerContainer", AbstractMessageListenerContainer.class);
assertFalse(gateway.isRunning());
assertFalse(messageListenerContainer.isRunning());
SmartLifecycleRoleController roleController = context.getBean(SmartLifecycleRoleController.class);
@SuppressWarnings("unchecked") MultiValueMap<String, SmartLifecycle> lifecycles = TestUtils.getPropertyValue(roleController, "lifecycles", MultiValueMap.class);
assertTrue(lifecycles.containsKey("foo"));
assertSame(gateway, lifecycles.getFirst("foo"));
gateway.start();
AbstractMessageListenerContainer container = (AbstractMessageListenerContainer) new DirectFieldAccessor(gateway).getPropertyValue("listenerContainer");
assertEquals(messageListenerContainer, container);
assertTrue(gateway.isRunning());
assertTrue(messageListenerContainer.isRunning());
gateway.stop();
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsInboundGatewayParserTests method testGatewayWithConnectionFactoryAndDestinationName.
@Test
public void testGatewayWithConnectionFactoryAndDestinationName() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsGatewayWithConnectionFactoryAndDestinationName.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("message-driven-test", message.getPayload());
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsInboundGatewayParserTests method testGatewayWithReplyQosProperties.
@Test
public void testGatewayWithReplyQosProperties() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("inboundGatewayWithReplyQos.xml", this.getClass());
JmsMessageDrivenEndpoint gateway = context.getBean("gatewayWithReplyQos", JmsMessageDrivenEndpoint.class);
DirectFieldAccessor accessor = new DirectFieldAccessor(new DirectFieldAccessor(gateway).getPropertyValue("listener"));
assertEquals(12345L, accessor.getPropertyValue("replyTimeToLive"));
assertEquals(7, accessor.getPropertyValue("replyPriority"));
assertEquals(DeliveryMode.NON_PERSISTENT, accessor.getPropertyValue("replyDeliveryMode"));
assertEquals(true, accessor.getPropertyValue("explicitQosEnabledForReplies"));
context.close();
}
use of org.springframework.integration.jms.JmsMessageDrivenEndpoint in project spring-integration by spring-projects.
the class JmsInboundGatewayParserTests method gatewayWithReplyChannel.
@Test
public void gatewayWithReplyChannel() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsGatewayWithReplyChannel.xml", this.getClass());
JmsTemplate template = new JmsTemplate(context.getBean(ConnectionFactory.class));
template.convertAndSend("testDestination", "Hello");
JmsMessageDrivenEndpoint gateway = (JmsMessageDrivenEndpoint) context.getBean("gateway");
Object replyChannel = TestUtils.getPropertyValue(gateway, "listener.gatewayDelegate.replyChannel");
assertEquals(context.getBean("replies"), replyChannel);
assertNotNull(template.receive("testReplyDestination"));
context.close();
}
Aggregations