Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-96-tests [created] 8ad3ffc74


# IGNITE-56 Migration of tests to IgniteCache


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

Branch: refs/heads/ignite-96-tests
Commit: 8ad3ffc742db50feea6e3f4b01691a5388b3a9c5
Parents: fc0eceb
Author: sevdokimov <[email protected]>
Authored: Mon Feb 9 12:39:27 2015 +0300
Committer: sevdokimov <[email protected]>
Committed: Mon Feb 9 12:39:27 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteCache.java     |   9 ++
 .../processors/cache/IgniteCacheProxy.java      |  21 +++
 .../GridCacheAffinityBackupsSelfTest.java       |   4 +-
 .../apache/ignite/GridTestStoreNodeStartup.java |   4 +-
 ...CachePartitionFairAffinityNodesSelfTest.java |   4 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |   6 +-
 .../ignite/internal/GridStartStopSelfTest.java  |   6 +-
 .../checkpoint/GridCheckpointTaskSelfTest.java  |   4 +-
 .../GridDeploymentMessageCountSelfTest.java     |   7 +-
 .../GridDiscoveryManagerAliveCacheSelfTest.java |   2 +-
 .../GridAffinityProcessorAbstractSelfTest.java  |   8 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |   4 +-
 .../cache/GridCacheAbstractMetricsSelfTest.java | 140 +++++++++++--------
 13 files changed, 135 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java 
b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index f2a917e..c7c67e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -20,6 +20,7 @@ package org.apache.ignite;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.query.*;
 import org.apache.ignite.cache.store.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.mxbean.*;
@@ -57,6 +58,14 @@ import java.util.concurrent.locks.*;
  * @param <V> Cache value type.
  */
 public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, 
IgniteAsyncSupport {
+    /// To be inline!!!
+    public V peek(K key);
+    public boolean isEmpty();
+    public void evict(K key);
+    public void promote(K key);
+    CacheConfiguration configuration();
+    //public void clear(K key);
+
     /** {@inheritDoc} */
     public @Override IgniteCache<K, V> withAsync();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index ea1f210..e9511b7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -1062,4 +1062,25 @@ public class IgniteCacheProxy<K, V> extends 
AsyncSupportAdapter<IgniteCache<K, V
     @Override public String toString() {
         return S.toString(IgniteCacheProxy.class, this);
     }
+
+    // To be inline
+    @Override public V peek(K key) {
+        return localPeek(key, CachePeekMode.ONHEAP);
+    }
+
+    public boolean isEmpty() {
+        return localSize() == 0;
+    }
+
+    @Override public void evict(K key) {
+        localEvict(Collections.<K>singleton(key));
+    }
+
+    @Override public void promote(K key) {
+        localPromote(Collections.singleton(key));
+    }
+
+    @Override public CacheConfiguration configuration() {
+        return getConfiguration(CacheConfiguration.class);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
index 1c40c71..3aa8e5d 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
@@ -90,12 +90,12 @@ public class GridCacheAffinityBackupsSelfTest extends 
GridCommonAbstractTest {
         startGrids(nodesCnt);
 
         try {
-            GridCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).jcache(null);
 
             Collection<UUID> members = new HashSet<>();
 
             for (int i = 0; i < 10000; i++) {
-                Collection<ClusterNode> nodes = 
cache.affinity().mapKeyToPrimaryAndBackups(i);
+                Collection<ClusterNode> nodes = 
affinity(cache).mapKeyToPrimaryAndBackups(i);
 
                 assertEquals(backups + 1, nodes.size());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java 
b/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java
index 040a4e3..45cf19c 100644
--- a/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java
+++ b/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java
@@ -40,13 +40,13 @@ public class GridTestStoreNodeStartup {
         try {
             Ignite g = 
G.start("modules/core/src/test/config/spring-cache-teststore.xml");
 
-            g.cache(null).loadCache(new P2<Object, Object>() {
+            g.jcache(null).loadCache(new P2<Object, Object>() {
                 @Override public boolean apply(Object o, Object o1) {
                     System.out.println("Key=" + o + ", Val=" + o1);
 
                     return true;
                 }
-            }, 0, 15, 1);
+            }, 15, 1);
 
             JOptionPane.showMessageDialog(null, "Press OK to stop test node.");
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/GridCachePartitionFairAffinityNodesSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/GridCachePartitionFairAffinityNodesSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/GridCachePartitionFairAffinityNodesSelfTest.java
index 28e5325..b178019 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/GridCachePartitionFairAffinityNodesSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/cache/affinity/fair/GridCachePartitionFairAffinityNodesSelfTest.java
@@ -203,10 +203,10 @@ public class GridCachePartitionFairAffinityNodesSelfTest 
extends GridCommonAbstr
                         info("Grid " + i + ": " + grid.localNode().id());
 
                         for (int part = 0; part < parts; part++) {
-                            List<ClusterNode> firstNodes = 
(List<ClusterNode>)grid(0).cache(null).affinity()
+                            List<ClusterNode> firstNodes = 
(List<ClusterNode>)grid(0).affinity(null)
                                 .mapPartitionToPrimaryAndBackups(part);
 
-                            List<ClusterNode> secondNodes = 
(List<ClusterNode>)grid.cache(null).affinity()
+                            List<ClusterNode> secondNodes = 
(List<ClusterNode>)grid.affinity(null)
                                 .mapPartitionToPrimaryAndBackups(part);
 
                             assertEquals(firstNodes.size(), 
secondNodes.size());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
index 4e817a3..2c308b6 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
@@ -441,7 +441,7 @@ public class GridJobMasterLeaveAwareSelfTest extends 
GridCommonAbstractTest {
             @Override public IgniteFuture<?> applyx(ClusterGroup prj) throws 
IgniteCheckedException {
                 IgniteCompute comp = compute(prj).withAsync();
 
-                CacheAffinity<Object> aff = 
prj.ignite().cache(null).affinity();
+                CacheAffinity<Object> aff = prj.ignite().affinity(null);
 
                 ClusterNode node = F.first(prj.nodes());
 
@@ -457,10 +457,10 @@ public class GridJobMasterLeaveAwareSelfTest extends 
GridCommonAbstractTest {
      */
     public void testAffinityCall() throws Exception {
         testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, 
IgniteFuture<?>>() {
-            @Override public IgniteFuture<?> applyx(ClusterGroup prj) throws 
IgniteCheckedException {
+            @Override public IgniteFuture<?> applyx(ClusterGroup prj) {
                 IgniteCompute comp = compute(prj).withAsync();
 
-                CacheAffinity<Object> aff = 
prj.ignite().cache(null).affinity();
+                CacheAffinity<Object> aff = prj.ignite().affinity(null);
 
                 ClusterNode node = F.first(prj.nodes());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
index d7ea10c..6f00c72 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
@@ -103,8 +103,8 @@ public class GridStartStopSelfTest extends 
GridCommonAbstractTest {
         Thread stopper = new Thread(new Runnable() {
             @Override public void run() {
                 try {
-                    try (IgniteTx ignored = 
g0.cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                        g0.cache(null).get(1);
+                    try (IgniteTx ignored = 
g0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
+                        g0.jcache(null).get(1);
 
                         latch.countDown();
 
@@ -127,7 +127,7 @@ public class GridStartStopSelfTest extends 
GridCommonAbstractTest {
 
         info("Before remove.");
 
-        g1.cache(null).remove(1);
+        g1.jcache(null).remove(1);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointTaskSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointTaskSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointTaskSelfTest.java
index b5b892b..e051fe9 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointTaskSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointTaskSelfTest.java
@@ -104,8 +104,8 @@ public class GridCheckpointTaskSelfTest extends 
GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        assert grid(1).cache(CACHE_NAME).isEmpty() : 
grid(1).cache(CACHE_NAME).entrySet();
-        assert grid(2).cache(CACHE_NAME).isEmpty() : 
grid(2).cache(CACHE_NAME).entrySet();
+        assert grid(1).jcache(CACHE_NAME).isEmpty() : 
grid(1).jcache(CACHE_NAME);
+        assert grid(2).jcache(CACHE_NAME).isEmpty() : 
grid(2).jcache(CACHE_NAME);
 
         stopAllGrids();
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
index 7be98ab..2e20613 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.managers.deployment;
 
+import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.compute.*;
@@ -130,12 +131,12 @@ public class GridDeploymentMessageCountSelfTest extends 
GridCommonAbstractTest {
         try {
             startGrids(2);
 
-            GridCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).jcache(null);
 
             cache.put("key", valCls.newInstance());
 
             for (int i = 0; i < 2; i++)
-                assertNotNull("For grid: " + i, 
grid(i).cache(null).peek("key"));
+                assertNotNull("For grid: " + i, 
grid(i).jcache(null).peek("key"));
 
             for (MessageCountingCommunicationSpi spi : commSpis.values()) {
                 assertTrue(spi.deploymentMessageCount() > 0);
@@ -149,7 +150,7 @@ public class GridDeploymentMessageCountSelfTest extends 
GridCommonAbstractTest {
                 cache.put(key, valCls.newInstance());
 
                 for (int k = 0; k < 2; k++)
-                    assertNotNull(grid(k).cache(null).peek(key));
+                    assertNotNull(grid(k).jcache(null).peek(key));
             }
 
             for (MessageCountingCommunicationSpi spi : commSpis.values())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
index ab4fe5b..433f9fa 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
@@ -108,7 +108,7 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
         }
 
         for (int i = 0; i < PERM_NODES_CNT + TMP_NODES_CNT; i++)
-            F.rand(alive).cache(null).put(i, String.valueOf(i));
+            F.rand(alive).jcache(null).put(i, String.valueOf(i));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
index 5d3877d..f3d297c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.processors.affinity;
 
-import org.apache.ignite.cache.*;
+import org.apache.ignite.*;
 import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
@@ -119,13 +119,13 @@ public abstract class 
GridAffinityProcessorAbstractSelfTest extends GridCommonAb
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid1.cache(CACHE_NAME);
+                grid1.jcache(CACHE_NAME);
 
                 return null;
             }
         }, IllegalArgumentException.class, null);
 
-        GridCache<Integer, Integer> cache = grid2.cache(CACHE_NAME);
+        IgniteCache<Integer, Integer> cache = grid2.jcache(CACHE_NAME);
 
         assertNotNull(cache);
 
@@ -144,7 +144,7 @@ public abstract class GridAffinityProcessorAbstractSelfTest 
extends GridCommonAb
 
         Map<ClusterNode, Collection<Integer>> node1Map = 
affPrc1.mapKeysToNodes(CACHE_NAME, keys);
         Map<ClusterNode, Collection<Integer>> node2Map = 
affPrc2.mapKeysToNodes(CACHE_NAME, keys);
-        Map<ClusterNode, Collection<Integer>> cacheMap = 
cache.affinity().mapKeysToNodes(keys);
+        Map<ClusterNode, Collection<Integer>> cacheMap = 
affinity(cache).mapKeysToNodes(keys);
 
         assertEquals(cacheMap.size(), node1Map.size());
         assertEquals(cacheMap.size(), node2Map.size());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/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 ff660a5..9d0304c 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
@@ -1817,10 +1817,10 @@ public abstract class GridCacheAbstractFullApiSelfTest 
extends GridCacheAbstract
 
         for (int i = 0; i < gridCount(); i++) {
             info("Peek key on grid [i=" + i + ", nodeId=" + 
grid(i).localNode().id() +
-                ", peekVal=" + grid(i).cache(null).peek("key") + ']');
+                ", peekVal=" + grid(i).jcache(null).peek("key") + ']');
 
             info("Peek key2 on grid [i=" + i + ", nodeId=" + 
grid(i).localNode().id() +
-                ", peekVal=" + grid(i).cache(null).peek("key2") + ']');
+                ", peekVal=" + grid(i).jcache(null).peek("key2") + ']');
         }
 
         assertEquals((Integer)6, cache.get("key2"));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ad3ffc7/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index f11c716..18b0a1c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -22,6 +22,7 @@ import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
 import org.apache.ignite.testframework.*;
 import org.apache.ignite.transactions.*;
 
@@ -77,11 +78,11 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).removeAll();
+            g.jcache(null).removeAll();
 
-            assert g.cache(null).isEmpty();
+            assert g.jcache(null).isEmpty();
 
-            g.cache(null).mxBean().clear();
+            g.jcache(null).mxBean().clear();
 
             g.transactions().resetMetrics();
         }
@@ -94,7 +95,7 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).configuration().setStatisticsEnabled(true);
+            g.jcache(null).configuration().setStatisticsEnabled(true);
         }
     }
 
@@ -110,21 +111,27 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
-    public void testRemoveAsyncAvgTime() throws Exception {
-        GridCache<Object, Object> cache = grid(0).cache(null);
+    public void testGetAndRemoveAsyncAvgTime() throws Exception {
+        IgniteCache<Object, Object> cache = grid(0).jcache(null);
 
-        cache.putx(1, 1);
-        cache.putx(2, 2);
+        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
+
+        cache.put(1, 1);
+        cache.put(2, 2);
 
         assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
 
-        IgniteInternalFuture<Object> fut = cache.removeAsync(1);
+        cacheAsync.getAndRemove(1);
+
+        IgniteFuture<Object> fut = cacheAsync.future();
 
         assertEquals(1, (int)fut.get());
 
         assert cache.metrics().getAverageRemoveTime() > 0;
 
-        fut = cache.removeAsync(2);
+        cacheAsync.getAndRemove(2);
+
+        fut = cacheAsync.future();
 
         assertEquals(2, (int)fut.get());
 
@@ -135,12 +142,13 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAsyncValAvgTime() throws Exception {
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).jcache(null);
+        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Integer key = 0;
 
         for (int i = 0; i < 1000; i++) {
-            if (cache.affinity().isPrimary(grid(0).localNode(), i)) {
+            if (affinity(cache).isPrimary(grid(0).localNode(), i)) {
                 key = i;
 
                 break;
@@ -151,7 +159,9 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
 
         cache.put(key, key);
 
-        IgniteInternalFuture<Boolean> fut = cache.removeAsync(key, key);
+        cacheAsync.remove(key, key);
+
+        IgniteFuture<Boolean> fut = cacheAsync.future();
 
         assertTrue(fut.get());
 
@@ -162,21 +172,20 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).jcache(null);
 
-        jcache.put(1, 1);
-        jcache.put(2, 2);
+        cache.put(1, 1);
+        cache.put(2, 2);
 
         assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
 
-        jcache.remove(1);
+        cache.remove(1);
 
         float avgRmvTime = cache.metrics().getAverageRemoveTime();
 
         assert avgRmvTime > 0;
 
-        jcache.remove(2);
+        cache.remove(2);
 
         assert cache.metrics().getAverageRemoveTime() > 0;
     }
@@ -185,12 +194,11 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAllAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).jcache(null);
 
-        jcache.put(1, 1);
-        jcache.put(2, 2);
-        jcache.put(3, 3);
+        cache.put(1, 1);
+        cache.put(2, 2);
+        cache.put(3, 3);
 
         assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
 
@@ -199,7 +207,7 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
         keys.add(2);
         keys.add(3);
 
-        jcache.removeAll(keys);
+        cache.removeAll(keys);
 
         float averageRemoveTime = cache.metrics().getAverageRemoveTime();
 
@@ -210,12 +218,13 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAllAsyncAvgTime() throws Exception {
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).jcache(null);
+        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Set<Integer> keys = new LinkedHashSet<>();
 
         for (int i = 0; i < 1000; i++) {
-            if (cache.affinity().isPrimary(grid(0).localNode(), i)) {
+            if (affinity(cache).isPrimary(grid(0).localNode(), i)) {
                 keys.add(i);
 
                 cache.put(i, i);
@@ -227,7 +236,9 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
 
         assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
 
-        IgniteInternalFuture<?> fut = cache.removeAllAsync(keys);
+        cacheAsync.removeAll(keys);
+
+        IgniteFuture<?> fut = cacheAsync.future();
 
         fut.get();
 
@@ -239,20 +250,19 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).jcache(null);
 
-        jcache.put(1, 1);
+        cache.put(1, 1);
 
         assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
 
-        jcache.get(1);
+        cache.get(1);
 
         float averageGetTime = cache.metrics().getAverageGetTime();
 
         assert averageGetTime > 0;
 
-        jcache.get(2);
+        cache.get(2);
 
         assert cache.metrics().getAverageGetTime() > 0;
     }
@@ -261,14 +271,13 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAllAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).jcache(null);
 
         assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
 
-        jcache.put(1, 1);
-        jcache.put(2, 2);
-        jcache.put(3, 3);
+        cache.put(1, 1);
+        cache.put(2, 2);
+        cache.put(3, 3);
 
         assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
 
@@ -277,7 +286,7 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
         keys.add(2);
         keys.add(3);
 
-        jcache.getAll(keys);
+        cache.getAll(keys);
 
         assert cache.metrics().getAverageGetTime() > 0;
     }
@@ -286,13 +295,14 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAllAsyncAvgTime() throws Exception {
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).jcache(null);
+        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
 
-        cache.putx(1, 1);
-        cache.putx(2, 2);
-        cache.putx(3, 3);
+        cache.put(1, 1);
+        cache.put(2, 2);
+        cache.put(3, 3);
 
         assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
 
@@ -301,7 +311,9 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
         keys.add(2);
         keys.add(3);
 
-        IgniteInternalFuture<Map<Object, Object>> fut = 
cache.getAllAsync(keys);
+        cacheAsync.getAll(keys);
+
+        IgniteFuture<Map<Object, Object>> fut = cacheAsync.future();
 
         fut.get();
 
@@ -314,13 +326,12 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testPutAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> jcache = grid(0).jcache(null);
-        GridCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).jcache(null);
 
         assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
         assertEquals(0, cache.metrics().getCachePuts());
 
-        jcache.put(1, 1);
+        cache.put(1, 1);
 
         float avgPutTime = cache.metrics().getAveragePutTime();
 
@@ -328,7 +339,7 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
 
         assertEquals(1, cache.metrics().getCachePuts());
 
-        jcache.put(2, 2);
+        cache.put(2, 2);
 
         assert cache.metrics().getAveragePutTime() >= 0;
     }
@@ -336,13 +347,16 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
-    public void testPutxAsyncAvgTime() throws Exception {
-        GridCache<Object, Object> cache = grid(0).cache(null);
+    public void testPutAsyncAvgTime() throws Exception {
+        IgniteCache<Object, Object> cache = grid(0).jcache(null);
+        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
         assertEquals(0, cache.metrics().getCachePuts());
 
-        IgniteInternalFuture<Boolean> fut = cache.putxAsync(1, 1);
+        cacheAsync.put(1, 1);
+
+        IgniteFuture<Boolean> fut = cache.future();
 
         fut.get();
 
@@ -354,13 +368,14 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
-    public void testPutAsyncAvgTime() throws Exception {
-        GridCache<Object, Object> cache = grid(0).cache(null);
+    public void testGetAndPutAsyncAvgTime() throws Exception {
+        IgniteCache<Object, Object> cache = grid(0).jcache(null);
+        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Integer key = null;
 
         for (int i = 0; i < 1000; i++) {
-            if (cache.affinity().isPrimary(grid(0).localNode(), i)) {
+            if (affinity(cache).isPrimary(grid(0).localNode(), i)) {
                 key = i;
 
                 break;
@@ -370,7 +385,9 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
         assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
         assertEquals(0.0, cache.metrics().getAverageGetTime(), 0.0);
 
-        IgniteInternalFuture<?> fut = cache.putAsync(key, key);
+        cacheAsync.getAndPut(key, key);
+
+        IgniteFuture<?> fut = cacheAsync.future();
 
         fut.get();
 
@@ -383,13 +400,14 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
-    public void testPutxIfAbsentAsyncAvgTime() throws Exception {
-        GridCache<Object, Object> cache = grid(0).cache(null);
+    public void testPutIfAbsentAsyncAvgTime() throws Exception {
+        IgniteCache<Object, Object> cache = grid(0).jcache(null);
+        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Integer key = null;
 
         for (int i = 0; i < 1000; i++) {
-            if (cache.affinity().isPrimary(grid(0).localNode(), i)) {
+            if (affinity(cache).isPrimary(grid(0).localNode(), i)) {
                 key = i;
 
                 break;
@@ -398,7 +416,9 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
 
         assertEquals(0.0f, cache.metrics().getAveragePutTime());
 
-        IgniteInternalFuture<Boolean> fut = cache.putxIfAbsentAsync(key, key);
+        cacheAsync.putIfAbsent(key, key);
+
+        IgniteFuture<Boolean> fut = cacheAsync.future();
 
         fut.get();
 
@@ -410,7 +430,7 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
-    public void testPutIfAbsentAsyncAvgTime() throws Exception {
+    public void testGetAndPutIfAbsentAsyncAvgTime() throws Exception {
         GridCache<Object, Object> cache = grid(0).cache(null);
 
         Integer key = null;

Reply via email to