use of org.redisson.api.RTransaction in project redisson by redisson.
the class TransactionalBean method testRollback.
@Transactional
public void testRollback() {
RTransaction transaction = transactionManager.getCurrentTransaction();
transaction.getMap("test2").put("1", "2");
throw new IllegalStateException();
}
use of org.redisson.api.RTransaction in project redisson by redisson.
the class TransactionalBean method testPropagationRequiredWithException.
@Transactional
public void testPropagationRequiredWithException() {
RTransaction transaction = transactionManager.getCurrentTransaction();
transaction.getMap("tr4").put("1", "0");
transactionalBean2.testPropagationRequiredWithException();
}
use of org.redisson.api.RTransaction in project redisson by redisson.
the class TransactionalBean method testNoTransaction.
public void testNoTransaction() {
try {
RTransaction transaction = transactionManager.getCurrentTransaction();
Assertions.fail();
} catch (NoTransactionException e) {
// skip
}
}
use of org.redisson.api.RTransaction in project redisson by redisson.
the class TransactionalBean method testCommit.
@Transactional
public void testCommit() {
RTransaction transaction = transactionManager.getCurrentTransaction();
transaction.getMap("test1").put("1", "2");
}
use of org.redisson.api.RTransaction in project redisson by redisson.
the class RedissonBaseTransactionalMapTest method testPut.
@Test
public void testPut() {
RMap<String, String> m = getMap();
m.put("1", "2");
m.put("3", "4");
RTransaction transaction = redisson.createTransaction(TransactionOptions.defaults());
RMap<String, String> map = getTransactionalMap(transaction);
assertThat(map.put("3", "5")).isEqualTo("4");
assertThat(map.get("3")).isEqualTo("5");
assertThat(m.get("3")).isEqualTo("4");
transaction.commit();
assertThat(m.get("1")).isEqualTo("2");
assertThat(m.get("3")).isEqualTo("5");
}
Aggregations