public void testConsumingViaJMSReceivesMessageFromCamel() throws Exception {
// lets create a message
Destination destination = getMandatoryBean(Destination.class, "consumeFrom");
ConnectionFactory factory = getMandatoryBean(ConnectionFactory.class, "connectionFactory");
DefaultProducerTemplate template = getMandatoryBean(DefaultProducerTemplate.class, "camelTemplate");
Connection connection = factory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
LOG.info("Consuming from: " + destination);
MessageConsumer consumer = session.createConsumer(destination);
// now lets send a message
template.sendBody("seda:consumer", expectedBody);
Message message = consumer.receive(5000);
Assert.assertNotNull("Should have received a message from destination: " + destination, message);
TextMessage textMessage = assertIsInstanceOf(TextMessage.class, message);