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 2017/04/18 15:04:08 UTC
[09/46] ignite git commit: Merge branch ignite-1.6.5 into
ignite-1.8.5-p1
Merge branch ignite-1.6.5 into ignite-1.8.5-p1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3be4e003
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3be4e003
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3be4e003
Branch: refs/heads/ignite-1561-1
Commit: 3be4e00373ec5a2b49788d70eb0aebccc3cb6ccf
Parents: ae435fb cf9f0a7
Author: Alexander Fedotov <al...@gmail.com>
Authored: Fri Apr 7 14:59:00 2017 +0300
Committer: Alexander Fedotov <al...@gmail.com>
Committed: Fri Apr 7 15:02:32 2017 +0300
----------------------------------------------------------------------
.../IgniteCacheExpiryPolicyAbstractTest.java | 39 ++++++++++++++++++++
1 file changed, 39 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3be4e003/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --cc modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index b234631,9739350..3339f65
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@@ -1018,45 -1009,43 +1019,83 @@@ public abstract class IgniteCacheExpiry
}
/**
+ * Put entry to server node and check how its expires in client NearCache.
+ *
+ * @throws Exception If failed.
+ */
+ public void testNearExpiresOnClient() throws Exception {
+ if(cacheMode() != PARTITIONED)
+ return;
+
+ factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS,1));
+
+ nearCache = true;
+
+ startGrids();
+
+ IgniteConfiguration clientCfg = getConfiguration("client").setClientMode(true);
+
+ ((TcpDiscoverySpi)clientCfg.getDiscoverySpi()).setForceServerMode(false);
+
+ Ignite client = startGrid("client", clientCfg);
+
+ IgniteCache<Object, Object> cache = client.cache(null);
+
+ Integer key = 1;
+
+ // Put on server node.
+ jcache(0).put(key, 1);
+
+ // Make entry cached in client NearCache.
+ assertEquals(1, cache.get(key));
+
+ assertEquals(1, cache.localPeek(key, CachePeekMode.NEAR));
+
+ waitExpired(key);
+
+ // Check client NearCache.
+ assertNull(cache.localPeek(key, CachePeekMode.NEAR));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testNearExpiresWithCacheStore() throws Exception {
+ factory = CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 1));
+
+ nearCache = true;
+
+ startGridsMultiThreaded(gridCount());
+
+ IgniteConfiguration clientCfg = getConfiguration("client").setClientMode(true);
+
+ ((TcpDiscoverySpi)clientCfg.getDiscoverySpi()).setForceServerMode(false);
+
+ Ignite client = startGrid("client", clientCfg);
+
+ CacheConfiguration ccfg = cacheConfiguration("testCache");
+
+ ccfg.setCacheStoreFactory(FactoryBuilder.factoryOf(GridCacheTestStore.class));
+ // ccfg.setExpiryPolicyFactory( CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 1)));
+
+ IgniteCache<Object, Object> cache = client.getOrCreateCache(ccfg);
+
+ Integer key = 1;
+
+ cache.put(key, 1);
+
+ assertEquals(1, cache.localPeek(key, CachePeekMode.NEAR));
+ assertEquals(1, cache.get(key));
+
+ waitExpired(key);
+
+ for(int i = 0; i < gridCount(); i++)
+ assertNull(jcache(i).localPeek(key, CachePeekMode.BACKUP, CachePeekMode.PRIMARY));
+
+ assertEquals(null, cache.get(key));
+ }
++
+ /**
* @return Test keys.
* @throws Exception If failed.
*/