ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [08/50] incubator-ignite git commit: #ignite-565: Remove GridCache from tests.
Date Fri, 27 Mar 2015 14:19:05 GMT
#ignite-565: Remove GridCache from tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/15334cc5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/15334cc5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/15334cc5

Branch: refs/heads/ignite-443
Commit: 15334cc528d65474a4763a0e32e25dd9c429ce97
Parents: 1b7fb1d
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Wed Mar 25 19:13:35 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Wed Mar 25 19:13:35 2015 +0300

----------------------------------------------------------------------
 .../rest/AbstractRestProcessorSelfTest.java     |  9 ---
 .../ignite/IgniteCacheAffinitySelfTest.java     |  8 +--
 .../cache/GridCacheAbstractFullApiSelfTest.java |  3 +-
 .../cache/GridCacheAbstractSelfTest.java        | 43 -------------
 .../GridCacheOnCopyFlagAbstractSelfTest.java    |  2 +-
 .../GridCacheNodeFailureAbstractTest.java       |  8 ---
 .../IgniteTxTimeoutAbstractTest.java            |  8 ---
 .../GridCacheDhtEvictionsDisabledSelfTest.java  |  6 +-
 .../near/GridCacheNearEvictionSelfTest.java     |  4 +-
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |  8 +--
 .../GridCacheReplicatedPreloadSelfTest.java     |  2 +-
 .../junits/common/GridCommonAbstractTest.java   | 64 ++++++++++----------
 .../query/h2/GridH2IndexRebuildTest.java        | 10 +--
 13 files changed, 50 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
index dbab4bd..20f3bf5 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.rest;
 
 import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
@@ -92,14 +91,6 @@ abstract class AbstractRestProcessorSelfTest extends GridCommonAbstractTest
{
     /**
      * @return Cache.
      */
-    @Deprecated
-    @Override protected <K, V> GridCache<K, V> cache() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * @return Cache.
-     */
     @Override protected <K, V> IgniteCache<K, V> jcache() {
         return grid(0).cache(null);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
index 0c8dcc2..74bb790 100644
--- a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
@@ -106,10 +106,10 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest
{
      * Check CacheAffinityProxy methods.
      */
     private void checkAffinity() {
-        checkAffinity(grid(0).affinity(null), cache(1, null).affinity());
-        checkAffinity(grid(0).affinity(CACHE1), cache(1, CACHE1).affinity());
-        checkAffinity(grid(0).affinity(CACHE1), cache(1, CACHE1).affinity());
-        checkAffinity(grid(0).affinity(CACHE2), cache(1, CACHE2).affinity());
+        checkAffinity(grid(0).affinity(null), internalCache(1, null).affinity());
+        checkAffinity(grid(0).affinity(CACHE1), internalCache(1, CACHE1).affinity());
+        checkAffinity(grid(0).affinity(CACHE1), internalCache(1, CACHE1).affinity());
+        checkAffinity(grid(0).affinity(CACHE2), internalCache(1, CACHE2).affinity());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 6e9ab2f..8ec68b1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -47,6 +47,7 @@ import java.util.concurrent.atomic.*;
 import java.util.concurrent.locks.*;
 
 import static java.util.concurrent.TimeUnit.*;
+import static org.apache.ignite.cache.CacheMemoryMode.OFFHEAP_TIERED;
 import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.events.EventType.*;
 import static org.apache.ignite.testframework.GridTestUtils.*;
@@ -3735,7 +3736,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             for (int i = 0; i < gridCount(); i++) {
                 GridCacheContext<String, Integer> ctx = context(i);
 
-                if (offheapTiered(ctx.cache()))
+                if (ctx.cache().configuration().getMemoryMode() == OFFHEAP_TIERED)
                     continue;
 
                 int size = 0;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index 0d10361..aa0b3d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -336,23 +336,6 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest
{
     }
 
     /**
-     * @param idx Index of grid.
-     * @return Cache instance casted to work with string and integer types for convenience.
-     */
-    @SuppressWarnings({"unchecked"})
-    @Override protected GridCache<String, Integer> cache(int idx) {
-        return ((IgniteKernal)grid(idx)).getCache(null);
-    }
-
-    /**
-     * @return Default cache instance casted to work with string and integer types for convenience.
-     */
-    @SuppressWarnings({"unchecked"})
-    @Override protected GridCache<String, Integer> cache() {
-        return cache(0);
-    }
-
-    /**
      * @return Default cache instance.
      */
     @SuppressWarnings({"unchecked"})
@@ -397,14 +380,6 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest
{
      * @param cache Cache.
      * @return {@code True} if cache has OFFHEAP_TIERED memory mode.
      */
-    protected boolean offheapTiered(GridCache cache) {
-        return cache.configuration().getMemoryMode() == OFFHEAP_TIERED;
-    }
-
-    /**
-     * @param cache Cache.
-     * @return {@code True} if cache has OFFHEAP_TIERED memory mode.
-     */
     protected <K, V> boolean offheapTiered(IgniteCache<K, V> cache) {
         return cache.getConfiguration(CacheConfiguration.class).getMemoryMode() == OFFHEAP_TIERED;
     }
@@ -434,24 +409,6 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest
{
     }
 
     /**
-     * @param cache Cache.
-     * @param val Value.
-     * @return {@code True} if offheap contains given value.
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("unchecked")
-    protected boolean containsOffheapValue(GridCache cache, Object val) throws Exception
{
-        for (Iterator<Map.Entry> it = cache.offHeapIterator(); it.hasNext();) {
-            Map.Entry e = it.next();
-
-            if (val.equals(e.getValue()))
-                return true;
-        }
-
-        return false;
-    }
-
-    /**
      * Filters cache entry projections leaving only ones with keys containing 'key'.
      */
     protected static IgnitePredicate<Cache.Entry<String, Integer>> entryKeyFilter
=

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
index 0f25fc1..b2906f8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOnCopyFlagAbstractSelfTest.java
@@ -80,7 +80,7 @@ public abstract class GridCacheOnCopyFlagAbstractSelfTest extends GridCacheAbstr
         interceptor.delegate(new CacheInterceptorAdapter<TestKey, TestValue>());
 
         for (int i = 0; i < gridCount(); i++)
-            cache(i, null).clearLocally();
+            jcache(i, null).localClearAll(keySet(jcache(i, null)));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
index 9974ac6..0656058 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
@@ -124,14 +124,6 @@ public abstract class GridCacheNodeFailureAbstractTest extends GridCommonAbstrac
      * @param i Grid index.
      * @return Cache.
      */
-    @Override protected <K, V> GridCache<K, V> cache(int i) {
-        return ((IgniteKernal)IGNITEs.get(i)).getCache(null);
-    }
-
-    /**
-     * @param i Grid index.
-     * @return Cache.
-     */
     @Override protected <K, V> IgniteCache<K, V> jcache(int i) {
         return IGNITEs.get(i).cache(null);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
index 6c56925..db6f0b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
@@ -65,14 +65,6 @@ public class IgniteTxTimeoutAbstractTest extends GridCommonAbstractTest
{
      * @param i Grid index.
      * @return Cache.
      */
-    @Override protected <K, V> GridCache<K, V> cache(int i) {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * @param i Grid index.
-     * @return Cache.
-     */
     @Override protected <K, V> IgniteCache<K, V> jcache(int i) {
         return IGNITEs.get(i).cache(null);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
index f4d0cb2..c35f106 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionsDisabledSelfTest.java
@@ -75,7 +75,7 @@ public class GridCacheDhtEvictionsDisabledSelfTest extends GridCommonAbstractTes
         checkNodes(startGridsMultiThreaded(1));
 
         assertEquals(26, colocated(0, "test").size());
-        assertEquals(26, cache(0, "test").size());
+        assertEquals(26, jcache(0, "test").localSize());
     }
 
     /** @throws Exception If failed. */
@@ -83,7 +83,7 @@ public class GridCacheDhtEvictionsDisabledSelfTest extends GridCommonAbstractTes
         checkNodes(startGridsMultiThreaded(2));
 
         assertTrue(colocated(0, "test").size() > 0);
-        assertTrue(cache(0, "test").size() > 0);
+        assertTrue(jcache(0, "test").localSize() > 0);
     }
 
     /** @throws Exception If failed. */
@@ -91,7 +91,7 @@ public class GridCacheDhtEvictionsDisabledSelfTest extends GridCommonAbstractTes
         checkNodes(startGridsMultiThreaded(3));
 
         assertTrue(colocated(0, "test").size() > 0);
-        assertTrue(cache(0, "test").size() > 0);
+        assertTrue(jcache(0, "test").localSize() > 0);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
index 11c0427..b8dafc6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
@@ -131,7 +131,7 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest
{
             });
 
             for (int i = 0; i < gridCnt; i++) {
-                assertEquals(cnt, grid(i).cache(null).size());
+                assertEquals(cnt, internalCache(i).size());
                 assertEquals(0, near(i).nearSize());
             }
         }
@@ -164,7 +164,7 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest
{
             });
 
             for (int i = 0; i < gridCnt; i++) {
-                final IgniteCache cache = grid(i).cache(null);
+                final GridCache cache = internalCache(i);
 
                 // Repeatedly check cache sizes because of concurrent cache updates.
                 assertTrue(GridTestUtils.waitForCondition(new PA() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index a850c5e..884e0d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -22,6 +22,7 @@ import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -128,13 +129,6 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
     }
 
     /**
-     * @return For the purpose of this test returns the near-only instance.
-     */
-    @Override protected GridCache<String, Integer> cache() {
-        return cache(nearIdx);
-    }
-
-    /**
      * @return A not near-only cache.
      */
     @Override protected IgniteCache<String, Integer> fullCache() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
index 1e6de78..51c2047 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
@@ -449,7 +449,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest
{
                 grid(0).cache(null).putAll(map);
 
             for (int gridIdx = 0; gridIdx < gridCnt; gridIdx++) {
-                assert grid(gridIdx).cache(null).size() == cnt : "Actual size: " + grid(gridIdx).cache(null).size();
+                assert grid(gridIdx).cache(null).localSize() == cnt : "Actual size: " + grid(gridIdx).cache(null).localSize();
 
                 info("Cache size is OK for grid index: " + gridIdx);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index a8237d2..6024a0a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -68,40 +68,43 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
      * @param idx Grid index.
      * @return Cache.
      */
-    protected <K, V> GridCache<K, V> cache(int idx) {
-        return grid(idx).cachex();
+    protected <K, V> IgniteCache<K, V> jcache(int idx) {
+        return grid(idx).cache(null);
     }
 
     /**
      * @param idx Grid index.
+     * @param name Cache name.
      * @return Cache.
      */
-    protected <K, V> IgniteCache<K, V> jcache(int idx) {
-        return grid(idx).cache(null);
+    protected <K, V> IgniteCache<K, V> jcache(int idx, String name) {
+        return grid(idx).cache(name);
     }
 
     /**
      * @param idx Grid index.
-     * @param name Cache name.
      * @return Cache.
      */
-    protected <K, V> GridCache<K, V> cache(int idx, String name) {
-        return grid(idx).cachex(name);
+    protected <K, V> GridCacheAdapter<K, V> internalCache(int idx) {
+        return ((IgniteKernal)grid(idx)).internalCache(null);
     }
 
     /**
+     * @param idx Grid index.
+     * @param name Cache name.
      * @return Cache.
      */
-    protected <K, V> GridCache<K, V> cache() {
-        return grid().cachex();
+    protected <K, V> GridCacheAdapter<K, V> internalCache(int idx, String name)
{
+        return ((IgniteKernal)grid(idx)).internalCache(name);
     }
 
     /**
-     * @param idx Grid index.
+     * @param ignite Grid.
+     * @param name Cache name.
      * @return Cache.
      */
-    protected <K, V> GridCache<K, V> internalCache(int idx) {
-        return ((IgniteKernal)grid(idx)).getCache(null);
+    protected <K, V> GridCacheAdapter<K, V> internalCache(Ignite ignite, String
name) {
+        return ((IgniteKernal)ignite).internalCache(name);
     }
 
     /**
@@ -142,18 +145,20 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
      * @param cache Cache.
      * @return DHT cache.
      */
-    protected static <K, V> GridDhtCacheAdapter<K, V> dht(GridCache<K,V>
cache) {
+    protected static <K, V> GridDhtCacheAdapter<K, V> dht(IgniteCache<K,V>
cache) {
         return nearEnabled(cache) ? near(cache).dht() :
-            ((IgniteKernal)cache.gridProjection().ignite()).<K, V>internalCache(cache.name()).context().dht();
+            ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().dht();
     }
 
     /**
-     * @param cache Cache.
+     * @param ignite Ignite.
+     * @param cfg Cache configuration.
      * @return DHT cache.
      */
-    protected static <K, V> GridDhtCacheAdapter<K, V> dht(IgniteCache<K,V>
cache) {
-        return nearEnabled(cache) ? near(cache).dht() :
-            ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().dht();
+    private static <K, V> GridDhtCacheAdapter<K, V> dht(Ignite ignite, CacheConfiguration
cfg) {
+        GridNearCacheAdapter<K, V> adapter = near(ignite, cfg.getName());
+        return nearEnabled(cfg) ? adapter.dht() :
+            ((IgniteKernal)ignite).<K, V>internalCache(cfg.getName()).context().dht();
     }
 
     /**
@@ -190,13 +195,9 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     }
 
     /**
-     * @param cache Cache.
      * @return {@code True} if near cache is enabled.
      */
-    protected static <K, V> boolean nearEnabled(GridCache<K,V> cache) {
-        CacheConfiguration cfg = ((IgniteKernal)cache.gridProjection().ignite()).
-            <K, V>internalCache(cache.name()).context().config();
-
+    private static <K, V> boolean nearEnabled(CacheConfiguration cfg) {
         return isNearEnabled(cfg);
     }
 
@@ -215,16 +216,15 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
      * @param cache Cache.
      * @return Near cache.
      */
-    protected static <K, V> GridNearCacheAdapter<K, V> near(GridCache<K,V>
cache) {
-        return ((IgniteKernal)cache.gridProjection().ignite()).<K, V>internalCache(cache.name()).context().near();
+    protected static <K, V> GridNearCacheAdapter<K, V> near(IgniteCache<K,V>
cache) {
+        return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().near();
     }
 
     /**
-     * @param cache Cache.
      * @return Near cache.
      */
-    protected static <K, V> GridNearCacheAdapter<K, V> near(IgniteCache<K,V>
cache) {
-        return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context().near();
+    private static <K, V> GridNearCacheAdapter<K, V> near(Ignite ignite, String
cacheName) {
+        return ((IgniteKernal)ignite).<K, V>internalCache(cacheName).context().near();
     }
 
     /**
@@ -347,13 +347,11 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
     @SuppressWarnings("BusyWait")
     protected void awaitPartitionMapExchange() throws InterruptedException {
         for (Ignite g : G.allGrids()) {
-            for (GridCache<?, ?> c : ((IgniteEx)g).cachesx()) {
-                CacheConfiguration cfg = c.configuration();
-
+            for (CacheConfiguration cfg : g.configuration().getCacheConfiguration()) {
                 if (cfg.getCacheMode() == PARTITIONED && cfg.getRebalanceMode() !=
NONE && g.cluster().nodes().size() > 1) {
                     AffinityFunction aff = cfg.getAffinity();
 
-                    GridDhtCacheAdapter<?, ?> dht = dht(c);
+                    GridDhtCacheAdapter<?, ?> dht = dht(g, cfg);
 
                     GridDhtPartitionTopology top = dht.topology();
 
@@ -362,7 +360,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
 
                         for (int i = 0; ; i++) {
                             // Must map on updated version of topology.
-                            Collection<ClusterNode> affNodes = c.affinity().mapPartitionToPrimaryAndBackups(p);
+                            Collection<ClusterNode> affNodes = g.affinity(cfg.getName()).mapPartitionToPrimaryAndBackups(p);
 
                             int exp = affNodes.size();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/15334cc5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
index 39cf663..21b5f04 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridH2IndexRebuildTest.java
@@ -153,9 +153,9 @@ public class GridH2IndexRebuildTest extends GridCacheAbstractSelfTest
{
      * @throws Exception if failed.
      */
     public void testRebuildIndexes() throws Exception {
-        cache().queries().rebuildIndexes(ArrayList.class).get();
+        ((IgniteKernal)grid(0)).internalCache(null).queries().rebuildIndexes(ArrayList.class).get();
 
-        cache().queries().rebuildAllIndexes().get();
+        ((IgniteKernal)grid(0)).internalCache(null).queries().rebuildAllIndexes().get();
 
         IgniteCache<Integer, TestValue1> cache1 = grid(0).cache(null);
         IgniteCache<Integer, TestValue2> cache2 = grid(0).cache(null);
@@ -186,8 +186,8 @@ public class GridH2IndexRebuildTest extends GridCacheAbstractSelfTest
{
             cache2.remove(ENTRY_CNT * 2 + i);
         }
 
-        cache().queries().rebuildIndexes(TestValue1.class).get();
-        cache().queries().rebuildIndexes(TestValue2.class).get();
+        ((IgniteKernal)grid(0)).internalCache(null).queries().rebuildIndexes(TestValue1.class).get();
+        ((IgniteKernal)grid(0)).internalCache(null).queries().rebuildIndexes(TestValue2.class).get();
 
         assertEquals(1, cache1.query(qry1).getAll().size());
         assertEquals(1, cache1.query(qry2).getAll().size());
@@ -195,7 +195,7 @@ public class GridH2IndexRebuildTest extends GridCacheAbstractSelfTest
{
         assertEquals(1, cache2.query(qry4).getAll().size());
         assertEquals(1, cache2.query(qry5).getAll().size());
 
-        cache().queries().rebuildAllIndexes().get();
+        ((IgniteKernal)grid(0)).internalCache(null).queries().rebuildAllIndexes().get();
 
         assertEquals(1, cache1.query(qry1).getAll().size());
         assertEquals(1, cache1.query(qry2).getAll().size());


Mime
View raw message