use of com.hazelcast.transaction.impl.TransactionManagerServiceImpl.TxBackupLog in project hazelcast by hazelcast.
the class TransactionImpl_TwoPhaseIntegrationTest method prepare_whenMultipleItemsAndDurabilityOne_thenBackupLog.
@Test
public void prepare_whenMultipleItemsAndDurabilityOne_thenBackupLog() {
TransactionOptions options = new TransactionOptions().setTransactionType(TWO_PHASE).setDurability(1);
TransactionImpl tx = new TransactionImpl(localTxService, localNodeEngine, options, txOwner);
tx.begin();
MockTransactionLogRecord record1 = new MockTransactionLogRecord();
tx.add(record1);
MockTransactionLogRecord record2 = new MockTransactionLogRecord();
tx.add(record2);
tx.prepare();
assertPrepared(tx);
TxBackupLog log = remoteTxService.txBackupLogs.get(tx.getTxnId());
assertNotNull(log);
assertEquals(COMMITTING, log.state);
record1.assertPrepareCalled().assertCommitNotCalled().assertRollbackNotCalled();
record2.assertPrepareCalled().assertCommitNotCalled().assertRollbackNotCalled();
}
use of com.hazelcast.transaction.impl.TransactionManagerServiceImpl.TxBackupLog in project hazelcast by hazelcast.
the class TransactionImpl_TwoPhaseIntegrationTest method prepare_whenMultipleItemsAndDurabilityOne_thenRemoveBackupLog.
@Test
public void prepare_whenMultipleItemsAndDurabilityOne_thenRemoveBackupLog() {
final String txOwner = localNodeEngine.getLocalMember().getUuid();
TransactionOptions options = new TransactionOptions().setTransactionType(TWO_PHASE).setDurability(1);
final TransactionImpl tx = new TransactionImpl(localTxService, localNodeEngine, options, txOwner);
tx.begin();
tx.add(new MockTransactionLogRecord());
tx.add(new MockTransactionLogRecord());
tx.prepare();
assertPrepared(tx);
TxBackupLog log = remoteTxService.txBackupLogs.get(tx.getTxnId());
assertNotNull(log);
cluster[0].shutdown();
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertFalse(remoteTxService.txBackupLogs.containsKey(tx.getTxnId()));
}
});
}
use of com.hazelcast.transaction.impl.TransactionManagerServiceImpl.TxBackupLog in project hazelcast by hazelcast.
the class TransactionImpl_TwoPhaseIntegrationTest method assertNoBackupLogOnRemote.
private void assertNoBackupLogOnRemote(TransactionImpl tx) {
TxBackupLog log = remoteTxService.txBackupLogs.get(tx.getTxnId());
assertNull(log);
}
use of com.hazelcast.transaction.impl.TransactionManagerServiceImpl.TxBackupLog in project hazelcast by hazelcast.
the class TransactionManagerServiceImplTest method assertTxLogState.
private void assertTxLogState(String txId, Transaction.State state) {
TxBackupLog backupLog = txService.txBackupLogs.get(txId);
assertNotNull(backupLog);
assertEquals(state, backupLog.state);
}
Aggregations