Merge branch 'sprint-1' of
https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-96
Conflicts:
modules/core/src/main/java/org/apache/ignite/cache/eviction/EvictableEntry.java
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/345098a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/345098a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/345098a5
Branch: refs/heads/ignite-96
Commit: 345098a57b8738a32813d4ac83239ec6b7b4983a
Parents: f5c2f06
Author: Yakov Zhdanov <[email protected]>
Authored: Fri Feb 6 22:57:07 2015 +0300
Committer: Yakov Zhdanov <[email protected]>
Committed: Fri Feb 6 22:57:07 2015 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractFullApiSelfTest.java | 908 ++++++++++---------
.../cache/GridCacheAbstractMetricsSelfTest.java | 411 ++++-----
.../cache/GridCacheAbstractSelfTest.java | 48 +-
.../cache/GridCacheAlwaysEvictionPolicy.java | 3 +-
.../cache/GridCacheConcurrentMapSelfTest.java | 9 +-
.../GridCacheConcurrentTxMultiNodeTest.java | 16 +-
.../cache/GridCacheEntryMemorySizeSelfTest.java | 1 +
.../cache/GridCacheIteratorPerformanceTest.java | 4 +-
.../cache/GridCacheLifecycleAwareSelfTest.java | 3 +-
...HeapMultiThreadedUpdateAbstractSelfTest.java | 3 +-
.../GridCacheOffHeapTieredAbstractSelfTest.java | 3 +-
...heOffHeapTieredEvictionAbstractSelfTest.java | 3 +-
.../GridCachePreloadingEvictionsSelfTest.java | 13 +-
.../processors/cache/GridCacheTestEntryEx.java | 5 +-
.../processors/cache/IgniteTxAbstractTest.java | 9 +-
...tractDistributedByteArrayValuesSelfTest.java | 6 +-
.../GridCacheClientModesAbstractSelfTest.java | 71 +-
...acheEntrySetIterationPreloadingSelfTest.java | 6 +-
.../distributed/GridCacheEventAbstractTest.java | 1 +
.../GridCacheNodeFailureAbstractTest.java | 7 +-
...chePartitionedReloadAllAbstractSelfTest.java | 93 +-
.../dht/GridCacheDhtPreloadPutGetSelfTest.java | 1 +
...cheGroupLockPartitionedAbstractSelfTest.java | 5 +-
.../GridCachePartitionedFullApiSelfTest.java | 1 +
.../GridCachePartitionedLoadCacheSelfTest.java | 9 +-
...achePartitionedMultiNodeFullApiSelfTest.java | 41 +-
...heConcurrentEvictionConsistencySelfTest.java | 5 +-
.../eviction/GridCacheEvictionAbstractTest.java | 19 +-
.../GridCacheEvictionFilterSelfTest.java | 13 +-
.../GridCacheEvictionLockUnlockSelfTest.java | 2 +-
.../cache/eviction/GridCacheMockEntry.java | 304 +------
.../local/GridCacheLocalIteratorsSelfTest.java | 2 +-
...ridCacheContinuousQueryAbstractSelfTest.java | 53 +-
33 files changed, 864 insertions(+), 1214 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/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 0d66b15..b46b654 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
@@ -36,6 +36,7 @@ import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
import javax.cache.*;
+import javax.cache.Cache.*;
import javax.cache.expiry.*;
import javax.cache.processor.*;
import java.util.*;
@@ -2687,137 +2688,139 @@ public abstract class
GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
public void testPeekMode() throws Exception {
- String key = "testPeekMode";
- GridCache<String, Integer> cache = primaryIgnite(key).cache(null);
-
- cache.put(key, 1);
-
- CacheEntry<String, Integer> entry = cache.entry(key);
-
- assert entry.primary();
-
- assert cache.peek(key, F.asList(TX)) == null;
- assert cache.peek(key, F.asList(SWAP)) == null;
- assert cache.peek(key, F.asList(DB)) == 1;
- assert cache.peek(key, F.asList(TX, GLOBAL)) == 1;
-
- if (cacheMode() == LOCAL) {
- assert cache.peek(key, F.asList(TX, NEAR_ONLY)) == 1;
- assert cache.peek(key, F.asList(TX, PARTITIONED_ONLY)) == 1;
- }
-
- assert cache.peek(key, F.asList(SMART)) == 1;
-
- assert entry.peek(F.asList(TX)) == null;
- assert entry.peek(F.asList(SWAP)) == null;
- assert entry.peek(F.asList(DB)) == 1;
- assert entry.peek(F.asList(TX, GLOBAL)) == 1;
-
- if (cacheMode() == LOCAL) {
- assert entry.peek(F.asList(TX, NEAR_ONLY)) == 1;
- assert entry.peek(F.asList(TX, PARTITIONED_ONLY)) == 1;
- }
-
- assert entry.peek(F.asList(SMART)) == 1;
-
- CacheEntry<String, Integer> ew = cache.entry("wrongKey");
-
- assert cache.peek("wrongKey", F.asList(TX, GLOBAL, SWAP, DB)) == null;
-
- if (cacheMode() == LOCAL) {
- assert cache.peek("wrongKey", F.asList(TX, NEAR_ONLY, SWAP, DB))
== null;
- assert cache.peek("wrongKey", F.asList(TX, PARTITIONED_ONLY, SWAP,
DB)) == null;
- }
-
- assert ew.peek(F.asList(TX, GLOBAL, SWAP, DB)) == null;
-
- if (cacheMode() != PARTITIONED) {
- assert ew.peek(F.asList(TX, NEAR_ONLY, SWAP, DB)) == null;
- assert ew.peek(F.asList(TX, PARTITIONED_ONLY, SWAP, DB)) == null;
- }
-
- if (txEnabled()) {
- IgniteTx tx = cache.txStart();
-
- cache.replace(key, 2);
-
- assert cache.peek(key, F.asList(GLOBAL)) == 1;
-
- if (cacheMode() == LOCAL) {
- assert cache.peek(key, F.asList(NEAR_ONLY)) == 1;
- assert cache.peek(key, F.asList(PARTITIONED_ONLY)) == 1;
- }
-
- assert cache.peek(key, F.asList(TX)) == 2;
- assert cache.peek(key, F.asList(SMART)) == 2;
- assert cache.peek(key, F.asList(SWAP)) == null;
- assert cache.peek(key, F.asList(DB)) == 1;
-
- assertEquals((Integer)1, entry.peek(F.asList(GLOBAL)));
-
- if (cacheMode() == LOCAL) {
- assertEquals((Integer)1, entry.peek(F.asList(NEAR_ONLY)));
- assertEquals((Integer)1,
entry.peek(F.asList(PARTITIONED_ONLY)));
- }
-
- assertEquals((Integer)2, entry.peek(F.asList(TX)));
- assertEquals((Integer)2, entry.peek(F.asList(SMART)));
- assertNull(entry.peek(F.asList(SWAP)));
- assertEquals((Integer)1, entry.peek(F.asList(DB)));
-
- tx.commit();
- }
- else
- cache.replace(key, 2);
-
- assertEquals((Integer)2, cache.peek(key, F.asList(GLOBAL)));
-
- if (cacheMode() == LOCAL) {
- assertEquals((Integer)2, cache.peek(key, F.asList(NEAR_ONLY)));
- assertEquals((Integer)2, cache.peek(key,
F.asList(PARTITIONED_ONLY)));
- }
-
- assertNull(cache.peek(key, F.asList(TX)));
- assertNull(cache.peek(key, F.asList(SWAP)));
- assertEquals((Integer)2, cache.peek(key, F.asList(DB)));
-
- assertEquals((Integer)2, entry.peek(F.asList(GLOBAL)));
-
- if (cacheMode() == LOCAL) {
- assertEquals((Integer)2, entry.peek(F.asList(NEAR_ONLY)));
- assertEquals((Integer)2, entry.peek(F.asList(PARTITIONED_ONLY)));
- }
-
- assertNull(entry.peek(F.asList(TX)));
- assertNull(entry.peek(F.asList(SWAP)));
- assertEquals((Integer)2, entry.peek(F.asList(DB)));
-
- assertTrue(cache.evict(key));
-
- assertNull(cache.peek(key, F.asList(SMART)));
- assertNull(cache.peek(key, F.asList(TX, GLOBAL)));
-
- if (cacheMode() == LOCAL) {
- assertNull(cache.peek(key, F.asList(TX, NEAR_ONLY)));
- assertNull(cache.peek(key, F.asList(TX, PARTITIONED_ONLY)));
- }
-
- assertEquals((Integer)2, cache.peek(key, F.asList(SWAP)));
- assertEquals((Integer)2, cache.peek(key, F.asList(DB)));
- assertEquals((Integer)2, cache.peek(key, F.asList(SMART, SWAP, DB)));
-
- assertNull(entry.peek(F.asList(SMART)));
- assertNull(entry.peek(F.asList(TX, GLOBAL)));
-
- if (cacheMode() == LOCAL) {
- assertNull(entry.peek(F.asList(TX, NEAR_ONLY)));
- assertNull(entry.peek(F.asList(TX, PARTITIONED_ONLY)));
- }
-
- assertEquals((Integer)2, cache.peek(key, F.asList(SWAP)));
-
- assertEquals((Integer)2, entry.peek(F.asList(DB)));
- assertEquals((Integer)2, entry.peek(F.asList(SMART, SWAP, DB)));
+ assert false;
+// String key = "testPeekMode";
+//
+// GridCache<String, Integer> cache = primaryIgnite(key).cache(null);
+//
+// cache.put(key, 1);
+//
+// Entry<String, Integer> entry = cache.entry(key);
+//
+// assert entry.primary();
+//
+// assert cache.peek(key, F.asList(TX)) == null;
+// assert cache.peek(key, F.asList(SWAP)) == null;
+// assert cache.peek(key, F.asList(DB)) == 1;
+// assert cache.peek(key, F.asList(TX, GLOBAL)) == 1;
+//
+// if (cacheMode() == LOCAL) {
+// assert cache.peek(key, F.asList(TX, NEAR_ONLY)) == 1;
+// assert cache.peek(key, F.asList(TX, PARTITIONED_ONLY)) == 1;
+// }
+//
+// assert cache.peek(key, F.asList(SMART)) == 1;
+//
+// assert entry.peek(F.asList(TX)) == null;
+// assert entry.peek(F.asList(SWAP)) == null;
+// assert entry.peek(F.asList(DB)) == 1;
+// assert entry.peek(F.asList(TX, GLOBAL)) == 1;
+//
+// if (cacheMode() == LOCAL) {
+// assert entry.peek(F.asList(TX, NEAR_ONLY)) == 1;
+// assert entry.peek(F.asList(TX, PARTITIONED_ONLY)) == 1;
+// }
+//
+// assert entry.peek(F.asList(SMART)) == 1;
+//
+// Entry<String, Integer> ew = cache.entry("wrongKey");
+//
+// assert cache.peek("wrongKey", F.asList(TX, GLOBAL, SWAP, DB)) ==
null;
+//
+// if (cacheMode() == LOCAL) {
+// assert cache.peek("wrongKey", F.asList(TX, NEAR_ONLY, SWAP, DB))
== null;
+// assert cache.peek("wrongKey", F.asList(TX, PARTITIONED_ONLY,
SWAP, DB)) == null;
+// }
+//
+// assert ew.peek(F.asList(TX, GLOBAL, SWAP, DB)) == null;
+//
+// if (cacheMode() != PARTITIONED) {
+// assert ew.peek(F.asList(TX, NEAR_ONLY, SWAP, DB)) == null;
+// assert ew.peek(F.asList(TX, PARTITIONED_ONLY, SWAP, DB)) == null;
+// }
+//
+// if (txEnabled()) {
+// IgniteTx tx = cache.txStart();
+//
+// cache.replace(key, 2);
+//
+// assert cache.peek(key, F.asList(GLOBAL)) == 1;
+//
+// if (cacheMode() == LOCAL) {
+// assert cache.peek(key, F.asList(NEAR_ONLY)) == 1;
+// assert cache.peek(key, F.asList(PARTITIONED_ONLY)) == 1;
+// }
+//
+// assert cache.peek(key, F.asList(TX)) == 2;
+// assert cache.peek(key, F.asList(SMART)) == 2;
+// assert cache.peek(key, F.asList(SWAP)) == null;
+// assert cache.peek(key, F.asList(DB)) == 1;
+//
+// assertEquals((Integer)1, entry.peek(F.asList(GLOBAL)));
+//
+// if (cacheMode() == LOCAL) {
+// assertEquals((Integer)1, entry.peek(F.asList(NEAR_ONLY)));
+// assertEquals((Integer)1,
entry.peek(F.asList(PARTITIONED_ONLY)));
+// }
+//
+// assertEquals((Integer)2, entry.peek(F.asList(TX)));
+// assertEquals((Integer)2, entry.peek(F.asList(SMART)));
+// assertNull(entry.peek(F.asList(SWAP)));
+// assertEquals((Integer)1, entry.peek(F.asList(DB)));
+//
+// tx.commit();
+// }
+// else
+// cache.replace(key, 2);
+//
+// assertEquals((Integer)2, cache.peek(key, F.asList(GLOBAL)));
+//
+// if (cacheMode() == LOCAL) {
+// assertEquals((Integer)2, cache.peek(key, F.asList(NEAR_ONLY)));
+// assertEquals((Integer)2, cache.peek(key,
F.asList(PARTITIONED_ONLY)));
+// }
+//
+// assertNull(cache.peek(key, F.asList(TX)));
+// assertNull(cache.peek(key, F.asList(SWAP)));
+// assertEquals((Integer)2, cache.peek(key, F.asList(DB)));
+//
+// assertEquals((Integer)2, entry.peek(F.asList(GLOBAL)));
+//
+// if (cacheMode() == LOCAL) {
+// assertEquals((Integer)2, entry.peek(F.asList(NEAR_ONLY)));
+// assertEquals((Integer)2, entry.peek(F.asList(PARTITIONED_ONLY)));
+// }
+//
+// assertNull(entry.peek(F.asList(TX)));
+// assertNull(entry.peek(F.asList(SWAP)));
+// assertEquals((Integer)2, entry.peek(F.asList(DB)));
+//
+// assertTrue(cache.evict(key));
+//
+// assertNull(cache.peek(key, F.asList(SMART)));
+// assertNull(cache.peek(key, F.asList(TX, GLOBAL)));
+//
+// if (cacheMode() == LOCAL) {
+// assertNull(cache.peek(key, F.asList(TX, NEAR_ONLY)));
+// assertNull(cache.peek(key, F.asList(TX, PARTITIONED_ONLY)));
+// }
+//
+// assertEquals((Integer)2, cache.peek(key, F.asList(SWAP)));
+// assertEquals((Integer)2, cache.peek(key, F.asList(DB)));
+// assertEquals((Integer)2, cache.peek(key, F.asList(SMART, SWAP, DB)));
+//
+// assertNull(entry.peek(F.asList(SMART)));
+// assertNull(entry.peek(F.asList(TX, GLOBAL)));
+//
+// if (cacheMode() == LOCAL) {
+// assertNull(entry.peek(F.asList(TX, NEAR_ONLY)));
+// assertNull(entry.peek(F.asList(TX, PARTITIONED_ONLY)));
+// }
+//
+// assertEquals((Integer)2, cache.peek(key, F.asList(SWAP)));
+//
+// assertEquals((Integer)2, entry.peek(F.asList(DB)));
+// assertEquals((Integer)2, entry.peek(F.asList(SMART, SWAP, DB)));
}
/**
@@ -2853,7 +2856,7 @@ public abstract class GridCacheAbstractFullApiSelfTest
extends GridCacheAbstract
// Force reload on primary node.
for (int i = 0; i < gridCount(); i++) {
- if (cache(i).entry(key).primary())
+ if (cache(i).affinity().isPrimary(grid(i).localNode(), key))
cache(i).reload(key);
}
@@ -2948,197 +2951,198 @@ public abstract class
GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
private void checkTtl(boolean inTx, boolean oldEntry) throws Exception {
- int ttl = 1000;
-
- final ExpiryPolicy expiry = new TouchedExpiryPolicy(new
Duration(MILLISECONDS, ttl));
-
- final GridCache<String, Integer> c = cache();
-
- final String key = primaryKeysForCache(c, 1).get(0);
-
- if (oldEntry)
- c.put(key, 1);
-
- CacheEntry<String, Integer> entry = c.entry(key);
-
- assert entry != null;
-
- assertEquals(0, entry.timeToLive());
- assertEquals(0, entry.expirationTime());
-
- long startTime = System.currentTimeMillis();
-
- if (inTx) {
- // Rollback transaction for the first time.
- IgniteTx tx = grid(0).transactions().txStart();
-
- try {
- grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
- }
- finally {
- tx.rollback();
- }
-
- assertEquals(0, entry.timeToLive());
- assertEquals(0, entry.expirationTime());
- }
-
- // Now commit transaction and check that ttl and expire time have been
saved.
- IgniteTx tx = inTx ? grid(0).transactions().txStart() : null;
-
- try {
- grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- long[] expireTimes = new long[gridCount()];
-
- for (int i = 0; i < gridCount(); i++) {
- CacheEntry<String, Integer> curEntry = cache(i).entry(key);
-
- if (curEntry.primary() || curEntry.backup()) {
- assertEquals(ttl, curEntry.timeToLive());
-
- assert curEntry.expirationTime() > startTime;
-
- expireTimes[i] = curEntry.expirationTime();
- }
- }
-
- // One more update from the same cache entry to ensure that expire
time is shifted forward.
- U.sleep(100);
-
- tx = inTx ? grid(0).transactions().txStart() : null;
-
- try {
- grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 2);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- for (int i = 0; i < gridCount(); i++) {
- CacheEntry<String, Integer> curEntry = cache(i).entry(key);
-
- if (curEntry.primary() || curEntry.backup()) {
- assertEquals(ttl, curEntry.timeToLive());
-
- assert curEntry.expirationTime() > expireTimes[i];
-
- expireTimes[i] = curEntry.expirationTime();
- }
- }
-
- // And one more direct update to ensure that expire time is shifted
forward.
- U.sleep(100);
-
- tx = inTx ? grid(0).transactions().txStart() : null;
-
- try {
- grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 3);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- for (int i = 0; i < gridCount(); i++) {
- CacheEntry<String, Integer> curEntry = cache(i).entry(key);
-
- if (curEntry.primary() || curEntry.backup()) {
- assertEquals(ttl, curEntry.timeToLive());
-
- assert curEntry.expirationTime() > expireTimes[i];
-
- expireTimes[i] = curEntry.expirationTime();
- }
- }
-
- // And one more update to ensure that ttl is not changed and expire
time is not shifted forward.
- U.sleep(100);
-
- log.info("Put 4");
-
- tx = inTx ? grid(0).transactions().txStart() : null;
-
- try {
- c.put(key, 4);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- log.info("Put 4 done");
-
- for (int i = 0; i < gridCount(); i++) {
- CacheEntry<String, Integer> curEntry = cache(i).entry(key);
-
- if (curEntry.primary() || curEntry.backup()) {
- assertEquals(ttl, curEntry.timeToLive());
- assertEquals(expireTimes[i], curEntry.expirationTime());
- }
- }
-
- // Avoid reloading from store.
- map.remove(key);
-
- assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicateX() {
- @SuppressWarnings("unchecked")
- @Override public boolean applyx() throws IgniteCheckedException {
- try {
- if (c.get(key) != null)
- return false;
-
- // Get "cache" field from GridCacheProxyImpl.
- GridCacheAdapter c0 = GridTestUtils.getFieldValue(c,
"cache");
-
- if (!c0.context().deferredDelete()) {
- GridCacheEntryEx e0 = c0.peekEx(key);
-
- return e0 == null || (e0.rawGet() == null &&
e0.valueBytes() == null);
- }
- else
- return true;
- }
- catch (GridCacheEntryRemovedException e) {
- throw new RuntimeException(e);
- }
- }
- }, Math.min(ttl * 10, getTestTimeout())));
-
- // Ensure that old TTL and expire time are not longer "visible".
- entry = c.entry(key);
-
- assert entry.get() == null;
-
- assertEquals(0, entry.timeToLive());
- assertEquals(0, entry.expirationTime());
-
- // Ensure that next update will not pick old expire time.
-
- tx = inTx ? c.txStart() : null;
-
- try {
- entry.set(10);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- U.sleep(2000);
-
- entry = c.entry(key);
-
- assertEquals((Integer)10, entry.get());
-
- assertEquals(0, entry.timeToLive());
- assertEquals(0, entry.expirationTime());
+ assert false;
+// int ttl = 1000;
+//
+// final ExpiryPolicy expiry = new TouchedExpiryPolicy(new
Duration(MILLISECONDS, ttl));
+//
+// final GridCache<String, Integer> c = cache();
+//
+// final String key = primaryKeysForCache(c, 1).get(0);
+//
+// if (oldEntry)
+// c.put(key, 1);
+//
+// Entry<String, Integer> entry = c.entry(key);
+//
+// assert entry != null;
+//
+// assertEquals(0, entry.timeToLive());
+// assertEquals(0, entry.expirationTime());
+//
+// long startTime = System.currentTimeMillis();
+//
+// if (inTx) {
+// // Rollback transaction for the first time.
+// IgniteTx tx = grid(0).transactions().txStart();
+//
+// try {
+// grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
+// }
+// finally {
+// tx.rollback();
+// }
+//
+// assertEquals(0, entry.timeToLive());
+// assertEquals(0, entry.expirationTime());
+// }
+//
+// // Now commit transaction and check that ttl and expire time have
been saved.
+// IgniteTx tx = inTx ? grid(0).transactions().txStart() : null;
+//
+// try {
+// grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// long[] expireTimes = new long[gridCount()];
+//
+// for (int i = 0; i < gridCount(); i++) {
+// Entry<String, Integer> curEntry = cache(i).entry(key);
+//
+// if (curEntry.primary() || curEntry.backup()) {
+// assertEquals(ttl, curEntry.timeToLive());
+//
+// assert curEntry.expirationTime() > startTime;
+//
+// expireTimes[i] = curEntry.expirationTime();
+// }
+// }
+//
+// // One more update from the same cache entry to ensure that expire
time is shifted forward.
+// U.sleep(100);
+//
+// tx = inTx ? grid(0).transactions().txStart() : null;
+//
+// try {
+// grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 2);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// for (int i = 0; i < gridCount(); i++) {
+// Entry<String, Integer> curEntry = cache(i).entry(key);
+//
+// if (curEntry.primary() || curEntry.backup()) {
+// assertEquals(ttl, curEntry.timeToLive());
+//
+// assert curEntry.expirationTime() > expireTimes[i];
+//
+// expireTimes[i] = curEntry.expirationTime();
+// }
+// }
+//
+// // And one more direct update to ensure that expire time is shifted
forward.
+// U.sleep(100);
+//
+// tx = inTx ? grid(0).transactions().txStart() : null;
+//
+// try {
+// grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 3);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// for (int i = 0; i < gridCount(); i++) {
+// Entry<String, Integer> curEntry = cache(i).entry(key);
+//
+// if (curEntry.primary() || curEntry.backup()) {
+// assertEquals(ttl, curEntry.timeToLive());
+//
+// assert curEntry.expirationTime() > expireTimes[i];
+//
+// expireTimes[i] = curEntry.expirationTime();
+// }
+// }
+//
+// // And one more update to ensure that ttl is not changed and expire
time is not shifted forward.
+// U.sleep(100);
+//
+// log.info("Put 4");
+//
+// tx = inTx ? grid(0).transactions().txStart() : null;
+//
+// try {
+// c.put(key, 4);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// log.info("Put 4 done");
+//
+// for (int i = 0; i < gridCount(); i++) {
+// Entry<String, Integer> curEntry = cache(i).entry(key);
+//
+// if (curEntry.primary() || curEntry.backup()) {
+// assertEquals(ttl, curEntry.timeToLive());
+// assertEquals(expireTimes[i], curEntry.expirationTime());
+// }
+// }
+//
+// // Avoid reloading from store.
+// map.remove(key);
+//
+// assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicateX() {
+// @SuppressWarnings("unchecked")
+// @Override public boolean applyx() throws IgniteCheckedException {
+// try {
+// if (c.get(key) != null)
+// return false;
+//
+// // Get "cache" field from GridCacheProxyImpl.
+// GridCacheAdapter c0 = GridTestUtils.getFieldValue(c,
"cache");
+//
+// if (!c0.context().deferredDelete()) {
+// GridCacheEntryEx e0 = c0.peekEx(key);
+//
+// return e0 == null || (e0.rawGet() == null &&
e0.valueBytes() == null);
+// }
+// else
+// return true;
+// }
+// catch (GridCacheEntryRemovedException e) {
+// throw new RuntimeException(e);
+// }
+// }
+// }, Math.min(ttl * 10, getTestTimeout())));
+//
+// // Ensure that old TTL and expire time are not longer "visible".
+// entry = c.entry(key);
+//
+// assert entry.get() == null;
+//
+// assertEquals(0, entry.timeToLive());
+// assertEquals(0, entry.expirationTime());
+//
+// // Ensure that next update will not pick old expire time.
+//
+// tx = inTx ? c.txStart() : null;
+//
+// try {
+// entry.set(10);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// U.sleep(2000);
+//
+// entry = c.entry(key);
+//
+// assertEquals((Integer)10, entry.get());
+//
+// assertEquals(0, entry.timeToLive());
+// assertEquals(0, entry.expirationTime());
}
/**
@@ -3178,121 +3182,122 @@ public abstract class
GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception If failed.
*/
public void testUnswap() throws Exception {
- GridCache<String, Integer> cache = cache();
-
- 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);
-
- final AtomicInteger swapEvts = new AtomicInteger(0);
- final AtomicInteger unswapEvts = new AtomicInteger(0);
-
- Collection<String> locKeys = new HashSet<>();
-
- if (CU.isAffinityNode(cache.configuration())) {
- locKeys.addAll(cache.projection(F.<String,
Integer>cachePrimary()).keySet());
-
- info("Local keys (primary): " + locKeys);
-
- locKeys.addAll(cache.projection(F.<String,
Integer>cacheBackup()).keySet());
-
- info("Local keys (primary + backup): " + locKeys);
- }
-
- for (int i = 0; i < gridCount(); i++) {
- grid(i).events().localListen(new IgnitePredicate<IgniteEvent>() {
- @Override public boolean apply(IgniteEvent evt) {
- info("Received event: " + evt);
-
- switch (evt.type()) {
- case EVT_CACHE_OBJECT_SWAPPED:
- swapEvts.incrementAndGet();
-
- break;
- case EVT_CACHE_OBJECT_UNSWAPPED:
- unswapEvts.incrementAndGet();
-
- break;
- }
-
- return true;
- }
- }, EVT_CACHE_OBJECT_SWAPPED, EVT_CACHE_OBJECT_UNSWAPPED);
- }
-
- assert cache.evict(k2);
- assert cache.evict(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));
-
- cnt++;
- }
- else
- assertNull(cache.promote(k2));
-
- if (locKeys.contains(k3)) {
- assertEquals((Integer)3, cache.promote(k3));
-
- cnt++;
- }
- else
- assertNull(cache.promote(k3));
-
- assertEquals(cnt, swapEvts.get());
- assertEquals(cnt, unswapEvts.get());
-
- assert cache.evict(k1);
-
- assertEquals((Integer)1, cache.get(k1));
-
- if (locKeys.contains(k1))
- cnt++;
-
- assertEquals(cnt, swapEvts.get());
- assertEquals(cnt, unswapEvts.get());
-
- cache.clear();
-
- // Check with multiple arguments.
- cache.put(k1, 1);
- cache.put(k2, 2);
- cache.put(k3, 3);
-
- swapEvts.set(0);
- unswapEvts.set(0);
-
- cache.evict(k2);
- cache.evict(k3);
-
- assert cache.containsKey(k1);
- assert !cache.containsKey(k2);
- assert !cache.containsKey(k3);
-
- cache.promoteAll(F.asList(k2, k3));
-
- cnt = 0;
-
- if (locKeys.contains(k2))
- cnt++;
-
- if (locKeys.contains(k3))
- cnt++;
-
- assertEquals(cnt, swapEvts.get());
- assertEquals(cnt, unswapEvts.get());
+ assert false;
+// GridCache<String, Integer> cache = cache();
+//
+// 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);
+//
+// final AtomicInteger swapEvts = new AtomicInteger(0);
+// final AtomicInteger unswapEvts = new AtomicInteger(0);
+//
+// Collection<String> locKeys = new HashSet<>();
+//
+// if (CU.isAffinityNode(cache.configuration())) {
+// locKeys.addAll(cache.projection(F.<String,
Integer>cachePrimary()).keySet());
+//
+// info("Local keys (primary): " + locKeys);
+//
+// locKeys.addAll(cache.projection(F.<String,
Integer>cacheBackup()).keySet());
+//
+// info("Local keys (primary + backup): " + locKeys);
+// }
+//
+// for (int i = 0; i < gridCount(); i++) {
+// grid(i).events().localListen(new IgnitePredicate<IgniteEvent>() {
+// @Override public boolean apply(IgniteEvent evt) {
+// info("Received event: " + evt);
+//
+// switch (evt.type()) {
+// case EVT_CACHE_OBJECT_SWAPPED:
+// swapEvts.incrementAndGet();
+//
+// break;
+// case EVT_CACHE_OBJECT_UNSWAPPED:
+// unswapEvts.incrementAndGet();
+//
+// break;
+// }
+//
+// return true;
+// }
+// }, EVT_CACHE_OBJECT_SWAPPED, EVT_CACHE_OBJECT_UNSWAPPED);
+// }
+//
+// assert cache.evict(k2);
+// assert cache.evict(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));
+//
+// cnt++;
+// }
+// else
+// assertNull(cache.promote(k2));
+//
+// if (locKeys.contains(k3)) {
+// assertEquals((Integer)3, cache.promote(k3));
+//
+// cnt++;
+// }
+// else
+// assertNull(cache.promote(k3));
+//
+// assertEquals(cnt, swapEvts.get());
+// assertEquals(cnt, unswapEvts.get());
+//
+// assert cache.evict(k1);
+//
+// assertEquals((Integer)1, cache.get(k1));
+//
+// if (locKeys.contains(k1))
+// cnt++;
+//
+// assertEquals(cnt, swapEvts.get());
+// assertEquals(cnt, unswapEvts.get());
+//
+// cache.clear();
+//
+// // Check with multiple arguments.
+// cache.put(k1, 1);
+// cache.put(k2, 2);
+// cache.put(k3, 3);
+//
+// swapEvts.set(0);
+// unswapEvts.set(0);
+//
+// cache.evict(k2);
+// cache.evict(k3);
+//
+// assert cache.containsKey(k1);
+// assert !cache.containsKey(k2);
+// assert !cache.containsKey(k3);
+//
+// cache.promoteAll(F.asList(k2, k3));
+//
+// cnt = 0;
+//
+// if (locKeys.contains(k2))
+// cnt++;
+//
+// if (locKeys.contains(k3))
+// cnt++;
+//
+// assertEquals(cnt, swapEvts.get());
+// assertEquals(cnt, unswapEvts.get());
}
/**
@@ -3534,8 +3539,8 @@ public abstract class GridCacheAbstractFullApiSelfTest
extends GridCacheAbstract
assertEquals(3, primKeys.size());
assertTrue(primKeys.containsAll(keys));
- primKeys = cache(0).projection(new P1<CacheEntry<String, Integer>>() {
- @Override public boolean apply(CacheEntry<String, Integer> e) {
+ primKeys = cache(0).projection(new P1<Entry<String, Integer>>() {
+ @Override public boolean apply(Entry<String, Integer> e) {
return !e.getKey().equals(keys.get(0));
}
}).primaryKeySet();
@@ -3552,8 +3557,8 @@ public abstract class GridCacheAbstractFullApiSelfTest
extends GridCacheAbstract
assertEquals(3, primVals.size());
assertTrue(primVals.containsAll(F.asList(0, 1, 2)));
- primVals = cache(0).projection(new P1<CacheEntry<String, Integer>>() {
- @Override public boolean apply(CacheEntry<String, Integer> e) {
+ primVals = cache(0).projection(new P1<Entry<String, Integer>>() {
+ @Override public boolean apply(Entry<String, Integer> e) {
return !e.getKey().equals(keys.get(0));
}
}).primaryValues();
@@ -3565,12 +3570,12 @@ public abstract class GridCacheAbstractFullApiSelfTest
extends GridCacheAbstract
// Entry set checks.
// -----------------
- Set<CacheEntry<String, Integer>> primEntries =
cache(0).primaryEntrySet();
+ Set<Entry<String, Integer>> primEntries = cache(0).primaryEntrySet();
assertEquals(3, primEntries.size());
- primEntries = cache(0).projection(new P1<CacheEntry<String,
Integer>>() {
- @Override public boolean apply(CacheEntry<String, Integer> e) {
+ primEntries = cache(0).projection(new P1<Entry<String, Integer>>() {
+ @Override public boolean apply(Entry<String, Integer> e) {
return !e.getKey().equals(keys.get(0));
}
}).primaryEntrySet();
@@ -3729,12 +3734,13 @@ public abstract class GridCacheAbstractFullApiSelfTest
extends GridCacheAbstract
for (int i = startFrom; i < startFrom + 100_000; i++) {
String key = "key" + i;
- if (cache.entry(key).primary()) {
- found.add(key);
-
- if (found.size() == cnt)
- return found;
- }
+ assert false;
+// if (cache.entry(key).primary()) {
+// found.add(key);
+//
+// if (found.size() == cnt)
+// return found;
+// }
}
throw new IgniteCheckedException("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/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index a5e76e7..88db27d 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -20,12 +20,7 @@ package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.*;
import org.apache.ignite.cache.*;
import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.lang.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.transactions.*;
-import javax.cache.expiry.*;
import java.util.*;
import java.util.concurrent.*;
@@ -678,218 +673,224 @@ public abstract class GridCacheAbstractMetricsSelfTest
extends GridCacheAbstract
* @throws Exception If failed.
*/
private void checkTtl(boolean inTx) throws Exception {
- int ttl = 1000;
-
- final ExpiryPolicy expiry = new TouchedExpiryPolicy(new
Duration(TimeUnit.MILLISECONDS, ttl));
-
- final GridCache<Integer, Integer> c = grid(0).cache(null);
-
- final Integer key = primaryKeysForCache(c, 1, 0).get(0);
-
- c.put(key, 1);
-
- Entry<Integer, Integer> entry = c.entry(key);
-
- assert entry != null;
-
- assertEquals(0, entry.timeToLive());
- assertEquals(0, entry.expirationTime());
- assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
-
- long startTime = System.currentTimeMillis();
-
- if (inTx) {
- // Rollback transaction for the first time.
- IgniteTx tx = grid(0).transactions().txStart();
-
- try {
- grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
- }
- finally {
- tx.rollback();
- }
-
- assertEquals(0, entry.timeToLive());
- assertEquals(0, entry.expirationTime());
- }
-
- // Now commit transaction and check that ttl and expire time have been
saved.
- IgniteTx tx = inTx ? c.txStart() : null;
-
- try {
- grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- long[] expireTimes = new long[gridCount()];
-
- for (int i = 0; i < gridCount(); i++) {
- Entry<Object, Object> curEntry = grid(i).cache(null).entry(key);
-
- if (curEntry.primary() || curEntry.backup()) {
- assertEquals(ttl, curEntry.timeToLive());
-
- assert curEntry.expirationTime() > startTime;
-
- expireTimes[i] = curEntry.expirationTime();
- }
- }
-
- // One more update from the same cache entry to ensure that expire
time is shifted forward.
- IgniteUtils.sleep(100);
-
- tx = inTx ? c.txStart() : null;
-
- try {
- grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 2);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- for (int i = 0; i < gridCount(); i++) {
- Entry<Object, Object> curEntry = grid(i).cache(null).entry(key);
-
- if (curEntry.primary() || curEntry.backup()) {
- assertEquals(ttl, curEntry.timeToLive());
-
- assert curEntry.expirationTime() > expireTimes[i];
-
- expireTimes[i] = curEntry.expirationTime();
- }
- }
-
- // And one more direct update to ensure that expire time is shifted
forward.
- IgniteUtils.sleep(100);
-
- assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
-
- tx = inTx ? c.txStart() : null;
-
- try {
- grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 3);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- for (int i = 0; i < gridCount(); i++) {
- Entry<Object, Object> curEntry = grid(i).cache(null).entry(key);
-
- if (curEntry.primary() || curEntry.backup()) {
- assertEquals(ttl, curEntry.timeToLive());
-
- assert curEntry.expirationTime() > expireTimes[i];
-
- expireTimes[i] = curEntry.expirationTime();
- }
- }
-
- // And one more update to ensure that ttl is not changed and expire
time is not shifted forward.
- IgniteUtils.sleep(100);
-
- assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
-
- log.info("Put 4");
-
- tx = inTx ? c.txStart() : null;
-
- try {
- grid(0).jcache(null).put(key, 4);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- log.info("Put 4 done");
-
- for (int i = 0; i < gridCount(); i++) {
- Entry<Object, Object> curEntry = grid(i).cache(null).entry(key);
-
- if (curEntry.primary() || curEntry.backup()) {
- assertEquals(ttl, curEntry.timeToLive());
- assertEquals(expireTimes[i], curEntry.expirationTime());
- }
- }
-
- assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
-
- // Avoid reloading from store.
- map.remove(key);
-
- assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicateX() {
- @SuppressWarnings("unchecked")
- @Override
- public boolean applyx() throws IgniteCheckedException {
- try {
- if (c.get(key) != null)
- return false;
-
- // Get "cache" field from GridCacheProxyImpl.
- GridCacheAdapter c0 = GridTestUtils.getFieldValue(c,
"cache");
-
- if (!c0.context().deferredDelete()) {
- GridCacheEntryEx e0 = c0.peekEx(key);
-
- return e0 == null || (e0.rawGet() == null &&
e0.valueBytes() == null);
- } else
- return true;
- } catch (GridCacheEntryRemovedException e) {
- throw new RuntimeException(e);
- }
- }
- }, Math.min(ttl * 10, getTestTimeout())));
-
- // Ensure that old TTL and expire time are not longer "visible".
- entry = c.entry(key);
-
- assertEquals(0, entry.timeToLive());
- assertEquals(0, entry.expirationTime());
-
- // Ensure that next update will not pick old expire time.
-
- tx = inTx ? c.txStart() : null;
-
- try {
- entry.set(10);
- }
- finally {
- if (tx != null)
- tx.commit();
- }
-
- IgniteUtils.sleep(2000);
-
- entry = c.entry(key);
-
- assertEquals((Integer)10, entry.get());
-
- assertEquals(0, entry.timeToLive());
- assertEquals(0, entry.expirationTime());
-
- if (c.configuration().getCacheMode() != CacheMode.PARTITIONED && inTx)
- assertEquals(1, grid(0).cache(null).metrics().getCacheEvictions());
+ assert false : "ignite-96";
+// int ttl = 1000;
+//
+// final ExpiryPolicy expiry = new TouchedExpiryPolicy(new
Duration(TimeUnit.MILLISECONDS, ttl));
+//
+// final GridCache<Integer, Integer> c = grid(0).cache(null);
+//
+// final Integer key = primaryKeysForCache(grid(0), c, 1, 0).get(0);
+//
+// c.put(key, 1);
+//
+// Entry<Integer, Integer> entry = c.entry(key);
+//
+// assert entry != null;
+//
+// assertEquals(0, entry.timeToLive());
+// assertEquals(0, entry.expirationTime());
+// assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
+//
+// long startTime = System.currentTimeMillis();
+//
+// if (inTx) {
+// // Rollback transaction for the first time.
+// IgniteTx tx = grid(0).transactions().txStart();
+//
+// try {
+// grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
+// }
+// finally {
+// tx.rollback();
+// }
+//
+// assertEquals(0, entry.timeToLive());
+// assertEquals(0, entry.expirationTime());
+// }
+//
+// // Now commit transaction and check that ttl and expire time have
been saved.
+// IgniteTx tx = inTx ? c.txStart() : null;
+//
+// try {
+// grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// long[] expireTimes = new long[gridCount()];
+//
+// for (int i = 0; i < gridCount(); i++) {
+// Entry<Object, Object> curEntry = grid(i).cache(null).entry(key);
+//
+// if (curEntry.primary() || curEntry.backup()) {
+// assertEquals(ttl, curEntry.timeToLive());
+//
+// assert curEntry.expirationTime() > startTime;
+//
+// expireTimes[i] = curEntry.expirationTime();
+// }
+// }
+//
+// // One more update from the same cache entry to ensure that expire
time is shifted forward.
+// IgniteUtils.sleep(100);
+//
+// tx = inTx ? c.txStart() : null;
+//
+// try {
+// grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 2);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// for (int i = 0; i < gridCount(); i++) {
+// Entry<Object, Object> curEntry = grid(i).cache(null).entry(key);
+//
+// if (curEntry.primary() || curEntry.backup()) {
+// assertEquals(ttl, curEntry.timeToLive());
+//
+// assert curEntry.expirationTime() > expireTimes[i];
+//
+// expireTimes[i] = curEntry.expirationTime();
+// }
+// }
+//
+// // And one more direct update to ensure that expire time is shifted
forward.
+// IgniteUtils.sleep(100);
+//
+// assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
+//
+// tx = inTx ? c.txStart() : null;
+//
+// try {
+// grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 3);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// for (int i = 0; i < gridCount(); i++) {
+// Entry<Object, Object> curEntry = grid(i).cache(null).entry(key);
+//
+// if (curEntry.primary() || curEntry.backup()) {
+// assertEquals(ttl, curEntry.timeToLive());
+//
+// assert curEntry.expirationTime() > expireTimes[i];
+//
+// expireTimes[i] = curEntry.expirationTime();
+// }
+// }
+//
+// // And one more update to ensure that ttl is not changed and expire
time is not shifted forward.
+// IgniteUtils.sleep(100);
+//
+// assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
+//
+// log.info("Put 4");
+//
+// tx = inTx ? c.txStart() : null;
+//
+// try {
+// grid(0).jcache(null).put(key, 4);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// log.info("Put 4 done");
+//
+// for (int i = 0; i < gridCount(); i++) {
+// Entry<Object, Object> curEntry = grid(i).cache(null).entry(key);
+//
+// if (curEntry.primary() || curEntry.backup()) {
+// assertEquals(ttl, curEntry.timeToLive());
+// assertEquals(expireTimes[i], curEntry.expirationTime());
+// }
+// }
+//
+// assertEquals(0, grid(0).cache(null).metrics().getCacheEvictions());
+//
+// // Avoid reloading from store.
+// map.remove(key);
+//
+// assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicateX() {
+// @SuppressWarnings("unchecked")
+// @Override
+// public boolean applyx() throws IgniteCheckedException {
+// try {
+// if (c.get(key) != null)
+// return false;
+//
+// // Get "cache" field from GridCacheProxyImpl.
+// GridCacheAdapter c0 = GridTestUtils.getFieldValue(c,
"cache");
+//
+// if (!c0.context().deferredDelete()) {
+// GridCacheEntryEx e0 = c0.peekEx(key);
+//
+// return e0 == null || (e0.rawGet() == null &&
e0.valueBytes() == null);
+// } else
+// return true;
+// } catch (GridCacheEntryRemovedException e) {
+// throw new RuntimeException(e);
+// }
+// }
+// }, Math.min(ttl * 10, getTestTimeout())));
+//
+// // Ensure that old TTL and expire time are not longer "visible".
+// entry = c.entry(key);
+//
+// assertEquals(0, entry.timeToLive());
+// assertEquals(0, entry.expirationTime());
+//
+// // Ensure that next update will not pick old expire time.
+//
+// tx = inTx ? c.txStart() : null;
+//
+// try {
+// entry.set(10);
+// }
+// finally {
+// if (tx != null)
+// tx.commit();
+// }
+//
+// IgniteUtils.sleep(2000);
+//
+// entry = c.entry(key);
+//
+// assertEquals((Integer)10, entry.get());
+//
+// assertEquals(0, entry.timeToLive());
+// assertEquals(0, entry.expirationTime());
+//
+// if (c.configuration().getCacheMode() != CacheMode.PARTITIONED &&
inTx)
+// assertEquals(1,
grid(0).cache(null).metrics().getCacheEvictions());
}
/**
+ * @param grid
* @param cache Cache.
* @param cnt Keys count.
* @param startFrom Start value for keys search.
* @return Collection of keys for which given cache is primary.
* @throws IgniteCheckedException If failed.
*/
- protected List<Integer> primaryKeysForCache(CacheProjection<Integer,
Integer> cache, int cnt, int startFrom)
- throws IgniteCheckedException {
+ protected List<Integer> primaryKeysForCache(
+ IgniteEx grid,
+ CacheProjection<Integer, Integer> cache,
+ int cnt,
+ int startFrom
+ ) throws IgniteCheckedException {
List<Integer> found = new ArrayList<>(cnt);
for (int i = startFrom; i < startFrom + 100_000; i++) {
- if (cache.entry(i).primary()) {
+ if (grid.affinity(cache.name()).isPrimary(grid.localNode(), i)) {
found.add(i);
if (found.size() == cnt)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index fe47ea9..3d6ca7e 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -37,11 +37,9 @@ import org.apache.ignite.transactions.*;
import org.jdk8.backport.*;
import org.jetbrains.annotations.*;
-import javax.cache.*;
+import javax.cache.Cache.*;
import javax.cache.configuration.*;
-import javax.cache.integration.*;
import java.util.*;
-import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import static org.apache.ignite.cache.CacheAtomicityMode.*;
@@ -510,9 +508,9 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
/**
* Filters cache entry projections leaving only ones with keys containing
'key'.
*/
- protected static IgnitePredicate<CacheEntry<String, Integer>>
entryKeyFilter =
- new P1<CacheEntry<String, Integer>>() {
- @Override public boolean apply(CacheEntry<String, Integer> entry) {
+ protected static IgnitePredicate<Entry<String, Integer>> entryKeyFilter =
+ new P1<Entry<String, Integer>>() {
+ @Override public boolean apply(Entry<String, Integer> entry) {
return entry.getKey().contains("key");
}
};
@@ -520,9 +518,9 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
/**
* Filters cache entry projections leaving only ones with keys not
containing 'key'.
*/
- protected static IgnitePredicate<CacheEntry<String, Integer>>
entryKeyFilterInv =
- new P1<CacheEntry<String, Integer>>() {
- @Override public boolean apply(CacheEntry<String, Integer> entry) {
+ protected static IgnitePredicate<Entry<String, Integer>> entryKeyFilterInv
=
+ new P1<Entry<String, Integer>>() {
+ @Override public boolean apply(Entry<String, Integer> entry) {
return !entry.getKey().contains("key");
}
};
@@ -530,10 +528,10 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
/**
* Filters cache entry projections leaving only ones with values less than
50.
*/
- protected static final IgnitePredicate<CacheEntry<String, Integer>> lt50 =
- new P1<CacheEntry<String, Integer>>() {
- @Override public boolean apply(CacheEntry<String, Integer> entry) {
- Integer i = entry.peek();
+ protected static final IgnitePredicate<Entry<String, Integer>> lt50 =
+ new P1<Entry<String, Integer>>() {
+ @Override public boolean apply(Entry<String, Integer> entry) {
+ Integer i = entry.getValue();
return i != null && i < 50;
}
@@ -542,10 +540,10 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
/**
* Filters cache entry projections leaving only ones with values greater
or equal than 100.
*/
- protected static final IgnitePredicate<CacheEntry<String, Integer>> gte100
=
- new P1<CacheEntry<String, Integer>>() {
- @Override public boolean apply(CacheEntry<String, Integer> entry) {
- Integer i = entry.peek();
+ protected static final IgnitePredicate<Entry<String, Integer>> gte100 =
+ new P1<Entry<String, Integer>>() {
+ @Override public boolean apply(Entry<String, Integer> entry) {
+ Integer i = entry.getValue();
return i != null && i >= 100;
}
@@ -558,10 +556,10 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
/**
* Filters cache entry projections leaving only ones with values greater
or equal than 200.
*/
- protected static final IgnitePredicate<CacheEntry<String, Integer>> gte200
=
- new P1<CacheEntry<String, Integer>>() {
- @Override public boolean apply(CacheEntry<String, Integer> entry) {
- Integer i = entry.peek();
+ protected static final IgnitePredicate<Entry<String, Integer>> gte200 =
+ new P1<Entry<String, Integer>>() {
+ @Override public boolean apply(Entry<String, Integer> entry) {
+ Integer i = entry.getValue();
return i != null && i >= 200;
}
@@ -575,7 +573,7 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
* {@link org.apache.ignite.lang.IgniteInClosure} for calculating sum.
*/
@SuppressWarnings({"PublicConstructorInNonPublicClass"})
- protected static final class SumVisitor implements CI1<CacheEntry<String,
Integer>> {
+ protected static final class SumVisitor implements CI1<Entry<String,
Integer>> {
/** */
private final AtomicInteger sum;
@@ -587,7 +585,7 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public void apply(CacheEntry<String, Integer> entry) {
+ @Override public void apply(Entry<String, Integer> entry) {
if (entry.getValue() != null) {
Integer i = entry.getValue();
@@ -602,7 +600,7 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
* {@link org.apache.ignite.lang.IgniteReducer} for calculating sum.
*/
@SuppressWarnings({"PublicConstructorInNonPublicClass"})
- protected static final class SumReducer implements R1<CacheEntry<String,
Integer>, Integer> {
+ protected static final class SumReducer implements R1<Entry<String,
Integer>, Integer> {
/** */
private int sum;
@@ -612,7 +610,7 @@ public abstract class GridCacheAbstractSelfTest extends
GridCommonAbstractTest {
}
/** {@inheritDoc} */
- @Override public boolean collect(CacheEntry<String, Integer> entry) {
+ @Override public boolean collect(Entry<String, Integer> entry) {
if (entry.getValue() != null) {
Integer i = entry.getValue();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java
index 2b8018b..8689671 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAlwaysEvictionPolicy.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache;
-import org.apache.ignite.cache.*;
import org.apache.ignite.cache.eviction.*;
/**
@@ -27,7 +26,7 @@ import org.apache.ignite.cache.eviction.*;
*/
public class GridCacheAlwaysEvictionPolicy<K, V> implements
CacheEvictionPolicy<K, V> {
/** {@inheritDoc} */
- @Override public void onEntryAccessed(boolean rmv, Entry<K, V> entry) {
+ @Override public void onEntryAccessed(boolean rmv, EvictableEntry<K, V>
entry) {
if (!rmv && entry.isCached())
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/GridCacheConcurrentMapSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
index 2478e71..bff07dc 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
@@ -25,6 +25,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.*;
@@ -93,7 +94,7 @@ public class GridCacheConcurrentMapSelfTest extends
GridCommonAbstractTest {
int idx = 0;
for (Entry<Integer, String> e : c.entrySet()) {
- assertNotNull(e.peek());
+ assertNotNull(e.getValue());
idx++;
}
@@ -132,7 +133,7 @@ public class GridCacheConcurrentMapSelfTest extends
GridCommonAbstractTest {
int idx = 0;
for (Entry<Integer, String> e : c.entrySet()) {
- assertNotNull(e.peek());
+ assertNotNull(e.getValue());
idx++;
}
@@ -212,7 +213,7 @@ public class GridCacheConcurrentMapSelfTest extends
GridCommonAbstractTest {
int idx = 0;
for (Entry<Integer, String> e : c.entrySet()) {
- assertNotNull(e.peek());
+ assertNotNull(e.getValue());
idx++;
}
@@ -307,7 +308,7 @@ public class GridCacheConcurrentMapSelfTest extends
GridCommonAbstractTest {
int idx = 0;
for (Entry<Integer, String> e : c.entrySet()) {
- assertNotNull(e.peek());
+ assertNotNull(e.getValue());
idx++;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
index aa61a57..1cc6af1 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.testframework.junits.common.*;
import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
+import javax.cache.Cache.*;
import java.io.*;
import java.util.*;
import java.util.concurrent.*;
@@ -709,13 +710,14 @@ public class GridCacheConcurrentTxMultiNodeTest extends
GridCommonAbstractTest {
* @throws IgniteCheckedException If failed.
*/
private void put(Object o, String cacheKey, String terminalId) throws
IgniteCheckedException {
- GridCache<CacheAffinityKey<String>, Object> cache =
ignite.cache(null);
-
- CacheAffinityKey<String> affinityKey = new
CacheAffinityKey<>(cacheKey, terminalId);
-
- Entry<CacheAffinityKey<String>, Object> entry =
cache.entry(affinityKey);
-
- entry.setx(o);
+// GridCache<CacheAffinityKey<String>, Object> cache =
ignite.cache(null);
+//
+// CacheAffinityKey<String> affinityKey = new
CacheAffinityKey<>(cacheKey, terminalId);
+//
+// Entry<CacheAffinityKey<String>, Object> entry =
cache.entry(affinityKey);
+//
+// entry.setx(o);
+ assert false;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
index ed1f87d..dad70c0 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
@@ -30,6 +30,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.io.*;
import java.lang.reflect.*;
import java.util.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
index 43759da..e6e0f19 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
@@ -26,6 +26,8 @@ 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 static org.apache.ignite.cache.CacheMode.*;
/**
@@ -210,7 +212,7 @@ public class GridCacheIteratorPerformanceTest extends
GridCommonAbstractTest {
IgniteInClosure<Entry<Integer, Integer>> c = new CI1<Entry<Integer,
Integer>>() {
@Override public void apply(Entry<Integer, Integer> t) {
- if (t.peek() < SMALL_ENTRY_CNT)
+ if (t.getValue() < SMALL_ENTRY_CNT)
cnt.increment();
}
};
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
index b543a78..af3bf19 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLifecycleAwareSelfTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.testframework.junits.common.*;
import org.jetbrains.annotations.*;
import javax.cache.*;
+import javax.cache.Cache.*;
import javax.cache.configuration.*;
import javax.cache.integration.*;
import java.util.*;
@@ -172,7 +173,7 @@ public class GridCacheLifecycleAwareSelfTest extends
GridAbstractLifecycleAwareS
}
/** {@inheritDoc} */
- @Override public void onEntryAccessed(boolean rmv, Entry entry) {
+ @Override public void onEntryAccessed(boolean rmv, EvictableEntry
entry) {
// No-op.
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
index 2c1bc7b..29d2b90 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
@@ -23,6 +23,7 @@ import org.apache.ignite.internal.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.testframework.*;
+import javax.cache.Cache.*;
import javax.cache.processor.*;
import java.io.*;
import java.util.concurrent.*;
@@ -385,7 +386,7 @@ public abstract class
GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
return false;
}
- else if (e.peek() == null) {
+ else if (e.getValue() == null) {
failed = true;
System.out.println(Thread.currentThread() + " got null value
in filter: " + e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
index 9743ccf..d803fd9 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
@@ -26,6 +26,7 @@ import org.apache.ignite.transactions.*;
import org.jetbrains.annotations.*;
import org.junit.*;
+import javax.cache.Cache.*;
import javax.cache.processor.*;
import java.util.*;
import java.util.concurrent.locks.*;
@@ -628,7 +629,7 @@ public abstract class
GridCacheOffHeapTieredAbstractSelfTest extends GridCacheAb
/** {@inheritDoc} */
@Override public boolean apply(Entry<Integer, Integer> e) {
- assertEquals(expVal, e.peek());
+ assertEquals(expVal, e.getValue());
return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
index 3a33d8a..74d8fae 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTieredEvictionAbstractSelfTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.portables.*;
import org.apache.ignite.testframework.*;
+import javax.cache.Cache.*;
import javax.cache.processor.*;
import java.io.*;
import java.util.*;
@@ -271,7 +272,7 @@ public abstract class
GridCacheOffHeapTieredEvictionAbstractSelfTest extends Gri
@Override public final boolean apply(Entry<Integer, Object> e) {
assertNotNull(e);
- Object val = e.peek();
+ Object val = e.getValue();
if (val == null) {
if (!acceptNull)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
index 679712d..78e0004 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
@@ -33,6 +33,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.*;
@@ -113,6 +114,8 @@ public class GridCachePreloadingEvictionsSelfTest extends
GridCommonAbstractTest
int oldSize = cache1.size();
+ assert false;
+
IgniteInternalFuture fut = multithreadedAsync(
new Callable<Object>() {
@Nullable @Override public Object call() throws Exception {
@@ -124,7 +127,7 @@ public class GridCachePreloadingEvictionsSelfTest extends
GridCommonAbstractTest
Entry<Integer, Object> entry =
randomEntry(ignite1);
if (entry != null)
- entry.evict();
+ ignite1.cache(null).evict(entry.getKey());
else
info("Entry is null.");
}
@@ -163,10 +166,10 @@ public class GridCachePreloadingEvictionsSelfTest extends
GridCommonAbstractTest
for (int i = 0; i < 1000; i++) {
Entry<Integer, Object> entry = randomEntry(ignite1);
- if (entry != null)
- entry.evict();
- else
- info("Entry is null.");
+// if (entry != null) // TODO ignite-96
+// entry.evict();
+// else
+// info("Entry is null.");
}
sleepUntilCashesEqualize(ignite1, ignite2, oldSize);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index dd54640..9081753 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -18,7 +18,7 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.eviction.*;
import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.internal.processors.cache.version.*;
import org.apache.ignite.internal.processors.dr.*;
@@ -27,6 +27,7 @@ import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.lang.*;
import org.jetbrains.annotations.*;
+import javax.cache.Cache.*;
import javax.cache.expiry.*;
import javax.cache.processor.*;
import java.util.*;
@@ -116,7 +117,7 @@ public class GridCacheTestEntryEx<K, V> extends
GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Nullable @Override public Entry<K, V> evictWrap() {
+ @Nullable @Override public EvictableEntry<K, V> evictWrap() {
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
index 31648a3..02b2644 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.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.*;
import java.util.concurrent.atomic.*;
@@ -423,16 +424,16 @@ abstract class IgniteTxAbstractTest extends
GridCommonAbstractTest {
if (j == 0) {
e1 = cache.entry(i);
- v1 = e1.get();
+ v1 = e1.getValue();
}
else {
Entry<Integer, String> e2 = cache.entry(i);
- String v2 = e2.get();
+ String v2 = e2.getValue();
if (!F.eq(v2, v1)) {
- v1 = e1.get();
- v2 = e2.get();
+ v1 = e1.getValue();
+ v2 = e2.getValue();
}
assert F.eq(v2, v1) :
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java
index fceba6d..dfcf6ab 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java
@@ -287,8 +287,12 @@ public abstract class
GridCacheAbstractDistributedByteArrayValuesSelfTest extend
GridCache<Integer, Object> primaryCache = null;
+ int i = 0;
+
for (GridCache<Integer, Object> cache : caches) {
- if (cache.entry(SWAP_TEST_KEY).primary()) {
+ Ignite ignite = ignites[i++];
+
+ if (ignite.affinity(null).isPrimary(ignite.cluster().localNode(),
SWAP_TEST_KEY)) {
primaryCache = cache;
break;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
index a8d4bd1..2c9f09d 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
@@ -147,41 +147,42 @@ public abstract class
GridCacheClientModesAbstractSelfTest extends GridCacheAbst
* @throws Exception If failed.
*/
public void testNearOnlyAffinity() throws Exception {
- for (int i = 0; i < gridCount(); i++) {
- Ignite g = grid(i);
-
- if (F.eq(g.name(), nearOnlyGridName)) {
- for (int k = 0; k < 10000; k++) {
- GridCache<Object, Object> cache = g.cache(null);
-
- String key = "key" + k;
-
- if (cacheMode() == PARTITIONED)
- assertFalse(cache.entry(key).primary() ||
cache.entry(key).backup());
-
-
assertFalse(cache.affinity().mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()));
- }
- }
- else {
- boolean foundEntry = false;
- boolean foundAffinityNode = false;
-
- for (int k = 0; k < 10000; k++) {
- GridCache<Object, Object> cache = g.cache(null);
-
- String key = "key" + k;
-
- if (cache.entry(key).primary() ||
cache.entry(key).backup())
- foundEntry = true;
-
- if
(cache.affinity().mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()))
- foundAffinityNode = true;
- }
-
- assertTrue("Did not found primary or backup entry for grid: "
+ i, foundEntry);
- assertTrue("Did not found affinity node for grid: " + i,
foundAffinityNode);
- }
- }
+ assert false;
+// for (int i = 0; i < gridCount(); i++) {
+// Ignite g = grid(i);
+//
+// if (F.eq(g.name(), nearOnlyGridName)) {
+// for (int k = 0; k < 10000; k++) {
+// GridCache<Object, Object> cache = g.cache(null);
+//
+// String key = "key" + k;
+//
+// if (cacheMode() == PARTITIONED)
+// assertFalse(cache.entry(key).primary() ||
cache.entry(key).backup());
+//
+//
assertFalse(cache.affinity().mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()));
+// }
+// }
+// else {
+// boolean foundEntry = false;
+// boolean foundAffinityNode = false;
+//
+// for (int k = 0; k < 10000; k++) {
+// GridCache<Object, Object> cache = g.cache(null);
+//
+// String key = "key" + k;
+//
+// if (cache.entry(key).primary() ||
cache.entry(key).backup())
+// foundEntry = true;
+//
+// if
(cache.affinity().mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()))
+// foundAffinityNode = true;
+// }
+//
+// assertTrue("Did not found primary or backup entry for grid:
" + i, foundEntry);
+// assertTrue("Did not found affinity node for grid: " + i,
foundAffinityNode);
+// }
+// }
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
index 511ae3d..15286f8 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetIterationPreloadingSelfTest.java
@@ -21,7 +21,7 @@ import org.apache.ignite.*;
import org.apache.ignite.cache.*;
import org.apache.ignite.internal.processors.cache.*;
-import javax.cache.*;
+import javax.cache.Cache.*;
import java.util.*;
/**
@@ -71,14 +71,14 @@ public class GridCacheEntrySetIterationPreloadingSelfTest
extends GridCacheAbstr
Collection<Entry<String, Integer>> entries = new
ArrayList<>(10_000);
for (int i = 0; i < 10_000; i++)
- entries.add((CacheEntry<String, Integer>)cache.randomEntry());
+ entries.add(cache.randomEntry());
startGrid(1);
startGrid(2);
startGrid(3);
for (Entry<String, Integer> entry : entries)
- entry.partition();
+ entry.getValue();
for (int i = 0; i < entryCnt; i++)
cache.remove(String.valueOf(i));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
index 75b813d..b3a7a60 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.transactions.*;
+import javax.cache.Cache.*;
import java.io.*;
import java.util.*;
import java.util.concurrent.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/345098a5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
----------------------------------------------------------------------
diff --git
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
index d9b4d62..a6c59c9 100644
---
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
+++
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.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 static org.apache.ignite.IgniteState.*;
@@ -115,7 +116,7 @@ public abstract class GridCacheNodeFailureAbstractTest
extends GridCommonAbstrac
Entry e = cache(i).entry(KEY);
- assert !e.isLocked() : "Entry is locked for grid [idx=" + i + ",
entry=" + e + ']';
+ assert !cache(i).isLocked(KEY) : "Entry is locked for grid [idx="
+ i + ", entry=" + e + ']';
}
}
@@ -258,7 +259,7 @@ public abstract class GridCacheNodeFailureAbstractTest
extends GridCommonAbstrac
Entry e = checkCache.entry(KEY);
- assert e.isLocked() : "Entry is not locked for grid [idx=" + checkIdx
+ ", entry=" + e + ']';
+ assert cache.isLocked(KEY) : "Entry is not locked for grid [idx=" +
checkIdx + ", entry=" + e + ']';
IgniteFuture<?> f = waitForLocalEvent(grid(checkIdx).events(), new
P1<IgniteEvent>() {
@Override public boolean apply(IgniteEvent e) {
@@ -292,6 +293,6 @@ public abstract class GridCacheNodeFailureAbstractTest
extends GridCommonAbstrac
e = checkCache.entry(KEY);
- assert !e.isLocked() : "Entry is locked for grid [idx=" + checkIdx +
", entry=" + e + ']';
+ assert !cache.isLocked(KEY) : "Entry is locked for grid [idx=" +
checkIdx + ", entry=" + e + ']';
}
}