}
});
}
public void testMinViewId2() throws Exception {
final TransactionTable tt0 = TestingUtil.getTransactionTable(cache(0));
final TransactionTable tt1 = TestingUtil.getTransactionTable(cache(1));
StateTransferManager stateTransferManager0 = TestingUtil.extractComponent(cache(0), StateTransferManager.class);
final int topologyId = stateTransferManager0.getCacheTopology().getTopologyId();
tm(1).begin();
cache(1).put(getKeyForCache(0),"v");
final DummyTransaction t = (DummyTransaction) tm(1).getTransaction();
t.runPrepare();
tm(1).suspend();
eventually(new Condition() {
@Override
public boolean isSatisfied() throws Exception {
return checkTxCount(0, 0, 1);
}
});
log.trace("Adding new node ..");
//add a new cache and check that min view is updated
addClusterEnabledCacheManager(c);
waitForClusterToForm();
log.trace("New node added.");
final int topologyId2 = stateTransferManager0.getCacheTopology().getTopologyId();
assertTrue(topologyId2 > topologyId);
assertEquals(tt0.getMinTopologyId(), topologyId);
assertEquals(tt1.getMinTopologyId(), topologyId);
tm(1).resume(t);
t.runCommitTx();
eventually(new Condition() {
@Override
public boolean isSatisfied() throws Exception {
return tt0.getMinTopologyId() == topologyId2 && tt1.getMinTopologyId() == topologyId2;
}
});
}