use of javax.jms.Message in project wildfly by wildfly.
the class MDBTestCase method testAnnoBasedMDB.
/**
* Test an annotation based MDB with properties substitution
* @throws Exception
*/
@Test
public void testAnnoBasedMDB() throws Exception {
this.jmsUtil.sendTextMessage("Say Nihao to " + AnnoBasedMDB.class.getName(), this.annoQueue, this.annoReplyQueue);
final Message reply = this.jmsUtil.receiveMessage(annoReplyQueue, 5000);
Assert.assertNotNull("Reply message was null on reply queue: " + this.annoReplyQueue, reply);
}
use of javax.jms.Message in project wildfly by wildfly.
the class MDBProxyBean method trigger.
@Override
public void trigger() throws Exception {
final String goodMorning = "Good morning";
// send as ObjectMessage
// this.jmsUtil = (JMSMessagingUtil) getInitialContext().lookup(getEJBJNDIBinding());
this.jmsUtil.sendTextMessage(goodMorning, this.queue, this.replyQueue);
// wait for an reply
final Message reply = this.jmsUtil.receiveMessage(replyQueue, 5000);
// test the reply
final TextMessage textMessage = (TextMessage) reply;
Assert.assertEquals("Unexpected reply message on reply queue: " + this.replyQueue, CdiIntegrationMDB.REPLY, textMessage.getText());
}
use of javax.jms.Message in project wildfly by wildfly.
the class MDB20MessageSelectorTestCase method retestMessageSelectors.
/**
* Re-tests 2 messages, both of them with the selected format.
*/
@Test
public void retestMessageSelectors() {
sendTextMessage("Say 1st hello to " + EJB2xMDB.class.getName() + " in 1.1 format", queue, replyQueueA, "Version 1.1");
final Message replyA = receiveMessage(replyQueueA, TimeoutUtil.adjust(1000));
Assert.assertNotNull("Missing reply from " + replyQueueA, replyA);
sendTextMessage("Say 2nd hello to " + EJB2xMDB.class.getName() + " in 1.1 format", queue, replyQueueB, "Version 1.1");
final Message replyB = receiveMessage(replyQueueB, TimeoutUtil.adjust(1000));
Assert.assertNotNull("Missing reply from " + replyQueueB, replyB);
}
use of javax.jms.Message in project wildfly by wildfly.
the class MDB20MessageSelectorTestCase method testMessageSelectors.
/**
* Tests 2 messages, only one of them with the selected format.
*/
@Test
public void testMessageSelectors() {
sendTextMessage("Say 1st hello to " + EJB2xMDB.class.getName() + " in 1.0 format", queue, replyQueueA, "Version 1.0");
final Message replyA = receiveMessage(replyQueueA, TimeoutUtil.adjust(1000));
Assert.assertNull("Unexpected reply from " + replyQueueA, replyA);
sendTextMessage("Say 2nd hello to " + EJB2xMDB.class.getName() + " in 1.1 format", queue, replyQueueB, "Version 1.1");
final Message replyB = receiveMessage(replyQueueB, TimeoutUtil.adjust(1000));
Assert.assertNotNull("Missing reply from " + replyQueueB, replyB);
}
use of javax.jms.Message in project wildfly by wildfly.
the class MDB20TopicTestCase method testEjb20TopicMDBs.
/**
* Tests 2 MDBs both listening on a topic.
*/
@Test
public void testEjb20TopicMDBs() {
sendTextMessage("Say hello to the topic", topic);
final Message replyA = receiveMessage(replyQueueA, TimeoutUtil.adjust(5000));
Assert.assertNotNull("Reply message was null on reply queue: " + replyQueueA, replyA);
final Message replyB = receiveMessage(replyQueueB, TimeoutUtil.adjust(5000));
Assert.assertNotNull("Reply message was null on reply queue: " + replyQueueB, replyB);
}
Aggregations