GridCacheAbstractMetricsSelfTest: fixed test for offheap mode.
@@ -765,7 +765,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
assertEquals(0, entry.ttl());
assertEquals(0, entry.expireTime());
- long startTime = System.currentTimeMillis();
+ long startTime = U.currentTimeMillis();
if (inTx) {
// Rollback transaction for the first time.
@@ -804,11 +804,11 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
if (c0.isNear())
c0 = c0.context().near().dht();
- GridCacheEntryEx curEntry = c0.peekEx(key);
+ GridCacheEntryEx curEntry = c0.entryEx(key);
- assertEquals(ttl, curEntry.ttl());
+ curEntry.unswap();
- assert curEntry.expireTime() > startTime;
+ assertTrue(curEntry.expireTime() >= startTime);
expireTimes[i] = curEntry.expireTime();
}
@@ -834,11 +834,11 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
if (c0.isNear())
c0 = c0.context().near().dht();
- GridCacheEntryEx curEntry = c0.peekEx(key);
+ GridCacheEntryEx curEntry = c0.entryEx(key);
- assertEquals(ttl, curEntry.ttl());
+ curEntry.unswap();
- assert curEntry.expireTime() > startTime;
+ assertTrue(curEntry.expireTime() >= startTime);
expireTimes[i] = curEntry.expireTime();
}
@@ -864,11 +864,11 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
if (c0.isNear())
c0 = c0.context().near().dht();
- GridCacheEntryEx curEntry = c0.peekEx(key);
+ GridCacheEntryEx curEntry = c0.entryEx(key);
- assertEquals(ttl, curEntry.ttl());
+ curEntry.unswap();
- assert curEntry.expireTime() > startTime;
+ assertTrue(curEntry.expireTime() >= startTime);
expireTimes[i] = curEntry.expireTime();
}
@@ -898,9 +898,10 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
if (c0.isNear())
c0 = c0.context().near().dht();
- GridCacheEntryEx curEntry = c0.peekEx(key);
+ GridCacheEntryEx curEntry = c0.entryEx(key);
+
+ curEntry.unswap();
- assertEquals(ttl, curEntry.ttl());
assertEquals(expireTimes[i], curEntry.expireTime());
}
}
@@ -919,7 +920,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
GridCacheAdapter c0 = cacheFromCtx(c);
if (!c0.context().deferredDelete()) {
- GridCacheEntryEx e0 = c0.peekEx(key);
+ GridCacheEntryEx e0 = c0.entryEx(key);
return e0 == null || (e0.rawGet() == null && e0.valueBytes() == null);
}
@@ -940,7 +941,6 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
// Ensure that old TTL and expire time are not longer "visible".
entry = c0.entryEx(key);
- assertEquals(0, entry.ttl());
assertEquals(0, entry.expireTime());
}
}
\ No newline at end of file
