use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class ClientTransactionalMapQuorumTest method parameters.
@Parameterized.Parameters(name = "Options: {0}")
public static Collection<Object[]> parameters() {
TransactionOptions localOption = TransactionOptions.getDefault();
localOption.setTransactionType(ONE_PHASE);
TransactionOptions twoPhaseOption = TransactionOptions.getDefault();
twoPhaseOption.setTransactionType(TWO_PHASE);
return Arrays.asList(new Object[] { twoPhaseOption }, new Object[] { localOption });
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionContextImpl_backupLogsTest method assertBackupLogCreationForced.
public void assertBackupLogCreationForced(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);
assertNotNull(remoteTxManager.txBackupLogs.get(txContext.getTxnId()));
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionImplTest method setup.
@Before
public void setup() {
HazelcastInstance hz = createHazelcastInstance();
operationService = getOperationService(hz);
logger = mock(ILogger.class);
txManagerService = mock(TransactionManagerServiceImpl.class);
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_TwoPhaseIntegrationTest method testPrepareFailed.
@Test
public void testPrepareFailed() {
TransactionOptions options = new TransactionOptions().setTransactionType(TWO_PHASE).setDurability(1);
TransactionImpl tx = new TransactionImpl(localTxService, localNodeEngine, options, txOwner);
tx.begin();
MockTransactionLogRecord record = new MockTransactionLogRecord().failPrepare();
tx.add(record);
try {
tx.prepare();
fail();
} catch (TransactionException expected) {
}
assertPreparing(tx);
assertNoBackupLogOnRemote(tx);
record.assertPrepareCalled().assertCommitNotCalled().assertRollbackNotCalled();
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionImpl_TwoPhaseIntegrationTest method prepare_whenMultipleItemsAndDurabilityZero_thenNoBackupLog.
@Test
public void prepare_whenMultipleItemsAndDurabilityZero_thenNoBackupLog() {
TransactionOptions options = new TransactionOptions().setTransactionType(TWO_PHASE).setDurability(0);
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);
assertNoBackupLogOnRemote(tx);
record1.assertPrepareCalled().assertCommitNotCalled().assertRollbackNotCalled();
record2.assertPrepareCalled().assertCommitNotCalled().assertRollbackNotCalled();
}
Aggregations