use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionalMapReadWriteQuorumTest method parameters.
@Parameterized.Parameters(name = "Executing: {0}")
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[] { twoPhaseOption }, new Object[] { onePhaseOption });
}
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-simulator by hazelcast.
the class MapTransactionTest method setup.
@Setup
public void setup() {
map = targetInstance.getMap(name);
resultList = targetInstance.getList(name + "results");
transactionOptions = new TransactionOptions();
transactionOptions.setTransactionType(transactionType).setDurability(durability);
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionQueueTest method testQueueWithMap.
@Test
public void testQueueWithMap() {
int insCount = 4;
String queueName = "defQueue";
String mapName = "defMap";
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(insCount);
HazelcastInstance[] instances = factory.newInstances(getConfig());
instances[0].getMap(mapName).lock("lock1");
TransactionContext context = instances[1].newTransactionContext(new TransactionOptions().setTimeout(5, SECONDS));
context.beginTransaction();
try {
boolean offered = context.getQueue(queueName).offer(new VersionedObject<>("item1"));
assertTrue(offered);
context.getMap(mapName).put("lock1", "value1");
fail();
} catch (TransactionException ex) {
// expected
context.rollbackTransaction();
}
assertEquals(0, instances[0].getQueue(queueName).size());
assertNull(instances[0].getMap(mapName).get("lock1"));
}
use of com.hazelcast.transaction.TransactionOptions in project hazelcast by hazelcast.
the class TransactionalListSplitBrainProtectionWriteTest 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, WRITE }, new Object[] { twoPhaseOption, WRITE }, new Object[] { onePhaseOption, READ_WRITE }, new Object[] { twoPhaseOption, READ_WRITE });
}
Aggregations