use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class SplitterParserTests method splitterImplementation.
@Test
public void splitterImplementation() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("splitterParserTests.xml", this.getClass());
context.start();
MessageChannel input = (MessageChannel) context.getBean("splitterImplementationInput");
PollableChannel output = (PollableChannel) context.getBean("output");
input.send(new GenericMessage<String>("this.is.a.test"));
Message<?> result1 = output.receive(1000);
assertEquals("this", result1.getPayload());
Message<?> result2 = output.receive(1000);
assertEquals("is", result2.getPayload());
Message<?> result3 = output.receive(1000);
assertEquals("a", result3.getPayload());
Message<?> result4 = output.receive(1000);
assertEquals("test", result4.getPayload());
assertNull(output.receive(0));
context.close();
}
use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class JmsChannelHistoryTests method testFullConfig.
@Test
public void testFullConfig() throws Exception {
ActiveMqTestUtils.prepare();
ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("JmsChannelHistoryTests-context.xml", this.getClass());
SubscribableChannel channel = ac.getBean("jmsChannel", SubscribableChannel.class);
PollableChannel resultChannel = ac.getBean("resultChannel", PollableChannel.class);
channel.send(new GenericMessage<String>("hello"));
Message<?> resultMessage = resultChannel.receive(10000);
MessageHistory history = MessageHistory.read(resultMessage);
assertTrue(history.get(0).contains("jmsChannel"));
ac.close();
}
use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class JmsInboundChannelAdapterParserTests method adapterWithConnectionFactoryAndDestination.
@Test
public void adapterWithConnectionFactoryAndDestination() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsInboundWithConnectionFactoryAndDestination.xml", this.getClass());
PollableChannel output = (PollableChannel) context.getBean("output");
Message<?> message = output.receive(timeoutOnReceive);
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
assertFalse(TestUtils.getPropertyValue(context.getBean("adapter"), "source.jmsTemplate", JmsTemplate.class).isSessionTransacted());
context.close();
}
use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class JmsInboundChannelAdapterParserTests method adapterWithConnectionFactoryAndDestinationName.
@Test
public void adapterWithConnectionFactoryAndDestinationName() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsInboundWithConnectionFactoryAndDestinationName.xml", this.getClass());
PollableChannel output = (PollableChannel) context.getBean("output");
Message<?> message = output.receive(timeoutOnReceive);
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
context.close();
}
use of org.springframework.messaging.PollableChannel in project spring-integration by spring-projects.
the class JmsInboundChannelAdapterParserTests method adapterWithHeaderMapper.
@Test
public void adapterWithHeaderMapper() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmsInboundWithHeaderMapper.xml", this.getClass());
PollableChannel output = (PollableChannel) context.getBean("output");
Message<?> message = output.receive(timeoutOnReceive);
assertNotNull("message should not be null", message);
assertEquals("polling-test", message.getPayload());
assertEquals("foo", message.getHeaders().get("testProperty"));
assertEquals(123, message.getHeaders().get("testAttribute"));
context.close();
}
Aggregations