use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class IgniteTxExceptionAbstractSelfTest method testPutNearTx.
/**
* @throws Exception If failed.
*/
public void testPutNearTx() throws Exception {
for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
checkPutTx(true, concurrency, isolation, keyForNode(grid(0).localNode(), NOT_PRIMARY_AND_BACKUP));
checkPutTx(false, concurrency, isolation, keyForNode(grid(0).localNode(), NOT_PRIMARY_AND_BACKUP));
}
}
}
use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class WithKeepBinaryCacheFullApiTest method testInvokeAllAsyncTx.
/**
* @throws Exception If failed.
*/
@SuppressWarnings("serial")
public void testInvokeAllAsyncTx() throws Exception {
if (!txShouldBeUsed())
return;
for (TransactionConcurrency conc : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
checkInvokeAllAsycnTx(conc, isolation);
jcache().removeAll();
}
}
}
use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class IndexingSpiQuerySelfTest method testIndexingSpiFailure.
/**
* @throws Exception If failed.
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void testIndexingSpiFailure() throws Exception {
IgniteConfiguration cfg = configuration();
cfg.setIndexingSpi(new MyBrokenIndexingSpi());
Ignite ignite = Ignition.start(cfg);
CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(CACHE_NAME);
ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
final IgniteCache<Integer, Integer> cache = ignite.createCache(ccfg);
final IgniteTransactions txs = ignite.transactions();
for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (final TransactionIsolation isolation : TransactionIsolation.values()) {
System.out.println("Run in transaction: " + concurrency + " " + isolation);
GridTestUtils.assertThrowsWithCause(new Callable<Void>() {
@Override
public Void call() throws Exception {
Transaction tx;
try (Transaction tx0 = tx = txs.txStart(concurrency, isolation)) {
cache.put(1, 1);
tx0.commit();
}
assertEquals(TransactionState.ROLLED_BACK, tx.state());
return null;
}
}, IgniteTxHeuristicCheckedException.class);
}
}
}
use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class IndexingSpiQueryTxSelfTest method testIndexingSpiWithTx.
/**
* @throws Exception If failed.
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void testIndexingSpiWithTx() throws Exception {
IgniteEx ignite = grid(0);
final IgniteCache<Integer, Integer> cache = ignite.cache("test-cache");
final IgniteTransactions txs = ignite.transactions();
for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) {
for (final TransactionIsolation isolation : TransactionIsolation.values()) {
System.out.println("Run in transaction: " + concurrency + " " + isolation);
GridTestUtils.assertThrowsWithCause(new Callable<Void>() {
@Override
public Void call() throws Exception {
Transaction tx;
try (Transaction tx0 = tx = txs.txStart(concurrency, isolation)) {
cache.put(1, 1);
tx0.commit();
}
assertEquals(TransactionState.ROLLED_BACK, tx.state());
return null;
}
}, IgniteTxHeuristicCheckedException.class);
}
}
}
use of org.apache.ignite.transactions.TransactionIsolation in project ignite by apache.
the class WithKeepBinaryCacheFullApiTest method testInvokeAsyncTx.
/**
* @throws Exception If failed.
*/
public void testInvokeAsyncTx() throws Exception {
if (!txShouldBeUsed())
return;
for (TransactionConcurrency conc : TransactionConcurrency.values()) {
for (TransactionIsolation isolation : TransactionIsolation.values()) {
checkInvokeAsyncTx(conc, isolation);
jcache().removeAll();
}
}
}
Aggregations