use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionalMultiMapSplitBrainProtectionReadTest method parameters.
@Parameters(name = "Executing: {0} {1}")
public static Collection<Object[]> parameters() {
TransactionOptions onePhaseOption = TransactionOptions.getDefault();
onePhaseOption.setTransactionType(ONE_PHASE);
TransactionOptions twoPhaseOption = TransactionOptions.getDefault();
twoPhaseOption.setTransactionType(TWO_PHASE);
return Arrays.asList(new Object[] { onePhaseOption, READ }, new Object[] { twoPhaseOption, READ }, new Object[] { onePhaseOption, READ_WRITE }, new Object[] { twoPhaseOption, READ_WRITE });
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionContextImpl_backupLogsTest method assertBackupLogCreationNotForced.
public void assertBackupLogCreationNotForced(String serviceName) {
TransactionOptions options = new TransactionOptions();
TransactionContextImpl txContext = new TransactionContextImpl(localTxManager, localNodeEngine, options, ownerUuid, false);
txContext.beginTransaction();
TransactionalObject result = txContext.getTransactionalObject(serviceName, "foo");
assertNotNull(result);
assertNull(remoteTxManager.txBackupLogs.get(txContext.getTxnId()));
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionImpl_OnePhaseTest method setup.
@Before
public void setup() {
HazelcastInstance hz = createHazelcastInstance();
operationService = getOperationService(hz);
logger = mock(ILogger.class);
txManagerService = mock(TransactionManagerServiceImpl.class);
txManagerService.commitCount = MwCounter.newMwCounter();
txManagerService.startCount = MwCounter.newMwCounter();
txManagerService.rollbackCount = MwCounter.newMwCounter();
nodeEngine = mock(NodeEngine.class);
when(nodeEngine.getOperationService()).thenReturn(operationService);
when(nodeEngine.getLocalMember()).thenReturn(new MemberImpl());
when(nodeEngine.getLogger(TransactionImpl.class)).thenReturn(logger);
options = new TransactionOptions().setTransactionType(ONE_PHASE);
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionImpl_TwoPhaseTest method commit_whenThrowsExceptionDuringCommit.
@Test
public void commit_whenThrowsExceptionDuringCommit() throws Exception {
TransactionOptions options = new TransactionOptions().setTransactionType(TWO_PHASE).setDurability(0);
TransactionImpl tx = new TransactionImpl(txManagerService, nodeEngine, options, UUID.randomUUID());
tx.begin();
tx.add(new MockTransactionLogRecord().failCommit());
tx.prepare();
try {
tx.commit();
fail();
} catch (TransactionException expected) {
}
assertEquals(COMMIT_FAILED, tx.getState());
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionImpl_TwoPhaseIntegrationTest method prepare_whenSingleItemAndDurabilityOne_thenNoBackupLog.
// =================== prepare ===========================================
@Test
public void prepare_whenSingleItemAndDurabilityOne_thenNoBackupLog() {
TransactionOptions options = new TransactionOptions().setTransactionType(TWO_PHASE).setDurability(1);
TransactionImpl tx = new TransactionImpl(localTxService, localNodeEngine, options, txOwner);
tx.begin();
MockTransactionLogRecord record = new MockTransactionLogRecord();
tx.add(record);
tx.prepare();
assertPrepared(tx);
assertNoBackupLogOnRemote(tx);
record.assertPrepareCalled().assertCommitNotCalled().assertRollbackNotCalled();
}
Aggregations