}
});
List<Xid> inDoubtTransactions = rm(cache(0)).getInDoubtTransactions();
assertEquals(3, inDoubtTransactions.size());
assert inDoubtTransactions.contains(new SerializableXid(t1_1.getXid()));
assert inDoubtTransactions.contains(new SerializableXid(t1_2.getXid()));
assert inDoubtTransactions.contains(new SerializableXid(t1_3.getXid()));
configuration.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
addClusterEnabledCacheManager(configuration);
defineRecoveryCache(1);
TestingUtil.blockUntilViewsReceived(60000, cache(0), cache(1));
DummyTransaction t1_4 = beginAndSuspendTx(cache(1));
prepareTransaction(t1_4);
log.trace("Before main recovery call.");
assertPrepared(4, t1_4);
//now second call would only return 1 prepared tx as we only go over the network once
assertPrepared(1, t1_4);
commitTransaction(t1_4);
assertPrepared(0, t1_4);
inDoubtTransactions = rm(cache(0)).getInDoubtTransactions();
assertEquals(3, inDoubtTransactions.size());
assert inDoubtTransactions.contains(new SerializableXid(t1_1.getXid()));
assert inDoubtTransactions.contains(new SerializableXid(t1_2.getXid()));
assert inDoubtTransactions.contains(new SerializableXid(t1_3.getXid()));
//now let's start to forget transactions
t1_4.firstEnlistedResource().forget(t1_1.getXid());
log.info("returned");
eventually(new Condition() {
@Override
public boolean isSatisfied() throws Exception {
return rm(cache(0)).getInDoubtTransactionInfo().size() == 2;
}
});
inDoubtTransactions = rm(cache(0)).getInDoubtTransactions();
assertEquals(2, inDoubtTransactions.size());
assert inDoubtTransactions.contains(new SerializableXid(t1_2.getXid()));
assert inDoubtTransactions.contains(new SerializableXid(t1_3.getXid()));
t1_4.firstEnlistedResource().forget(t1_2.getXid());
t1_4.firstEnlistedResource().forget(t1_3.getXid());
eventually(new Condition() {
@Override