You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/03/29 14:02:38 UTC

[14/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now all async methods are defined explicitly, IgniteAsyncSupport is deprecated. This closes #1648.

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/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 b39dabc..20bd9eb 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
@@ -711,6 +711,26 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         cache.put("key1", 1);
         cache.put("key2", 2);
 
+        IgniteFuture<Integer> fut1 = cache.getAsync("key1");
+
+        IgniteFuture<Integer> fut2 = cache.getAsync("key2");
+
+        IgniteFuture<Integer> fut3 = cache.getAsync("wrongKey");
+
+        assert fut1.get() == 1;
+        assert fut2.get() == 2;
+        assert fut3.get() == null;
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testGetAsyncOld() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        cache.put("key1", 1);
+        cache.put("key2", 2);
+
         IgniteCache<String, Integer> cacheAsync = cache.withAsync();
 
         cacheAsync.get("key1");
@@ -730,6 +750,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assert fut3.get() == null;
     }
 
+
     /**
      * @throws Exception In case of error.
      */
@@ -963,6 +984,33 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     public void testGetAllAsync() throws Exception {
         final IgniteCache<String, Integer> cache = jcache();
 
+        cache.put("key1", 1);
+        cache.put("key2", 2);
+
+        GridTestUtils.assertThrows(log, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                cache.getAllAsync(null);
+
+                return null;
+            }
+        }, NullPointerException.class, null);
+
+        IgniteFuture<Map<String, Integer>> fut2 = cache.getAllAsync(Collections.<String>emptySet());
+
+        IgniteFuture<Map<String, Integer>> fut3 = cache.getAllAsync(ImmutableSet.of("key1", "key2"));
+
+        assert fut2.get().isEmpty();
+        assert fut3.get().size() == 2 : "Invalid map: " + fut3.get();
+        assert fut3.get().get("key1") == 1;
+        assert fut3.get().get("key2") == 2;
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testGetAllAsyncOld() throws Exception {
+        final IgniteCache<String, Integer> cache = jcache();
+
         final IgniteCache<String, Integer> cacheAsync = cache.withAsync();
 
         cache.put("key1", 1);
@@ -1581,7 +1629,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
-    public void testGetAndPutAsync() throws Exception {
+    public void testGetAndPutAsyncOld() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
         IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -1607,7 +1655,27 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
-    public void testPutAsync0() throws Exception {
+    public void testGetAndPutAsync() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        cache.put("key1", 1);
+        cache.put("key2", 2);
+
+        IgniteFuture<Integer> fut1 = cache.getAndPutAsync("key1", 10);
+
+        IgniteFuture<Integer> fut2 = cache.getAndPutAsync("key2", 11);
+
+        assertEquals((Integer)1, fut1.get(5000));
+        assertEquals((Integer)2, fut2.get(5000));
+
+        assertEquals((Integer)10, cache.get("key1"));
+        assertEquals((Integer)11, cache.get("key2"));
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
+    public void testPutAsyncOld0() throws Exception {
         IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
 
         cacheAsync.getAndPut("key1", 0);
@@ -1623,9 +1691,23 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     }
 
     /**
+     * @throws Exception In case of error.
+     */
+    public void testPutAsync0() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        IgniteFuture<Integer> fut1 = cache.getAndPutAsync("key1", 0);
+
+        IgniteFuture<Integer> fut2 = cache.getAndPutAsync("key2", 1);
+
+        assert fut1.get(5000) == null;
+        assert fut2.get(5000) == null;
+    }
+
+    /**
      * @throws Exception If failed.
      */
-    public void testInvokeAsync() throws Exception {
+    public void testInvokeAsyncOld() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
         cache.put("key2", 1);
@@ -1660,6 +1742,33 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
+    public void testInvokeAsync() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        cache.put("key2", 1);
+        cache.put("key3", 3);
+
+        IgniteFuture<?> fut0 = cache.invokeAsync("key1", INCR_PROCESSOR);
+
+        IgniteFuture<?> fut1 = cache.invokeAsync("key2", INCR_PROCESSOR);
+
+        IgniteFuture<?> fut2 = cache.invokeAsync("key3", RMV_PROCESSOR);
+
+        fut0.get();
+        fut1.get();
+        fut2.get();
+
+        assertEquals((Integer)1, cache.get("key1"));
+        assertEquals((Integer)2, cache.get("key2"));
+        assertNull(cache.get("key3"));
+
+        for (int i = 0; i < gridCount(); i++)
+            assertNull(jcache(i).localPeek("key3", ONHEAP));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testInvoke() throws Exception {
         final IgniteCache<String, Integer> cache = jcache();
 
@@ -1755,7 +1864,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
-    public void testPutAsync() throws Exception {
+    public void testPutAsyncOld() throws Exception {
         Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
 
         IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
@@ -1798,6 +1907,45 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testPutAsync() throws Exception {
+        Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+        try {
+            jcache().put("key2", 1);
+
+            IgniteFuture<?> fut1 = jcache().putAsync("key1", 10);
+
+            IgniteFuture<?> fut2 = jcache().putAsync("key2", 11);
+
+            IgniteFuture<Void> f = null;
+
+            if (tx != null)
+                f = tx.commitAsync();
+
+            assertNull(fut1.get());
+            assertNull(fut2.get());
+
+            try {
+                if (f != null)
+                    f.get();
+            } catch (Throwable t) {
+                assert false : "Unexpected exception " + t;
+            }
+        }
+        finally {
+            if (tx != null)
+                tx.close();
+        }
+
+        checkSize(F.asSet("key1", "key2"));
+
+        assert jcache().get("key1") == 10;
+        assert jcache().get("key2") == 11;
+    }
+
+    /**
      * @throws Exception In case of error.
      */
     public void testPutAll() throws Exception {
@@ -2045,7 +2193,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
-    public void testPutAllAsync() throws Exception {
+    public void testPutAllAsyncOld() throws Exception {
         Map<String, Integer> map = F.asMap("key1", 1, "key2", 2);
 
         IgniteCache<String, Integer> cache = jcache();
@@ -2075,6 +2223,30 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
+    public void testPutAllAsync() throws Exception {
+        Map<String, Integer> map = F.asMap("key1", 1, "key2", 2);
+
+        IgniteCache<String, Integer> cache = jcache();
+
+        IgniteFuture<?> f1 = cache.putAllAsync(map);
+
+        map.put("key1", 10);
+        map.put("key2", 20);
+
+        IgniteFuture<?> f2 = cache.putAllAsync(map);
+
+        assertNull(f2.get());
+        assertNull(f1.get());
+
+        checkSize(F.asSet("key1", "key2"));
+
+        assert cache.get("key1") == 10;
+        assert cache.get("key2") == 20;
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
     public void testGetAndPutIfAbsent() throws Exception {
         Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
 
@@ -2152,7 +2324,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
-    public void testGetAndPutIfAbsentAsync() throws Exception {
+    public void testGetAndPutIfAbsentAsyncOld() throws Exception {
         Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
 
         IgniteCache<String, Integer> cache = jcache();
@@ -2224,6 +2396,67 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
+    public void testGetAndPutIfAbsentAsync() throws Exception {
+        Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+        IgniteCache<String, Integer> cache = jcache();
+
+
+        try {
+            IgniteFuture<Integer> fut1 = cache.getAndPutIfAbsentAsync("key", 1);
+
+            assertNull(fut1.get());
+            assertEquals((Integer)1, cache.get("key"));
+
+            IgniteFuture<Integer> fut2 = cache.getAndPutIfAbsentAsync("key", 2);
+
+            assertEquals((Integer)1, fut2.get());
+            assertEquals((Integer)1, cache.get("key"));
+
+            if (tx != null)
+                tx.commit();
+        }
+        finally {
+            if (tx != null)
+                tx.close();
+        }
+
+        // Check swap.
+        cache.put("key2", 1);
+
+        cache.localEvict(Collections.singleton("key2"));
+
+        assertEquals((Integer)1, cache.getAndPutIfAbsentAsync("key2", 3).get());
+
+        // Check db.
+        if (!isMultiJvm()) {
+            storeStgy.putToStore("key3", 3);
+
+            assertEquals((Integer)3, cache.getAndPutIfAbsentAsync("key3", 4).get());
+        }
+
+        cache.localEvict(Collections.singleton("key2"));
+
+        // Same checks inside tx.
+        tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+        try {
+            assertEquals(1, (int)cache.getAndPutIfAbsentAsync("key2", 3).get());
+
+            if (tx != null)
+                tx.commit();
+
+            assertEquals((Integer)1, cache.get("key2"));
+        }
+        finally {
+            if (tx != null)
+                tx.close();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testPutIfAbsent() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
@@ -2285,7 +2518,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @param inTx In tx flag.
      * @throws Exception If failed.
      */
-    private void checkPutxIfAbsentAsync(boolean inTx) throws Exception {
+    private void checkPutxIfAbsentAsyncOld(boolean inTx) throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
         IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2353,9 +2586,65 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     }
 
     /**
+     * @param inTx In tx flag.
+     * @throws Exception If failed.
+     */
+    private void checkPutxIfAbsentAsync(boolean inTx) throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        IgniteFuture<Boolean> fut1 = cache.putIfAbsentAsync("key", 1);
+
+        assert fut1.get();
+        assert cache.get("key") != null && cache.get("key") == 1;
+
+        IgniteFuture<Boolean> fut2 = cache.putIfAbsentAsync("key", 2);
+
+        assert !fut2.get();
+        assert cache.get("key") != null && cache.get("key") == 1;
+
+        // Check swap.
+        cache.put("key2", 1);
+
+        cache.localEvict(Collections.singleton("key2"));
+
+        assertFalse(cache.putIfAbsentAsync("key2", 3).get());
+
+        // Check db.
+        if (!isMultiJvm()) {
+            storeStgy.putToStore("key3", 3);
+
+            assertFalse(cache.putIfAbsentAsync("key3", 4).get());
+        }
+
+        cache.localEvict(Collections.singletonList("key2"));
+
+        // Same checks inside tx.
+        Transaction tx = inTx ? transactions().txStart() : null;
+
+        try {
+            assertFalse(cache.putIfAbsentAsync("key2", 3).get());
+
+            if (!isMultiJvm())
+                assertFalse(cache.putIfAbsentAsync("key3", 4).get());
+
+            if (tx != null)
+                tx.commit();
+        }
+        finally {
+            if (tx != null)
+                tx.close();
+        }
+
+        assertEquals((Integer)1, cache.get("key2"));
+
+        if (!isMultiJvm())
+            assertEquals((Integer)3, cache.get("key3"));
+    }
+
+    /**
      * @throws Exception In case of error.
      */
-    public void testPutIfAbsentAsyncConcurrent() throws Exception {
+    public void testPutIfAbsentAsyncConcurrentOld() throws Exception {
         IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
 
         cacheAsync.putIfAbsent("key1", 1);
@@ -2371,6 +2660,20 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     }
 
     /**
+     * @throws Exception In case of error.
+     */
+    public void testPutIfAbsentAsyncConcurrent() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        IgniteFuture<Boolean> fut1 = cache.putIfAbsentAsync("key1", 1);
+
+        IgniteFuture<Boolean> fut2 = cache.putIfAbsentAsync("key2", 2);
+
+        assert fut1.get();
+        assert fut2.get();
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testGetAndReplace() throws Exception {
@@ -2461,26 +2764,168 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     public void testReplace() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
-        cache.put("key", 1);
+        cache.put("key", 1);
+
+        assert cache.get("key") == 1;
+
+        assert cache.replace("key", 2);
+
+        assert cache.get("key") == 2;
+
+        assert !cache.replace("wrong", 2);
+
+        cache.localEvict(Collections.singleton("key"));
+
+        assert cache.replace("key", 4);
+
+        assert cache.get("key") == 4;
+
+        if (!isMultiJvm()) {
+            storeStgy.putToStore("key2", 5);
+
+            assert cache.replace("key2", 6);
+
+            assertEquals((Integer)6, cache.get("key2"));
+        }
+
+        cache.localEvict(Collections.singleton("key"));
+
+        Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+        try {
+            assert cache.replace("key", 5);
+
+            if (tx != null)
+                tx.commit();
+        }
+        finally {
+            if (tx != null)
+                tx.close();
+        }
+
+        assert cache.get("key") == 5;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetAndReplaceAsyncOld() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        IgniteCache<String, Integer> cacheAsync = cache.withAsync();
+
+        cache.put("key", 1);
+
+        assert cache.get("key") == 1;
+
+        cacheAsync.getAndReplace("key", 2);
+
+        assert cacheAsync.<Integer>future().get() == 1;
+
+        assert cache.get("key") == 2;
+
+        cacheAsync.getAndReplace("wrong", 0);
+
+        assert cacheAsync.future().get() == null;
+
+        assert cache.get("wrong") == null;
+
+        cacheAsync.replace("key", 0, 3);
+
+        assert !cacheAsync.<Boolean>future().get();
+
+        assert cache.get("key") == 2;
+
+        cacheAsync.replace("key", 0, 3);
+
+        assert !cacheAsync.<Boolean>future().get();
+
+        assert cache.get("key") == 2;
+
+        cacheAsync.replace("key", 2, 3);
+
+        assert cacheAsync.<Boolean>future().get();
+
+        assert cache.get("key") == 3;
+
+        cache.localEvict(Collections.singleton("key"));
+
+        cacheAsync.replace("key", 3, 4);
+
+        assert cacheAsync.<Boolean>future().get();
+
+        assert cache.get("key") == 4;
+
+        if (!isMultiJvm()) {
+            storeStgy.putToStore("key2", 5);
+
+            cacheAsync.replace("key2", 5, 6);
+
+            assert cacheAsync.<Boolean>future().get();
+
+            assertEquals((Integer)6, cache.get("key2"));
+        }
+
+        cache.localEvict(Collections.singleton("key"));
+
+        Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
+
+        try {
+            cacheAsync.replace("key", 4, 5);
+
+            assert cacheAsync.<Boolean>future().get();
+
+            if (tx != null)
+                tx.commit();
+        }
+        finally {
+            if (tx != null)
+                tx.close();
+        }
+
+        assert cache.get("key") == 5;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetAndReplaceAsync() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        cache.put("key", 1);
+
+        assert cache.get("key") == 1;
+
+        assert cache.getAndReplaceAsync("key", 2).get() == 1;
+
+        assert cache.get("key") == 2;
+
+        assert cache.getAndReplaceAsync("wrong", 0).get() == null;
+
+        assert cache.get("wrong") == null;
+
+        assert !cache.replaceAsync("key", 0, 3).get();
 
-        assert cache.get("key") == 1;
+        assert cache.get("key") == 2;
 
-        assert cache.replace("key", 2);
+        assert !cache.replaceAsync("key", 0, 3).get();
 
         assert cache.get("key") == 2;
 
-        assert !cache.replace("wrong", 2);
+        assert cache.replaceAsync("key", 2, 3).get();
+
+        assert cache.get("key") == 3;
 
         cache.localEvict(Collections.singleton("key"));
 
-        assert cache.replace("key", 4);
+        assert cache.replaceAsync("key", 3, 4).get();
 
         assert cache.get("key") == 4;
 
         if (!isMultiJvm()) {
             storeStgy.putToStore("key2", 5);
 
-            assert cache.replace("key2", 6);
+            assert cache.replaceAsync("key2", 5, 6).get();
 
             assertEquals((Integer)6, cache.get("key2"));
         }
@@ -2490,7 +2935,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
 
         try {
-            assert cache.replace("key", 5);
+            assert cache.replaceAsync("key", 4, 5).get();
 
             if (tx != null)
                 tx.commit();
@@ -2506,7 +2951,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
-    public void testGetAndReplaceAsync() throws Exception {
+    public void testReplacexAsyncOld() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
         IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2515,39 +2960,21 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         assert cache.get("key") == 1;
 
-        cacheAsync.getAndReplace("key", 2);
-
-        assert cacheAsync.<Integer>future().get() == 1;
-
-        assert cache.get("key") == 2;
-
-        cacheAsync.getAndReplace("wrong", 0);
-
-        assert cacheAsync.future().get() == null;
-
-        assert cache.get("wrong") == null;
+        cacheAsync.replace("key", 2);
 
-        cacheAsync.replace("key", 0, 3);
+        assert cacheAsync.<Boolean>future().get();
 
-        assert !cacheAsync.<Boolean>future().get();
+        info("Finished replace.");
 
-        assert cache.get("key") == 2;
+        assertEquals((Integer)2, cache.get("key"));
 
-        cacheAsync.replace("key", 0, 3);
+        cacheAsync.replace("wrond", 2);
 
         assert !cacheAsync.<Boolean>future().get();
 
-        assert cache.get("key") == 2;
-
-        cacheAsync.replace("key", 2, 3);
-
-        assert cacheAsync.<Boolean>future().get();
-
-        assert cache.get("key") == 3;
-
         cache.localEvict(Collections.singleton("key"));
 
-        cacheAsync.replace("key", 3, 4);
+        cacheAsync.replace("key", 4);
 
         assert cacheAsync.<Boolean>future().get();
 
@@ -2556,11 +2983,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         if (!isMultiJvm()) {
             storeStgy.putToStore("key2", 5);
 
-            cacheAsync.replace("key2", 5, 6);
+            cacheAsync.replace("key2", 6);
 
             assert cacheAsync.<Boolean>future().get();
 
-            assertEquals((Integer)6, cache.get("key2"));
+            assert cache.get("key2") == 6;
         }
 
         cache.localEvict(Collections.singleton("key"));
@@ -2568,7 +2995,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
 
         try {
-            cacheAsync.replace("key", 4, 5);
+            cacheAsync.replace("key", 5);
 
             assert cacheAsync.<Boolean>future().get();
 
@@ -2589,38 +3016,28 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     public void testReplacexAsync() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
-        IgniteCache<String, Integer> cacheAsync = cache.withAsync();
-
         cache.put("key", 1);
 
         assert cache.get("key") == 1;
 
-        cacheAsync.replace("key", 2);
-
-        assert cacheAsync.<Boolean>future().get();
+        assert cache.replaceAsync("key", 2).get();
 
         info("Finished replace.");
 
         assertEquals((Integer)2, cache.get("key"));
 
-        cacheAsync.replace("wrond", 2);
-
-        assert !cacheAsync.<Boolean>future().get();
+        assert !cache.replaceAsync("wrond", 2).get();
 
         cache.localEvict(Collections.singleton("key"));
 
-        cacheAsync.replace("key", 4);
-
-        assert cacheAsync.<Boolean>future().get();
+        assert cache.replaceAsync("key", 4).get();
 
         assert cache.get("key") == 4;
 
         if (!isMultiJvm()) {
             storeStgy.putToStore("key2", 5);
 
-            cacheAsync.replace("key2", 6);
-
-            assert cacheAsync.<Boolean>future().get();
+            assert cache.replaceAsync("key2", 6).get();
 
             assert cache.get("key2") == 6;
         }
@@ -2630,9 +3047,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         Transaction tx = txShouldBeUsed() ? transactions().txStart() : null;
 
         try {
-            cacheAsync.replace("key", 5);
-
-            assert cacheAsync.<Boolean>future().get();
+            assert cache.replaceAsync("key", 5).get();
 
             if (tx != null)
                 tx.commit();
@@ -2769,9 +3184,43 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testRemoveLoadAsync() throws Exception {
+        if (isMultiJvm())
+            return;
+
+        int cnt = 10;
+
+        Set<String> keys = new HashSet<>();
+
+        for (int i = 0; i < cnt; i++)
+            keys.add(String.valueOf(i));
+
+        jcache().removeAllAsync(keys).get();
+
+        for (String key : keys)
+            storeStgy.putToStore(key, Integer.parseInt(key));
+
+        for (int g = 0; g < gridCount(); g++)
+            grid(g).cache(null).localLoadCacheAsync(null).get();
+
+        for (int g = 0; g < gridCount(); g++) {
+            for (int i = 0; i < cnt; i++) {
+                String key = String.valueOf(i);
+
+                if (grid(0).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode()))
+                    assertEquals((Integer)i, peek(jcache(g), key));
+                else
+                    assertNull(peek(jcache(g), key));
+            }
+        }
+    }
+
+    /**
      * @throws Exception In case of error.
      */
-    public void testRemoveAsync() throws Exception {
+    public void testRemoveAsyncOld() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
         IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2805,6 +3254,30 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
+    public void testRemoveAsync() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        cache.put("key1", 1);
+        cache.put("key2", 2);
+
+        assert !cache.removeAsync("key1", 0).get();
+
+        assert cache.get("key1") != null && cache.get("key1") == 1;
+
+        assert cache.removeAsync("key1", 1).get();
+
+        assert cache.get("key1") == null;
+
+        assert cache.getAndRemoveAsync("key2").get() == 2;
+
+        assert cache.get("key2") == null;
+
+        assert cache.getAndRemoveAsync("key2").get() == null;
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
     public void testRemove() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
@@ -2818,7 +3291,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
-    public void testRemovexAsync() throws Exception {
+    public void testRemovexAsyncOld() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
         IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -2839,6 +3312,21 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
+    public void testRemovexAsync() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        cache.put("key1", 1);
+
+        assert cache.removeAsync("key1").get();
+
+        assert cache.get("key1") == null;
+
+        assert !cache.removeAsync("key1").get();
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
     public void testGlobalRemoveAll() throws Exception {
         globalRemoveAll(false);
     }
@@ -2854,7 +3342,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @param async If {@code true} uses asynchronous operation.
      * @throws Exception In case of error.
      */
-    private void globalRemoveAll(boolean async) throws Exception {
+    private void globalRemoveAllOld(boolean async) throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
         cache.put("key1", 1);
@@ -2922,6 +3410,64 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     }
 
     /**
+     * @param async If {@code true} uses asynchronous operation.
+     * @throws Exception In case of error.
+     */
+    private void globalRemoveAll(boolean async) throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        cache.put("key1", 1);
+        cache.put("key2", 2);
+        cache.put("key3", 3);
+
+        checkSize(F.asSet("key1", "key2", "key3"));
+
+        atomicClockModeDelay(cache);
+
+        if (async)
+            cache.removeAllAsync(F.asSet("key1", "key2")).get();
+        else
+            cache.removeAll(F.asSet("key1", "key2"));
+
+        checkSize(F.asSet("key3"));
+
+        checkContainsKey(false, "key1");
+        checkContainsKey(false, "key2");
+        checkContainsKey(true, "key3");
+
+        // Put values again.
+        cache.put("key1", 1);
+        cache.put("key2", 2);
+        cache.put("key3", 3);
+
+        atomicClockModeDelay(cache);
+
+        if (async)
+            jcache(gridCount() > 1 ? 1 : 0).removeAllAsync().get();
+        else
+            jcache(gridCount() > 1 ? 1 : 0).removeAll();
+
+        assertEquals(0, cache.localSize());
+        long entryCnt = hugeRemoveAllEntryCount();
+
+        for (int i = 0; i < entryCnt; i++)
+            cache.put(String.valueOf(i), i);
+
+        for (int i = 0; i < entryCnt; i++)
+            assertEquals(Integer.valueOf(i), cache.get(String.valueOf(i)));
+
+        atomicClockModeDelay(cache);
+
+        if (async)
+            cache.removeAllAsync().get();
+        else
+            cache.removeAll();
+
+        for (int i = 0; i < entryCnt; i++)
+            assertNull(cache.get(String.valueOf(i)));
+    }
+
+    /**
      * @return Count of entries to be removed in removeAll() test.
      */
     protected long hugeRemoveAllEntryCount() {
@@ -3012,7 +3558,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
-    public void testRemoveAllAsync() throws Exception {
+    public void testRemoveAllAsyncOld() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
         IgniteCache<String, Integer> cacheAsync = cache.withAsync();
@@ -3037,6 +3583,27 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @throws Exception In case of error.
      */
+    public void testRemoveAllAsync() throws Exception {
+        IgniteCache<String, Integer> cache = jcache();
+
+        cache.put("key1", 1);
+        cache.put("key2", 2);
+        cache.put("key3", 3);
+
+        checkSize(F.asSet("key1", "key2", "key3"));
+
+        assertNull(cache.removeAllAsync(F.asSet("key1", "key2")).get());
+
+        checkSize(F.asSet("key3"));
+
+        checkContainsKey(false, "key1");
+        checkContainsKey(false, "key2");
+        checkContainsKey(true, "key3");
+    }
+
+    /**
+     * @throws Exception In case of error.
+     */
     public void testLoadAll() throws Exception {
         IgniteCache<String, Integer> cache = jcache();
 
@@ -3267,21 +3834,29 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGlobalClearAll() throws Exception {
-        globalClearAll(false);
+        globalClearAll(false, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGlobalClearAllAsyncOld() throws Exception {
+        globalClearAll(true, true);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testGlobalClearAllAsync() throws Exception {
-        globalClearAll(true);
+        globalClearAll(true, false);
     }
 
     /**
      * @param async If {@code true} uses async method.
+     * @param oldAsync Use old async API.
      * @throws Exception If failed.
      */
-    protected void globalClearAll(boolean async) throws Exception {
+    protected void globalClearAll(boolean async, boolean oldAsync) throws Exception {
         // Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries
         // because some of them were blocked due to having readers.
         for (int i = 0; i < gridCount(); i++) {
@@ -3290,11 +3865,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }
 
         if (async) {
-            IgniteCache<String, Integer> asyncCache = jcache().withAsync();
+            if(oldAsync) {
+                IgniteCache<String, Integer> asyncCache = jcache().withAsync();
 
-            asyncCache.clear();
+                asyncCache.clear();
 
-            asyncCache.future().get();
+                asyncCache.future().get();
+            } else
+                jcache().clearAsync().get();
         }
         else
             jcache().clear();
@@ -4328,6 +4906,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
     /**
      * @param key Key.
+     * @return Ignite instance for primary node.
      */
     protected Ignite primaryIgnite(String key) {
         ClusterNode node = grid(0).affinity(null).mapKeyToNode(key);
@@ -4356,6 +4935,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @param cache Cache.
      * @param cnt Keys count.
+     * @param startFrom Begin value ofthe key.
      * @return Collection of keys for which given cache is primary.
      */
     protected List<String> primaryKeysForCache(IgniteCache<String, Integer> cache, int cnt, int startFrom) {
@@ -4771,36 +5351,51 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGlobalClearKey() throws Exception {
-        testGlobalClearKey(false, Arrays.asList("key25"));
+        testGlobalClearKey(false, Arrays.asList("key25"), false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGlobalClearKeyAsyncOld() throws Exception {
+        testGlobalClearKey(true, Arrays.asList("key25"), true);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testGlobalClearKeyAsync() throws Exception {
-        testGlobalClearKey(true, Arrays.asList("key25"));
+        testGlobalClearKey(true, Arrays.asList("key25"), false);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testGlobalClearKeys() throws Exception {
-        testGlobalClearKey(false, Arrays.asList("key25", "key100", "key150"));
+        testGlobalClearKey(false, Arrays.asList("key25", "key100", "key150"), false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGlobalClearKeysAsyncOld() throws Exception {
+        testGlobalClearKey(true, Arrays.asList("key25", "key100", "key150"), true);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testGlobalClearKeysAsync() throws Exception {
-        testGlobalClearKey(true, Arrays.asList("key25", "key100", "key150"));
+        testGlobalClearKey(true, Arrays.asList("key25", "key100", "key150"), false);
     }
 
     /**
      * @param async If {@code true} uses async method.
      * @param keysToRmv Keys to remove.
+     * @param oldAsync Use old async API.
      * @throws Exception If failed.
      */
-    protected void testGlobalClearKey(boolean async, Collection<String> keysToRmv) throws Exception {
+    protected void testGlobalClearKey(boolean async, Collection<String> keysToRmv, boolean oldAsync) throws Exception {
         // Save entries only on their primary nodes. If we didn't do so, clearLocally() will not remove all entries
         // because some of them were blocked due to having readers.
         for (int i = 0; i < 500; ++i) {
@@ -4812,14 +5407,22 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }
 
         if (async) {
-            IgniteCache<String, Integer> asyncCache = jcache().withAsync();
+            if (oldAsync) {
+                IgniteCache<String, Integer> asyncCache = jcache().withAsync();
 
-            if (keysToRmv.size() == 1)
-                asyncCache.clear(F.first(keysToRmv));
-            else
-                asyncCache.clearAll(new HashSet<>(keysToRmv));
+                if (keysToRmv.size() == 1)
+                    asyncCache.clear(F.first(keysToRmv));
+                else
+                    asyncCache.clearAll(new HashSet<>(keysToRmv));
 
-            asyncCache.future().get();
+                asyncCache.future().get();
+            } else {
+
+                if (keysToRmv.size() == 1)
+                    jcache().clearAsync(F.first(keysToRmv)).get();
+                else
+                    jcache().clearAllAsync(new HashSet<>(keysToRmv)).get();
+            }
         }
         else {
             if (keysToRmv.size() == 1)
@@ -5437,21 +6040,22 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
             grid(0).events().localListen(lsnr, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED);
 
-            if (async)
-                cache = cache.withAsync();
-
             try (Transaction tx = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                Integer val0 = cache.get(keys.get(0));
+                Integer val0;
 
                 if (async)
-                    val0 = cache.<Integer>future().get();
+                    val0 = cache.getAsync(keys.get(0)).get();
+                else
+                     val0 = cache.get(keys.get(0));
 
                 assertEquals(0, val0.intValue());
 
-                Map<String, Integer> allOutTx = cache.getAllOutTx(F.asSet(keys.get(1)));
+                Map<String, Integer> allOutTx;
 
                 if (async)
-                    allOutTx = cache.<Map<String, Integer>>future().get();
+                    allOutTx = cache.getAllOutTxAsync(F.asSet(keys.get(1))).get();
+                else
+                    allOutTx = cache.getAllOutTx(F.asSet(keys.get(1)));
 
                 assertEquals(1, allOutTx.size());
 
@@ -5484,13 +6088,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testTransformException() throws Exception {
-        final IgniteCache<String, Integer> cache = jcache().withAsync();
-
-        cache.invoke("key2", ERR_PROCESSOR);
+        final IgniteCache<String, Integer> cache = jcache();
 
         assertThrows(log, new Callable<Object>() {
             @Override public Object call() throws Exception {
-                IgniteFuture fut = cache.future().chain(new IgniteClosure<IgniteFuture, Object>() {
+                IgniteFuture fut = cache.invokeAsync("key2", ERR_PROCESSOR).chain(new IgniteClosure<IgniteFuture, Object>() {
                     @Override public Object apply(IgniteFuture o) {
                         return o.get();
                     }
@@ -5554,27 +6156,32 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         IgniteCache<String, Integer> cache = jcache();
         Ignite ignite = ignite(0);
 
-        doTransformResourceInjection(ignite, cache);
-        doTransformResourceInjection(ignite, cache.withAsync());
+        doTransformResourceInjection(ignite, cache, false, false);
+        doTransformResourceInjection(ignite, cache, true, false);
+        doTransformResourceInjection(ignite, cache, true, true);
 
         if (txEnabled()) {
-            doTransformResourceInjectionInTx(ignite, cache);
-            doTransformResourceInjectionInTx(ignite, cache.withAsync());
+            doTransformResourceInjectionInTx(ignite, cache, false, false);
+            doTransformResourceInjectionInTx(ignite, cache, true, false);
+            doTransformResourceInjectionInTx(ignite, cache, true, true);
         }
     }
 
     /**
      * @param ignite Node.
      * @param cache Cache.
+     * @param async Use async API.
+     * @param oldAsync Use old async API.
      * @throws Exception If failed.
      */
-    private void doTransformResourceInjectionInTx(Ignite ignite, IgniteCache<String, Integer> cache) throws Exception {
+    private void doTransformResourceInjectionInTx(Ignite ignite, IgniteCache<String, Integer> cache, boolean async,
+        boolean oldAsync) throws Exception {
         for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
             for (TransactionIsolation isolation : TransactionIsolation.values()) {
                 IgniteTransactions txs = ignite.transactions();
 
                 try (Transaction tx = txs.txStart(concurrency, isolation)) {
-                    doTransformResourceInjection(ignite, cache);
+                    doTransformResourceInjection(ignite, cache, async, oldAsync);
 
                     tx.commit();
                 }
@@ -5585,9 +6192,12 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     /**
      * @param ignite Node.
      * @param cache Cache.
+     * @param async Use async API.
+     * @param oldAsync Use old async API.
      * @throws Exception If failed.
      */
-    private void doTransformResourceInjection(Ignite ignite, IgniteCache<String, Integer> cache) throws Exception {
+    private void doTransformResourceInjection(Ignite ignite, IgniteCache<String, Integer> cache, boolean async,
+        boolean oldAsync) throws Exception {
         final Collection<ResourceType> required = Arrays.asList(ResourceType.IGNITE_INSTANCE,
             ResourceType.CACHE_NAME,
             ResourceType.LOGGER,
@@ -5600,11 +6210,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         UUID opId = evts.remoteListen(lsnr, null, EventType.EVT_CACHE_OBJECT_READ);
 
         try {
-            checkResourceInjectionOnInvoke(cache, required);
+            checkResourceInjectionOnInvoke(cache, required, async, oldAsync);
 
-            checkResourceInjectionOnInvokeAll(cache, required);
+            checkResourceInjectionOnInvokeAll(cache, required, async, oldAsync);
 
-            checkResourceInjectionOnInvokeAllMap(cache, required);
+            checkResourceInjectionOnInvokeAllMap(cache, required, async, oldAsync);
         }
         finally {
             evts.stopRemoteListen(opId);
@@ -5616,9 +6226,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      *
      * @param cache Cache.
      * @param required Expected injected resources.
+     * @param async Use async API.
+     * @param oldAsync Use old async API.
      */
     private void checkResourceInjectionOnInvokeAllMap(IgniteCache<String, Integer> cache,
-        Collection<ResourceType> required) {
+        Collection<ResourceType> required, boolean async, boolean oldAsync) {
         Map<String, EntryProcessorResult<Integer>> results;
 
         Map<String, EntryProcessor<String, Integer, Integer>> map = new HashMap<>();
@@ -5628,10 +6240,19 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         map.put(UUID.randomUUID().toString(), new ResourceInjectionEntryProcessor());
         map.put(UUID.randomUUID().toString(), new ResourceInjectionEntryProcessor());
 
-        results = cache.invokeAll(map);
+        if (async) {
+            if (oldAsync) {
+                IgniteCache<String, Integer> acache = cache.withAsync();
 
-        if (cache.isAsync())
-            results = cache.<Map<String, EntryProcessorResult<Integer>>>future().get();
+                acache.invokeAll(map);
+
+                results = acache.<Map<String, EntryProcessorResult<Integer>>>future().get();
+            }
+            else
+                results = cache.invokeAllAsync(map).get();
+        }
+        else
+            results = cache.invokeAll(map);
 
         assertEquals(map.size(), results.size());
 
@@ -5648,19 +6269,31 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      *
      * @param cache Cache.
      * @param required Expected injected resources.
+     * @param async Use async API.
+     * @param oldAsync Use old async API.
      */
     private void checkResourceInjectionOnInvokeAll(IgniteCache<String, Integer> cache,
-        Collection<ResourceType> required) {
+        Collection<ResourceType> required, boolean async, boolean oldAsync) {
         Set<String> keys = new HashSet<>(Arrays.asList(UUID.randomUUID().toString(),
             UUID.randomUUID().toString(),
             UUID.randomUUID().toString(),
             UUID.randomUUID().toString()));
 
-        Map<String, EntryProcessorResult<Integer>> results = cache.invokeAll(keys,
-            new ResourceInjectionEntryProcessor());
+        Map<String, EntryProcessorResult<Integer>> results;
+
+        if (async) {
+            if (oldAsync) {
+                IgniteCache<String, Integer> acache = cache.withAsync();
+
+                acache.invokeAll(keys, new ResourceInjectionEntryProcessor());
 
-        if (cache.isAsync())
-            results = cache.<Map<String, EntryProcessorResult<Integer>>>future().get();
+                results = acache.<Map<String, EntryProcessorResult<Integer>>>future().get();
+            }
+            else
+                results = cache.invokeAllAsync(keys, new ResourceInjectionEntryProcessor()).get();
+        }
+        else
+            results = cache.invokeAll(keys, new ResourceInjectionEntryProcessor());
 
         assertEquals(keys.size(), results.size());
 
@@ -5677,13 +6310,30 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      *
      * @param cache Cache.
      * @param required Expected injected resources.
+     * @param async Use async API.
+     * @param oldAsync Use old async API.
      */
     private void checkResourceInjectionOnInvoke(IgniteCache<String, Integer> cache,
-        Collection<ResourceType> required) {
+        Collection<ResourceType> required, boolean async, boolean oldAsync) {
 
         String key = UUID.randomUUID().toString();
 
-        Integer flags = cache.invoke(key, new GridCacheAbstractFullApiSelfTest.ResourceInjectionEntryProcessor());
+        Integer flags;
+
+        if (async) {
+            if (oldAsync) {
+                IgniteCache<String, Integer> acache = cache.withAsync();
+
+                acache.invoke(key, new GridCacheAbstractFullApiSelfTest.ResourceInjectionEntryProcessor());
+
+                flags = acache.<Integer>future().get();
+            }
+            else
+                flags = cache.invokeAsync(key,
+                    new GridCacheAbstractFullApiSelfTest.ResourceInjectionEntryProcessor()).get();
+        }
+        else
+            flags = cache.invoke(key, new GridCacheAbstractFullApiSelfTest.ResourceInjectionEntryProcessor());
 
         if (cache.isAsync())
             flags = cache.<Integer>future().get();

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/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 5ad7e5c..a858085 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
@@ -171,20 +171,13 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testGetAndRemoveAsyncAvgTime() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
 
-        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
-
         for (int i = 0; i < KEY_CNT; i++)
             cache.put(i, i);
 
         assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
 
-        for (int i = 0; i < KEY_CNT; i++) {
-            cacheAsync.getAndRemove(i);
-
-            IgniteFuture<Object> fut = cacheAsync.future();
-
-            fut.get();
-        }
+        for (int i = 0; i < KEY_CNT; i++)
+            cache.getAndRemoveAsync(i).get();
 
         assert cache.localMetrics().getAverageRemoveTime() > 0;
     }
@@ -194,7 +187,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      */
     public void testRemoveAsyncValAvgTime() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
-        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Integer key = 0;
 
@@ -210,9 +202,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         cache.put(key, key);
 
-        cacheAsync.remove(key, key);
-
-        IgniteFuture<Boolean> fut = cacheAsync.future();
+        IgniteFuture<Boolean> fut = cache.removeAsync(key, key);
 
         assertTrue(fut.get());
 
@@ -265,7 +255,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      */
     public void testRemoveAllAsyncAvgTime() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
-        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Set<Integer> keys = new LinkedHashSet<>();
 
@@ -282,9 +271,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         assertEquals(cache.localMetrics().getAverageRemoveTime(), 0.0, 0.0);
 
-        cacheAsync.removeAll(keys);
-
-        IgniteFuture<?> fut = cacheAsync.future();
+        IgniteFuture<?> fut = cache.removeAllAsync(keys);
 
         fut.get();
 
@@ -342,7 +329,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      */
     public void testGetAllAsyncAvgTime() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
-        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
@@ -357,9 +343,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         keys.add(2);
         keys.add(3);
 
-        cacheAsync.getAll(keys);
-
-        IgniteFuture<Map<Object, Object>> fut = cacheAsync.future();
+        IgniteFuture<Map<Object, Object>> fut = cache.getAllAsync(keys);
 
         fut.get();
 
@@ -390,14 +374,11 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      */
     public void testPutAsyncAvgTime() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
-        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
         assertEquals(0, cache.localMetrics().getCachePuts());
 
-        cacheAsync.put(1, 1);
-
-        cacheAsync.future().get();
+        cache.putAsync(1, 1).get();
 
         TimeUnit.MILLISECONDS.sleep(100L);
 
@@ -409,7 +390,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      */
     public void testGetAndPutAsyncAvgTime() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
-        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Integer key = null;
 
@@ -424,11 +404,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
         assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
-        cacheAsync.getAndPut(key, key);
-
-        IgniteFuture<?> fut = cacheAsync.future();
-
-        fut.get();
+        cache.getAndPutAsync(key, key).get();
 
         TimeUnit.MILLISECONDS.sleep(100L);
 
@@ -441,7 +417,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      */
     public void testPutIfAbsentAsyncAvgTime() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
-        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Integer key = null;
 
@@ -455,11 +430,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         assertEquals(0.0f, cache.localMetrics().getAveragePutTime());
 
-        cacheAsync.putIfAbsent(key, key);
-
-        IgniteFuture<Boolean> fut = cacheAsync.future();
-
-        fut.get();
+        cache.putIfAbsentAsync(key, key).get();
 
         TimeUnit.MILLISECONDS.sleep(100L);
 
@@ -471,7 +442,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      */
     public void testGetAndPutIfAbsentAsyncAvgTime() throws Exception {
         IgniteCache<Object, Object> cache = grid(0).cache(null);
-        IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
         Integer key = null;
 
@@ -485,11 +455,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         assertEquals(0.0f, cache.localMetrics().getAveragePutTime());
 
-        cacheAsync.getAndPutIfAbsent(key, key);
-
-        IgniteFuture<?> fut = cacheAsync.future();
-
-        fut.get();
+        cache.getAndPutIfAbsentAsync(key, key).get();
 
         TimeUnit.MILLISECONDS.sleep(100L);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
index 84f4cc2..cebab2f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAsyncOperationsLimitSelfTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache;
 
 import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.ignite.IgniteCache;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.util.GridAtomicInteger;
 import org.apache.ignite.internal.util.typedef.CI1;
@@ -57,13 +56,7 @@ public class GridCacheAsyncOperationsLimitSelfTest extends GridCacheAbstractSelf
 
             cnt.incrementAndGet();
 
-            IgniteCache<String, Integer> cacheAsync = jcache().withAsync();
-
-            cacheAsync.put("key" + i, i);
-
-            IgniteFuture<?> fut = cacheAsync.future();
-
-            fut.listen(new CI1<IgniteFuture<?>>() {
+            jcache().putAsync("key" + i, i).listen(new CI1<IgniteFuture<?>>() {
                 @Override public void apply(IgniteFuture<?> t) {
                     cnt.decrementAndGet();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
index 41232c0..589f910 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
@@ -342,11 +342,9 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
 
                     long submitTime1 = t0;
 
-                    IgniteCompute comp = g.compute(g.cluster().forPredicate(serverNode)).withAsync();
+                    IgniteCompute comp = g.compute(g.cluster().forPredicate(serverNode));
 
-                    comp.execute(RequestTask.class, new Message(terminalId, nodeId));
-
-                    ComputeTaskFuture<Void> f1 = comp.future();
+                    ComputeTaskFuture<Void> f1 = comp.executeAsync(RequestTask.class, new Message(terminalId, nodeId));
 
                     submitTime.setIfGreater(System.currentTimeMillis() - submitTime1);
 
@@ -354,9 +352,7 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
 
                     submitTime1 = System.currentTimeMillis();
 
-                    comp.execute(ResponseTask.class, new Message(terminalId, nodeId));
-
-                    ComputeTaskFuture<Void> f2 = comp.future();
+                    ComputeTaskFuture<Void> f2 = comp.executeAsync(ResponseTask.class, new Message(terminalId, nodeId));
 
                     submitTime.setIfGreater(System.currentTimeMillis() - submitTime1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
index 73cd89d..26c69e8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
@@ -254,18 +254,11 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
 
         log.info("GetAsync 1.");
 
-        IgniteCache<String, Integer> cacheAsync = cache.withAsync();
 
-        if (needVer) {
-            cacheAsync.getEntry(key);
-
-            assertEquals((Integer)101, cacheAsync.<CacheEntry<String, Integer>>future().get().getValue());
-        }
-        else {
-            cacheAsync.get(key);
-
-            assertEquals((Integer)101, cacheAsync.<Integer>future().get());
-        }
+        if (needVer)
+            assertEquals((Integer)101, cache.getEntryAsync(key).get().getValue());
+        else
+            assertEquals((Integer)101, cache.getAsync(key).get());
 
         assertEquals(1, interceptor.invokeCnt.get());
 
@@ -303,8 +296,6 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
 
         IgniteCache<String, Integer> cache = jcache(0);
 
-        IgniteCache<String, Integer> cacheAsync = cache.withAsync();
-
         Collection<CacheEntry<String, Integer>> c;
         Map<String, Integer> map;
 
@@ -368,11 +359,8 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
             if (needVer) {
                 if (j == 0)
                     c = cache.getEntries(keys);
-                else {
-                    cacheAsync.getEntries(keys);
-
-                    c = cacheAsync.<Collection<CacheEntry<String, Integer>>>future().get();
-                }
+                else
+                    c = cache.getEntriesAsync(keys).get();
 
                 for (CacheEntry<String, Integer> e : c) {
                     int k = Integer.valueOf(e.getKey());
@@ -398,11 +386,8 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
             else {
                 if (j == 0)
                     map = cache.getAll(keys);
-                else {
-                    cacheAsync.getAll(keys);
-
-                    map = cacheAsync.<Map<String, Integer>>future().get();
-                }
+                else
+                    map = cache.getAllAsync(keys).get();
 
                 int i = 0;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
index ac56d18..f3d2434 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
@@ -123,11 +123,7 @@ public class GridCacheMissingCommitVersionSelfTest extends GridCommonAbstractTes
         for (Integer key : q) {
             log.info("Trying to update " + key);
 
-            IgniteCache<Integer, Integer> asyncCache = cache.withAsync();
-
-            asyncCache.put(key, 2);
-
-            IgniteFuture<?> fut = asyncCache.future();
+            IgniteFuture<?> fut = cache.putAsync(key, 2);
 
             try {
                 fut.get(5000);

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
index 406194c..d700856 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
@@ -318,7 +318,7 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
 
             final AtomicBoolean inputExhausted = new AtomicBoolean();
 
-            IgniteCompute comp = compute(master.cluster().forPredicate(workerNodesFilter)).withAsync();
+            IgniteCompute comp = compute(master.cluster().forPredicate(workerNodesFilter));
 
             for (Integer key : testKeys) {
                 dataChunk.add(key);
@@ -331,14 +331,12 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
 
                     log.info("Pushing data chunk [chunkNo=" + chunkCntr + "]");
 
-                    comp.execute(
+                    ComputeTaskFuture<Void> fut = comp.executeAsync(
                         new GridCachePutAllTask(
                             runningWorkers.get(rnd.nextInt(runningWorkers.size())).cluster().localNode().id(),
                             CACHE_NAME),
                             dataChunk);
 
-                    ComputeTaskFuture<Void> fut = comp.future();
-
                     resQueue.put(fut); // Blocks if queue is full.
 
                     fut.listen(new CI1<IgniteFuture<Void>>() {
@@ -514,7 +512,7 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
 
             final AtomicBoolean inputExhausted = new AtomicBoolean();
 
-            IgniteCompute comp = compute(master.cluster().forPredicate(workerNodesFilter)).withAsync();
+            IgniteCompute comp = compute(master.cluster().forPredicate(workerNodesFilter));
 
             for (Integer key : testKeys) {
                 ClusterNode mappedNode = master.affinity(CACHE_NAME).mapKeyToNode(key);
@@ -536,9 +534,7 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
 
                     log.info("Pushing data chunk [chunkNo=" + chunkCntr + "]");
 
-                    comp.execute(new GridCachePutAllTask(nodeId, CACHE_NAME), data);
-
-                    ComputeTaskFuture<Void> fut = comp.future();
+                    ComputeTaskFuture<Void> fut = comp.executeAsync(new GridCachePutAllTask(nodeId, CACHE_NAME), data);
 
                     resQueue.put(fut); // Blocks if queue is full.
 
@@ -587,9 +583,7 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
             }
 
             for (Map.Entry<UUID, Collection<Integer>> entry : dataChunks.entrySet()) {
-                comp.execute(new GridCachePutAllTask(entry.getKey(), CACHE_NAME), entry.getValue());
-
-                ComputeTaskFuture<Void> fut = comp.future();
+                ComputeTaskFuture<Void> fut = comp.executeAsync(new GridCachePutAllTask(entry.getKey(), CACHE_NAME), entry.getValue());
 
                 resQueue.put(fut); // Blocks if queue is full.
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
index 0eb8ccc..42bba79 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
@@ -357,7 +357,6 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
 
                 try {
                     IgniteCache<Integer, TestValue> cache = g.cache(null);
-                    IgniteCache<Integer, TestValue> cacheAsync = cache.withAsync();
 
                     refs.add(new WeakReference<Object>(cacheContext(cache)));
 
@@ -365,9 +364,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
 
                     refs.add(new WeakReference<Object>(val));
 
-                    cacheAsync.putIfAbsent(0, val);
-
-                    cacheAsync.future().get();
+                    cache.putIfAbsentAsync(0, val).get();
                 }
                 finally {
                     G.stop(g.name(), cancel);
@@ -393,7 +390,6 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
 
                 try {
                     IgniteCache<Integer, TestValue> cache = g.cache(null);
-                    IgniteCache<Integer, TestValue> cacheAsync = cache.withAsync();
 
                     refs.add(new WeakReference<Object>(cacheContext(cache)));
 
@@ -404,9 +400,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
 
                         refs.add(new WeakReference<Object>(val));
 
-                        cacheAsync.putIfAbsent(0, val);
-
-                        futs.add(cacheAsync.future());
+                        futs.add(cache.putIfAbsentAsync(0, val));
                     }
 
                     for (IgniteFuture<?> fut : futs)
@@ -473,7 +467,6 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
 
                 try {
                     IgniteCache<Integer, TestValue> cache = g.cache(null);
-                    IgniteCache<Integer, TestValue> cacheAsync = cache.withAsync();
 
                     refs.add(new WeakReference<Object>(cacheContext(cache)));
 
@@ -484,9 +477,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
 
                         refs.add(new WeakReference<Object>(val));
 
-                        cacheAsync.put(i, val);
-
-                        cacheAsync.future().get();
+                        cache.putAsync(i, val).get();
                     }
 
                     tx.commit();

http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
index a131307..dc357f1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearGetR
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.spi.IgniteSpiException;
@@ -206,13 +207,11 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
             @Override public Object call() throws Exception {
                 info("Start operation.");
 
-                IgniteCache<Object, Object> cache = clientCache().withAsync();
-
-                cache.getAndPut(1, 1);
+                IgniteFuture f = clientCache().getAndPutAsync(1, 1);
 
                 info("Stop operation.");
 
-                return cache.future().get();
+                return f.get();
             }
         });
     }