Repository: incubator-ignite Updated Branches: refs/heads/ignite-96 abbb198c5 -> 07a492a30
ignite-96 wip Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/07a492a3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/07a492a3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/07a492a3 Branch: refs/heads/ignite-96 Commit: 07a492a3070d3ac526670c951d5110918fce6e9f Parents: abbb198 Author: Yakov Zhdanov <yzhda...@gridgain.com> Authored: Tue Feb 10 01:50:30 2015 +0300 Committer: Yakov Zhdanov <yzhda...@gridgain.com> Committed: Tue Feb 10 01:50:30 2015 +0300 ---------------------------------------------------------------------- .../distributed/near/GridNearCacheAdapter.java | 2 +- .../cache/GridCacheAbstractFullApiSelfTest.java | 22 +++++++++++------ .../dht/GridCacheDhtPreloadPutGetSelfTest.java | 10 +++----- ...achePartitionedMultiNodeFullApiSelfTest.java | 25 ++++++++++++-------- 4 files changed, 34 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07a492a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java index 77d83a5..134731d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheAdapter.java @@ -479,7 +479,7 @@ public abstract class GridNearCacheAdapter<K, V> extends GridDistributedCacheAda @Override public Cache.Entry<K, V> entry(K key) { // We don't try wrap entry from near or dht cache. // Created object will be wrapped once some method is called. - return new CacheEntryImpl<>(key, null); + return new CacheEntryImpl<>(key, peek(key)); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07a492a3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index dbb9804..b4ef527 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -2941,7 +2941,12 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract if (oldEntry) c.put(key, 1); - GridCacheEntryEx entry = ((IgniteKernal)grid(0)).internalCache().peekEx(key); + GridCacheAdapter<Object, Object> internalCache = ((IgniteKernal)grid(0)).internalCache(); + + if (internalCache.isNear()) + internalCache = internalCache.context().near().dht(); + + GridCacheEntryEx entry = internalCache.peekEx(key); assert entry != null; @@ -2961,7 +2966,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract tx.rollback(); } - entry = ((IgniteKernal)grid(0)).internalCache().peekEx(key); + entry = internalCache.peekEx(key); assertEquals(0, entry.ttl()); assertEquals(0, entry.expireTime()); @@ -2983,7 +2988,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract for (int i = 0; i < gridCount(); i++) { if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) { GridCacheEntryEx<Object, Object> curEntry = - ((IgniteKernal)grid(0)).internalCache().peekEx(key); + internalCache.peekEx(key); assertEquals(ttl, curEntry.ttl()); @@ -3009,7 +3014,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract for (int i = 0; i < gridCount(); i++) { if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) { GridCacheEntryEx<Object, Object> curEntry = - ((IgniteKernal)grid(0)).internalCache().peekEx(key); + internalCache.peekEx(key); assertEquals(ttl, curEntry.ttl()); @@ -3035,7 +3040,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract for (int i = 0; i < gridCount(); i++) { if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) { GridCacheEntryEx<Object, Object> curEntry = - ((IgniteKernal)grid(0)).internalCache().peekEx(key); + internalCache.peekEx(key); assertEquals(ttl, curEntry.ttl()); @@ -3065,7 +3070,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract for (int i = 0; i < gridCount(); i++) { if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) { GridCacheEntryEx<Object, Object> curEntry = - ((IgniteKernal)grid(0)).internalCache().peekEx(key); + internalCache.peekEx(key); assertEquals(ttl, curEntry.ttl()); assertEquals(expireTimes[i], curEntry.expireTime()); @@ -3104,8 +3109,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract } }, Math.min(ttl * 10, getTestTimeout()))); + if (internalCache.isLocal()) + return; + // Ensure that old TTL and expire time are not longer "visible". - entry = ((IgniteKernal)grid(0)).internalCache().peekEx(key); + entry = internalCache.peekEx(key); assert c.entry(key).getValue() == null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07a492a3/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 c91b94a..438ce8c 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 @@ -191,17 +191,13 @@ public class GridCacheDhtPreloadPutGetSelfTest extends GridCommonAbstractTest { for (int i = 0; i < ITER_CNT; i++) { info("Iteration # " + i); - GridCache<Integer, Integer> cache = g2.cache(null); + IgniteCache<Integer, Integer> cache = g2.jcache(null); for (int j = 0; j < KEY_CNT; j++) { - Cache.Entry<Integer, Integer> entry = cache.entry(j); - - assert entry != null; - - Integer val = entry.getValue(); + Integer val = cache.get(j); if (j % FREQUENCY == 0) - info("Read entry: " + entry.getKey() + " -> " + val); + info("Read entry: " + j + " -> " + val); if (done.get()) assert val != null && val == j; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/07a492a3/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 04def3a..178e5c6 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 @@ -26,11 +26,11 @@ import org.apache.ignite.events.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.lang.*; -import javax.cache.*; import java.util.*; import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheMode.*; +import static org.apache.ignite.cache.CachePeekMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.events.EventType.*; import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; @@ -61,6 +61,13 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti } /** + * TODO fix and uncomment + */ + @Override public void testPartitionEntrySetRemove() throws Exception { + assert false : "ignite-96"; + } + + /** * @throws Exception If failed. */ public void testPutAllRemoveAll() throws Exception { @@ -228,19 +235,17 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti Integer nearPeekVal = nearEnabled ? 1 : null; - GridCache<String, Integer> c = cache(i); - - Cache.Entry<String, Integer> e = c.entry("key"); + IgniteCache<String, Integer> c = jcache(i); - if (c.affinity().isBackup(grid(i).localNode(), "key")) { - assertNull(c.peek("key", F.asList(NEAR_ONLY))); + if (c.unwrap(Ignite.class).affinity(null).isBackup(grid(i).localNode(), "key")) { + assertNull(c.localPeek("key", NEAR)); - assertEquals((Integer)1, c.peek("key", F.asList(PARTITIONED_ONLY))); + assertEquals((Integer)1, c.localPeek("key", BACKUP)); } - else if (!c.affinity().isPrimaryOrBackup(grid(i).localNode(), "key")) { - assertEquals(nearPeekVal, c.peek("key", Arrays.asList(NEAR_ONLY))); + else if (!c.unwrap(Ignite.class).affinity(null).isPrimaryOrBackup(grid(i).localNode(), "key")) { + assertEquals(nearPeekVal, c.localPeek("key", NEAR)); - assert c.peek("key", Arrays.asList(PARTITIONED_ONLY)) == null; + assertNull(c.localPeek("key", PRIMARY, BACKUP)); assertEquals((Integer)1, jcache(i).get("key")); }