Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 05061200C56 for ; Thu, 30 Mar 2017 13:49:37 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 03798160B9A; Thu, 30 Mar 2017 11:49:37 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4F182160BA5 for ; Thu, 30 Mar 2017 13:49:32 +0200 (CEST) Received: (qmail 87668 invoked by uid 500); 30 Mar 2017 11:49:31 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 87395 invoked by uid 99); 30 Mar 2017 11:49:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Mar 2017 11:49:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 14275DFE5C; Thu, 30 Mar 2017 11:49:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agoncharuk@apache.org To: commits@ignite.apache.org Date: Thu, 30 Mar 2017 11:49:36 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [07/50] [abbrv] ignite git commit: IGNITE-4475: New async API: now all async methods are defined explicitly, IgniteAsyncSupport is deprecated. This closes #1648. archived-at: Thu, 30 Mar 2017 11:49:37 -0000 http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java index e47a18d..4bada88 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigVariationsFullApiTest.java @@ -56,6 +56,7 @@ import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.IgniteTransactions; +import org.apache.ignite.cache.CacheEntry; import org.apache.ignite.cache.CacheEntryEventSerializableFilter; import org.apache.ignite.cache.CacheEntryProcessor; import org.apache.ignite.cache.CachePeekMode; @@ -225,6 +226,41 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar for (int i = 0; i < gridCount(); i++) assertEquals(globalPrimarySize, jcache(i).size(PRIMARY)); + for (int i = 0; i < gridCount(); i++) + assertEquals(globalPrimarySize, jcache(i).sizeLong(PRIMARY)); + + for (int i = 0; i < gridCount(); i++) + assertEquals(globalPrimarySize, (int)jcache(i).sizeAsync(PRIMARY).get()); + + for (int i = 0; i < gridCount(); i++) + assertEquals((long)globalPrimarySize, (long)jcache(i).sizeLongAsync(PRIMARY).get()); + + for (int i = 0; i < gridCount(); i++) { + IgniteCacheProxy cache = (IgniteCacheProxy)jcache(i); + + long cacheSize = 0; + + int parts = cache.context().affinity().partitions(); + + for (int part = 0; part < parts; ++part) + cacheSize += jcache(i).sizeLong(part, PRIMARY); + + assertEquals((long)globalPrimarySize, cacheSize); + } + + for (int i = 0; i < gridCount(); i++) { + IgniteCacheProxy cache = (IgniteCacheProxy)jcache(i); + + long cacheSize = 0; + + int parts = cache.context().affinity().partitions(); + + for (int part = 0; part < parts; ++part) + cacheSize += jcache(i).sizeLongAsync(part, PRIMARY).get(); + + assertEquals((long)globalPrimarySize, cacheSize); + } + int times = 1; if (cacheMode() == REPLICATED) @@ -242,10 +278,21 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar * @throws Exception In case of error. */ public void testContainsKey() throws Exception { - jcache().put("testContainsKey", 1); - checkContainsKey(true, "testContainsKey"); + Map vals = new HashMap<>(); + + for (int i = 0; i < CNT; i++) + vals.put("key" + i, i); + + jcache().putAll(vals); + + checkContainsKey(true, "key0"); checkContainsKey(false, "testContainsKeyWrongKey"); + + for (int i = 0; i < gridCount(); i++) { + assertTrue(jcache(i).containsKeys(vals.keySet())); + assertTrue(jcache(i).containsKeysAsync(vals.keySet()).get()); + } } /** @@ -420,7 +467,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ - public void testGetAsync() throws Exception { + public void testGetAsyncOld() throws Exception { IgniteCache cache = jcache(); cache.put("key1", 1); @@ -448,6 +495,26 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ + public void testGetAsync() throws Exception { + IgniteCache cache = jcache(); + + cache.put("key1", 1); + cache.put("key2", 2); + + IgniteFuture fut1 = cache.getAsync("key1"); + + IgniteFuture fut2 = cache.getAsync("key2"); + + IgniteFuture fut3 = cache.getAsync("wrongKey"); + + assert fut1.get() == 1; + assert fut2.get() == 2; + assert fut3.get() == null; + } + + /** + * @throws Exception In case of error. + */ public void testGetAll() throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() { @@ -570,7 +637,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ - public void testGetAllAsync() throws Exception { + public void testGetAllAsyncOld() throws Exception { final IgniteCache cache = jcache(); final IgniteCache cacheAsync = cache.withAsync(); @@ -601,6 +668,33 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ + public void testGetAllAsync() throws Exception { + final IgniteCache cache = jcache(); + + cache.put("key1", 1); + cache.put("key2", 2); + + GridTestUtils.assertThrows(log, new Callable() { + @Override public Void call() throws Exception { + cache.getAllAsync(null); + + return null; + } + }, NullPointerException.class, null); + + IgniteFuture> fut2 = cache.getAllAsync(Collections.emptySet()); + + IgniteFuture> 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 testPut() throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { @@ -899,6 +993,50 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } /** + * @throws Exception If failed. + */ + public void testInvokeAllAsyncOptimisticReadCommitted() throws Exception { + runInAllDataModes(new TestRunnable() { + @Override public void run() throws Exception { + checkInvokeAllAsync(OPTIMISTIC, READ_COMMITTED); + } + }); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeAllAsyncOptimisticRepeatableRead() throws Exception { + runInAllDataModes(new TestRunnable() { + @Override public void run() throws Exception { + checkInvokeAllAsync(OPTIMISTIC, REPEATABLE_READ); + } + }); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeAllAsyncPessimisticReadCommitted() throws Exception { + runInAllDataModes(new TestRunnable() { + @Override public void run() throws Exception { + checkInvokeAllAsync(PESSIMISTIC, READ_COMMITTED); + } + }); + } + + /** + * @throws Exception If failed. + */ + public void testInvokeAllAsyncPessimisticRepeatableRead() throws Exception { + runInAllDataModes(new TestRunnable() { + @Override public void run() throws Exception { + checkInvokeAllAsync(PESSIMISTIC, REPEATABLE_READ); + } + }); + } + + /** * @param concurrency Transaction concurrency. * @param isolation Transaction isolation. * @throws Exception If failed. @@ -994,6 +1132,103 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } /** + * @param concurrency Transaction concurrency. + * @param isolation Transaction isolation. + * @throws Exception If failed. + */ + private void checkInvokeAllAsync(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception { + // TODO IGNITE-2664: enable tests for all modes when IGNITE-2664 will be fixed. + if (dataMode != DataMode.EXTERNALIZABLE && gridCount() > 1) + return; + + final Object key1 = key(1); + final Object key2 = key(2); + final Object key3 = key(3); + + final Object val1 = value(1); + final Object val2 = value(2); + final Object val3 = value(3); + final Object val4 = value(4); + + final IgniteCache cache = jcache(); + + cache.put(key2, val1); + cache.put(key3, val3); + + if (txShouldBeUsed()) { + Map> res; + + try (Transaction tx = ignite(0).transactions().txStart(concurrency, isolation)) { + res = cache.invokeAllAsync(F.asSet(key1, key2, key3), INCR_PROCESSOR, dataMode).get(); + + tx.commit(); + } + + assertEquals(val1, cache.get(key1)); + assertEquals(val2, cache.get(key2)); + assertEquals(val4, cache.get(key3)); + + assertNull(res.get(key1)); + assertEquals(val1, res.get(key2).get()); + assertEquals(val3, res.get(key3).get()); + + assertEquals(2, res.size()); + + cache.remove(key1); + cache.put(key2, val1); + cache.put(key3, val3); + } + + Map> res = + cache.invokeAllAsync(F.asSet(key1, key2, key3), RMV_PROCESSOR).get(); + + for (int i = 0; i < gridCount(); i++) { + assertNull(jcache(i).localPeek(key1, ONHEAP)); + assertNull(jcache(i).localPeek(key2, ONHEAP)); + assertNull(jcache(i).localPeek(key3, ONHEAP)); + } + + assertNull(res.get(key1)); + assertEquals(val1, res.get(key2).get()); + assertEquals(val3, res.get(key3).get()); + + assertEquals(2, res.size()); + + cache.remove(key1); + cache.put(key2, val1); + cache.put(key3, val3); + + res = cache.invokeAllAsync(F.asSet(key1, key2, key3), INCR_PROCESSOR, dataMode).get(); + + assertEquals(val1, cache.get(key1)); + assertEquals(val2, cache.get(key2)); + assertEquals(val4, cache.get(key3)); + + assertNull(res.get(key1)); + assertEquals(val1, res.get(key2).get()); + assertEquals(val3, res.get(key3).get()); + + assertEquals(2, res.size()); + + cache.remove(key1); + cache.put(key2, val1); + cache.put(key3, val3); + + res = cache.invokeAllAsync( + F.asMap(key1, INCR_PROCESSOR, key2, INCR_PROCESSOR, key3, INCR_PROCESSOR), dataMode).get(); + + assertEquals(val1, cache.get(key1)); + assertEquals(val2, cache.get(key2)); + assertEquals(val4, cache.get(key3)); + + assertNull(res.get(key1)); + assertEquals(val1, res.get(key2).get()); + assertEquals(val3, res.get(key3).get()); + + assertEquals(2, res.size()); + } + + /** * @throws Exception If failed. */ public void testInvokeAllWithNulls() throws Exception { @@ -1295,7 +1530,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ - public void testGetAndPutAsync() throws Exception { + public void testGetAndPutAsyncOld() throws Exception { IgniteCache cache = jcache(); IgniteCache cacheAsync = cache.withAsync(); @@ -1321,7 +1556,27 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ - public void testPutAsync0() throws Exception { + public void testGetAndPutAsync() throws Exception { + IgniteCache cache = jcache(); + + cache.put("key1", 1); + cache.put("key2", 2); + + IgniteFuture fut1 = cache.getAndPutAsync("key1", 10); + + IgniteFuture 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 cacheAsync = jcache().withAsync(); cacheAsync.getAndPut("key1", 0); @@ -1337,9 +1592,21 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } /** + * @throws Exception In case of error. + */ + public void testPutAsync0() throws Exception { + IgniteFuture fut1 = jcache().getAndPutAsync("key1", 0); + + IgniteFuture fut2 = jcache().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 { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { final Object key1 = key(1); @@ -1386,6 +1653,46 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception If failed. */ + public void testInvokeAsync() throws Exception { + runInAllDataModes(new TestRunnable() { + @Override public void run() throws Exception { + final Object key1 = key(1); + final Object key2 = key(2); + final Object key3 = key(3); + + final Object val1 = value(1); + final Object val2 = value(2); + final Object val3 = value(3); + + IgniteCache cache = jcache(); + + cache.put(key2, val1); + cache.put(key3, val3); + + IgniteFuture fut0 = cache.invokeAsync(key1, INCR_PROCESSOR, dataMode); + + IgniteFuture fut1 = cache.invokeAsync(key2, INCR_PROCESSOR, dataMode); + + + IgniteFuture fut2 = cache.invokeAsync(key3, RMV_PROCESSOR); + + fut0.get(); + fut1.get(); + fut2.get(); + + assertEquals(val1, cache.get(key1)); + assertEquals(val2, 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 { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { @@ -1492,7 +1799,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception If failed. */ - public void testPutAsync() throws Exception { + public void testPutAsyncOld() throws Exception { Transaction tx = txShouldBeUsed() ? transactions().txStart() : null; IgniteCache cacheAsync = jcache().withAsync(); @@ -1535,6 +1842,45 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } /** + * @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 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 (Integer)jcache().get("key1") == 10; + assert (Integer)jcache().get("key2") == 11; + } + + /** * @throws Exception In case of error. */ public void testPutAll() throws Exception { @@ -1782,7 +2128,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ - public void testPutAllAsync() throws Exception { + public void testPutAllAsyncOld() throws Exception { Map map = F.asMap("key1", 1, "key2", 2); IgniteCache cache = jcache(); @@ -1812,6 +2158,30 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ + public void testPutAllAsync() throws Exception { + Map map = F.asMap("key1", 1, "key2", 2); + + IgniteCache 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; @@ -1898,7 +2268,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception If failed. */ - public void testGetAndPutIfAbsentAsync() throws Exception { + public void testGetAndPutIfAbsentAsyncOld() throws Exception { Transaction tx = txShouldBeUsed() ? transactions().txStart() : null; IgniteCache cache = jcache(); @@ -1979,6 +2349,75 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception If failed. */ + public void testGetAndPutIfAbsentAsync() throws Exception { + Transaction tx = txShouldBeUsed() ? transactions().txStart() : null; + + IgniteCache cache = jcache(); + + try { + IgniteFuture fut1 = cache.getAndPutIfAbsentAsync("key", 1); + + assertNull(fut1.get()); + assertEquals((Integer)1, cache.get("key")); + + IgniteFuture 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(); + } + + if (!storeEnabled()) + return; + + // Check swap. + cache.put("key2", 1); + + cache.localEvict(Collections.singleton("key2")); + + if (!isLoadPreviousValue()) + cache.get("key2"); + + assertEquals((Integer)1, cache.getAndPutIfAbsentAsync("key2", 3).get()); + + // Check db. + if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) { + putToStore("key3", 3); + + assertEquals((Integer)3, cache.getAndPutIfAbsentAsync("key3", 4).get()); + } + + cache.localEvict(Collections.singleton("key2")); + + if (!isLoadPreviousValue()) + cache.get("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 cache = jcache(); @@ -2033,6 +2472,21 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ + public void testPutxIfAbsentAsyncOld() throws Exception { + if (txShouldBeUsed()) + checkPutxIfAbsentAsyncOld(true); + } + + /** + * @throws Exception In case of error. + */ + public void testPutxIfAbsentAsyncOldNoTx() throws Exception { + checkPutxIfAbsentAsyncOld(false); + } + + /** + * @throws Exception In case of error. + */ public void testPutxIfAbsentAsync() throws Exception { if (txShouldBeUsed()) checkPutxIfAbsentAsync(true); @@ -2049,7 +2503,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar * @param inTx In tx flag. * @throws Exception If failed. */ - private void checkPutxIfAbsentAsync(boolean inTx) throws Exception { + private void checkPutxIfAbsentAsyncOld(boolean inTx) throws Exception { IgniteCache cache = jcache(); IgniteCache cacheAsync = cache.withAsync(); @@ -2126,9 +2580,74 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } /** + * @param inTx In tx flag. + * @throws Exception If failed. + */ + private void checkPutxIfAbsentAsync(boolean inTx) throws Exception { + IgniteCache cache = jcache(); + + IgniteFuture fut1 = cache.putIfAbsentAsync("key", 1); + + assert fut1.get(); + assert cache.get("key") != null && cache.get("key") == 1; + + IgniteFuture fut2 = cache.putIfAbsentAsync("key", 2); + + assert !fut2.get(); + assert cache.get("key") != null && cache.get("key") == 1; + + if (!storeEnabled()) + return; + + // Check swap. + cache.put("key2", 1); + + cache.localEvict(Collections.singleton("key2")); + + if (!isLoadPreviousValue()) + cache.get("key2"); + + assertFalse(cache.putIfAbsentAsync("key2", 3).get()); + + // Check db. + if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) { + putToStore("key3", 3); + + assertFalse(cache.putIfAbsentAsync("key3", 4).get()); + } + + cache.localEvict(Collections.singletonList("key2")); + + if (!isLoadPreviousValue()) + cache.get("key2"); + + // Same checks inside tx. + Transaction tx = inTx ? transactions().txStart() : null; + + try { + assertFalse(cache.putIfAbsentAsync("key2", 3).get()); + + if (storeEnabled() && isLoadPreviousValue() && !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 (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) + assertEquals((Integer)3, cache.get("key3")); + } + + /** * @throws Exception In case of error. */ - public void testPutIfAbsentAsyncConcurrent() throws Exception { + public void testPutIfAbsentAsyncOldConcurrent() throws Exception { IgniteCache cacheAsync = jcache().withAsync(); cacheAsync.putIfAbsent("key1", 1); @@ -2144,6 +2663,20 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } /** + * @throws Exception In case of error. + */ + public void testPutIfAbsentAsyncConcurrent() throws Exception { + IgniteCache cache = jcache(); + + IgniteFuture fut1 = cache.putIfAbsentAsync("key1", 1); + + IgniteFuture fut2 = cache.putIfAbsentAsync("key2", 2); + + assert fut1.get(); + assert fut2.get(); + } + + /** * @throws Exception If failed. */ public void testGetAndReplace() throws Exception { @@ -2297,7 +2830,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception If failed. */ - public void testGetAndReplaceAsync() throws Exception { + public void testGetAndReplaceAsyncOld() throws Exception { IgniteCache cache = jcache(); IgniteCache cacheAsync = cache.withAsync(); @@ -2386,7 +2919,78 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception If failed. */ - public void testReplacexAsync() throws Exception { + public void testGetAndReplaceAsync() throws Exception { + IgniteCache 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") == 2; + + assert !cache.replaceAsync("key", 0, 3).get(); + + assert cache.get("key") == 2; + + assert cache.replaceAsync("key", 2, 3).get(); + + assert cache.get("key") == 3; + + if (!storeEnabled()) + return; + + cache.localEvict(Collections.singleton("key")); + + if (!isLoadPreviousValue()) + cache.get("key"); + + assert cache.replaceAsync("key", 3, 4).get(); + + assert cache.get("key") == 4; + + if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) { + putToStore("key2", 5); + + assert cache.replaceAsync("key2", 5, 6).get(); + + assertEquals((Integer)6, cache.get("key2")); + } + + cache.localEvict(Collections.singleton("key")); + + if (!isLoadPreviousValue()) + cache.get("key"); + + Transaction tx = txShouldBeUsed() ? transactions().txStart() : null; + + try { + assert cache.replaceAsync("key", 4, 5).get(); + + if (tx != null) + tx.commit(); + } + finally { + if (tx != null) + tx.close(); + } + + assert cache.get("key") == 5; + } + + /** + * @throws Exception If failed. + */ + public void testReplacexAsyncOld() throws Exception { IgniteCache cache = jcache(); IgniteCache cacheAsync = cache.withAsync(); @@ -2455,6 +3059,65 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } /** + * @throws Exception If failed. + */ + public void testReplacexAsync() throws Exception { + IgniteCache cache = jcache(); + + cache.put("key", 1); + + assert cache.get("key") == 1; + + assert cache.replaceAsync("key", 2).get(); + + info("Finished replace."); + + assertEquals((Integer)2, cache.get("key")); + + assert !cache.replaceAsync("wrond", 2).get(); + + if (!storeEnabled()) + return; + + cache.localEvict(Collections.singleton("key")); + + if (!isLoadPreviousValue()) + cache.get("key"); + + assert cache.replaceAsync("key", 4).get(); + + assert cache.get("key") == 4; + + if (storeEnabled() && isLoadPreviousValue() && !isMultiJvm()) { + putToStore("key2", 5); + + assert cache.replaceAsync("key2", 6).get(); + + assert cache.get("key2") == 6; + } + + cache.localEvict(Collections.singleton("key")); + + if (!isLoadPreviousValue()) + cache.get("key"); + + Transaction tx = txShouldBeUsed() ? transactions().txStart() : null; + + try { + assert cache.replaceAsync("key", 5).get(); + + if (tx != null) + tx.commit(); + } + finally { + if (tx != null) + tx.close(); + } + + assert cache.get("key") == 5; + } + + /** * @throws Exception In case of error. */ public void testGetAndRemove() throws Exception { @@ -2602,7 +3265,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ - public void testRemoveAsync() throws Exception { + public void testRemoveAsyncOld() throws Exception { IgniteCache cache = jcache(); IgniteCache cacheAsync = cache.withAsync(); @@ -2636,6 +3299,30 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ + public void testRemoveAsync() throws Exception { + IgniteCache 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 cache = jcache(); @@ -2649,7 +3336,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ - public void testRemovexAsync() throws Exception { + public void testRemovexAsyncOld() throws Exception { IgniteCache cache = jcache(); IgniteCache cacheAsync = cache.withAsync(); @@ -2670,22 +3357,45 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ + public void testRemovexAsync() throws Exception { + IgniteCache 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); + globalRemoveAll(false, false); + } + + /** + * @throws Exception In case of error. + */ + public void testGlobalRemoveAllAsyncOld() throws Exception { + globalRemoveAll(true, true); } /** * @throws Exception In case of error. */ public void testGlobalRemoveAllAsync() throws Exception { - globalRemoveAll(true); + globalRemoveAll(true, false); } /** * @param async If {@code true} uses asynchronous operation. + * @param oldAsync Use old async API. * @throws Exception In case of error. */ - private void globalRemoveAll(boolean async) throws Exception { + private void globalRemoveAll(boolean async, boolean oldAsync) throws Exception { IgniteCache cache = jcache(); cache.put("key1", 1); @@ -2699,9 +3409,13 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar IgniteCache asyncCache = cache.withAsync(); if (async) { - asyncCache.removeAll(F.asSet("key1", "key2")); + if (oldAsync) { + asyncCache.removeAll(F.asSet("key1", "key2")); - asyncCache.future().get(); + asyncCache.future().get(); + } + else + cache.removeAllAsync(F.asSet("key1", "key2")).get(); } else cache.removeAll(F.asSet("key1", "key2")); @@ -2720,11 +3434,15 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar atomicClockModeDelay(cache); if (async) { - IgniteCache asyncCache0 = jcache(gridCount() > 1 ? 1 : 0).withAsync(); + if (oldAsync) { + IgniteCache asyncCache0 = jcache(gridCount() > 1 ? 1 : 0).withAsync(); - asyncCache0.removeAll(); + asyncCache0.removeAll(); - asyncCache0.future().get(); + asyncCache0.future().get(); + } + else + jcache(gridCount() > 1 ? 1 : 0).removeAllAsync().get(); } else jcache(gridCount() > 1 ? 1 : 0).removeAll(); @@ -2741,9 +3459,13 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar atomicClockModeDelay(cache); if (async) { - asyncCache.removeAll(); + if (oldAsync) { + asyncCache.removeAll(); - asyncCache.future().get(); + asyncCache.future().get(); + } + else + cache.removeAllAsync().get(); } else cache.removeAll(); @@ -2843,7 +3565,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ - public void testRemoveAllAsync() throws Exception { + public void testRemoveAllAsyncOld() throws Exception { IgniteCache cache = jcache(); IgniteCache cacheAsync = cache.withAsync(); @@ -2868,6 +3590,27 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @throws Exception In case of error. */ + public void testRemoveAllAsync() throws Exception { + IgniteCache 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 { if (!storeEnabled()) return; @@ -3101,21 +3844,29 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar * @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++) { @@ -3124,11 +3875,15 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } if (async) { - IgniteCache asyncCache = jcache().withAsync(); + if (oldAsync) { + IgniteCache asyncCache = jcache().withAsync(); - asyncCache.clear(); + asyncCache.clear(); - asyncCache.future().get(); + asyncCache.future().get(); + } + else + jcache().clearAsync().get(); } else jcache().clear(); @@ -4189,8 +4944,10 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar * @throws Exception If failed. */ private void checkContainsKey(boolean exp, Object key) throws Exception { - if (nearEnabled()) + if (nearEnabled()) { assertEquals(exp, jcache().containsKey(key)); + assertEquals(exp, (boolean)jcache().containsKeyAsync(key).get()); + } else { boolean contains = false; @@ -4207,6 +4964,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @param key Key. + * @return Ignite instance of the primary node for the specified key. */ protected Ignite primaryIgnite(String key) { ClusterNode node = grid(0).affinity(cacheName()).mapKeyToNode(key); @@ -4235,6 +4993,7 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar /** * @param gridIdx Grid index. * @param cnt Keys count. + * @param startFrom Key value to start. * @return Collection of keys for which given cache is primary. */ protected List primaryKeysForCache(int gridIdx, int cnt, int startFrom) { @@ -4633,36 +5392,51 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar * @throws Exception If failed. */ public void testGlobalClearKey() throws Exception { - testGlobalClearKey(false, Arrays.asList("key25")); + testGlobalClearKey(false, false, Arrays.asList("key25")); + } + + /** + * @throws Exception If failed. + */ + public void testGlobalClearKeyAsyncOld() throws Exception { + testGlobalClearKey(true, true, Arrays.asList("key25")); } /** * @throws Exception If failed. */ public void testGlobalClearKeyAsync() throws Exception { - testGlobalClearKey(true, Arrays.asList("key25")); + testGlobalClearKey(true, false, Arrays.asList("key25")); } /** * @throws Exception If failed. */ public void testGlobalClearKeys() throws Exception { - testGlobalClearKey(false, Arrays.asList("key25", "key100", "key150")); + testGlobalClearKey(false, false, Arrays.asList("key25", "key100", "key150")); + } + + /** + * @throws Exception If failed. + */ + public void testGlobalClearKeysAsyncOld() throws Exception { + testGlobalClearKey(true, true, Arrays.asList("key25", "key100", "key150")); } /** * @throws Exception If failed. */ public void testGlobalClearKeysAsync() throws Exception { - testGlobalClearKey(true, Arrays.asList("key25", "key100", "key150")); + testGlobalClearKey(true, false, Arrays.asList("key25", "key100", "key150")); } /** * @param async If {@code true} uses async method. + * @param oldAsync Use old async API. * @param keysToRmv Keys to remove. * @throws Exception If failed. */ - protected void testGlobalClearKey(boolean async, Collection keysToRmv) throws Exception { + protected void testGlobalClearKey(boolean async, boolean oldAsync, Collection keysToRmv) 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) { @@ -4674,14 +5448,22 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } if (async) { - IgniteCache asyncCache = jcache().withAsync(); + if (oldAsync) { + IgniteCache 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) @@ -5254,20 +6036,29 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar * @throws Exception If failed. */ public void testGetOutTx() throws Exception { - checkGetOutTx(false); + checkGetOutTx(false, false); + } + + /** + * @throws Exception If failed. + */ + public void testGetOutTxAsyncOld() throws Exception { + checkGetOutTx(true, true); } /** * @throws Exception If failed. */ public void testGetOutTxAsync() throws Exception { - checkGetOutTx(true); + checkGetOutTx(true, false); } /** + * @param async Use async API. + * @param oldAsync Uase old style async API. * @throws Exception If failed. */ - private void checkGetOutTx(boolean async) throws Exception { + private void checkGetOutTx(boolean async, boolean oldAsync) throws Exception { final AtomicInteger lockEvtCnt = new AtomicInteger(); IgnitePredicate lsnr = new IgnitePredicate() { @@ -5290,21 +6081,40 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar grid(0).events().localListen(lsnr, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED); - if (async) + if (async && oldAsync) cache = cache.withAsync(); try (Transaction tx = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { - Integer val0 = cache.get(keys.get(0)); + Integer val0; + + if (async) { + if (oldAsync) { + cache.get(keys.get(0)); + + val0 = cache.future().get(); + } + else + val0 = cache.getAsync(keys.get(0)).get(); + } + else + val0 = cache.get(keys.get(0)); - if (async) - val0 = cache.future().get(); assertEquals(0, val0.intValue()); - Map allOutTx = cache.getAllOutTx(F.asSet(keys.get(1))); + Map allOutTx; + + if (async) { + if (oldAsync) { + cache.getAllOutTx(F.asSet(keys.get(1))); - if (async) - allOutTx = cache.>future().get(); + allOutTx = cache.>future().get(); + } + else + allOutTx = cache.getAllOutTxAsync(F.asSet(keys.get(1))).get(); + } + else + allOutTx = cache.getAllOutTx(F.asSet(keys.get(1))); assertEquals(1, allOutTx.size()); @@ -5337,13 +6147,13 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar * @throws Exception If failed. */ public void testInvokeException() throws Exception { - final IgniteCache cache = jcache().withAsync(); + final IgniteCache cache = jcache(); - cache.invoke("key2", ERR_PROCESSOR); + final IgniteFuture fut = cache.invokeAsync("key2", ERR_PROCESSOR); assertThrows(log, new Callable() { @Override public Object call() throws Exception { - IgniteFuture fut = cache.future().chain(new IgniteClosure() { + fut.chain(new IgniteClosure() { @Override public Object apply(IgniteFuture o) { return o.get(); } @@ -5457,6 +6267,45 @@ public class IgniteCacheConfigVariationsFullApiTest extends IgniteCacheConfigVar } /** + * @throws Exception If failed. + */ + public void testGetEntry() throws Exception { + runInAllDataModes(new TestRunnable() { + @Override public void run() throws Exception { + Map vals = new HashMap<>(); + + for (int i = 0; i < CNT; i++) + vals.put("key" + i, i); + + jcache(0).putAll(vals); + + for (int i = 0; i < gridCount(); i++) { + assertEquals(0, jcache(i).getEntry("key0").getValue()); + assertEquals(0, jcache(i).getEntryAsync("key0").get().getValue()); + + assertTrue( + F.transform( + jcache(i).getEntries(vals.keySet()), + new IgniteClosure, Object>() { + @Override public Object apply(CacheEntry entry) { + return entry.getValue(); + } + }).containsAll(vals.values())); + + assertTrue( + F.transform( + jcache(i).getEntriesAsync(vals.keySet()).get(), + new IgniteClosure, Object>() { + @Override public Object apply(CacheEntry entry) { + return entry.getValue(); + } + }).containsAll(vals.values())); + } + } + }); + } + + /** * Sets given value, returns old value. */ public static final class SetValueProcessor implements EntryProcessor { http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java index 51a70b9..9681e97 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java @@ -178,13 +178,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT checkValue(key, 63); - IgniteCache asyncCache = cache.withAsync(); - - assertTrue(asyncCache.isAsync()); - - assertNull(asyncCache.invoke(key, incProcessor)); - - IgniteFuture fut = asyncCache.future(); + IgniteFuture fut = cache.invokeAsync(key, incProcessor); assertNotNull(fut); @@ -484,13 +478,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT checkValue(key, null); } - IgniteCache asyncCache = cache.withAsync(); - - assertTrue(asyncCache.isAsync()); - - assertNull(asyncCache.invokeAll(keys, new IncrementProcessor())); - - IgniteFuture>> fut = asyncCache.future(); + IgniteFuture>> fut = cache.invokeAllAsync(keys, new IncrementProcessor()); Map> resMap = fut.get(); @@ -509,9 +497,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT for (Integer key : keys) invokeMap.put(key, incProcessor); - assertNull(asyncCache.invokeAll(invokeMap)); - - fut = asyncCache.future(); + fut = cache.invokeAllAsync(invokeMap); resMap = fut.get(); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java index cb9c2d7..76667c5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java @@ -74,7 +74,7 @@ public class IgniteCacheManyAsyncOperationsTest extends IgniteCacheAbstractTest try (Ignite client = startGrid(gridCount())) { assertTrue(client.configuration().isClientMode()); - IgniteCache cache = client.cache(null).withAsync(); + IgniteCache cache = client.cache(null); final int ASYNC_OPS = cache.getConfiguration(CacheConfiguration.class).getMaxConcurrentAsyncOperations(); @@ -91,9 +91,7 @@ public class IgniteCacheManyAsyncOperationsTest extends IgniteCacheAbstractTest List> futs = new ArrayList<>(ASYNC_OPS); for (int i = 0; i < ASYNC_OPS; i++) { - cache.putAll(map); - - futs.add(cache.future()); + futs.add(cache.putAllAsync(map)); if (i % 50 == 0) log.info("Created futures: " + (i + 1)); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java index fa1677c..343653c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java @@ -394,8 +394,6 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra if (cacheMode() == LOCAL) { IgniteCache cache0 = jcache(0); - IgniteCache cacheAsync0 = cache0.withAsync(); - for (int i = 0; i < HEAP_ENTRIES; i++) { cache0.put(i, String.valueOf(i)); @@ -413,13 +411,9 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra assertEquals(size, cache0.size(NEAR)); assertEquals(size, cache0.size(ALL)); - cacheAsync0.size(); - - assertEquals(size, cacheAsync0.future().get()); - - cacheAsync0.size(PRIMARY); + assertEquals(size, (int) cache0.sizeAsync().get()); - assertEquals(size, cacheAsync0.future().get()); + assertEquals(size, (int) cache0.sizeAsync(PRIMARY).get()); } for (int i = 0; i < HEAP_ENTRIES; i++) { @@ -439,9 +433,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra assertEquals(size, cache0.size(NEAR)); assertEquals(size, cache0.size(ALL)); - cacheAsync0.size(); - - assertEquals(size, cacheAsync0.future().get()); + assertEquals(size, (int) cache0.sizeAsync().get()); } checkEmpty(); @@ -514,8 +506,6 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra int part = 0; IgniteCache cache0 = jcache(0); - IgniteCache cacheAsync0 = cache0.withAsync(); - for (int i = 0; i < HEAP_ENTRIES; i++) { cache0.put(i, String.valueOf(i)); @@ -533,13 +523,9 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra assertEquals(size, cache0.sizeLong(part, NEAR)); assertEquals(size, cache0.sizeLong(part, ALL)); - cacheAsync0.size(); + assertEquals(size, (long) cache0.sizeAsync().get()); - assertEquals(size, (long) cacheAsync0.future().get()); - - cacheAsync0.sizeLong(part, PRIMARY); - - assertEquals(size, cacheAsync0.future().get()); + assertEquals(size, (long) cache0.sizeLongAsync(part, PRIMARY).get()); } for (int i = 0; i < HEAP_ENTRIES; i++) { @@ -559,9 +545,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra assertEquals(size, cache0.sizeLong(part, NEAR)); assertEquals(size, cache0.sizeLong(part, ALL)); - cacheAsync0.size(); - - assertEquals(size, (long) cacheAsync0.future().get()); + assertEquals(size, (long) cache0.sizeAsync().get()); } } @@ -995,6 +979,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra * @param nodeIdx Node index. * @param part Cache partition * @return Tuple with number of primary and backup keys (one or both will be zero). + * @throws IgniteCheckedException If failed. */ private T2 swapKeysCount(int nodeIdx, int part) throws IgniteCheckedException { GridCacheContext ctx = ((IgniteEx)ignite(nodeIdx)).context().cache().internalCache().context(); @@ -1331,15 +1316,11 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra for (int i = 0; i < gridCount(); i++) { IgniteCache cache = jcache(i); - IgniteCache cacheAsync = cache.withAsync(); - assertEquals(exp, cache.size(PRIMARY)); size += cache.localSize(PRIMARY); - cacheAsync.size(PRIMARY); - - assertEquals(exp, cacheAsync.future().get()); + assertEquals(exp, (int) cache.sizeAsync(PRIMARY).get()); } assertEquals(exp, size); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java index 3e6b0b0..a8eb01d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/WithKeepBinaryCacheFullApiTest.java @@ -31,6 +31,7 @@ import org.apache.ignite.binary.BinaryObject; import org.apache.ignite.cache.CacheEntry; import org.apache.ignite.cache.CacheEntryProcessor; import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.lang.IgniteFuture; import org.apache.ignite.testframework.junits.IgniteCacheConfigVariationsAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; @@ -180,7 +181,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA public void testRemovePutGetAsync() throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { - final IgniteCache cache = jcache().withKeepBinary().withAsync(); + final IgniteCache cache = jcache().withKeepBinary(); final Set keys = new LinkedHashSet() {{ for (int i = 0; i < CNT; i++) @@ -189,22 +190,17 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA runInAllTxModes(new TestRunnable() { @Override public void run() throws Exception { - for (Object key : keys) { - cache.remove(key); - - cache.future().get(); - } + for (Object key : keys) + cache.removeAsync(key).get(); } }); runInAllTxModes(new TestRunnable() { @Override public void run() throws Exception { for (Object key : keys) { - cache.get(key); - assertNull(cache.future().get()); + assertNull(cache.getAsync(key).get()); - cache.getEntry(key); - assertNull(cache.future().get()); + assertNull(cache.getEntryAsync(key).get()); } } }); @@ -215,17 +211,14 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA @Override public void run() throws Exception { Object val = value(valueOf(key)); - cache.put(key, val); - - cache.future().get(); + cache.putAsync(key, val).get(); - cache.get(key); - BinaryObject retVal = (BinaryObject)cache.future().get(); + BinaryObject retVal = (BinaryObject)cache.getAsync(key).get(); assertEquals(val, retVal.deserialize()); - cache.getEntry(key); - CacheEntry e = (CacheEntry)cache.future().get(); + CacheEntry e = + (CacheEntry)cache.getEntryAsync(key).get(); assertEquals(key, deserializeBinary(e.getKey())); @@ -311,7 +304,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA public void testPutAllGetAllAsync() throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { - final IgniteCache cache = jcache().withKeepBinary().withAsync(); + final IgniteCache cache = jcache().withKeepBinary(); final Set keys = new LinkedHashSet() {{ for (int i = 0; i < CNT; i++) @@ -320,8 +313,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA runInAllTxModes(new TestRunnable() { @Override public void run() throws Exception { - cache.getAll(keys); - Map res = (Map)cache.future().get(); + Map res = (Map)cache.getAllAsync(keys).get(); for (Object val : res.values()) assertNull(val); @@ -330,9 +322,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA runInAllTxModes(new TestRunnable() { @Override public void run() throws Exception { - cache.getEntries(keys); - - Collection entries = (Collection)cache.future().get(); + Collection entries = + (Collection)cache.getEntriesAsync(keys).get(); for (CacheEntry e : entries) assertNull(e.getValue()); @@ -349,12 +340,10 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA } }}; - cache.putAll(keyValMap); - - cache.future().get(); + cache.putAllAsync(keyValMap).get(); - cache.getAll(keys); - Set> set = ((Map)cache.future().get()).entrySet(); + Set> set = + ((Map)cache.getAllAsync(keys).get()).entrySet(); for (Map.Entry e : set) { Object expVal = value(valueOf(e.getKey().deserialize())); @@ -362,10 +351,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA assertEquals(expVal, e.getValue().deserialize()); } - cache.getEntries(keys); - Collection> entries = - (Collection>)cache.future().get(); + (Collection>)cache.getEntriesAsync(keys).get(); for (CacheEntry e : entries) { assertTrue(e.getKey() instanceof BinaryObject); @@ -375,9 +362,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA assertEquals(expVal, e.getValue().deserialize()); } - cache.removeAll(keys); + cache.removeAllAsync(keys).get(); - cache.future().get(); } }); } @@ -575,7 +561,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA public void testInvokeAsync() throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { - final IgniteCache cache = jcache().withKeepBinary().withAsync(); + final IgniteCache cache = jcache().withKeepBinary(); Set keys = new LinkedHashSet() {{ for (int i = 0; i < CNT; i++) @@ -583,41 +569,27 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA }}; for (final Object key : keys) { - cache.invoke(key, NOOP_ENTRY_PROC); - - Object res = cache.future().get(); + Object res = cache.invokeAsync(key, NOOP_ENTRY_PROC).get(); assertNull(res); - cache.get(key); - - assertNull(cache.future().get()); + assertNull(cache.getAsync(key).get()); } for (final Object key : keys) { - cache.invoke(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode); - - Object res = cache.future().get(); + Object res = cache.invokeAsync(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get(); assertNull(res); - cache.get(key); - - assertEquals(value(0), deserializeBinary(cache.future().get())); - - cache.invoke(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode); + assertEquals(value(0), deserializeBinary(cache.getAsync(key).get())); - res = cache.future().get(); + res = cache.invokeAsync(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get(); assertEquals(value(0), deserializeBinary(res)); - cache.get(key); + assertEquals(value(1), deserializeBinary(cache.getAsync(key).get())); - assertEquals(value(1), deserializeBinary(cache.future().get())); - - cache.remove(key); - - assertTrue((Boolean)cache.future().get()); + assertTrue((Boolean)cache.removeAsync(key).get()); } // TODO IGNITE-2973: should be always false. @@ -625,30 +597,20 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA try { for (final Object key : keys) { - cache.invoke(key, INC_ENTRY_PROC_USER_OBJ, dataMode); - - Object res = cache.future().get(); + Object res = cache.invokeAsync(key, INC_ENTRY_PROC_USER_OBJ, dataMode).get(); assertNull(res); - cache.get(key); - - assertEquals(value(0), deserializeBinary(cache.future().get())); + assertEquals(value(0), deserializeBinary(cache.getAsync(key).get())); - cache.invoke(key, INC_ENTRY_PROC_USER_OBJ, dataMode); - - res = cache.future().get(); + res = cache.invokeAsync(key, INC_ENTRY_PROC_USER_OBJ, dataMode).get(); // TODO IGNITE-2953: uncomment the following assert when the issue will be fixed. // assertEquals(value(0), res); - cache.get(key); - - assertEquals(value(1), deserializeBinary(cache.future().get())); + assertEquals(value(1), deserializeBinary(cache.getAsync(key).get())); - cache.remove(key); - - assertTrue((Boolean)cache.future().get()); + assertTrue((Boolean)cache.removeAsync(key).get()); } } finally { @@ -683,7 +645,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA public void checkInvokeAsyncTx(final TransactionConcurrency conc, final TransactionIsolation isolation) throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { - final IgniteCache cache = jcache().withKeepBinary().withAsync(); + final IgniteCache cache = jcache().withKeepBinary(); Set keys = new LinkedHashSet() {{ for (int i = 0; i < CNT; i++) @@ -692,15 +654,11 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { for (final Object key : keys) { - cache.invoke(key, NOOP_ENTRY_PROC); - - Object res = cache.future().get(); + Object res = cache.invokeAsync(key, NOOP_ENTRY_PROC).get(); assertNull(res); - cache.get(key); - - assertNull(cache.future().get()); + assertNull(cache.getAsync(key).get()); } tx.commit(); @@ -710,37 +668,31 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA Object res; try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invoke(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode); - - res = cache.future().get(); + res = cache.invokeAsync(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get(); tx.commit(); } assertNull(res); - cache.get(key); + assertEquals(value(0), deserializeBinary(cache.getAsync(key).get())); - assertEquals(value(0), deserializeBinary(cache.future().get())); + IgniteFuture f; try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invoke(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode); + f = cache.invokeAsync(key, INC_ENTRY_PROC_BINARY_OBJ, dataMode); tx.commit(); } - res = cache.future().get(); + res = f.get(); assertEquals(value(0), deserializeBinary(res)); - cache.get(key); - - assertEquals(value(1), deserializeBinary(cache.future().get())); + assertEquals(value(1), deserializeBinary(cache.getAsync(key).get())); try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.remove(key); - - assertTrue((Boolean)cache.future().get()); + assertTrue((Boolean)cache.removeAsync(key).get()); tx.commit(); } @@ -754,23 +706,17 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA Object res; try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invoke(key, INC_ENTRY_PROC_USER_OBJ, dataMode); - - res = cache.future().get(); + res = cache.invokeAsync(key, INC_ENTRY_PROC_USER_OBJ, dataMode).get(); tx.commit(); } assertNull(res); - cache.get(key); - - assertEquals(value(0), deserializeBinary(cache.future().get())); + assertEquals(value(0), deserializeBinary(cache.getAsync(key).get())); try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invoke(key, INC_ENTRY_PROC_USER_OBJ, dataMode); - - res = cache.future().get(); + res = cache.invokeAsync(key, INC_ENTRY_PROC_USER_OBJ, dataMode).get(); tx.commit(); } @@ -778,14 +724,10 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA // TODO IGNITE-2953: uncomment the following assert when the issue will be fixed. // assertEquals(value(0), res); - cache.get(key); - - assertEquals(value(1), deserializeBinary(cache.future().get())); + assertEquals(value(1), deserializeBinary(cache.getAsync(key).get())); try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.remove(key); - - assertTrue((Boolean)cache.future().get()); + assertTrue((Boolean)cache.removeAsync(key).get()); tx.commit(); } @@ -988,17 +930,15 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA public void testInvokeAllAsync() throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { - final IgniteCache cache = jcache().withKeepBinary().withAsync(); + final IgniteCache cache = jcache().withKeepBinary(); final Set keys = new LinkedHashSet() {{ for (int i = 0; i < CNT; i++) add(key(i)); }}; - cache.invokeAll(keys, NOOP_ENTRY_PROC); - Map> resMap = - (Map>)cache.future().get(); + (Map>)cache.invokeAllAsync(keys, NOOP_ENTRY_PROC).get(); for (Map.Entry> e : resMap.entrySet()) { assertTrue("Wrong key type, binary object expected: " + e.getKey(), e.getKey() instanceof BinaryObject); @@ -1006,41 +946,33 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA assertNull(e.getValue().get()); } - cache.invokeAll(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get(); checkInvokeAllAsyncResult(cache, resMap, null, value(0), true); - cache.invokeAll(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get(); checkInvokeAllAsyncResult(cache, resMap, value(0), value(1), true); - cache.removeAll(keys); - - cache.future().get(); + cache.removeAllAsync(keys).get(); // TODO IGNITE-2973: should be always false. interceptorBinaryObjExp = atomicityMode() == TRANSACTIONAL; try { - cache.invokeAll(keys, INC_ENTRY_PROC_USER_OBJ, dataMode); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, INC_ENTRY_PROC_USER_OBJ, dataMode).get(); checkInvokeAllAsyncResult(cache, resMap, null, value(0), false); - cache.invokeAll(keys, INC_ENTRY_PROC_USER_OBJ, dataMode); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, INC_ENTRY_PROC_USER_OBJ, dataMode).get(); checkInvokeAllAsyncResult(cache, resMap, value(0), value(1), false); - cache.removeAll(keys); - - cache.future().get(); + cache.removeAllAsync(keys).get(); } finally { interceptorBinaryObjExp = true; @@ -1070,12 +1002,12 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA * * @param conc Concurrency. * @param isolation Isolation. - * @throws Exception + * @throws Exception If failed. */ private void checkInvokeAllAsycnTx(final TransactionConcurrency conc, final TransactionIsolation isolation) throws Exception { runInAllDataModes(new TestRunnable() { @Override public void run() throws Exception { - final IgniteCache cache = jcache().withKeepBinary().withAsync(); + final IgniteCache cache = jcache().withKeepBinary(); final Set keys = new LinkedHashSet() {{ for (int i = 0; i < CNT; i++) @@ -1085,9 +1017,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA Map> resMap; try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invokeAll(keys, NOOP_ENTRY_PROC); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, NOOP_ENTRY_PROC).get(); tx.commit(); } @@ -1099,9 +1030,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA } try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invokeAll(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get(); tx.commit(); } @@ -1109,9 +1039,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA checkInvokeAllAsyncResult(cache, resMap, null, value(0), true); try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invokeAll(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, INC_ENTRY_PROC_BINARY_OBJ, dataMode).get(); tx.commit(); } @@ -1119,9 +1048,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA checkInvokeAllAsyncResult(cache, resMap, value(0), value(1), true); try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.removeAll(keys); - - cache.future().get(); + cache.removeAllAsync(keys).get(); tx.commit(); } @@ -1131,9 +1058,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA try { try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invokeAll(keys, INC_ENTRY_PROC_USER_OBJ, dataMode); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, INC_ENTRY_PROC_USER_OBJ, dataMode).get(); tx.commit(); } @@ -1141,9 +1067,8 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA checkInvokeAllAsyncResult(cache, resMap, null, value(0), false); try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.invokeAll(keys, INC_ENTRY_PROC_USER_OBJ, dataMode); - - resMap = (Map>)cache.future().get(); + resMap = (Map>) + cache.invokeAllAsync(keys, INC_ENTRY_PROC_USER_OBJ, dataMode).get(); tx.commit(); } @@ -1151,9 +1076,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA checkInvokeAllAsyncResult(cache, resMap, value(0), value(1), false); try (Transaction tx = testedGrid().transactions().txStart(conc, isolation)) { - cache.removeAll(keys); - - cache.future().get(); + cache.removeAllAsync(keys).get(); tx.commit(); } @@ -1185,9 +1108,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA if (deserializeRes) assertEquals(expRes, deserializeRes ? deserializeBinary(res) : res); - cache.get(e.getKey()); - - assertEquals(cacheVal, deserializeBinary(cache.future().get())); + assertEquals(cacheVal, deserializeBinary(cache.getAsync(e.getKey()).get())); } } @@ -1203,6 +1124,7 @@ public class WithKeepBinaryCacheFullApiTest extends IgniteCacheConfigVariationsA /** * @param task Task. + * @throws Exception If failed. */ protected void runInAllTxModes(TestRunnable task) throws Exception { info("Executing implicite tx"); http://git-wip-us.apache.org/repos/asf/ignite/blob/282b334f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java index 1e05400..bc9214f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java @@ -102,8 +102,6 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest { IgniteCache cache = ignite(0).cache(null).withKeepBinary(); - IgniteCache asyncCache = cache.withAsync(); - cache.put(new TestKey(1), new TestValue(10)); cache.put(new TestKey(1), new TestValue(10)); @@ -111,16 +109,14 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest { BinaryObject obj = (BinaryObject)cache.get(new TestKey(1)); assertEquals(10, (int)obj.field("val")); - asyncCache.get(new TestKey(1)); - obj = (BinaryObject)asyncCache.future().get(); + obj = (BinaryObject)cache.getAsync(new TestKey(1)).get(); assertEquals(10, (int)obj.field("val")); Cache.Entry e = (Cache.Entry)cache.getEntry(new TestKey(1)); assertEquals(1, (int)e.getKey().field("key")); assertEquals(10, (int)e.getValue().field("val")); - asyncCache.getEntry(new TestKey(1)); - e = (Cache.Entry)asyncCache.future().get(); + e = (Cache.Entry)cache.getEntryAsync(new TestKey(1)).get(); assertEquals(1, (int)e.getKey().field("key")); assertEquals(10, (int)e.getValue().field("val")); @@ -157,8 +153,6 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest { IgniteCache cache = ignite(0).cache(null).withKeepBinary(); - IgniteCache asyncCache = cache.withAsync(); - cache.put(1, 10); cache.put(1, 10); @@ -166,16 +160,14 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest { Integer obj = (Integer)cache.get(1); assertEquals((Integer)10, obj); - asyncCache.get(1); - obj = (Integer)asyncCache.future().get(); + obj = (Integer)cache.getAsync(1).get(); assertEquals((Integer)10, obj); Cache.Entry e = (Cache.Entry)cache.getEntry(1); assertEquals((Integer)1, e.getKey()); assertEquals((Integer)10, e.getValue()); - asyncCache.getEntry(1); - e = (Cache.Entry)asyncCache.future().get(); + e = (Cache.Entry)cache.getEntryAsync(1).get(); assertEquals((Integer)1, e.getKey()); assertEquals((Integer)10, e.getValue());