ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: #ignite-45-gridcache: remove GridCache from tests.
Date Mon, 23 Mar 2015 16:29:48 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-45-gridcache 67a73557d -> b994d3ef7


#ignite-45-gridcache: 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/b994d3ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b994d3ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b994d3ef

Branch: refs/heads/ignite-45-gridcache
Commit: b994d3ef73c36d999564a6ba213e47e5e9235f06
Parents: 67a7355
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Mon Mar 23 19:29:43 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Mon Mar 23 19:29:43 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheEntryVersionSelfTest.java    |  4 ++--
 .../GridCacheExAbstractFullApiSelfTest.java     |  7 +++---
 .../GridCacheQueryIndexingDisabledSelfTest.java | 19 ++++++----------
 .../GridCacheQueryInternalKeysSelfTest.java     |  4 ++--
 .../IgniteClientAffinityAssignmentSelfTest.java |  4 ++--
 .../cache/IgnitePutAllLargeBatchSelfTest.java   |  8 +++----
 ...xOriginatingNodeFailureAbstractSelfTest.java |  4 +---
 ...cOriginatingNodeFailureAbstractSelfTest.java |  4 +---
 ...itionedTxOriginatingNodeFailureSelfTest.java | 17 +++++----------
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |  8 +++----
 ...achePartitionedMultiNodeCounterSelfTest.java |  8 -------
 ...achePartitionedMultiNodeFullApiSelfTest.java | 23 ++++++++++----------
 .../IgniteCacheExpiryPolicyAbstractTest.java    |  3 +--
 ...eCacheExpiryPolicyWithStoreAbstractTest.java |  4 ++--
 .../igfs/IgfsDataManagerSelfTest.java           |  6 ++---
 .../processors/igfs/IgfsSizeSelfTest.java       |  4 ++--
 .../cache/GridCacheOffHeapAndSwapSelfTest.java  |  2 +-
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |  2 +-
 18 files changed, 52 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
index efc0ee1..365d28b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
@@ -113,7 +113,7 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest
{
                     if (entry != null) {
                         GridCacheVersion ver = entry.version();
 
-                        long order = cache.affinity().mapKeyToNode(key).order();
+                        long order = grid.affinity(null).mapKeyToNode(key).order();
 
                         // Check topology version.
                         assertEquals(3, ver.topologyVersion() -
@@ -140,7 +140,7 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest
{
                     if (entry != null) {
                         GridCacheVersion ver = entry.version();
 
-                        long order = cache.affinity().mapKeyToNode(key).order();
+                        long order = grid.affinity(null).mapKeyToNode(key).order();
 
                         // Check topology version.
                         assertEquals(4, ver.topologyVersion() -

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
index 8eb6477..e49dc0e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
@@ -62,13 +63,13 @@ public abstract class GridCacheExAbstractFullApiSelfTest extends GridCacheAbstra
         try {
             grid(0).events().localListen(lsnr, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED);
 
-            GridCache<String, Integer> cache = cache();
+            IgniteCache<String, Integer> cache = jcache();
 
             try (Transaction tx = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
                 int key = 0;
 
                 for (int i = 0; i < 1000; i++) {
-                    if (cache.affinity().mapKeyToNode("key" + i).id().equals(grid(0).localNode().id()))
{
+                    if (grid(0).affinity(null).mapKeyToNode("key" + i).id().equals(grid(0).localNode().id()))
{
                         key = i;
 
                         break;
@@ -78,7 +79,7 @@ public abstract class GridCacheExAbstractFullApiSelfTest extends GridCacheAbstra
                 cache.get("key" + key);
 
                 for (int i = key + 1; i < 1000; i++) {
-                    if (cache.affinity().mapKeyToNode("key" + i).id().equals(grid(0).localNode().id()))
{
+                    if (grid(0).affinity(null).mapKeyToNode("key" + i).id().equals(grid(0).localNode().id()))
{
                         key = i;
 
                         break;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
index 8e32c6d..9045d8e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
@@ -19,11 +19,11 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.query.*;
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.testframework.*;
 
-import java.util.*;
+import javax.cache.*;
 import java.util.concurrent.*;
 
 /**
@@ -48,7 +48,7 @@ public class GridCacheQueryIndexingDisabledSelfTest extends GridCacheAbstractSel
      * @param c Closure.
      */
     private void doTest(Callable<Object> c) {
-        GridTestUtils.assertThrows(log, c, IgniteCheckedException.class, "Indexing is disabled
for cache: null");
+        GridTestUtils.assertThrows(log, c, CacheException.class, "Indexing is disabled for
cache: null");
     }
 
     /**
@@ -57,8 +57,7 @@ public class GridCacheQueryIndexingDisabledSelfTest extends GridCacheAbstractSel
     public void testSqlFieldsQuery() throws IgniteCheckedException {
         doTest(new Callable<Object>() {
             @Override public Object call() throws IgniteCheckedException {
-                return cache().queries().createSqlFieldsQuery("select * from dual").execute()
-                    .get();
+                return jcache().query(new SqlFieldsQuery("select * from dual")).getAll();
             }
         });
     }
@@ -69,8 +68,7 @@ public class GridCacheQueryIndexingDisabledSelfTest extends GridCacheAbstractSel
     public void testTextQuery() throws IgniteCheckedException {
         doTest(new Callable<Object>() {
             @Override public Object call() throws IgniteCheckedException {
-                return cache().queries().createFullTextQuery(String.class, "text")
-                    .execute().get();
+                return jcache().query(new TextQuery<>(String.class, "text")).getAll();
             }
         });
     }
@@ -81,8 +79,7 @@ public class GridCacheQueryIndexingDisabledSelfTest extends GridCacheAbstractSel
     public void testSqlQuery() throws IgniteCheckedException {
         doTest(new Callable<Object>() {
             @Override public Object call() throws IgniteCheckedException {
-                return cache().queries().createSqlQuery(String.class, "1 = 1")
-                    .execute().get();
+                return jcache().query(new SqlQuery<>(String.class, "1 = 1")).getAll();
             }
         });
     }
@@ -91,8 +88,6 @@ public class GridCacheQueryIndexingDisabledSelfTest extends GridCacheAbstractSel
      * @throws IgniteCheckedException If failed.
      */
     public void testScanQuery() throws IgniteCheckedException {
-        CacheQuery<Map.Entry<String, Integer>> qry = cache().queries().createScanQuery(null);
-
-        qry.execute().get();
+        jcache().query(new ScanQuery<>(null)).getAll();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
index bc8529e..1168851 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
@@ -67,7 +67,7 @@ public class GridCacheQueryInternalKeysSelfTest extends GridCacheAbstractSelfTes
     @SuppressWarnings("unchecked")
     public void testInternalKeysPreloading() throws Exception {
         try {
-            GridCache<Object, Object> cache = ((IgniteKernal)grid(0)).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).jcache(null);
 
             for (int i = 0; i < ENTRY_CNT; i++)
                 cache.put(new GridCacheQueueHeaderKey("queue" + i), 1);
@@ -77,7 +77,7 @@ public class GridCacheQueryInternalKeysSelfTest extends GridCacheAbstractSelfTes
             for (int i = 0; i < ENTRY_CNT; i++) {
                 GridCacheQueueHeaderKey internalKey = new GridCacheQueueHeaderKey("queue"
+ i);
 
-                Collection<ClusterNode> nodes = cache.affinity().mapKeyToPrimaryAndBackups(internalKey);
+                Collection<ClusterNode> nodes = grid(0).affinity(null).mapKeyToPrimaryAndBackups(internalKey);
 
                 for (ClusterNode n : nodes) {
                     Ignite g = findGridForNodeId(n.id());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
index 1f1b8e8..6f096f4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
@@ -132,14 +132,14 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe
      * @throws Exception If failed.
      */
     private void checkAffinity() throws Exception {
-        CacheAffinity<Object> aff = ((IgniteKernal)grid(0)).cache(null).affinity();
+        CacheAffinity<Object> aff = grid(0).affinity(null);
 
         for (Ignite grid : Ignition.allGrids()) {
             try {
                 if (grid.cluster().localNode().id().equals(grid(0).localNode().id()))
                     continue;
 
-                CacheAffinity<Object> checkAff = ((IgniteKernal)grid).cache(null).affinity();
+                CacheAffinity<Object> checkAff = grid.affinity(null);
 
                 for (int p = 0; p < PARTS; p++)
                     assertEquals(aff.mapPartitionToPrimaryAndBackups(p), checkAff.mapPartitionToPrimaryAndBackups(p));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
index 2278b5c..1e51b32 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
@@ -17,13 +17,13 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
-import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.apache.ignite.transactions.*;
 
@@ -211,13 +211,13 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest
{
             }
 
             for (int g = 0; g < GRID_CNT; g++) {
-                GridCache<Object, Object> checkCache = ((IgniteKernal)grid(g)).cache(null);
+                IgniteCache<Object, Object> checkCache =grid(g).jcache(null);
 
                 ClusterNode checkNode = grid(g).localNode();
 
                 for (int i = 0; i < keyCnt; i++) {
-                    if (checkCache.affinity().isPrimaryOrBackup(checkNode, i))
-                        assertEquals(i * i, checkCache.peek(i, F.asList(GridCachePeekMode.PARTITIONED_ONLY)));
+                    if (grid(g).affinity(null).isPrimaryOrBackup(checkNode, i))
+                        assertEquals(i * i, checkCache.localPeek(i, CachePeekMode.PRIMARY,
CachePeekMode.BACKUP));
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
index b98cd94..7e2dbfd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
@@ -128,14 +128,12 @@ public abstract class IgniteTxOriginatingNodeFailureAbstractSelfTest
extends Gri
 
         Map<Integer, Collection<ClusterNode>> nodeMap = new HashMap<>();
 
-        GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(1)).internalCache();
-
         info("Node being checked: " + grid(1).localNode().id());
 
         for (Integer key : keys) {
             Collection<ClusterNode> nodes = new ArrayList<>();
 
-            nodes.addAll(cache.affinity().mapKeyToPrimaryAndBackups(key));
+            nodes.addAll(grid(1).affinity(null).mapKeyToPrimaryAndBackups(key));
 
             nodes.remove(txNode);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
index 0754a29..e5e8d17 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
@@ -149,14 +149,12 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
 
         Map<Integer, Collection<ClusterNode>> nodeMap = new HashMap<>();
 
-        GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(1)).internalCache();
-
         info("Node being checked: " + grid(1).localNode().id());
 
         for (Integer key : keys) {
             Collection<ClusterNode> nodes = new ArrayList<>();
 
-            nodes.addAll(cache.affinity().mapKeyToPrimaryAndBackups(key));
+            nodes.addAll(grid(1).affinity(null).mapKeyToPrimaryAndBackups(key));
 
             nodes.remove(txNode);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
index b932a93..d4e84a5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
@@ -58,14 +58,12 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
      * @throws Exception If failed.
      */
     public void testTxFromPrimary() throws Exception {
-        GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(originatingNode())).internalCache();
-
         ClusterNode txNode = grid(originatingNode()).localNode();
 
         Integer key = null;
 
         for (int i = 0; i < Integer.MAX_VALUE; i++) {
-            if (cache.affinity().isPrimary(txNode, i)) {
+            if (grid(originatingNode()).affinity(null).isPrimary(txNode, i)) {
                 key = i;
 
                 break;
@@ -81,14 +79,12 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
      * @throws Exception If failed.
      */
     public void testTxFromBackup() throws Exception {
-        GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(originatingNode())).internalCache();
-
         ClusterNode txNode = grid(originatingNode()).localNode();
 
         Integer key = null;
 
         for (int i = 0; i < Integer.MAX_VALUE; i++) {
-            if (cache.affinity().isBackup(txNode, i)) {
+            if (grid(originatingNode()).affinity(null).isBackup(txNode, i)) {
                 key = i;
 
                 break;
@@ -104,14 +100,13 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
      * @throws Exception If failed.
      */
     public void testTxFromNotColocated() throws Exception {
-        GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(originatingNode())).internalCache();
-
         ClusterNode txNode = grid(originatingNode()).localNode();
 
         Integer key = null;
 
         for (int i = 0; i < Integer.MAX_VALUE; i++) {
-            if (!cache.affinity().isPrimary(txNode, i) && !cache.affinity().isBackup(txNode,
i)) {
+            if (!grid(originatingNode()).affinity(null).isPrimary(txNode, i)
+                && !grid(originatingNode()).affinity(null).isBackup(txNode, i)) {
                 key = i;
 
                 break;
@@ -127,8 +122,6 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
      * @throws Exception If failed.
      */
     public void testTxAllNodes() throws Exception {
-        GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(originatingNode())).internalCache();
-
         List<ClusterNode> allNodes = new ArrayList<>(GRID_CNT);
 
         for (int i = 0; i < GRID_CNT; i++)
@@ -140,7 +133,7 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
             for (Iterator<ClusterNode> iter = allNodes.iterator(); iter.hasNext();)
{
                 ClusterNode node = iter.next();
 
-                if (cache.affinity().isPrimary(node, i)) {
+                if (grid(originatingNode()).affinity(null).isPrimary(node, i)) {
                     keys.add(i);
 
                     iter.remove();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/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 8923865..a6ad58a 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
@@ -224,7 +224,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
 
         final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(TimeUnit.MILLISECONDS,
ttl));
 
-        final GridCache<String, Integer> c = cache();
+        final IgniteCache<String, Integer> c = jcache();
 
         final String key = primaryKeysForCache(fullCache(), 1).get(0);
 
@@ -271,7 +271,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
 
             GridCacheEntryEx entry = null;
 
-            if (cache(i).affinity().isPrimaryOrBackup(grid(i).localNode(), key)) {
+            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
                 GridCacheAdapter<String, Integer> dht = internalCache(jcache(i));
 
                 if (dht.context().isNear())
@@ -315,7 +315,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
         for (int i = 0; i < gridCount(); i++) {
             GridCacheEntryEx entry = null;
 
-            if (cache(i).affinity().isPrimaryOrBackup(grid(i).localNode(), key)) {
+            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
                 GridCacheAdapter<String, Integer> dht = internalCache(jcache(i));
 
                 if (dht.context().isNear())
@@ -356,7 +356,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
         for (int i = 0; i < gridCount(); i++) {
             GridCacheEntryEx entry = null;
 
-            if (cache(i).affinity().isPrimaryOrBackup(grid(i).localNode(), key)) {
+            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
                 GridCacheAdapter<String, Integer> dht = internalCache(jcache(i));
 
                 if (dht.context().isNear())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
index 54d8fba..b2b51db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
@@ -116,14 +116,6 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
     }
 
     /**
-     * @param cache Cache.
-     * @return Affinity.
-     */
-    private static CacheAffinity<String> affinity(GridCache<String, Integer>
cache) {
-        return cache.affinity();
-    }
-
-    /**
      * @param g Grid.
      * @return Near cache.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index dfafc5c..7a58885 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -205,13 +205,12 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         jcache().put("key", 1);
 
         for (int i = 0; i < gridCount(); i++) {
-            if (cache(i).affinity().isBackup(grid(i).localNode(), "key")) {
-                assert cache(i).evict("key") : "Entry was not evicted [idx=" + i + ", entry="
+
-                    (nearEnabled() ? dht(i).entryEx("key") : colocated(i).entryEx("key"))
+ ']';
+            if (grid(i).affinity(null).isBackup(grid(i).localNode(), "key")) {
+                jcache(i).localEvict(Collections.singleton("key"));
 
-                assert cache(i).peek("key") == null;
+                assert jcache(i).localPeek("key") == null;
 
-                assert cache(i).get("key") == 1;
+                assert jcache(i).get("key") == 1;
 
                 assert swapEvts.get() == 1 : "Swap events: " + swapEvts.get();
 
@@ -272,20 +271,20 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
             Integer nearPeekVal = nearEnabled ? 1 : null;
 
-            GridCache<String, Integer> c = cache(i);
+            IgniteCache<String, Integer> c = jcache(i);
 
-            if (c.affinity().isBackup(grid(i).localNode(), "key")) {
-                assert c.peek("key", Arrays.asList(NEAR_ONLY)) == null;
+            if (grid(i).affinity(null).isBackup(grid(i).localNode(), "key")) {
+                assert c.localPeek("key", NEAR) == null;
 
-                assert c.peek("key", Arrays.asList(PARTITIONED_ONLY)) == 1;
+                assert c.localPeek("key", PRIMARY, BACKUP) == 1;
             }
-            else if (!c.affinity().isPrimaryOrBackup(grid(i).localNode(), "key")) {
+            else if (!grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), "key"))
{
                 // Initialize near reader.
                 assertEquals((Integer)1, jcache(i).get("key"));
 
-                assertEquals(nearPeekVal, c.peek("key", Arrays.asList(NEAR_ONLY)));
+                assertEquals(nearPeekVal, c.localPeek("key", NEAR));
 
-                assert c.peek("key", Arrays.asList(PARTITIONED_ONLY)) == null;
+                assert c.localPeek("key", PRIMARY, BACKUP) == null;
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index f44a2c7..50bbdba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@ -40,7 +40,6 @@ import java.util.concurrent.*;
 
 import static org.apache.ignite.cache.CacheAtomicWriteOrderMode.*;
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.cache.CacheDistributionMode.*;
 import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.transactions.TransactionConcurrency.*;
 import static org.apache.ignite.transactions.TransactionIsolation.*;
@@ -922,7 +921,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         checkTtl(key, 60_000L);
 
         IgniteCache<Object, Object> cache =
-            cache(0).affinity().isPrimary(grid(1).localNode(), key) ? jcache(1) : jcache(2);
+            grid(0).affinity(null).isPrimary(grid(1).localNode(), key) ? jcache(1) : jcache(2);
 
         assertEquals(1, cache.get(key));
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
index f5656ea..3dec1a0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
@@ -197,9 +197,9 @@ public abstract class IgniteCacheExpiryPolicyWithStoreAbstractTest extends
Ignit
 
             if (e == null) {
                 if (primaryOnly)
-                    assertTrue("Not found " + key, !cache.affinity().isPrimary(grid.localNode(),
key));
+                    assertTrue("Not found " + key, !grid.affinity(null).isPrimary(grid.localNode(),
key));
                 else
-                    assertTrue("Not found " + key, !cache.affinity().isPrimaryOrBackup(grid.localNode(),
key));
+                    assertTrue("Not found " + key, !grid.affinity(null).isPrimaryOrBackup(grid.localNode(),
key));
             }
             else {
                 found = true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
index f6f2cc9..0ef40d8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
@@ -456,7 +456,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
             do {
                 IgfsBlockKey key = new IgfsBlockKey(info.id(), null, false, block);
 
-                ClusterNode affNode = grid(0).cachex(DATA_CACHE_NAME).affinity().mapKeyToNode(key);
+                ClusterNode affNode = grid(0).affinity(DATA_CACHE_NAME).mapKeyToNode(key);
 
                 assertTrue("Failed to find node in affinity [dataMgr=" + loc.nodeIds() +
                     ", nodeId=" + affNode.id() + ", block=" + block + ']', loc.nodeIds().contains(affNode.id()));
@@ -517,8 +517,6 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
      * @param affinity Affinity block locations to check.
      */
     private void checkAffinity(int blockSize, IgfsFileInfo info, Iterable<IgfsBlockLocation>
affinity) {
-        GridCache<Object, Object> dataCache = grid(0).cachex(DATA_CACHE_NAME);
-
         for (IgfsBlockLocation loc : affinity) {
             info("Going to check IGFS block location: " + loc);
 
@@ -530,7 +528,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
                 IgfsBlockKey key = new IgfsBlockKey(info.id(),
                     info.fileMap().affinityKey(block * blockSize, false), false, block);
 
-                ClusterNode affNode = dataCache.affinity().mapKeyToNode(key);
+                ClusterNode affNode = grid(0).affinity(DATA_CACHE_NAME).mapKeyToNode(key);
 
                 assertTrue("Failed to find node in affinity [dataMgr=" + loc.nodeIds() +
                     ", nodeId=" + affNode.id() + ", block=" + block + ']', loc.nodeIds().contains(affNode.id()));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
index e4eff51..2087479 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java
@@ -676,7 +676,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
         IgniteEx grid = grid(0);
 
         for (ClusterNode node : grid.cluster().nodes()) {
-            if (grid.cachex(DATA_CACHE_NAME).affinity().isPrimary(node, key))
+            if (grid.affinity(DATA_CACHE_NAME).isPrimary(node, key))
                 return node.id();
         }
 
@@ -695,7 +695,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest {
         Collection<UUID> ids = new HashSet<>();
 
         for (ClusterNode node : grid.cluster().nodes()) {
-            if (grid.cachex(DATA_CACHE_NAME).affinity().isPrimaryOrBackup(node, key))
+            if (grid.affinity(DATA_CACHE_NAME).isPrimaryOrBackup(node, key))
                 ids.add(node.id());
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
index 889c8bc..f2f7101 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java
@@ -287,7 +287,7 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest
{
 
         for (long i = 0; i < ENTRY_CNT; i++) {
             // Avoid entry creation.
-            int part = cache.affinity().partition(i);
+            int part = grid(0).affinity(null).partition(i);
 
             Collection<Long> list = grouped.get(part);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b994d3ef/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
index 37c65ff..aabaf61 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
@@ -210,7 +210,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
         Set<UUID> nodes = new HashSet<>();
 
         for (Cache.Entry<Integer, Integer> entry : entries)
-            nodes.add(((IgniteKernal)g).cache(null).affinity().mapKeyToPrimaryAndBackups(entry.getKey()).iterator().next().id());
+            nodes.add(g.affinity(null).mapKeyToPrimaryAndBackups(entry.getKey()).iterator().next().id());
 
         return nodes;
     }


Mime
View raw message