You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/03/02 17:36:01 UTC
[09/50] incubator-ignite git commit: IGNITE-136 Added test eviction
for local store.
IGNITE-136 Added test eviction for local store.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2e115bf6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2e115bf6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2e115bf6
Branch: refs/heads/ignite-337
Commit: 2e115bf663aef70f6141119adcbd11e2c7bbbaaa
Parents: 3a466e8
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Feb 27 17:57:04 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Feb 27 17:57:04 2015 +0300
----------------------------------------------------------------------
.../GridCacheAbstractLocalStoreSelfTest.java | 30 ++++++++++++++++++++
1 file changed, 30 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e115bf6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
index 781c6a6..c43b8f8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
@@ -25,6 +25,7 @@ import org.apache.ignite.configuration.*;
import org.apache.ignite.events.*;
import org.apache.ignite.internal.processors.cache.store.*;
import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.spi.discovery.tcp.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
@@ -35,6 +36,7 @@ import org.jetbrains.annotations.*;
import javax.cache.*;
import javax.cache.configuration.*;
+import javax.cache.expiry.*;
import javax.cache.integration.*;
import java.util.*;
import java.util.concurrent.*;
@@ -170,6 +172,34 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
/**
* @throws Exception If failed.
*/
+ public void testEvict() throws Exception {
+ Ignite ignite1 = startGrid(1);
+
+ IgniteCache<Object, Object> cache = ignite1.jcache(null).withExpiryPolicy(new CreatedExpiryPolicy(
+ new Duration(TimeUnit.MILLISECONDS, 100L)));
+
+ // Putting entry.
+ for (int i = 0; i < KEYS; i++)
+ cache.put(i, i);
+
+ // Wait when entry
+ U.sleep(200);
+
+ // Check that entry is evicted from cache, but local store does contain it.
+ for (int i = 0; i < KEYS; i++) {
+ cache.localEvict(Arrays.asList(i));
+
+ assertNull(cache.localPeek(i));
+
+ assertEquals(i, (int)LOCAL_STORE_1.load(i).get1());
+
+ assertEquals(i, cache.get(i));
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testPrimaryNode() throws Exception {
Ignite ignite1 = startGrid(1);