byte[] branchQualifier = new byte[] { 1, 2, 3, 4, 5, 6, 0, 0, 0, 0 };
byte[] globalTxId = new byte[] { 6, 5, 4, 3, 2, 1, 0, 0, 0, 0 };
Xid trailing = new MessagingXid(branchQualifier, 12435, globalTxId);
res1.start(trailing, XAResource.TMNOFLAGS);
MessageProducer prod1 = sess1.createProducer(queue1);
TextMessage tm1 = sess1.createTextMessage("testing1");
prod1.send(tm1);
res1.end(trailing, XAResource.TMSUCCESS);
res1.prepare(trailing);
// Now "crash" the server
ServerManagement.stopServerPeer();
ServerManagement.startServerPeer();
deployAndLookupAdministeredObjects();
conn1.close();
conn1 = cf.createXAConnection();
XAResource res = conn1.createXASession().getXAResource();
Xid[] xids = res.recover(XAResource.TMSTARTRSCAN);
assertEquals(1, xids.length);
Xid[] xids2 = res.recover(XAResource.TMENDRSCAN);
assertEquals(0, xids2.length);
Xid trailing2 = xids[0];
assertTrue(trailing.getFormatId() == trailing2.getFormatId());
assertEqualByteArrays(trailing.getGlobalTransactionId(), trailing2.getGlobalTransactionId());
assertEqualByteArrays(trailing.getBranchQualifier(), trailing2.getBranchQualifier());
res.commit(trailing, false);
}
finally
{