fixing test

create consumer before sending message so queue is auto created
This commit is contained in:
Andy Taylor 2016-05-05 13:00:53 +01:00
parent 99acd68838
commit f4f35fc2f5
1 changed files with 2 additions and 2 deletions

View File

@ -93,17 +93,17 @@ public class FailureXATest extends ActiveMQTestBase {
try {
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
Queue queue = session.createQueue("Queue1");
final XASession xaSession = connection.createXASession();
MessageConsumer consumer = xaSession.createConsumer(queue);
MessageProducer producer = session.createProducer(queue);
producer.send(session.createTextMessage("hello " + 1));
session.commit();
final XASession xaSession = connection.createXASession();
XAResource xaResource = xaSession.getXAResource();
final Xid xid = newXID();
xaResource.start(xid, XAResource.TMNOFLAGS);
MessageConsumer consumer = xaSession.createConsumer(queue);
connection.start();
Assert.assertNotNull(consumer.receive(5000));