package camelinaction; import org.apache.camel.test.spring.CamelSpringTestSupport; import org.junit.Test; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringTXToTXTest extends CamelSpringTestSupport { @Override protected AbstractApplicationContext createApplicationContext() { return new ClassPathXmlApplicationContext("TXToTXTest.xml"); } @Test public void testWithCamel() throws Exception { template.sendBody("activemq:queue:a", "Hi Camel"); String reply = consumer.receiveBody("activemq:queue:b", 10000, String.class); assertEquals("Hi Camel", reply); reply = consumer.receiveBody("activemq:queue:camel", 10000, String.class); assertEquals("Hi Camel", reply); } @Test public void testWithDonkey() throws Exception { template.sendBody("activemq:queue:a", "Donkey"); String reply = consumer.receiveBody("activemq:queue:b", 10000, String.class); assertNull("There should be no reply", reply); reply = consumer.receiveBody("activemq:queue:camel", 10000, String.class); assertNull("There should be no reply", reply); reply = consumer.receiveBody("activemq:queue:ActiveMQ.DLQ", 10000, String.class); assertNotNull("It should have been moved to DLQ", reply); } }