Repository: ignite Updated Branches: refs/heads/ignite-8446 20dd0ad97 -> 389f0d59e
8446 Signed-off-by: Anton Vinogradov <a...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/389f0d59 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/389f0d59 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/389f0d59 Branch: refs/heads/ignite-8446 Commit: 389f0d59ed918589884c6f7c2cef3bf44b7d31da Parents: 20dd0ad Author: Anton Vinogradov <a...@apache.org> Authored: Mon Jul 2 14:40:12 2018 +0300 Committer: Anton Vinogradov <a...@apache.org> Committed: Mon Jul 2 14:40:12 2018 +0300 ---------------------------------------------------------------------- .../TxRollbackOnIncorrectParamsTest.java | 56 +++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/389f0d59/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java index b71429d..2b6e3b0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnIncorrectParamsTest.java @@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.transactions; import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; +import javax.cache.CacheException; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteEvents; @@ -32,7 +33,6 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; -import org.apache.ignite.transactions.TransactionRollbackException; import static org.apache.ignite.events.EventType.EVTS_TX; import static org.apache.ignite.events.EventType.EVT_TX_STARTED; @@ -64,7 +64,7 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { return true; }, EVT_TX_STARTED); - IgniteCache cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); + IgniteCache cache = ignite.getOrCreateCache(defaultCacheConfiguration()); try (Transaction tx = ignite.transactions().txStart( TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ, 200, 2)) { @@ -81,7 +81,7 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { fail("Should fail prior this line."); } - catch (TransactionRollbackException ignored) { + catch (CacheException ignored) { // No-op. } @@ -92,7 +92,7 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { fail("Should fail prior this line."); } - catch (TransactionRollbackException ignored) { + catch (CacheException ignored) { // No-op. } } @@ -120,7 +120,7 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { return true; }, EVT_TX_STARTED); - IgniteCache cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); + IgniteCache cache = ignite.getOrCreateCache(defaultCacheConfiguration()); try (Transaction tx = ignite.transactions().withLabel("test").txStart()) { cache.put(1, 1); @@ -135,7 +135,7 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { fail("Should fail prior this line."); } - catch (TransactionRollbackException ignored) { + catch (CacheException ignored) { // No-op. } } @@ -147,6 +147,9 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { Ignite ignite = startGrid(0); Ignite remote = startGrid(1); + IgniteCache cacheLocal = ignite.getOrCreateCache(defaultCacheConfiguration()); + IgniteCache cacheRemote = remote.getOrCreateCache(defaultCacheConfiguration()); + final IgniteEvents evts = ignite.events(); evts.enableLocal(EVTS_TX); @@ -166,39 +169,37 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { }, EVT_TX_STARTED); - IgniteCache cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); - try (Transaction tx = ignite.transactions().withLabel("test").txStart()) { - cache.put(1, 1); + cacheLocal.put(1, 1); tx.commit(); } try (Transaction tx = remote.transactions().withLabel("test").txStart()) { - cache.put(1, 2); + cacheRemote.put(1, 2); tx.commit(); } try (Transaction tx = ignite.transactions().txStart()) { - cache.put(1, 3); + cacheLocal.put(1, 3); tx.commit(); fail("Should fail prior this line."); } - catch (TransactionRollbackException ignored) { + catch (CacheException ignored) { // No-op. } try (Transaction tx = remote.transactions().txStart()) { - cache.put(1, 4); + cacheRemote.put(1, 4); tx.commit(); fail("Should fail prior this line."); } - catch (TransactionRollbackException ignored) { + catch (CacheException ignored) { // No-op. } } @@ -210,6 +211,9 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { Ignite ignite = startGrid(0); Ignite remote = startGrid(1); + IgniteCache cacheLocal = ignite.getOrCreateCache(defaultCacheConfiguration()); + IgniteCache cacheRemote = remote.getOrCreateCache(defaultCacheConfiguration()); + final IgniteEvents evts = ignite.events(); evts.enableLocal(EVTS_TX); @@ -229,41 +233,40 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { }, EVT_TX_STARTED); - IgniteCache cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); try (Transaction tx = ignite.transactions().txStart( TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ, 100, 2)) { - cache.put(1, 1); + cacheLocal.put(1, 1); tx.commit(); } try (Transaction tx = remote.transactions().txStart( TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ, 100, 2)) { - cache.put(1, 2); + cacheRemote.put(1, 2); tx.commit(); } try (Transaction tx = ignite.transactions().txStart()) { - cache.put(1, 3); + cacheLocal.put(1, 3); tx.commit(); fail("Should fail prior this line."); } - catch (TransactionRollbackException ignored) { + catch (CacheException ignored) { // No-op. } try (Transaction tx = remote.transactions().txStart()) { - cache.put(1, 4); + cacheRemote.put(1, 4); tx.commit(); fail("Should fail prior this line."); } - catch (TransactionRollbackException ignored) { + catch (CacheException ignored) { // No-op. } } @@ -275,6 +278,9 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { Ignite ignite = startGrid(0); Ignite remote = startGrid(1); + IgniteCache cacheLocal = ignite.getOrCreateCache(defaultCacheConfiguration()); + IgniteCache cacheRemote = remote.getOrCreateCache(defaultCacheConfiguration()); + final IgniteEvents evts = ignite.events(); evts.enableLocal(EVTS_TX); @@ -306,19 +312,17 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { }, EVT_TX_STARTED); - IgniteCache cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME); - assertFalse(rollbackFailed.get()); assertFalse(alreadyRolledBack.get()); try (Transaction tx = ignite.transactions().txStart()) { - cache.put(1, 1); + cacheLocal.put(1, 1); tx.commit(); fail("Should fail prior this line."); } - catch (TransactionRollbackException ignored) { + catch (CacheException ignored) { // No-op. } @@ -326,7 +330,7 @@ public class TxRollbackOnIncorrectParamsTest extends GridCommonAbstractTest { assertFalse(alreadyRolledBack.get()); try (Transaction tx = remote.transactions().txStart()) { - cache.put(1, 2); + cacheRemote.put(1, 2); tx.commit(); }