ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [1/7] ignite git commit: IGNITE-2414 .NET: TestWithExpiryPolicy is split into two parts: one is fine, another one is muted due to IGNITE-1423.
Date Wed, 20 Jan 2016 12:02:40 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-2236 384b39786 -> 879ef6875


IGNITE-2414 .NET: TestWithExpiryPolicy is split into two parts: one is fine, another one is
muted due to IGNITE-1423.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5cea2330
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5cea2330
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5cea2330

Branch: refs/heads/ignite-2236
Commit: 5cea23302f44ddd279df7a5e9ddd0a814b781ffb
Parents: c1c2081
Author: Pavel Tupitsyn <ptupitsyn@gridgain.com>
Authored: Wed Jan 20 13:48:41 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Jan 20 13:48:41 2016 +0300

----------------------------------------------------------------------
 .../Cache/CacheAbstractTest.cs                  | 70 ++++++++++++++------
 1 file changed, 48 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5cea2330/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
index 57e4949..0237a41 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
@@ -935,35 +935,66 @@ namespace Apache.Ignite.Core.Tests.Cache
 
             cache0.RemoveAll(new List<int> { key0, key1 });
 
-            // Test zero expiration.
-            cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.Zero, TimeSpan.Zero,
TimeSpan.Zero));
+            // Test regular expiration.
+            cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.FromMilliseconds(100),
+                TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(100)));
 
             cache.Put(key0, key0);
             cache.Put(key1, key1);
+            Assert.IsTrue(cache0.ContainsKey(key0));
+            Assert.IsTrue(cache0.ContainsKey(key1));
+            Thread.Sleep(200);
             Assert.IsFalse(cache0.ContainsKey(key0));
             Assert.IsFalse(cache0.ContainsKey(key1));
 
             cache0.Put(key0, key0);
             cache0.Put(key1, key1);
-            Assert.IsTrue(cache0.ContainsKey(key0));
-            Assert.IsTrue(cache0.ContainsKey(key1));
             cache.Put(key0, key0 + 1);
             cache.Put(key1, key1 + 1);
+            Assert.IsTrue(cache0.ContainsKey(key0));
+            Assert.IsTrue(cache0.ContainsKey(key1));
+            Thread.Sleep(200);
             Assert.IsFalse(cache0.ContainsKey(key0));
             Assert.IsFalse(cache0.ContainsKey(key1));
 
             cache0.Put(key0, key0);
             cache0.Put(key1, key1);
-            cache.Get(key0);
+            cache.Get(key0); 
             cache.Get(key1);
+            Assert.IsTrue(cache0.ContainsKey(key0));
+            Assert.IsTrue(cache0.ContainsKey(key1));
+            Thread.Sleep(200);
             Assert.IsFalse(cache0.ContainsKey(key0));
             Assert.IsFalse(cache0.ContainsKey(key1));
+        }
+        
+        /// <summary>
+        /// Expiry policy tests for zero and negative expiry values.
+        /// </summary>
+        [Test]
+        [Ignore("IGNITE-1423")]
+        public void TestWithExpiryPolicyZeroNegative()
+        {
+            ICache<int, int> cache0 = Cache(0);
+            
+            int key0;
+            int key1;
 
-            cache0.RemoveAll(new List<int> { key0, key1 });
+            if (LocalCache())
+            {
+                key0 = 0;
+                key1 = 1;
+            }
+            else
+            {
+                key0 = PrimaryKeyForCache(cache0);
+                key1 = PrimaryKeyForCache(Cache(1));
+            }
 
-            // Test negative expiration.
-            cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.FromMilliseconds(-100),

-                TimeSpan.FromMilliseconds(-100), TimeSpan.FromMilliseconds(-100)));
+            var cache = cache0.WithExpiryPolicy(new ExpiryPolicy(null, null, null));
+
+            // Test zero expiration.
+            cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.Zero, TimeSpan.Zero,
TimeSpan.Zero));
 
             cache.Put(key0, key0);
             cache.Put(key1, key1);
@@ -988,37 +1019,32 @@ namespace Apache.Ignite.Core.Tests.Cache
 
             cache0.RemoveAll(new List<int> { key0, key1 });
 
-            // Test regular expiration.
-            cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.FromMilliseconds(100),
-                TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(100)));
+            // Test negative expiration.
+            cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.FromMilliseconds(-100),

+                TimeSpan.FromMilliseconds(-100), TimeSpan.FromMilliseconds(-100)));
 
             cache.Put(key0, key0);
             cache.Put(key1, key1);
-            Assert.IsTrue(cache0.ContainsKey(key0));
-            Assert.IsTrue(cache0.ContainsKey(key1));
-            Thread.Sleep(200);
             Assert.IsFalse(cache0.ContainsKey(key0));
             Assert.IsFalse(cache0.ContainsKey(key1));
 
             cache0.Put(key0, key0);
             cache0.Put(key1, key1);
-            cache.Put(key0, key0 + 1);
-            cache.Put(key1, key1 + 1);
             Assert.IsTrue(cache0.ContainsKey(key0));
             Assert.IsTrue(cache0.ContainsKey(key1));
-            Thread.Sleep(200);
+            cache.Put(key0, key0 + 1);
+            cache.Put(key1, key1 + 1);
             Assert.IsFalse(cache0.ContainsKey(key0));
             Assert.IsFalse(cache0.ContainsKey(key1));
 
             cache0.Put(key0, key0);
             cache0.Put(key1, key1);
-            cache.Get(key0); 
+            cache.Get(key0);
             cache.Get(key1);
-            Assert.IsTrue(cache0.ContainsKey(key0));
-            Assert.IsTrue(cache0.ContainsKey(key1));
-            Thread.Sleep(200);
             Assert.IsFalse(cache0.ContainsKey(key0));
             Assert.IsFalse(cache0.ContainsKey(key1));
+
+            cache0.RemoveAll(new List<int> { key0, key1 });
         }
 
         [Test]


Mime
View raw message