You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2014/12/22 00:04:11 UTC

[18/46] incubator-ignite git commit: GG-9141 - Renaming

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReloadSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReloadSelfTest.java
index 58ecc84..357483c 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReloadSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReloadSelfTest.java
@@ -63,16 +63,16 @@ public class GridCacheReloadSelfTest extends GridCommonAbstractTest {
         cacheCfg.setEvictionPolicy(new GridCacheLruEvictionPolicy(MAX_CACHE_ENTRIES));
         cacheCfg.setDistributionMode(nearEnabled ? NEAR_PARTITIONED : PARTITIONED_ONLY);
         cacheCfg.setStore(new GridCacheStoreAdapter<Integer, Integer>() {
-            @Override public Integer load(@Nullable GridCacheTx tx, Integer key) {
+            @Override public Integer load(@Nullable IgniteTx tx, Integer key) {
                 return key;
             }
 
-            @Override public void put(@Nullable GridCacheTx tx, Integer key,
+            @Override public void put(@Nullable IgniteTx tx, Integer key,
                 @Nullable Integer val) {
                 //No-op.
             }
 
-            @Override public void remove(@Nullable GridCacheTx tx, Integer key) {
+            @Override public void remove(@Nullable IgniteTx tx, Integer key) {
                 //No-op.
             }
         });

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReplicatedTxStoreExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReplicatedTxStoreExceptionSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReplicatedTxStoreExceptionSelfTest.java
index 79eeaf2..e45ce62 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReplicatedTxStoreExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheReplicatedTxStoreExceptionSelfTest.java
@@ -17,7 +17,7 @@ import static org.gridgain.grid.cache.GridCacheMode.*;
 /**
  *
  */
-public class GridCacheReplicatedTxStoreExceptionSelfTest extends GridCacheTxStoreExceptionAbstractSelfTest {
+public class GridCacheReplicatedTxStoreExceptionSelfTest extends IgniteTxStoreExceptionAbstractSelfTest {
     /** {@inheritDoc} */
     @Override protected GridCacheMode cacheMode() {
         return REPLICATED;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSlowTxWarnTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSlowTxWarnTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSlowTxWarnTest.java
index 3a55089..126224a 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSlowTxWarnTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSlowTxWarnTest.java
@@ -108,7 +108,7 @@ public class GridCacheSlowTxWarnTest extends GridCommonAbstractTest {
 
         GridCache<Object, Object> cache1 = g.cache(cacheName);
 
-        GridCacheTx tx = cache1.txStart();
+        IgniteTx tx = cache1.txStart();
 
         try {
             cache1.put(1, 1);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStopSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStopSelfTest.java
index 74e76aa..bbdf29c 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStopSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStopSelfTest.java
@@ -138,7 +138,7 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
                 putFuts.add(GridTestUtils.runAsync(new Callable<Void>() {
                     @Override public Void call() throws Exception {
                         if (startTx) {
-                            try (GridCacheTx tx = cache.txStart()) {
+                            try (IgniteTx tx = cache.txStart()) {
                                 cache.put(key, key);
 
                                 readyLatch.countDown();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStorePutxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStorePutxSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStorePutxSelfTest.java
index e84f96c..3e88b82 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStorePutxSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheStorePutxSelfTest.java
@@ -89,7 +89,7 @@ public class GridCacheStorePutxSelfTest extends GridCommonAbstractTest {
     public void testPutxShouldNotTriggerLoadWithTx() throws Exception {
         GridCache<Integer, Integer> cache = cache();
 
-        try (GridCacheTx tx = cache.txStart()) {
+        try (IgniteTx tx = cache.txStart()) {
             assertTrue(cache.putx(1, 1));
             assertTrue(cache.putx(2, 2, (IgnitePredicate)null));
 
@@ -102,7 +102,7 @@ public class GridCacheStorePutxSelfTest extends GridCommonAbstractTest {
     /** */
     private static class TestStore implements GridCacheStore<Integer, Integer> {
         /** {@inheritDoc} */
-        @Nullable @Override public Integer load(@Nullable GridCacheTx tx, Integer key) throws IgniteCheckedException {
+        @Nullable @Override public Integer load(@Nullable IgniteTx tx, Integer key) throws IgniteCheckedException {
             loads.incrementAndGet();
 
             return null;
@@ -115,37 +115,37 @@ public class GridCacheStorePutxSelfTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public void loadAll(@Nullable GridCacheTx tx, Collection<? extends Integer> keys,
+        @Override public void loadAll(@Nullable IgniteTx tx, Collection<? extends Integer> keys,
             IgniteBiInClosure<Integer, Integer> c) throws IgniteCheckedException {
             // No-op.
         }
 
         /** {@inheritDoc} */
-        @Override public void put(@Nullable GridCacheTx tx, Integer key,
+        @Override public void put(@Nullable IgniteTx tx, Integer key,
             @Nullable Integer val) throws IgniteCheckedException {
             // No-op.
         }
 
         /** {@inheritDoc} */
-        @Override public void putAll(@Nullable GridCacheTx tx,
+        @Override public void putAll(@Nullable IgniteTx tx,
             Map<? extends Integer, ? extends Integer> map) throws IgniteCheckedException {
             // No-op.
         }
 
         /** {@inheritDoc} */
-        @Override public void remove(@Nullable GridCacheTx tx, Integer key)
+        @Override public void remove(@Nullable IgniteTx tx, Integer key)
             throws IgniteCheckedException {
             // No-op.
         }
 
         /** {@inheritDoc} */
-        @Override public void removeAll(@Nullable GridCacheTx tx, Collection<? extends Integer> keys)
+        @Override public void removeAll(@Nullable IgniteTx tx, Collection<? extends Integer> keys)
             throws IgniteCheckedException {
             // No-op.
         }
 
         /** {@inheritDoc} */
-        @Override public void txEnd(GridCacheTx tx, boolean commit) throws IgniteCheckedException {
+        @Override public void txEnd(IgniteTx tx, boolean commit) throws IgniteCheckedException {
             // No-op.
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapReloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapReloadSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapReloadSelfTest.java
index 5989cbc..d9cd5a2 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapReloadSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheSwapReloadSelfTest.java
@@ -212,19 +212,19 @@ public class GridCacheSwapReloadSelfTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public Object load(@Nullable GridCacheTx tx, Object key)
+        @Override public Object load(@Nullable IgniteTx tx, Object key)
             throws IgniteCheckedException {
             return map.get(key);
         }
 
         /** {@inheritDoc} */
-        @Override public void put(GridCacheTx tx, Object key, @Nullable Object val)
+        @Override public void put(IgniteTx tx, Object key, @Nullable Object val)
             throws IgniteCheckedException {
             map.put(key, val);
         }
 
         /** {@inheritDoc} */
-        @Override public void remove(GridCacheTx tx, Object key) throws IgniteCheckedException {
+        @Override public void remove(IgniteTx tx, Object key) throws IgniteCheckedException {
             map.remove(key);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestStore.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestStore.java
index f6f5894..bae49d7 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestStore.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTestStore.java
@@ -29,7 +29,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     private final Map<Integer, String> map;
 
     /** Transactions. */
-    private final Collection<GridCacheTx> txs = new GridConcurrentHashSet<>();
+    private final Collection<IgniteTx> txs = new GridConcurrentHashSet<>();
 
     /** Last method called. */
     private String lastMtd;
@@ -37,13 +37,13 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     /** */
     private long ts = System.currentTimeMillis();
 
-    /** {@link #load(GridCacheTx, Object)} method call counter .*/
+    /** {@link #load(IgniteTx, Object)} method call counter .*/
     private AtomicInteger loadCnt = new AtomicInteger();
 
-    /** {@link #put(GridCacheTx, Object, Object)} method call counter .*/
+    /** {@link #put(IgniteTx, Object, Object)} method call counter .*/
     private AtomicInteger putCnt = new AtomicInteger();
 
-    /** {@link #putAll(GridCacheTx, Map)} method call counter .*/
+    /** {@link #putAll(IgniteTx, Map)} method call counter .*/
     private AtomicInteger putAllCnt = new AtomicInteger();
 
     /** Flag indicating if methods of this store should fail. */
@@ -97,7 +97,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     /**
      * @return Transactions.
      */
-    public Collection<GridCacheTx> transactions() {
+    public Collection<IgniteTx> transactions() {
         return txs;
     }
 
@@ -155,28 +155,28 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     }
 
     /**
-     * @return Count of {@link #load(GridCacheTx, Object)} method calls since last reset.
+     * @return Count of {@link #load(IgniteTx, Object)} method calls since last reset.
      */
     public int getLoadCount() {
         return loadCnt.get();
     }
 
     /**
-     * @return Count of {@link #put(GridCacheTx, Object, Object)} method calls since last reset.
+     * @return Count of {@link #put(IgniteTx, Object, Object)} method calls since last reset.
      */
     public int getPutCount() {
         return putCnt.get();
     }
 
     /**
-     * @return Count of {@link #putAll(GridCacheTx, Map)} method calls since last reset.
+     * @return Count of {@link #putAll(IgniteTx, Map)} method calls since last reset.
      */
     public int getPutAllCount() {
         return putAllCnt.get();
     }
 
     /** {@inheritDoc} */
-    @Override public String load(GridCacheTx tx, Integer key) throws IgniteCheckedException {
+    @Override public String load(IgniteTx tx, Integer key) throws IgniteCheckedException {
         checkTx(tx);
 
         lastMtd = "load";
@@ -207,7 +207,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     }
 
     /** {@inheritDoc} */
-    @Override public void loadAll(GridCacheTx tx, Collection<? extends Integer> keys,
+    @Override public void loadAll(IgniteTx tx, Collection<? extends Integer> keys,
         IgniteBiInClosure<Integer, String> c) throws IgniteCheckedException {
         checkTx(tx);
 
@@ -224,7 +224,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     }
 
     /** {@inheritDoc} */
-    @Override public void put(@Nullable GridCacheTx tx, Integer key, String val)
+    @Override public void put(@Nullable IgniteTx tx, Integer key, String val)
         throws IgniteCheckedException {
         checkTx(tx);
 
@@ -238,7 +238,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     }
 
     /** {@inheritDoc} */
-    @Override public void putAll(GridCacheTx tx, Map<? extends Integer, ? extends String> map)
+    @Override public void putAll(IgniteTx tx, Map<? extends Integer, ? extends String> map)
         throws IgniteCheckedException {
         checkTx(tx);
 
@@ -252,7 +252,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     }
 
     /** {@inheritDoc} */
-    @Override public void remove(GridCacheTx tx, Integer key) throws IgniteCheckedException {
+    @Override public void remove(IgniteTx tx, Integer key) throws IgniteCheckedException {
         checkTx(tx);
 
         lastMtd = "remove";
@@ -263,7 +263,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     }
 
     /** {@inheritDoc} */
-    @Override public void removeAll(GridCacheTx tx, Collection<? extends Integer> keys)
+    @Override public void removeAll(IgniteTx tx, Collection<? extends Integer> keys)
         throws IgniteCheckedException {
         checkTx(tx);
 
@@ -276,7 +276,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
     }
 
     /** {@inheritDoc} */
-    @Override public void txEnd(GridCacheTx tx, boolean commit) {
+    @Override public void txEnd(IgniteTx tx, boolean commit) {
         // No-op.
     }
 
@@ -298,7 +298,7 @@ public final class GridCacheTestStore implements GridCacheStore<Integer, String>
      * @param tx Checks transaction.
      * @throws IgniteCheckedException If transaction is incorrect.
      */
-    private void checkTx(GridCacheTx tx) throws IgniteCheckedException {
+    private void checkTx(IgniteTx tx) throws IgniteCheckedException {
         if (tx == null)
             return;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
index d938a4e..90ca487 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
@@ -201,7 +201,7 @@ public abstract class GridCacheTransactionalAbstractMetricsSelfTest extends Grid
         GridCache<Integer, Integer> cache = grid(0).cache(null);
 
         for (int i = 0; i < TX_CNT; i++) {
-            GridCacheTx tx = cache.txStart(concurrency, isolation);
+            IgniteTx tx = cache.txStart(concurrency, isolation);
 
             if (put)
                 for (int j = 0; j < keyCount(); j++)
@@ -241,7 +241,7 @@ public abstract class GridCacheTransactionalAbstractMetricsSelfTest extends Grid
         GridCache<Integer, Integer> cache = grid(0).cache(null);
 
         for (int i = 0; i < TX_CNT; i++) {
-            GridCacheTx tx = cache.txStart(concurrency, isolation);
+            IgniteTx tx = cache.txStart(concurrency, isolation);
 
             if (put)
                 for (int j = 0; j < keyCount(); j++)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAbstractTest.java
deleted file mode 100644
index 1b1d21b..0000000
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxAbstractTest.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.kernal.processors.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.transactions.*;
-import org.gridgain.grid.cache.*;
-import org.gridgain.grid.cache.affinity.*;
-import org.gridgain.grid.kernal.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.gridgain.grid.util.typedef.*;
-import org.gridgain.grid.util.typedef.internal.*;
-import org.gridgain.testframework.junits.common.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.transactions.GridCacheTxConcurrency.*;
-import static org.apache.ignite.transactions.GridCacheTxIsolation.*;
-
-/**
- * Tests for local transactions.
- */
-@SuppressWarnings( {"BusyWait"})
-abstract class GridCacheTxAbstractTest extends GridCommonAbstractTest {
-    /** Random number generator. */
-    private static final Random RAND = new Random();
-
-    /** Execution count. */
-    private static final AtomicInteger cntr = new AtomicInteger();
-
-    /** */
-    private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
-    /**
-     * Start grid by default.
-     */
-    protected GridCacheTxAbstractTest() {
-        super(false /*start grid. */);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration c = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(ipFinder);
-
-        c.setDiscoverySpi(disco);
-
-        return c;
-    }
-
-    /**
-     * @return Grid count.
-     */
-    protected abstract int gridCount();
-
-    /**
-     * @return Key count.
-     */
-    protected abstract int keyCount();
-
-    /**
-     * @return Maximum key value.
-     */
-    protected abstract int maxKeyValue();
-
-    /**
-     * @return Thread iterations.
-     */
-    protected abstract int iterations();
-
-    /**
-     * @return True if in-test logging is enabled.
-     */
-    protected abstract boolean isTestDebug();
-
-    /**
-     * @return {@code True} if memory stats should be printed.
-     */
-    protected abstract boolean printMemoryStats();
-
-    /** {@inheritDoc} */
-    private void debug(String msg) {
-        if (isTestDebug())
-            info(msg);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @Override protected void beforeTestsStarted() throws Exception {
-        for (int i = 0; i < gridCount(); i++)
-            startGrid(i);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     * @param i Grid index.
-     * @return Cache.
-     */
-    @SuppressWarnings("unchecked")
-    @Override protected GridCache<Integer, String> cache(int i) {
-        return grid(i).cache(null);
-    }
-
-    /**
-     * @return Keys.
-     */
-    protected Iterable<Integer> getKeys() {
-        List<Integer> keys = new ArrayList<>(keyCount());
-
-        for (int i = 0; i < keyCount(); i++)
-            keys.add(RAND.nextInt(maxKeyValue()) + 1);
-
-        Collections.sort(keys);
-
-        return Collections.unmodifiableList(keys);
-    }
-
-    /**
-     * @return Random cache operation.
-     */
-    protected OP getOp() {
-        switch (RAND.nextInt(3)) {
-            case 0: { return OP.READ; }
-            case 1: { return OP.WRITE; }
-            case 2: { return OP.REMOVE; }
-
-            // Should never be reached.
-            default: { assert false; return null; }
-        }
-    }
-
-    /**
-     * @param concurrency Concurrency.
-     * @param isolation Isolation.
-     * @throws Exception If check failed.
-     */
-    protected void checkCommit(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation) throws Exception {
-        int gridIdx = RAND.nextInt(gridCount());
-
-        Ignite ignite = grid(gridIdx);
-
-        if (isTestDebug())
-            debug("Checking commit on grid: " + ignite.cluster().localNode().id());
-
-        for (int i = 0; i < iterations(); i++) {
-            GridCache<Integer, String> cache = cache(gridIdx);
-
-            GridCacheTx tx = cache.txStart(concurrency, isolation, 0, 0);
-
-            try {
-                int prevKey = -1;
-
-                for (Integer key : getKeys()) {
-                    // Make sure we have the same locking order for all concurrent transactions.
-                    assert key >= prevKey : "key: " + key + ", prevKey: " + prevKey;
-
-                    if (isTestDebug()) {
-                        GridCacheAffinityFunction aff = cache.configuration().getAffinity();
-
-                        int part = aff.partition(key);
-
-                        debug("Key affinity [key=" + key + ", partition=" + part + ", affinity=" +
-                            U.toShortString(cache.affinity().mapPartitionToPrimaryAndBackups(part)) + ']');
-                    }
-
-                    String val = Integer.toString(key);
-
-                    switch (getOp()) {
-                        case READ: {
-                            if (isTestDebug())
-                                debug("Reading key [key=" + key + ", i=" + i + ']');
-
-                            val = cache.get(key);
-
-                            if (isTestDebug())
-                                debug("Read value for key [key=" + key + ", val=" + val + ']');
-
-                            break;
-                        }
-
-                        case WRITE: {
-                            if (isTestDebug())
-                                debug("Writing key and value [key=" + key + ", val=" + val + ", i=" + i + ']');
-
-                            cache.put(key, val);
-
-                            break;
-                        }
-
-                        case REMOVE: {
-                            if (isTestDebug())
-                                debug("Removing key [key=" + key + ", i=" + i  + ']');
-
-                            cache.remove(key);
-
-                            break;
-                        }
-
-                        default: { assert false; }
-                    }
-                }
-
-                tx.commit();
-
-                if (isTestDebug())
-                    debug("Committed transaction [i=" + i + ", tx=" + tx + ']');
-            }
-            catch (GridCacheTxOptimisticException e) {
-                if (concurrency != OPTIMISTIC || isolation != SERIALIZABLE) {
-                    error("Received invalid optimistic failure.", e);
-
-                    throw e;
-                }
-
-                if (isTestDebug())
-                    info("Optimistic transaction failure (will rollback) [i=" + i + ", msg=" + e.getMessage() +
-                        ", tx=" + tx.xid() + ']');
-
-                try {
-                    tx.rollback();
-                }
-                catch (IgniteCheckedException ex) {
-                    error("Failed to rollback optimistic failure: " + tx, ex);
-
-                    throw ex;
-                }
-            }
-            catch (Exception e) {
-                error("Transaction failed (will rollback): " + tx, e);
-
-                tx.rollback();
-
-                throw e;
-            }
-            catch (Error e) {
-                error("Error when executing transaction (will rollback): " + tx, e);
-
-                tx.rollback();
-
-                throw e;
-            }
-            finally {
-                GridCacheTx t = cache.tx();
-
-                assert t == null : "Thread should not have transaction upon completion ['t==tx'=" + (t == tx) +
-                    ", t=" + t + (t != tx ? "tx=" + tx : "tx=''") + ']';
-            }
-        }
-
-        if (printMemoryStats()) {
-            if (cntr.getAndIncrement() % 100 == 0)
-                // Print transaction memory stats.
-                ((GridKernal)grid(gridIdx)).internalCache().context().tm().printMemoryStats();
-        }
-    }
-
-    /**
-     * @param concurrency Concurrency.
-     * @param isolation Isolation.
-     * @throws IgniteCheckedException If check failed.
-     */
-    protected void checkRollback(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation)
-        throws Exception {
-        checkRollback(new ConcurrentHashMap<Integer, String>(), concurrency, isolation);
-    }
-
-    /**
-     * @param map Map to check.
-     * @param concurrency Concurrency.
-     * @param isolation Isolation.
-     * @throws IgniteCheckedException If check failed.
-     */
-    protected void checkRollback(ConcurrentMap<Integer, String> map, GridCacheTxConcurrency concurrency,
-        GridCacheTxIsolation isolation) throws Exception {
-        int gridIdx = RAND.nextInt(gridCount());
-
-        Ignite ignite = grid(gridIdx);
-
-        if (isTestDebug())
-            debug("Checking commit on grid: " + ignite.cluster().localNode().id());
-
-        for (int i = 0; i < iterations(); i++) {
-            GridCache<Integer, String> cache = cache(gridIdx);
-
-            GridCacheTx tx = cache.txStart(concurrency, isolation, 0, 0);
-
-            try {
-                for (Integer key : getKeys()) {
-                    if (isTestDebug()) {
-                        GridCacheAffinityFunction aff = cache.configuration().getAffinity();
-
-                        int part = aff.partition(key);
-
-                        debug("Key affinity [key=" + key + ", partition=" + part + ", affinity=" +
-                            U.toShortString(cache.affinity().mapPartitionToPrimaryAndBackups(part)) + ']');
-                    }
-
-                    String val = Integer.toString(key);
-
-                    switch (getOp()) {
-                        case READ: {
-                            debug("Reading key: " + key);
-
-                            checkMap(map, key, cache.get(key));
-
-                            break;
-                        }
-
-                        case WRITE: {
-                            debug("Writing key and value [key=" + key + ", val=" + val + ']');
-
-                            checkMap(map, key, cache.put(key, val));
-
-                            break;
-                        }
-
-                        case REMOVE: {
-                            debug("Removing key: " + key);
-
-                            checkMap(map, key, cache.remove(key));
-
-                            break;
-                        }
-
-                        default: { assert false; }
-                    }
-                }
-
-                tx.rollback();
-
-                debug("Rolled back transaction: " + tx);
-            }
-            catch (GridCacheTxOptimisticException e) {
-                tx.rollback();
-
-                log.warning("Rolled back transaction due to optimistic exception [tx=" + tx + ", e=" + e + ']');
-
-                throw e;
-            }
-            catch (Exception e) {
-                tx.rollback();
-
-                error("Rolled back transaction due to exception [tx=" + tx + ", e=" + e + ']');
-
-                throw e;
-            }
-            finally {
-                GridCacheTx t1 = cache.tx();
-
-                debug("t1=" + t1);
-
-                assert t1 == null : "Thread should not have transaction upon completion ['t==tx'=" + (t1 == tx) +
-                    ", t=" + t1 + ']';
-            }
-        }
-    }
-
-    /**
-     * @param map Map to check against.
-     * @param key Key.
-     * @param val Value.
-     */
-    private void checkMap(ConcurrentMap<Integer, String> map, Integer key, String val) {
-        if (val != null) {
-            String v = map.putIfAbsent(key, val);
-
-            assert v == null || v.equals(val);
-        }
-    }
-
-    /**
-     * Checks integrity of all caches after tests.
-     *
-     * @throws IgniteCheckedException If check failed.
-     */
-    @SuppressWarnings({"ErrorNotRethrown"})
-    protected void finalChecks() throws Exception {
-        for (int i = 1; i <= maxKeyValue(); i++) {
-            for (int k = 0; k < 3; k++) {
-                try {
-                    GridCacheEntry<Integer, String> e1 = null;
-
-                    String v1 = null;
-
-                    for (int j = 0; j < gridCount(); j++) {
-                        GridCache<Integer, String> cache = cache(j);
-
-                        GridCacheTx tx = cache.tx();
-
-                        assertNull("Transaction is not completed: " + tx, tx);
-
-                        if (j == 0) {
-                            e1 = cache.entry(i);
-
-                            v1 = e1.get();
-                        }
-                        else {
-                            GridCacheEntry<Integer, String> e2 = cache.entry(i);
-
-                            String v2 = e2.get();
-
-                            if (!F.eq(v2, v1)) {
-                                v1 = e1.get();
-                                v2 = e2.get();
-                            }
-
-                            assert F.eq(v2, v1) :
-                                "Invalid cached value [key=" + i + ", v1=" + v1 + ", v2=" + v2 + ", e1=" + e1 +
-                                    ", e2=" + e2 + ", grid=" + j + ']';
-                        }
-                    }
-
-                    break;
-                }
-                catch (AssertionError e) {
-                    if (k == 2)
-                        throw e;
-                    else
-                        // Wait for transactions to complete.
-                        Thread.sleep(500);
-                }
-            }
-        }
-
-        for (int i = 1; i <= maxKeyValue(); i++) {
-            for (int k = 0; k < 3; k++) {
-                try {
-                    for (int j = 0; j < gridCount(); j++) {
-                        GridCacheProjection<Integer, String> cache = cache(j);
-
-                        cache.removeAll();
-
-//                        assert cache.keySet().isEmpty() : "Cache is not empty: " + cache.entrySet();
-                    }
-
-                    break;
-                }
-                catch (AssertionError e) {
-                    if (k == 2)
-                        throw e;
-                    else
-                        // Wait for transactions to complete.
-                        Thread.sleep(500);
-                }
-            }
-        }
-    }
-
-    /**
-     * Cache operation.
-     */
-    protected enum OP {
-        /** Cache read. */
-        READ,
-
-        /** Cache write. */
-        WRITE,
-
-        /** Cache remove. */
-        REMOVE
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxConcurrentGetAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxConcurrentGetAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxConcurrentGetAbstractTest.java
deleted file mode 100644
index c2f6fa0..0000000
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxConcurrentGetAbstractTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.kernal.processors.cache;
-
-import org.apache.ignite.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.transactions.*;
-import org.gridgain.grid.kernal.*;
-import org.gridgain.grid.kernal.processors.cache.distributed.dht.*;
-import org.gridgain.grid.kernal.processors.cache.distributed.near.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.gridgain.testframework.junits.common.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.apache.ignite.transactions.GridCacheTxConcurrency.*;
-import static org.apache.ignite.transactions.GridCacheTxIsolation.*;
-
-/**
- * Checks multithreaded put/get cache operations on one node.
- */
-public abstract class GridCacheTxConcurrentGetAbstractTest extends GridCommonAbstractTest {
-    /** Debug flag. */
-    private static final boolean DEBUG = false;
-
-    /** */
-    protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final int THREAD_NUM = 20;
-
-    /**
-     * Default constructor.
-     *
-     */
-    protected GridCacheTxConcurrentGetAbstractTest() {
-        super(true /** Start grid. */);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi spi = new TcpDiscoverySpi();
-
-        spi.setIpFinder(ipFinder);
-
-        cfg.setDiscoverySpi(spi);
-
-        return cfg;
-    }
-
-    /**
-     * @param g Grid.
-     * @return Near cache.
-     */
-    GridNearCacheAdapter<String, Integer> near(Ignite g) {
-        return (GridNearCacheAdapter<String, Integer>)((GridKernal)g).<String, Integer>internalCache();
-    }
-
-    /**
-     * @param g Grid.
-     * @return DHT cache.
-     */
-    GridDhtCacheAdapter<String, Integer> dht(Ignite g) {
-        return near(g).dht();
-    }
-
-    /**
-     * JUnit.
-     *
-     * @throws Exception If failed.
-     */
-    public void testPutGet() throws Exception {
-        // Random key.
-        final String key = UUID.randomUUID().toString();
-
-        final Ignite ignite = grid();
-
-        ignite.cache(null).put(key, "val");
-
-        GridCacheEntryEx<String,Integer> dhtEntry = dht(ignite).peekEx(key);
-
-        if (DEBUG)
-            info("DHT entry [hash=" + System.identityHashCode(dhtEntry) + ", entry=" + dhtEntry + ']');
-
-        String val = txGet(ignite, key);
-
-        assertNotNull(val);
-
-        info("Starting threads: " + THREAD_NUM);
-
-        multithreaded(new Callable<String>() {
-            @Override public String call() throws Exception {
-                return txGet(ignite, key);
-            }
-        }, THREAD_NUM, "getter-thread");
-    }
-
-    /**
-     * @param ignite Grid.
-     * @param key Key.
-     * @return Value.
-     * @throws Exception If failed.
-     */
-    private String txGet(Ignite ignite, String key) throws Exception {
-        try (GridCacheTx tx = ignite.cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) {
-            GridCacheEntryEx<String, Integer> dhtEntry = dht(ignite).peekEx(key);
-
-            if (DEBUG)
-                info("DHT entry [hash=" + System.identityHashCode(dhtEntry) + ", xid=" + tx.xid() +
-                    ", entry=" + dhtEntry + ']');
-
-            String val = ignite.<String, String>cache(null).get(key);
-
-            assertNotNull(val);
-            assertEquals("val", val);
-
-            tx.commit();
-
-            return val;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3008d2ad/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java
deleted file mode 100644
index 1b86fe1..0000000
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheTxExceptionAbstractSelfTest.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/* @java.file.header */
-
-/*  _________        _____ __________________        _____
- *  __  ____/___________(_)______  /__  ____/______ ____(_)_______
- *  _  / __  __  ___/__  / _  __  / _  / __  _  __ `/__  / __  __ \
- *  / /_/ /  _  /    _  /  / /_/ /  / /_/ /  / /_/ / _  /  _  / / /
- *  \____/   /_/     /_/   \_,__/   \____/   \__,_/  /_/   /_/ /_/
- */
-
-package org.gridgain.grid.kernal.processors.cache;
-
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.indexing.*;
-import org.apache.ignite.transactions.*;
-import org.gridgain.grid.cache.*;
-import org.gridgain.grid.kernal.*;
-import org.gridgain.grid.kernal.processors.cache.distributed.near.*;
-import org.gridgain.testframework.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.gridgain.grid.cache.GridCacheMode.*;
-
-/**
- * Tests that transaction is invalidated in case of {@link GridCacheTxHeuristicException}.
- */
-public abstract class GridCacheTxExceptionAbstractSelfTest extends GridCacheAbstractSelfTest {
-    /** Index SPI throwing exception. */
-    private static TestIndexingSpi idxSpi = new TestIndexingSpi();
-
-    /** */
-    private static final int PRIMARY = 0;
-
-    /** */
-    private static final int BACKUP = 1;
-
-    /** */
-    private static final int NOT_PRIMARY_AND_BACKUP = 2;
-
-    /** */
-    private static Integer lastKey;
-
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 3;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setIndexingSpi(idxSpi);
-
-        cfg.getTransactionsConfiguration().setTxSerializableEnabled(true);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridCacheConfiguration cacheConfiguration(String gridName) throws Exception {
-        GridCacheConfiguration ccfg = super.cacheConfiguration(gridName);
-
-        ccfg.setQueryIndexEnabled(true);
-        ccfg.setStore(null);
-
-        return ccfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        super.beforeTestsStarted();
-
-        lastKey = 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        idxSpi.forceFail(false);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutNear() throws Exception {
-        checkPut(true, keyForNode(grid(0).localNode(), NOT_PRIMARY_AND_BACKUP));
-
-        checkPut(false, keyForNode(grid(0).localNode(), NOT_PRIMARY_AND_BACKUP));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutPrimary() throws Exception {
-        checkPut(true, keyForNode(grid(0).localNode(), PRIMARY));
-
-        checkPut(false, keyForNode(grid(0).localNode(), PRIMARY));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutBackup() throws Exception {
-        checkPut(true, keyForNode(grid(0).localNode(), BACKUP));
-
-        checkPut(false, keyForNode(grid(0).localNode(), BACKUP));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutAll() throws Exception {
-        checkPutAll(true, keyForNode(grid(0).localNode(), PRIMARY),
-            keyForNode(grid(0).localNode(), PRIMARY),
-            keyForNode(grid(0).localNode(), PRIMARY));
-
-        checkPutAll(false, keyForNode(grid(0).localNode(), PRIMARY),
-            keyForNode(grid(0).localNode(), PRIMARY),
-            keyForNode(grid(0).localNode(), PRIMARY));
-
-        if (gridCount() > 1) {
-            checkPutAll(true, keyForNode(grid(1).localNode(), PRIMARY),
-                keyForNode(grid(1).localNode(), PRIMARY),
-                keyForNode(grid(1).localNode(), PRIMARY));
-
-            checkPutAll(false, keyForNode(grid(1).localNode(), PRIMARY),
-                keyForNode(grid(1).localNode(), PRIMARY),
-                keyForNode(grid(1).localNode(), PRIMARY));
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRemoveNear() throws Exception {
-        checkRemove(false, keyForNode(grid(0).localNode(), NOT_PRIMARY_AND_BACKUP));
-
-        checkRemove(true, keyForNode(grid(0).localNode(), NOT_PRIMARY_AND_BACKUP));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRemovePrimary() throws Exception {
-        checkRemove(false, keyForNode(grid(0).localNode(), PRIMARY));
-
-        checkRemove(true, keyForNode(grid(0).localNode(), PRIMARY));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRemoveBackup() throws Exception {
-        checkRemove(false, keyForNode(grid(0).localNode(), BACKUP));
-
-        checkRemove(true, keyForNode(grid(0).localNode(), BACKUP));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTransformNear() throws Exception {
-        checkTransform(false, keyForNode(grid(0).localNode(), NOT_PRIMARY_AND_BACKUP));
-
-        checkTransform(true, keyForNode(grid(0).localNode(), NOT_PRIMARY_AND_BACKUP));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTransformPrimary() throws Exception {
-        checkTransform(false, keyForNode(grid(0).localNode(), PRIMARY));
-
-        checkTransform(true, keyForNode(grid(0).localNode(), PRIMARY));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTransformBackup() throws Exception {
-        checkTransform(false, keyForNode(grid(0).localNode(), BACKUP));
-
-        checkTransform(true, keyForNode(grid(0).localNode(), BACKUP));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutNearTx() throws Exception {
-        for (GridCacheTxConcurrency concurrency : GridCacheTxConcurrency.values()) {
-            for (GridCacheTxIsolation isolation : GridCacheTxIsolation.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));
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutPrimaryTx() throws Exception {
-        for (GridCacheTxConcurrency concurrency : GridCacheTxConcurrency.values()) {
-            for (GridCacheTxIsolation isolation : GridCacheTxIsolation.values()) {
-                checkPutTx(true, concurrency, isolation, keyForNode(grid(0).localNode(), PRIMARY));
-
-                checkPutTx(false, concurrency, isolation, keyForNode(grid(0).localNode(), PRIMARY));
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutBackupTx() throws Exception {
-        for (GridCacheTxConcurrency concurrency : GridCacheTxConcurrency.values()) {
-            for (GridCacheTxIsolation isolation : GridCacheTxIsolation.values()) {
-                checkPutTx(true, concurrency, isolation, keyForNode(grid(0).localNode(), BACKUP));
-
-                checkPutTx(false, concurrency, isolation, keyForNode(grid(0).localNode(), BACKUP));
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutMultipleKeysTx() throws Exception {
-        for (GridCacheTxConcurrency concurrency : GridCacheTxConcurrency.values()) {
-            for (GridCacheTxIsolation isolation : GridCacheTxIsolation.values()) {
-                checkPutTx(true, concurrency, isolation,
-                    keyForNode(grid(0).localNode(), PRIMARY),
-                    keyForNode(grid(0).localNode(), PRIMARY),
-                    keyForNode(grid(0).localNode(), PRIMARY));
-
-                checkPutTx(false, concurrency, isolation,
-                    keyForNode(grid(0).localNode(), PRIMARY),
-                    keyForNode(grid(0).localNode(), PRIMARY),
-                    keyForNode(grid(0).localNode(), PRIMARY));
-
-                if (gridCount() > 1) {
-                    checkPutTx(true, concurrency, isolation,
-                        keyForNode(grid(1).localNode(), PRIMARY),
-                        keyForNode(grid(1).localNode(), PRIMARY),
-                        keyForNode(grid(1).localNode(), PRIMARY));
-
-                    checkPutTx(false, concurrency, isolation,
-                        keyForNode(grid(1).localNode(), PRIMARY),
-                        keyForNode(grid(1).localNode(), PRIMARY),
-                        keyForNode(grid(1).localNode(), PRIMARY));
-                }
-            }
-        }
-    }
-
-    /**
-     * @param putBefore If {@code true} then puts some value before executing failing operation.
-     * @param keys Keys.
-     * @param concurrency Transaction concurrency.
-     * @param isolation Transaction isolation.
-     * @throws Exception If failed.
-     */
-    private void checkPutTx(boolean putBefore, GridCacheTxConcurrency concurrency,
-        GridCacheTxIsolation isolation, final Integer... keys) throws Exception {
-        assertTrue(keys.length > 0);
-
-        info("Test transaction [concurrency=" + concurrency + ", isolation=" + isolation + ']');
-
-        GridCache<Integer, Integer> cache = grid(0).cache(null);
-
-        if (putBefore) {
-            idxSpi.forceFail(false);
-
-            info("Start transaction.");
-
-            try (GridCacheTx tx = cache.txStart(concurrency, isolation)) {
-                for (Integer key : keys) {
-                    info("Put " + key);
-
-                    cache.put(key, 1);
-                }
-
-                info("Commit.");
-
-                tx.commit();
-            }
-        }
-
-        // Execute get from all nodes to create readers for near cache.
-        for (int i = 0; i < gridCount(); i++) {
-            for (Integer key : keys)
-                grid(i).cache(null).get(key);
-        }
-
-        idxSpi.forceFail(true);
-
-        try {
-            info("Start transaction.");
-
-            try (GridCacheTx tx = cache.txStart(concurrency, isolation)) {
-                for (Integer key : keys) {
-                    info("Put " + key);
-
-                    cache.put(key, 2);
-                }
-
-                info("Commit.");
-
-                tx.commit();
-            }
-
-            fail("Transaction should fail.");
-        }
-        catch (GridCacheTxHeuristicException e) {
-            log.info("Expected exception: " + e);
-        }
-
-        for (Integer key : keys)
-            checkEmpty(key);
-    }
-
-    /**
-     * @param key Key.
-     * @throws Exception If failed.
-     */
-    private void checkEmpty(final Integer key) throws Exception {
-        idxSpi.forceFail(false);
-
-        info("Check key: " + key);
-
-        for (int i = 0; i < gridCount(); i++) {
-            GridKernal grid = (GridKernal) grid(i);
-
-            GridCacheAdapter cache = grid.internalCache(null);
-
-            GridCacheMapEntry entry = cache.map().getEntry(key);
-
-            log.info("Entry: " + entry);
-
-            if (entry != null) {
-                assertFalse("Unexpected entry for grid [i=" + i + ", entry=" + entry + ']', entry.lockedByAny());
-                assertFalse("Unexpected entry for grid [i=" + i + ", entry=" + entry + ']', entry.hasValue());
-            }
-
-            if (cache.isNear()) {
-                entry = ((GridNearCacheAdapter)cache).dht().map().getEntry(key);
-
-                log.info("Dht entry: " + entry);
-
-                if (entry != null) {
-                    assertFalse("Unexpected entry for grid [i=" + i + ", entry=" + entry + ']', entry.lockedByAny());
-                    assertFalse("Unexpected entry for grid [i=" + i + ", entry=" + entry + ']', entry.hasValue());
-                }
-            }
-        }
-
-        for (int i = 0; i < gridCount(); i++)
-            assertEquals("Unexpected value for grid " + i, null, grid(i).cache(null).get(key));
-    }
-
-    /**
-     * @param putBefore If {@code true} then puts some value before executing failing operation.
-     * @param key Key.
-     * @throws Exception If failed.
-     */
-    private void checkPut(boolean putBefore, final Integer key) throws Exception {
-        if (putBefore) {
-            idxSpi.forceFail(false);
-
-            info("Put key: " + key);
-
-            grid(0).cache(null).put(key, 1);
-        }
-
-        // Execute get from all nodes to create readers for near cache.
-        for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
-
-        idxSpi.forceFail(true);
-
-        info("Going to put: " + key);
-
-        GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
-                grid(0).cache(null).put(key, 2);
-
-                return null;
-            }
-        }, GridCacheTxHeuristicException.class, null);
-
-        checkEmpty(key);
-    }
-
-    /**
-     * @param putBefore If {@code true} then puts some value before executing failing operation.
-     * @param key Key.
-     * @throws Exception If failed.
-     */
-    private void checkTransform(boolean putBefore, final Integer key) throws Exception {
-        if (putBefore) {
-            idxSpi.forceFail(false);
-
-            info("Put key: " + key);
-
-            grid(0).cache(null).put(key, 1);
-        }
-
-        // Execute get from all nodes to create readers for near cache.
-        for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
-
-        idxSpi.forceFail(true);
-
-        info("Going to transform: " + key);
-
-        GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
-                grid(0).cache(null).transform(key, new IgniteClosure<Object, Object>() {
-                    @Override public Object apply(Object o) {
-                        return 2;
-                    }
-                });
-
-                return null;
-            }
-        }, GridCacheTxHeuristicException.class, null);
-
-        checkEmpty(key);
-    }
-
-    /**
-     * @param putBefore If {@code true} then puts some value before executing failing operation.
-     * @param keys Keys.
-     * @throws Exception If failed.
-     */
-    private void checkPutAll(boolean putBefore, Integer ... keys) throws Exception {
-        assert keys.length > 1;
-
-        if (putBefore) {
-            idxSpi.forceFail(false);
-
-            Map<Integer, Integer> m = new HashMap<>();
-
-            for (Integer key : keys)
-                m.put(key, 1);
-
-            info("Put data: " + m);
-
-            grid(0).cache(null).putAll(m);
-        }
-
-        // Execute get from all nodes to create readers for near cache.
-        for (int i = 0; i < gridCount(); i++) {
-            for (Integer key : keys)
-                grid(i).cache(null).get(key);
-        }
-
-        idxSpi.forceFail(true);
-
-        final Map<Integer, Integer> m = new HashMap<>();
-
-        for (Integer key : keys)
-            m.put(key, 2);
-
-        info("Going to putAll: " + m);
-
-        GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
-                grid(0).cache(null).putAll(m);
-
-                return null;
-            }
-        }, GridCacheTxHeuristicException.class, null);
-
-        for (Integer key : m.keySet())
-            checkEmpty(key);
-    }
-
-    /**
-     * @param putBefore If {@code true} then puts some value before executing failing operation.
-     * @param key Key.
-     * @throws Exception If failed.
-     */
-    private void checkRemove(boolean putBefore, final Integer key) throws Exception {
-        if (putBefore) {
-            idxSpi.forceFail(false);
-
-            info("Put key: " + key);
-
-            grid(0).cache(null).put(key, 1);
-        }
-
-        // Execute get from all nodes to create readers for near cache.
-        for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
-
-        idxSpi.forceFail(true);
-
-        info("Going to remove: " + key);
-
-        GridTestUtils.assertThrows(log, new Callable<Void>() {
-            @Override public Void call() throws Exception {
-                grid(0).cache(null).remove(key);
-
-                return null;
-            }
-        }, GridCacheTxHeuristicException.class, null);
-
-        checkEmpty(key);
-    }
-
-    /**
-     * Generates key of a given type for given node.
-     *
-     * @param node Node.
-     * @param type Key type.
-     * @return Key.
-     */
-    private Integer keyForNode(ClusterNode node, int type) {
-        GridCache<Integer, Integer> cache = grid(0).cache(null);
-
-        if (cache.configuration().getCacheMode() == LOCAL)
-            return ++lastKey;
-
-        if (cache.configuration().getCacheMode() == REPLICATED && type == NOT_PRIMARY_AND_BACKUP)
-            return ++lastKey;
-
-        for (int key = lastKey + 1; key < (lastKey + 10_000); key++) {
-            switch (type) {
-                case NOT_PRIMARY_AND_BACKUP: {
-                    if (!cache.affinity().isPrimaryOrBackup(node, key)) {
-                        lastKey = key;
-
-                        return key;
-                    }
-
-                    break;
-                }
-
-                case PRIMARY: {
-                    if (cache.affinity().isPrimary(node, key)) {
-                        lastKey = key;
-
-                        return key;
-                    }
-
-                    break;
-                }
-
-                case BACKUP: {
-                    if (cache.affinity().isBackup(node, key)) {
-                        lastKey = key;
-
-                        return key;
-                    }
-
-                    break;
-                }
-
-                default:
-                    fail();
-            }
-        }
-
-        throw new IllegalStateException("Failed to find key.");
-    }
-
-    /**
-     * Indexing SPI that can fail on demand.
-     */
-    private static class TestIndexingSpi extends IgniteSpiAdapter implements GridIndexingSpi {
-        /** Fail flag. */
-        private volatile boolean fail;
-
-        /**
-         * @param fail Fail flag.
-         */
-        public void forceFail(boolean fail) {
-            this.fail = fail;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Iterator<?> query(@Nullable String spaceName, Collection<Object> params, @Nullable GridIndexingQueryFilter filters) throws IgniteSpiException {
-            throw new UnsupportedOperationException();
-        }
-
-        /** {@inheritDoc} */
-        @Override public void store(@Nullable String spaceName, Object key, Object val, long expirationTime)
-            throws IgniteSpiException {
-            if (fail) {
-                fail = false;
-
-                throw new IgniteSpiException("Test exception.");
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void remove(@Nullable String spaceName, Object k)
-            throws IgniteSpiException {
-            if (fail) {
-                fail = false;
-
-                throw new IgniteSpiException("Test exception.");
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onSwap(@Nullable String spaceName, Object key) throws IgniteSpiException {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onUnswap(@Nullable String spaceName, Object key, Object val) throws IgniteSpiException {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStop() throws IgniteSpiException {
-            // No-op.
-        }
-    }
-}