http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java index 392298d..996ac73 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java @@ -30,6 +30,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.junits.common.*; import org.jdk8.backport.*; +import javax.cache.Cache.*; import javax.cache.configuration.*; import java.util.*; @@ -184,43 +185,44 @@ public abstract class GridCachePartitionedReloadAllAbstractSelfTest extends Grid * @throws Exception If test failed. */ public void testReloadAll() throws Exception { - // Fill caches with values. - for (GridCache<Integer, String> cache : caches) { - Iterable<Integer> keys = primaryKeysForCache(cache, 100); - - info("Values [cache=" + caches.indexOf(cache) + ", size=" + F.size(keys.iterator()) + ", keys=" + keys + "]"); - - for (Integer key : keys) - map.put(key, "val" + key); - } - - Collection<GridCache<Integer, String>> emptyCaches = new ArrayList<>(caches); - - for (GridCache<Integer, String> cache : caches) { - info("Reloading cache: " + caches.indexOf(cache)); - - // Check data is reloaded only on the nodes on which reloadAll() has been called. - if (!nearEnabled()) { - for (GridCache<Integer, String> eCache : emptyCaches) - assertEquals("Non-null values found in cache [cache=" + caches.indexOf(eCache) + - ", size=" + eCache.size() + ", size=" + eCache.size() + - ", entrySetSize=" + eCache.entrySet().size() + "]", - 0, eCache.size()); - } - - cache.reloadAll(map.keySet()); - - for (Integer key : map.keySet()) { - Entry entry = cache.entry(key); - - if (entry.primary() || entry.backup() || nearEnabled()) - assertEquals(map.get(key), cache.peek(key)); - else - assertNull(cache.peek(key)); - } - - emptyCaches.remove(cache); - } + assert false; +// // Fill caches with values. +// for (GridCache<Integer, String> cache : caches) { +// Iterable<Integer> keys = primaryKeysForCache(cache, 100); +// +// info("Values [cache=" + caches.indexOf(cache) + ", size=" + F.size(keys.iterator()) + ", keys=" + keys + "]"); +// +// for (Integer key : keys) +// map.put(key, "val" + key); +// } +// +// Collection<GridCache<Integer, String>> emptyCaches = new ArrayList<>(caches); +// +// for (GridCache<Integer, String> cache : caches) { +// info("Reloading cache: " + caches.indexOf(cache)); +// +// // Check data is reloaded only on the nodes on which reloadAll() has been called. +// if (!nearEnabled()) { +// for (GridCache<Integer, String> eCache : emptyCaches) +// assertEquals("Non-null values found in cache [cache=" + caches.indexOf(eCache) + +// ", size=" + eCache.size() + ", size=" + eCache.size() + +// ", entrySetSize=" + eCache.entrySet().size() + "]", +// 0, eCache.size()); +// } +// +// cache.reloadAll(map.keySet()); +// +// for (Integer key : map.keySet()) { +// Entry entry = cache.entry(key); +// +// if (entry.primary() || entry.backup() || nearEnabled()) +// assertEquals(map.get(key), cache.peek(key)); +// else +// assertNull(cache.peek(key)); +// } +// +// emptyCaches.remove(cache); +// } } /** @@ -233,14 +235,15 @@ public abstract class GridCachePartitionedReloadAllAbstractSelfTest extends Grid private Iterable<Integer> primaryKeysForCache(CacheProjection<Integer,String> cache, int cnt) { Collection<Integer> found = new ArrayList<>(cnt); - for (int i = 0; i < 10000; i++) { - if (cache.entry(i).primary()) { - found.add(i); - - if (found.size() == cnt) - return found; - } - } + assert false; +// for (int i = 0; i < 10000; i++) { +// if (cache.entry(i).primary()) { +// found.add(i); +// +// if (found.size() == cnt) +// return found; +// } +// } throw new IllegalStateException("Unable to find " + cnt + " keys as primary for cache."); }
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java index 409c9e8..6a3a9e6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java @@ -29,6 +29,7 @@ import org.apache.ignite.testframework.*; import org.apache.ignite.testframework.junits.common.*; import org.jetbrains.annotations.*; +import javax.cache.Cache.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java index 22864df..6ca0342 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheGroupLockPartitionedAbstractSelfTest.java @@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.testframework.*; import org.apache.ignite.transactions.*; +import javax.cache.Cache.*; import java.util.*; import java.util.concurrent.*; @@ -88,10 +89,10 @@ public abstract class GridCacheGroupLockPartitionedAbstractSelfTest extends Grid cache.entrySet(cache(0).affinity().partition(affinityKey)); for (Entry<CacheAffinityKey<Integer>, Integer> entry : set) { - Integer old = entry.get(); + Integer old = entry.getValue(); if (old != null) - entry.set(old + 1); + cache.putx(entry.getKey(), old + 1); else { Object key = entry.getKey(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java index e9c2924..b8de222 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java @@ -25,6 +25,7 @@ import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.util.typedef.*; +import javax.cache.Cache.*; import java.util.*; import static org.apache.ignite.cache.CacheMode.*; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java index d03d995..f98808a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java @@ -21,6 +21,7 @@ import org.apache.ignite.*; import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cache.store.*; +import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; @@ -30,6 +31,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.junits.common.*; import org.jetbrains.annotations.*; +import javax.cache.Cache.*; import javax.cache.configuration.*; import static org.apache.ignite.cache.CacheMode.*; @@ -123,8 +125,11 @@ public class GridCachePartitionedLoadCacheSelfTest extends GridCommonAbstractTes int cnt2 = 0; - for (CacheEntry<Object, Object> e : cache(0).entrySet()) { - assert e.primary() || e.backup(); + ClusterNode locNode = grid(0).localNode(); + + for (Entry<Integer, String> e : this.<Integer, String>cache(0).entrySet()) { + assert aff.isPrimary(locNode, e.getKey()) || + aff.isBackup(locNode, e.getKey()); cnt2++; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java index 0fc9364..1446bdc 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java @@ -20,20 +20,18 @@ package org.apache.ignite.internal.processors.cache.distributed.near; import org.apache.ignite.cache.*; import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cluster.*; -import org.apache.ignite.compute.*; import org.apache.ignite.events.*; -import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.lang.*; +import javax.cache.Cache.*; import java.util.*; import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; -import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; import static org.apache.ignite.events.IgniteEventType.*; +import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; /** * Multi-node tests for partitioned cache. @@ -200,9 +198,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti jcache().put("key", 1); for (int i = 0; i < gridCount(); i++) { - CacheEntry<String, Integer> e = cache(i).entry("key"); - - if (e.backup()) { + if (cache(i).affinity().isBackup(grid(i).localNode(), "key")) { assert cache(i).evict("key") : "Entry was not evicted [idx=" + i + ", entry=" + (nearEnabled() ? dht(i).entryEx("key") : colocated(i).entryEx("key")) + ']'; @@ -232,22 +228,15 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti GridCache<String, Integer> c = cache(i); - CacheEntry<String, Integer> e = c.entry("key"); - - if (e.backup()) { - assertNull("NEAR_ONLY for cache: " + i, e.peek(F.asList(NEAR_ONLY))); - assertEquals((Integer)1, e.peek(F.asList(PARTITIONED_ONLY))); + Entry<String, Integer> e = c.entry("key"); + if (c.affinity().isBackup(grid(i).localNode(), "key")) { assertNull(c.peek("key", F.asList(NEAR_ONLY))); assertEquals((Integer)1, c.peek("key", F.asList(PARTITIONED_ONLY))); } - else if (!e.primary() && !e.backup()) { - assertEquals((Integer)1, e.get()); - - assertEquals(nearPeekVal, e.peek(Arrays.asList(NEAR_ONLY))); - - assert e.peek(Arrays.asList(PARTITIONED_ONLY)) == null; + else if (!c.affinity().isPrimaryOrBackup(grid(i).localNode(), "key")) { + assertEquals((Integer)1, e.getValue()); assertEquals(nearPeekVal, c.peek("key", Arrays.asList(NEAR_ONLY))); @@ -269,24 +258,12 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti GridCache<String, Integer> c = cache(i); - CacheEntry<String, Integer> e = c.entry("key"); - - if (e.backup()) { - assert e.peek(F.asList(NEAR_ONLY)) == null; - - assert e.peek(Arrays.asList(PARTITIONED_ONLY)) == 1; - + if (c.affinity().isBackup(grid(i).localNode(), "key")) { assert c.peek("key", Arrays.asList(NEAR_ONLY)) == null; assert c.peek("key", Arrays.asList(PARTITIONED_ONLY)) == 1; } - else if (!e.primary() && !e.backup()) { - assert e.get() == 1; - - assertEquals(nearPeekVal, e.peek(Arrays.asList(NEAR_ONLY))); - - assert e.peek(Arrays.asList(PARTITIONED_ONLY)) == null; - + else if (!c.affinity().isPrimaryOrBackup(grid(i).localNode(), "key")) { assertEquals(nearPeekVal, c.peek("key", Arrays.asList(NEAR_ONLY))); assert c.peek("key", Arrays.asList(PARTITIONED_ONLY)) == null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java index 478a168..7a10b21 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java @@ -31,6 +31,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.junits.common.*; import org.apache.ignite.transactions.*; +import javax.cache.Cache.*; import java.util.*; import java.util.concurrent.*; @@ -208,7 +209,7 @@ public class GridCacheConcurrentEvictionConsistencySelfTest extends GridCommonAb fut.get(); - Collection<Entry<Integer, Integer>> queue = internalQueue(plc); + Collection<EvictableEntry<Integer, Integer>> queue = internalQueue(plc); info("Test results [threadCnt=" + threadCnt + ", iterCnt=" + ITERATION_CNT + ", cacheSize=" + cache.size() + ", internalQueueSize" + queue.size() + ", duration=" + (System.currentTimeMillis() - start) + ']'); @@ -248,7 +249,7 @@ public class GridCacheConcurrentEvictionConsistencySelfTest extends GridCommonAb * @param plc Policy to get queue from. * @return Internal entries collection. */ - private Collection<Entry<Integer, Integer>> internalQueue(CacheEvictionPolicy<?, ?> plc) { + private Collection<EvictableEntry<Integer, Integer>> internalQueue(CacheEvictionPolicy<?, ?> plc) { if (plc instanceof CacheFifoEvictionPolicy) { CacheFifoEvictionPolicy<Integer, Integer> plc0 = (CacheFifoEvictionPolicy<Integer, Integer>)plc; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java index 06be201..6198561 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionAbstractTest.java @@ -28,6 +28,7 @@ import org.apache.ignite.testframework.junits.common.*; import org.apache.ignite.transactions.*; import org.jetbrains.annotations.*; +import javax.cache.Cache.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -128,8 +129,8 @@ public abstract class GridCacheEvictionAbstractTest<T extends CacheEvictionPolic protected MockEntry entry(MockEntry[] arr, int idx) { MockEntry e = arr[idx]; - if (e.isEvicted()) - e = arr[idx] = new MockEntry(e.getKey()); +// if (e.isEvicted()) // TODO ignite-96 +// e = arr[idx] = new MockEntry(e.getKey()); return e; } @@ -444,19 +445,5 @@ public abstract class GridCacheEvictionAbstractTest<T extends CacheEvictionPolic @Override public String getValue() throws IllegalStateException { return val; } - - /** {@inheritDoc} */ - @Override public String setValue(String val) { - String old = this.val; - - this.val = val; - - return old; - } - - /** {@inheritDoc} */ - @Override public CacheProjection<String, String> projection() { - return parent; - } } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java index c9a7a82..ef2a2dd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java @@ -27,6 +27,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.junits.common.*; +import javax.cache.Cache.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -54,8 +55,8 @@ public class GridCacheEvictionFilterSelfTest extends GridCommonAbstractTest { /** Policy. */ private CacheEvictionPolicy<Object, Object> plc = new CacheEvictionPolicy<Object, Object>() { - @Override public void onEntryAccessed(boolean rmv, Entry entry) { - assert !(entry.peek() instanceof Integer); + @Override public void onEntryAccessed(boolean rmv, EvictableEntry entry) { + assert !(entry.getValue() instanceof Integer); } }; @@ -229,14 +230,12 @@ public class GridCacheEvictionFilterSelfTest extends GridCommonAbstractTest { i.incrementAndGet(); - String grid = entry.projection().gridProjection().ignite().name(); - - boolean ret = !(entry.peek() instanceof Integer); + boolean ret = !(entry.getValue() instanceof Integer); if (!ret) - info(">>> Not evicting key [grid=" + grid + ", key=" + entry.getKey() + ", cnt=" + i.get() + ']'); + info(">>> Not evicting key [key=" + entry.getKey() + ", cnt=" + i.get() + ']'); else - info(">>> Evicting key [grid=" + grid + ", key=" + entry.getKey() + ", cnt=" + i.get() + ']'); + info(">>> Evicting key [key=" + entry.getKey() + ", cnt=" + i.get() + ']'); return ret; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java index 8803934..274a418 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java @@ -169,7 +169,7 @@ public class GridCacheEvictionLockUnlockSelfTest extends GridCommonAbstractTest /** Eviction policy. */ private static class EvictionPolicy implements CacheEvictionPolicy<Object, Object> { /** {@inheritDoc} */ - @Override public void onEntryAccessed(boolean rmv, Entry<Object, Object> entry) { + @Override public void onEntryAccessed(boolean rmv, EvictableEntry<Object, Object> entry) { touchCnt.incrementAndGet(); entry.evict(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java index c410734..82776d7 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheMockEntry.java @@ -17,18 +17,11 @@ package org.apache.ignite.internal.processors.cache.eviction; -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.cache.*; -import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.internal.util.tostring.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; -import java.util.*; +import javax.cache.Cache.*; /** * Mock cache entry. @@ -38,14 +31,6 @@ public class GridCacheMockEntry<K, V> extends GridMetadataAwareAdapter implement @GridToStringInclude private K key; - /** */ - @GridToStringInclude - private boolean evicted; - - /** */ - @GridToStringInclude - private boolean canEvict = true; - /** * Constructor. * @@ -55,17 +40,6 @@ public class GridCacheMockEntry<K, V> extends GridMetadataAwareAdapter implement this.key = key; } - /** - * Constructor. - * - * @param key Key. - * @param canEvict Evict or not. - */ - public GridCacheMockEntry(K key, boolean canEvict) { - this.key = key; - this.canEvict = canEvict; - } - /** {@inheritDoc} */ @Override public K getKey() throws IllegalStateException { return key; @@ -77,282 +51,6 @@ public class GridCacheMockEntry<K, V> extends GridMetadataAwareAdapter implement } /** {@inheritDoc} */ - @Override public V setValue(V val) { - return null; - } - - /** {@inheritDoc} */ - @Override public boolean evict() { - evicted = true; - - onEvicted(); - - return canEvict; - } - - /** - * Eviction callback. - */ - public void onEvicted() { - for (String key : allMeta().keySet()) - removeMeta(key); - } - - /** - * - * @return Evicted or not. - */ - public boolean isEvicted() { - return evicted; - } - - /** {@inheritDoc} */ - @Override public V peek() { - return null; - } - - /** {@inheritDoc} */ - @Override public V peek(@Nullable Collection<GridCachePeekMode> modes) { - return null; - } - - /** {@inheritDoc} */ - @Override public boolean isLocked() { - return false; - } - - /** {@inheritDoc} */ - @Override public boolean isLockedByThread() { - return false; - } - - /** {@inheritDoc} */ - @Nullable @Override public Object version() { - return null; - } - - /** {@inheritDoc} */ - @Override public long expirationTime() { - return 0; - } - - /** {@inheritDoc} */ - @Override public long timeToLive() { - return 0; - } - - /** {@inheritDoc} */ - @Override public boolean primary() { - // No-op. - return false; - } - - /** {@inheritDoc} */ - @Override public boolean backup() { - // No-op. - return false; - } - - /** {@inheritDoc} */ - @Override public int partition() { - return 0; - } - - /** {@inheritDoc} */ - @Nullable @Override public V set(V val, - @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<V> setAsync(V val, - @Nullable IgnitePredicate<Entry<K, V>>... filter) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public V setIfAbsent(V val) throws IgniteCheckedException { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<V> setIfAbsentAsync(V val) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Override public boolean setx(V val, - @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException { - // No-op. - return false; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<Boolean> setxAsync(V val, - @Nullable IgnitePredicate<Entry<K, V>>... filter) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Override public boolean setxIfAbsent(@Nullable V val) throws IgniteCheckedException { - // No-op. - return false; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<Boolean> setxIfAbsentAsync(V val) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public V replace(V val) throws IgniteCheckedException { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<V> replaceAsync(V val) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Override public boolean replacex(V val) throws IgniteCheckedException { - // No-op. - return false; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<Boolean> replacexAsync(V val) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Override public boolean replace(V oldVal, V newVal) throws IgniteCheckedException { - // No-op. - return false; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<Boolean> replaceAsync(V oldVal, V newVal) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public V remove( - @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<V> removeAsync( - @Nullable IgnitePredicate<Entry<K, V>>... filter) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Override public boolean removex(@Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException { - // No-op. - return false; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<Boolean> removexAsync( - @Nullable IgnitePredicate<Entry<K, V>>... filter) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Override public boolean remove(V val) throws IgniteCheckedException { - // No-op. - return false; - } - - /** {@inheritDoc} */ - @Nullable @Override public IgniteInternalFuture<Boolean> removeAsync(V val) { - // No-op. - return null; - } - - /** {@inheritDoc} */ - @Override public void timeToLive(long ttl) { - // No-op. - } - - /** {@inheritDoc} */ - @Override public boolean lock(long timeout, - @Nullable IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException { - return false; - } - - /** {@inheritDoc} */ - @Override public IgniteInternalFuture<Boolean> lockAsync(long timeout, - @Nullable IgnitePredicate<Entry<K, V>>... filter) { - return new GridFinishedFuture<>(null, false); - } - - /** {@inheritDoc} */ - @Override public void unlock(IgnitePredicate<Entry<K, V>>... filter) throws IgniteCheckedException { - // No-op. - } - - /** {@inheritDoc} */ - @Override public boolean isCached() { - return !evicted; - } - - /** {@inheritDoc} */ - @Override public int memorySize() { - return 1024; - } - - /** {@inheritDoc} */ - @Override public CacheProjection<K, V> projection() { - return null; - } - - /** {@inheritDoc} */ - @Nullable @Override public V reload() throws IgniteCheckedException { - return null; - } - - /** {@inheritDoc} */ - @Override public IgniteInternalFuture<V> reloadAsync() { - return new GridFinishedFuture<>(); - } - - /** {@inheritDoc} */ - @Nullable @Override public V get() throws IgniteCheckedException { - return null; - } - - /** {@inheritDoc} */ - @Override public IgniteInternalFuture<V> getAsync() { - return new GridFinishedFuture<>(); - } - - /** {@inheritDoc} */ - @Override public boolean clear() { - return false; - } - - /** {@inheritDoc} */ - @Override public boolean compact() throws IgniteCheckedException { - return false; - } - - /** {@inheritDoc} */ @Override public <T> T unwrap(Class<T> clazz) { if(clazz.isAssignableFrom(getClass())) return clazz.cast(this); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/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 79d649e..25dab08 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 @@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.local; import org.apache.ignite.cache.*; import org.apache.ignite.internal.processors.cache.*; +import javax.cache.Cache.*; import java.io.*; import java.util.*; @@ -99,7 +100,6 @@ public class GridCacheLocalIteratorsSelfTest extends GridCacheAbstractIteratorsS checkKey(entry.getKey()); checkValue(entry.getValue(), bound); - checkValue(entry.get(), bound); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java index 27d1a53..30b8f1d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java @@ -42,6 +42,7 @@ import org.apache.ignite.testframework.junits.common.*; import org.jdk8.backport.*; import org.jetbrains.annotations.*; +import javax.cache.Cache.*; import javax.cache.configuration.*; import javax.cache.integration.*; import java.util.*; @@ -1116,7 +1117,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo CacheContinuousQuery<Integer, Integer> qry = cache.projection( new P1<Entry<Integer, Integer>>() { @Override public boolean apply(Entry<Integer, Integer> e) { - Integer i = e.peek(); + Integer i = e.getValue(); return i != null && i > 10; } @@ -1267,56 +1268,6 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo } /** - * @throws Exception If filter. - */ - public void testUpdateInFilter() throws Exception { - GridCache<Integer, Integer> cache = grid(0).cache(null); - - cache.putx(1, 1); - - CacheProjection<Integer, Integer> prj = cache.projection(new P1<Entry<Integer, Integer>>() { - @SuppressWarnings("ThrowableResultOfMethodCallIgnored") - @Override public boolean apply(final Entry<Integer, Integer> e) { - GridTestUtils.assertThrows( - log, - new Callable<Object>() { - @Override public Object call() throws Exception { - e.set(1000); - - return null; - } - }, - CacheFlagException.class, - null - ); - - return true; - } - }); - - CacheContinuousQuery<Integer, Integer> qry = prj.queries().createContinuousQuery(); - - final CountDownLatch latch = new CountDownLatch(1); - - qry.localCallback(new P2<UUID, Collection<CacheContinuousQueryEntry<Integer, Integer>>>() { - @Override public boolean apply(UUID nodeId, Collection<CacheContinuousQueryEntry<Integer, Integer>> entries) { - latch.countDown(); - - return true; - } - }); - - try { - qry.execute(); - - assert latch.await(LATCH_TIMEOUT, MILLISECONDS); - } - finally { - qry.close(); - } - } - - /** * @throws Exception If failed. */ public void testNodeJoin() throws Exception {
