use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class TransactionalSetAbstractTest method testSetSizeAfterAdd_withinTxn.
@Test
public void testSetSizeAfterAdd_withinTxn() throws Exception {
TransactionContext context = local.newTransactionContext();
context.beginTransaction();
TransactionalSet<Object> txnSet = context.getSet(setName);
txnSet.add(ELEMENT);
context.commitTransaction();
assertEquals(1, set.size());
}
use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class TransactionalSetAbstractTest method testAddDuplicateElement_withinTxn.
@Test
public void testAddDuplicateElement_withinTxn() throws Exception {
TransactionContext context = local.newTransactionContext();
context.beginTransaction();
TransactionalSet<Object> txnSet = context.getSet(setName);
assertTrue(txnSet.add(ELEMENT));
assertFalse(txnSet.add(ELEMENT));
context.commitTransaction();
assertEquals(1, local.getSet(setName).size());
}
use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class TransactionalSetAbstractTest method testRemove_withinTxn.
@Test
public void testRemove_withinTxn() throws Exception {
set.add(ELEMENT);
TransactionContext context = local.newTransactionContext();
context.beginTransaction();
TransactionalSet<Object> txnSet = context.getSet(setName);
assertTrue(txnSet.remove(ELEMENT));
assertFalse(txnSet.remove("NOT_THERE"));
context.commitTransaction();
assertEquals(0, set.size());
}
use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class TransactionalSetAbstractTest method testAdd_withinTxn.
@Test
public void testAdd_withinTxn() throws Exception {
TransactionContext context = local.newTransactionContext();
context.beginTransaction();
TransactionalSet<Object> txnSet = context.getSet(setName);
assertTrue(txnSet.add(ELEMENT));
assertEquals(1, txnSet.size());
context.commitTransaction();
assertEquals(1, set.size());
}
use of com.hazelcast.transaction.TransactionContext in project hazelcast by hazelcast.
the class TransactionalSetAbstractTest method testSetSizeAfterRemove_withinTxn.
@Test
public void testSetSizeAfterRemove_withinTxn() throws Exception {
set.add(ELEMENT);
TransactionContext context = local.newTransactionContext();
context.beginTransaction();
TransactionalSet<Object> txnSet = context.getSet(setName);
txnSet.remove(ELEMENT);
context.commitTransaction();
assertEquals(0, set.size());
}
Aggregations