# IGNITE-56 Use IgniteCache in ignite-core module (2).
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d6ed7189 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d6ed7189 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d6ed7189 Branch: refs/heads/sprint-1 Commit: d6ed7189b5e209bd91bcb4d9f85a4e8ad405b267 Parents: 7d4002a Author: sevdokimov <[email protected]> Authored: Sun Feb 1 19:47:29 2015 +0300 Committer: sevdokimov <[email protected]> Committed: Sun Feb 1 19:47:29 2015 +0300 ---------------------------------------------------------------------- .../dht/GridCacheAtomicFullApiSelfTest.java | 2 +- .../dht/GridCacheColocatedDebugTest.java | 28 +-- ...tomicClientOnlyMultiNodeFullApiSelfTest.java | 190 +++++++++---------- .../local/GridCacheLocalFullApiSelfTest.java | 64 +------ .../local/GridCacheLocalIteratorsSelfTest.java | 51 +---- .../cache/GridCacheCommandHandlerSelfTest.java | 4 +- .../GridCacheWriteBehindStoreLoadTest.java | 22 +-- 7 files changed, 127 insertions(+), 234 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ed7189/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java index 6ec88b9..52e75f1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicFullApiSelfTest.java @@ -78,7 +78,7 @@ public class GridCacheAtomicFullApiSelfTest extends GridCachePartitionedFullApiS GridTestUtils.assertThrows(log, new Callable<Void>() { @Override public Void call() throws Exception { - cache().getAll(null).isEmpty(); + jcache().getAll(null).isEmpty(); return null; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ed7189/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java index 32c2f7a..1b1a7dd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java @@ -458,19 +458,21 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { startGrid(); try { - IgniteTx tx = explicitTx ? cache().txStart(concurrency, isolation) : null; + IgniteTx tx = explicitTx ? grid().transactions().txStart(concurrency, isolation) : null; try { - cache().putAll(F.asMap(1, "Hello", 2, "World")); + IgniteCache<Object, Object> cache = jcache(); + + cache.putAll(F.asMap(1, "Hello", 2, "World")); if (tx != null) tx.commit(); - System.out.println(cache().metrics()); + System.out.println(cache.metrics()); - assertEquals("Hello", cache().get(1)); - assertEquals("World", cache().get(2)); - assertNull(cache().get(3)); + assertEquals("Hello", cache.get(1)); + assertEquals("World", cache.get(2)); + assertNull(cache.get(3)); } finally { if (tx != null) @@ -491,26 +493,28 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest { startGrid(); try { - IgniteTx tx = cache().txStart(concurrency, isolation); + IgniteTx tx = grid().transactions().txStart(concurrency, isolation); try { - String old = (String)cache().get(1); + IgniteCache<Object, Object> cache = jcache(); + + String old = (String)cache.get(1); assert old == null; - String replaced = (String)cache().put(1, "newVal"); + String replaced = (String)cache.getAndPut(1, "newVal"); assert replaced == null; - replaced = (String)cache().put(1, "newVal2"); + replaced = (String)cache.getAndPut(1, "newVal2"); assertEquals("newVal", replaced); if (tx != null) tx.commit(); - assertEquals("newVal2", cache().get(1)); - assertNull(cache().get(3)); + assertEquals("newVal2", cache.get(1)); + assertNull(cache.get(3)); } finally { if (tx != null) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ed7189/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java index a4a21dc..bd6600d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.cache.distributed.near; +import com.google.common.collect.*; import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.events.*; @@ -169,7 +170,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache /** {@inheritDoc} */ @Override public void testEvictExpired() throws Exception { - GridCache<String, Integer> cache = cache(); + IgniteCache<String, Integer> cache = jcache(); String key = primaryKeysForCache(cache, 1).get(0); @@ -185,15 +186,15 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache Thread.sleep(ttl + 100); // Expired entry should not be swapped. - assertTrue(cache.evict(key)); + cache.localEvict(Collections.<String>singleton(key)); - assertNull(cache.peek(key)); + assertNull(cache.localPeek(key)); - assertNull(cache.promote(key)); + cache.localPromote(Collections.singleton(key)); - assertNull(cache.peek(key)); + assertNull(cache.localPeek(key)); - assertTrue(cache.isEmpty()); + assertTrue(cache.localSize() == 0); // Force reload on primary node. for (int i = 0; i < gridCount(); i++) { @@ -202,81 +203,63 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache } // Will do near get request. - cache.reload(key); + cache.loadAll(Collections.singleton(key), true, null); - assertEquals(null, cache.peek(key)); + assertEquals(null, cache.localPeek(key)); } /** {@inheritDoc} */ @Override public void testEvictAll() throws Exception { - List<String> keys = primaryKeysForCache(cache(), 3); + IgniteCache<String, Integer> cache = jcache(); + + List<String> keys = primaryKeysForCache(cache, 3); String key1 = keys.get(0); String key2 = keys.get(1); String key3 = keys.get(2); - cache().put(key1, 1); - cache().put(key2, 2); - cache().put(key3, 3); - - assert cache().peek(key1) == null; - assert cache().peek(key2) == null; - assert cache().peek(key3) == null; - - cache().evictAll(F.asList(key1, key2)); - - assert cache().peek(key1) == null; - assert cache().peek(key2) == null; - assert cache().peek(key3) == null; + cache.put(key1, 1); + cache.put(key2, 2); + cache.put(key3, 3); - cache().reloadAll(F.asList(key1, key2)); + assert cache.localPeek(key1) == null; + assert cache.localPeek(key2) == null; + assert cache.localPeek(key3) == null; - assert cache().peek(key1) == null; - assert cache().peek(key2) == null; - assert cache().peek(key3) == null; + cache.localEvict(F.asList(key1, key2)); - cache().evictAll(F.asList(key1, key2)); + assert cache.localPeek(key1) == null; + assert cache.localPeek(key2) == null; + assert cache.localPeek(key3) == null; - assert cache().peek(key1) == null; - assert cache().peek(key2) == null; - assert cache().peek(key3) == null; + cache.loadAll(ImmutableSet.of(key1, key2), true, null); - cache().reloadAll(F.asList(key1, key2)); + assert cache.localPeek(key1) == null; + assert cache.localPeek(key2) == null; + assert cache.localPeek(key3) == null; - assert cache().peek(key1) == null; - assert cache().peek(key2) == null; - assert cache().peek(key3) == null; + cache.localEvict(F.asList(key1, key2)); - cache().evictAll(); + assert cache.localPeek(key1) == null; + assert cache.localPeek(key2) == null; + assert cache.localPeek(key3) == null; - assert cache().peek(key1) == null; - assert cache().peek(key2) == null; - assert cache().peek(key3) == null; + cache.loadAll(ImmutableSet.of(key1, key2), true, null); - cache().put(key1, 1); - cache().put(key2, 102); - cache().put(key3, 3); + assert cache.localPeek(key1) == null; + assert cache.localPeek(key2) == null; + assert cache.localPeek(key3) == null; - cache().projection(gte100).evictAll(); + cache.localEvict(new HashSet<>(keys)); - assert cache().peek(key1) == null; - assert cache().peek(key2) == null; - assert cache().peek(key3) == null; - - cache().put(key1, 1); - cache().put(key2, 102); - cache().put(key3, 3); - - cache().projection(gte100).evictAll(F.asList(key1, key2, key3)); - - assert cache().peek(key1) == null; - assert cache().peek(key2) == null; - assert cache().peek(key3) == null; + assert cache.localPeek(key1) == null; + assert cache.localPeek(key2) == null; + assert cache.localPeek(key3) == null; } /** {@inheritDoc} */ @Override public void testPeekExpired() throws Exception { - GridCache<String, Integer> c = cache(); + IgniteCache<String, Integer> c = jcache(); String key = primaryKeysForCache(c, 1).get(0); @@ -284,7 +267,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache c.put(key, 1); - assertEquals(null, c.peek(key)); + assertEquals(null, c.localPeek(key)); long ttl = 500; @@ -293,16 +276,16 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache Thread.sleep(ttl + 100); - assert c.peek(key) == null; + assert c.localPeek(key) == null; - assert c.isEmpty() : "Cache is not empty: " + c.values(); + assert c.localSize() == 0 : "Cache is not empty."; } /** {@inheritDoc} */ @Override public void testEvict() throws Exception { - GridCache<String, Integer> cache = cache(); + IgniteCache<String, Integer> cache = jcache(); - List<String> keys = primaryKeysForCache(cache, 2); + List<String> keys = primaryKeysForCache(cache(), 2); String key = keys.get(0); String key2 = keys.get(1); @@ -311,43 +294,45 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache assertEquals((Integer)1, cache.get(key)); - assertTrue(cache.evict(key)); + cache.localEvict(Collections.<String>singleton(key)); - assertNull(cache.peek(key)); + assertNull(cache.localPeek(key)); - cache.reload(key); + cache.loadAll(Collections.singleton(key), true, null); - assertEquals(null, cache.peek(key)); + assertEquals(null, cache.localPeek(key)); cache.remove(key); cache.put(key, 1); cache.put(key2, 102); - assertTrue(cache.projection(gte100).evict(key)); + cache.localEvict(Collections.<String>singleton(key)); assertEquals((Integer)1, cache.get(key)); - assertTrue(cache.projection(gte100).evict(key2)); + cache.localEvict(Collections.<String>singleton(key2)); - assertNull(cache.peek(key2)); + assertNull(cache.localPeek(key2)); - assertTrue(cache.evict(key)); + cache.localEvict(Collections.<String>singleton(key)); - assertNull(cache.peek(key)); + assertNull(cache.localPeek(key)); } /** {@inheritDoc} */ @Override public void testUnswap() throws Exception { - List<String> keys = primaryKeysForCache(cache(), 3); + IgniteCache<String, Integer> cache = jcache(); + + List<String> keys = primaryKeysForCache(cache, 3); String k1 = keys.get(0); String k2 = keys.get(1); String k3 = keys.get(2); - cache().put(k1, 1); - cache().put(k2, 2); - cache().put(k3, 3); + cache.put(k1, 1); + cache.put(k2, 2); + cache.put(k3, 3); final AtomicInteger swapEvts = new AtomicInteger(0); final AtomicInteger unswapEvts = new AtomicInteger(0); @@ -375,37 +360,48 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache }, EVT_CACHE_OBJECT_SWAPPED, EVT_CACHE_OBJECT_UNSWAPPED); } - assert cache().evict(k2); - assert cache().evict(k3); + cache.localEvict(Collections.<String>singleton(k2)); + cache.localEvict(Collections.<String>singleton(k3)); - assert !cache().containsKey(k1); - assert !cache().containsKey(k2); - assert !cache().containsKey(k3); + assert !cache.containsKey(k1); + assert !cache.containsKey(k2); + assert !cache.containsKey(k3); int cnt = 0; if (locKeys.contains(k2)) { - assertEquals((Integer)2, cache().promote(k2)); + cache.localPromote(Collections.singleton(k2)); + + assertEquals((Integer)2, cache.localPeek(k2)); cnt++; } - else - assertNull(cache().promote(k2)); + else { + cache.localPromote(Collections.singleton(k2)); + + assertNull(cache.localPeek(k2)); + } + if (locKeys.contains(k3)) { - assertEquals((Integer)3, cache().promote(k3)); + cache.localPromote(Collections.singleton(k3)); + + assertEquals((Integer)3, cache.localPeek(k3)); cnt++; } - else - assertNull(cache().promote(k3)); + else { + cache.localPromote(Collections.singleton(k3)); + + assertNull(cache.localPeek(k3)); + } assertEquals(cnt, swapEvts.get()); assertEquals(cnt, unswapEvts.get()); - assert cache().evict(k1); + cache.localEvict(Collections.<String>singleton(k1)); - assertEquals((Integer)1, cache().get(k1)); + assertEquals((Integer)1, cache.get(k1)); if (locKeys.contains(k1)) cnt++; @@ -413,24 +409,24 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache assertEquals(cnt, swapEvts.get()); assertEquals(cnt, unswapEvts.get()); - cache().clearAll(); + cache.clear(); // Check with multiple arguments. - cache().put(k1, 1); - cache().put(k2, 2); - cache().put(k3, 3); + cache.put(k1, 1); + cache.put(k2, 2); + cache.put(k3, 3); swapEvts.set(0); unswapEvts.set(0); - cache().evict(k2); - cache().evict(k3); + cache.localEvict(Collections.<String>singleton(k2)); + cache.localEvict(Collections.<String>singleton(k3)); - assert !cache().containsKey(k1); - assert !cache().containsKey(k2); - assert !cache().containsKey(k3); + assert !cache.containsKey(k1); + assert !cache.containsKey(k2); + assert !cache.containsKey(k3); - cache().promoteAll(F.asList(k2, k3)); + cache.localPromote(ImmutableSet.of(k2, k3)); cnt = 0; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ed7189/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java index 48497b9..c497fca 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java @@ -17,15 +17,14 @@ package org.apache.ignite.internal.processors.cache.local; +import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.lang.*; import org.apache.ignite.internal.util.typedef.*; import java.util.*; -import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheMode.*; @@ -60,10 +59,12 @@ public class GridCacheLocalFullApiSelfTest extends GridCacheAbstractFullApiSelfT * @throws Exception In case of error. */ public void testMapKeysToNodes() throws Exception { - cache().put("key1", 1); - cache().put("key2", 2); + IgniteCache<String, Integer> cache = jcache(); - Map<ClusterNode, Collection<String>> map = cache().affinity().mapKeysToNodes(F.asList("key1", "key2")); + cache.put("key1", 1); + cache.put("key2", 2); + + Map<ClusterNode, Collection<String>> map = grid(0).<String>affinity(null).mapKeysToNodes(F.asList("key1", "key2")); assert map.size() == 1; @@ -75,7 +76,7 @@ public class GridCacheLocalFullApiSelfTest extends GridCacheAbstractFullApiSelfT for (String key : keys) assert "key1".equals(key) || "key2".equals(key); - map = cache().affinity().mapKeysToNodes(F.asList("key1", "key2")); + map = grid(0).<String>affinity(null).mapKeysToNodes(F.asList("key1", "key2")); assert map.size() == 1; @@ -87,55 +88,4 @@ public class GridCacheLocalFullApiSelfTest extends GridCacheAbstractFullApiSelfT for (String key : keys) assert "key1".equals(key) || "key2".equals(key); } - - /** - * Based on issue GG-2864 - * - * @throws Exception In case of error. - */ - public void testFilteredKeySet() throws Exception { - if (!txEnabled() || portableEnabled()) - return; - - final GridCache<String, Integer> myCache = cache(); - - final AtomicLong cntr = new AtomicLong(); - - // Some counter. - myCache.dataStructures().atomicLong("some_counter", 0L, true).incrementAndGet(); - - // I would like to filter from key set all entities which key name is not started with "a_". - IgnitePredicate<CacheEntry<String, Integer>> aPred = new IgnitePredicate<CacheEntry<String, Integer>>() { - @Override public boolean apply(CacheEntry<String, Integer> entry) { - cntr.incrementAndGet(); - - assert entry.getKey() instanceof String; - - return entry.getKey().startsWith("a_"); - } - }; - - Set<String> aKeySet = myCache.projection(aPred).keySet(); - - aKeySet.size(); // Initiate lazy iteration. - - assertEquals(0, cntr.get()); - - // Key set is empty as expected - no entities in cache except atomic counter !!! - assertTrue(aKeySet.isEmpty()); - - // Add some entities to cache. - myCache.putx("a_1", 1); - myCache.putx("a_2", 2); - myCache.putx("b_1", 3); - - // Repeat key set filtering. - aKeySet = myCache.projection(aPred).keySet(); - - // This will cause iteration and counter will get incremented. - assertEquals(2, aKeySet.size()); - - assertEquals(3, cntr.get()); - assertTrue(aKeySet.containsAll(F.asList("a_1", "a_2"))); - } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ed7189/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIteratorsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIteratorsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIteratorsSelfTest.java index 4b44708..e845884 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIteratorsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalIteratorsSelfTest.java @@ -48,56 +48,7 @@ public class GridCacheLocalIteratorsSelfTest extends GridCacheAbstractIteratorsS * @throws Exception If failed. */ public void testCacheIteratorSerialization() throws Exception { - testIteratorSerialization(cache().iterator(), entryCount()); - } - - /** - * @throws Exception If failed. - */ - public void testCacheProjectionIteratorSerialization() throws Exception { - testIteratorSerialization(cache().projection(lt50).iterator(), 50); - } - - /** - * @throws Exception If failed. - */ - public void testEntrySetIteratorSerialization() throws Exception { - testIteratorSerialization(cache().entrySet().iterator(), entryCount()); - } - - /** - * @throws Exception If failed. - */ - public void testFilteredEntrySetIteratorSerialization() throws Exception { - testIteratorSerialization(cache().projection(lt50).entrySet().iterator(), 50); - } - - /** - * @throws Exception If failed. - */ - public void testKeySetIteratorSerialization() throws Exception { - testIteratorSerialization(cache().keySet().iterator(), entryCount()); - } - - /** - * @throws Exception If failed. - */ - public void testFilteredKeySetIteratorSerialization() throws Exception { - testIteratorSerialization(cache().projection(lt50).keySet().iterator(), 50); - } - - /** - * @throws Exception If failed. - */ - public void testValuesIteratorSerialization() throws Exception { - testIteratorSerialization(cache().values().iterator(), entryCount()); - } - - /** - * @throws Exception If failed. - */ - public void testFilteredValuesIteratorSerialization() throws Exception { - testIteratorSerialization(cache().projection(lt50).values().iterator(), 50); + testIteratorSerialization(jcache().iterator(), entryCount()); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ed7189/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java index 7a1765b..974888d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java @@ -192,13 +192,13 @@ public class GridCacheCommandHandlerSelfTest extends GridCommonAbstractTest { try { // Change cache state. - cache().putx(key, curVal); + jcache().put(key, curVal); // Validate behavior for initialized cache (has current value). assertTrue("Expects succeed.", (Boolean)hnd.handleAsync(req).get().getResponse()); } finally { - res = (T)cache().remove(key); + res = (T)jcache().getAndRemove(key); } return res; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6ed7189/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java index e8b5a30..c339e55 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheWriteBehindStoreLoadTest.java @@ -19,7 +19,6 @@ package org.apache.ignite.loadtests.cache; import org.apache.ignite.*; import org.apache.ignite.cache.*; -import org.apache.ignite.cache.GridCache; import org.apache.ignite.cache.store.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; @@ -80,10 +79,10 @@ public class GridCacheWriteBehindStoreLoadTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { - GridCache<?, ?> cache = cache(); + IgniteCache<Object, Object> cache = jcache(); if (cache != null) - cache.clearAll(); + cache.clear(); } /** @@ -151,7 +150,7 @@ public class GridCacheWriteBehindStoreLoadTest extends GridCommonAbstractTest { private void loadCache() throws Exception { final AtomicBoolean running = new AtomicBoolean(true); - final GridCache<Long, String> cache = cache(); + final IgniteCache<Object, Object> cache = jcache(); final AtomicLong keyCntr = new AtomicLong(); @@ -163,19 +162,12 @@ public class GridCacheWriteBehindStoreLoadTest extends GridCommonAbstractTest { Random rnd = new Random(); - try { - while (running.get()) { - long putNum = keyCntr.incrementAndGet(); + while (running.get()) { + long putNum = keyCntr.incrementAndGet(); - long key = rndKeys ? rnd.nextInt(keysCnt) : putNum; + long key = rndKeys ? rnd.nextInt(keysCnt) : putNum; - cache.put(key, "val" + key); - } - } - catch (IgniteCheckedException e) { - error("Unexpected exception in put thread", e); - - assert false; + cache.put(key, "val" + key); } } }, threadCnt, "put");
