# IGNITE-96 Remove all 'ignite-96' occurences.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ff788da8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ff788da8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ff788da8 Branch: refs/heads/ignite-189 Commit: ff788da8a91f27adb431e19270f16f02ac2f6d70 Parents: 46b4489 Author: sevdokimov <sevdoki...@gridgain.com> Authored: Thu Feb 12 16:31:31 2015 +0300 Committer: sevdokimov <sevdoki...@gridgain.com> Committed: Thu Feb 12 20:01:29 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheMapEntry.java | 12 +++-- .../cache/GridCacheOffHeapSelfTest.java | 46 +++++++++----------- .../cache/GridCacheOffHeapAndSwapSelfTest.java | 23 +++++----- .../processors/cache/GridCacheSwapSelfTest.java | 40 ++++++++--------- .../near/GridCachePartitionedQuerySelfTest.java | 33 +++++++------- 5 files changed, 72 insertions(+), 82 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff788da8/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java index c20cf03..0c8fa66 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java @@ -4458,13 +4458,19 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V> if (cls.isAssignableFrom(IgniteCache.class)) return (T)cctx.grid().jcache(cctx.name()); + if (cls.isAssignableFrom(getClass())) + return (T)this; + if (cls.isAssignableFrom(EvictableEntry.class)) return (T)wrapEviction(); - if (!cls.equals(getClass())) - throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls); + if (cls.isAssignableFrom(CacheVersionedEntryImpl.class)) + return (T)wrapVersioned(); + + if (cls.isAssignableFrom(GridCacheMapEntry.this.getClass())) + return (T)GridCacheMapEntry.this; - return (T)this; + throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls); } /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff788da8/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java index eb79901..99d7578 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java @@ -22,6 +22,7 @@ import org.apache.ignite.cache.*; import org.apache.ignite.cache.query.*; import org.apache.ignite.configuration.*; 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.*; @@ -32,7 +33,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.spi.swapspace.file.*; import org.apache.ignite.testframework.junits.common.*; -import javax.cache.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -40,9 +40,9 @@ import java.util.concurrent.atomic.*; import static java.util.concurrent.TimeUnit.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; import static org.apache.ignite.configuration.DeploymentMode.*; import static org.apache.ignite.events.EventType.*; +import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; /** * Test for cache swap. @@ -224,7 +224,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { } }, EVT_CACHE_OBJECT_TO_OFFHEAP, EVT_CACHE_OBJECT_FROM_OFFHEAP); - GridCache<Integer, CacheValue> cache = grid(0).cache(null); + GridCache<Integer, CacheValue> cache = ((IgniteKernal)grid(0)).cache(null); populate(cache); evictAll(cache); @@ -332,7 +332,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { * @param cache Cache. * @throws Exception In case of error. */ - private void populate(CacheProjection<Integer, CacheValue> cache) throws Exception { + private void populate(GridCache<Integer, CacheValue> cache) throws Exception { resetCounters(); for (int i = 0; i < ENTRY_CNT; i++) { @@ -343,13 +343,11 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { assert val != null; assert val.value() == i; - Cache.Entry<Integer, CacheValue> entry = cache.entry(i); + GridCacheEntryEx entry = dht(cache).peekEx(i); assert entry != null; - assert false : "ignite-96"; - -// versions.put(i, entry.version()); + versions.put(i, entry.version()); } assert swapCnt.get() == 0; @@ -394,8 +392,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void query(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void query(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); Collection<Map.Entry<Integer, CacheValue>> res = cache.queries(). @@ -429,8 +426,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void unswap(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void unswap(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); assertEquals(0, swapCnt.get()); @@ -464,8 +460,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void unswapAll(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void unswapAll(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); Collection<Integer> keys = new HashSet<>(); @@ -495,8 +490,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void get(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void get(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); for (int i = lowerBound; i < upperBound; i++) { @@ -525,8 +519,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void peek(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void peek(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); for (int i = lowerBound; i < upperBound; i++) { @@ -564,20 +557,21 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void checkEntries(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void checkEntries(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { for (int i = lowerBound; i < upperBound; i++) { - Cache.Entry<Integer, CacheValue> entry = cache.entry(i); + cache.promote(i); + + GridCacheEntryEx<Integer, CacheValue> entry = dht(cache).entryEx(i); assert entry != null; - assert entry.getKey() != null; + assert entry.key() != null; - CacheValue val = entry.getValue(); + CacheValue val = entry.rawGet(); assertNotNull("Value null for key: " + i, val); - assertEquals(entry.getKey(), (Integer)val.value()); - assert false : "ignite-96"; - //assertEquals(entry.version(), versions.get(i)); + assertEquals(entry.key(), (Integer)val.value()); + + assertEquals(entry.version(), versions.get(i)); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff788da8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java index 7e15c6e..60000f9 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapAndSwapSelfTest.java @@ -33,7 +33,6 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.spi.swapspace.file.*; import org.apache.ignite.testframework.junits.common.*; -import javax.cache.*; import java.util.*; import java.util.concurrent.atomic.*; @@ -214,12 +213,11 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest { assert val != null; assert val == i; - Cache.Entry<Long, Long> entry = cache.entry(i); + GridCacheEntryEx entry = dht(cache).peekEx(i); assert entry != null; - assert false : "ignite-96"; - // versions.put(i, entry.version()); + versions.put(i, entry.version()); } assertEquals(0, offheapedCnt.get()); @@ -265,19 +263,20 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest { * @param cache Cache. * @throws Exception In case of error. */ - private void checkEntries(CacheProjection<Long, Long> cache) throws Exception { + private void checkEntries(GridCache<Long, Long> cache) throws Exception { for (long i = from; i < to; i++) { - Cache.Entry<Long, Long> entry = cache.entry(i); + cache.promote(i); + + GridCacheEntryEx<Long, Long> entry = dht(cache).entryEx(i); assert entry != null; - assert entry.getKey() != null; + assert entry.key() != null; - Long val = entry.getValue(); + Long val = entry.rawGet(); assertNotNull("Value null for key: " + i, val); - assertEquals(entry.getKey(), val); - assert false : "ignite-96"; -// assertEquals(entry.version(), versions.get(i)); + assertEquals(entry.key(), val); + assertEquals(entry.version(), versions.get(i)); } assertEquals(0, swappedCnt.get()); @@ -483,7 +482,7 @@ public class GridCacheOffHeapAndSwapSelfTest extends GridCommonAbstractTest { } /** - * Tests {@link org.apache.ignite.cache.CacheProjection#peek(Object)} behavior on offheaped entries. + * Tests {@link GridCache#peek(Object)} behavior on offheaped entries. * * @throws Exception If failed. */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff788da8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java index e953c7b..3a3578f 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapSelfTest.java @@ -32,7 +32,6 @@ import org.apache.ignite.spi.swapspace.*; import org.apache.ignite.spi.swapspace.noop.*; import org.apache.ignite.testframework.junits.common.*; -import javax.cache.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -40,9 +39,9 @@ import java.util.concurrent.atomic.*; import static java.util.concurrent.TimeUnit.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; import static org.apache.ignite.configuration.DeploymentMode.*; import static org.apache.ignite.events.EventType.*; +import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; /** * Test for cache swap. @@ -417,7 +416,7 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest { * @param cache Cache. * @throws Exception In case of error. */ - private void populate(CacheProjection<Integer, CacheValue> cache) throws Exception { + private void populate(GridCache<Integer, CacheValue> cache) throws Exception { resetCounters(); for (int i = 0; i < ENTRY_CNT; i++) { @@ -428,12 +427,11 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest { assert val != null; assert val.value() == i; - Cache.Entry<Integer, CacheValue> entry = cache.entry(i); + GridCacheEntryEx entry = ((GridCacheAdapter)cache.cache()).peekEx(i); assert entry != null; - assert false : "ignite-96"; - // versions.put(i, entry.version()); + versions.put(i, entry.version()); } assert swapCnt.get() == 0; @@ -466,8 +464,7 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void query(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void query(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); Collection<Map.Entry<Integer, CacheValue>> res = cache.queries(). @@ -501,8 +498,7 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void unswap(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void unswap(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); assertEquals(0, swapCnt.get()); @@ -536,8 +532,7 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void unswapAll(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void unswapAll(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); Collection<Integer> keys = new HashSet<>(); @@ -567,8 +562,7 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void get(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void get(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); for (int i = lowerBound; i < upperBound; i++) { @@ -597,8 +591,7 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void peek(CacheProjection<Integer, CacheValue> cache, - int lowerBound, int upperBound) throws Exception { + private void peek(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { resetCounters(); for (int i = lowerBound; i < upperBound; i++) { @@ -636,20 +629,21 @@ public class GridCacheSwapSelfTest extends GridCommonAbstractTest { * @param upperBound Upper key bound. * @throws Exception In case of error. */ - private void checkEntries(CacheProjection<Integer, CacheValue> cache, + private void checkEntries(GridCache<Integer, CacheValue> cache, int lowerBound, int upperBound) throws Exception { for (int i = lowerBound; i < upperBound; i++) { - Cache.Entry<Integer, CacheValue> entry = cache.entry(i); + cache.promote(i); + + GridCacheEntryEx<Integer, CacheValue> entry = dht(cache).entryEx(i); assert entry != null; - assert entry.getKey() != null; + assert entry.key() != null; - CacheValue val = entry.getValue(); + CacheValue val = entry.rawGet(); assert val != null; - assert entry.getKey() == val.value(); - assert false : "ignite-96"; -// assert entry.version().equals(versions.get(i)); + assert entry.key() == val.value(); + assert entry.version().equals(versions.get(i)); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ff788da8/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java index 97a0144..d6bf21f 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedQuerySelfTest.java @@ -168,24 +168,21 @@ public class GridCachePartitionedQuerySelfTest extends GridCacheAbstractQuerySel checkResult(entries, p1, p3, p4); - assert false : "ignite-96"; - -// // Now do the same filtering but using projection. -// qry = cache0.projection(F.<UUID, Person>cachePrimary()).queries().createSqlQuery(Person.class, -// "salary < 2000"); -// -// qry.keepAll(true); -// -// entries = qry.execute().get(); -// -// assert entries != null; -// -// info("Queried persons: " + F.viewReadOnly(entries, F.<Person>mapEntry2Value())); -// -// // Expect result including backup persons. -// assertEquals(3, entries.size()); -// -// checkResult(entries, p1, p3, p4); + // Now do the same filtering but using projection. + qry = cache0.queries().createSqlQuery(Person.class, "salary < 2000"); + + qry.keepAll(true); + + entries = qry.execute().get(); + + assert entries != null; + + info("Queried persons: " + F.viewReadOnly(entries, F.<Person>mapEntry2Value())); + + // Expect result including backup persons. + assertEquals(3, entries.size()); + + checkResult(entries, p1, p3, p4); } /**