testPaging(false);
}
public void testPaging(final boolean restartServer) throws Exception
{
Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
SimpleString pageQueue = new SimpleString("pagequeue");
AddressSettings pageAddressSettings = new AddressSettings();
pageAddressSettings.setMaxSizeBytes(100 * 1024);
pageAddressSettings.setPageSizeBytes(10 * 1024);
addressSettings.put(pageQueue.toString(), pageAddressSettings);
addSettings();
clientSession.createQueue(pageQueue, pageQueue, null, true);
clientSession.start(xid, XAResource.TMNOFLAGS);
ClientProducer pageProducer = clientSession.createProducer(pageQueue);
for (int i = 0; i < 1000; i++)
{
ClientMessage m = createBytesMessage(new byte[512], true);
pageProducer.send(m);
}
pageProducer.close();
clientSession.end(xid, XAResource.TMSUCCESS);
clientSession.prepare(xid);
BasicXaRecoveryTest.log.info("*** stopping and restarting");
if (restartServer)
{
stopAndRestartServer();
}
else
{
recreateClients();
}
Xid[] xids = clientSession.recover(XAResource.TMSTARTRSCAN);
Assert.assertEquals(xids.length, 1);
Assert.assertEquals(xids[0].getFormatId(), xid.getFormatId());
UnitTestCase.assertEqualsByteArrays(xids[0].getBranchQualifier(), xid.getBranchQualifier());
UnitTestCase.assertEqualsByteArrays(xids[0].getGlobalTransactionId(), xid.getGlobalTransactionId());
clientSession.commit(xid, false);
clientSession.close();