final Xid xid0 = new MockXid(0, UidGenerator.generateUid().getArray(), BitronixXid.FORMAT_ID);
xaResource.addInDoubtXid(xid0);
Set names = new HashSet();
names.add("no-such-registered-resource");
journal.log(Status.STATUS_COMMITTING, new Uid(xid0.getGlobalTransactionId()), names);
assertEquals(1, TransactionManagerServices.getJournal().collectDanglingRecords().size());
// the TM must run the recoverer in this scenario
TransactionManagerServices.getTransactionManager();
assertEquals(1, TransactionManagerServices.getJournal().collectDanglingRecords().size());
assertNull(TransactionManagerServices.getRecoverer().getCompletionException());
assertEquals(0, TransactionManagerServices.getRecoverer().getCommittedCount());
assertEquals(1, TransactionManagerServices.getRecoverer().getRolledbackCount());
assertEquals(0, xaResource.recover(XAResource.TMSTARTRSCAN | XAResource.TMENDRSCAN).length);
// the TM is running, adding this resource will kick incremental recovery on it
PoolingDataSource pds = new PoolingDataSource() {
public XAStatefulHolder createPooledConnection(Object xaFactory, ResourceBean bean) throws Exception {
JdbcPooledConnection pc = (JdbcPooledConnection) super.createPooledConnection(xaFactory, bean);
MockXAResource xaResource = (MockXAResource) pc.getXAResource();
xaResource.addInDoubtXid(UidGenerator.generateXid(new Uid(xid0.getGlobalTransactionId())));
return pc;
}
};
pds.setClassName(MockitoXADataSource.class.getName());
pds.setUniqueName("no-such-registered-resource");