usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject usergrid git commit: Add some buffering to the permissions cache tests in case a slow c* cluster is being used.
Date Wed, 30 Dec 2015 06:10:05 GMT
Repository: usergrid
Updated Branches:
  refs/heads/master fadad9ec9 -> 2867d26d6


Add some buffering to the permissions cache tests in case a slow c* cluster is being used.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/2867d26d
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/2867d26d
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/2867d26d

Branch: refs/heads/master
Commit: 2867d26d681b4ba8d868066117302cc0a4494cbb
Parents: fadad9e
Author: Michael Russo <michaelarusso@gmail.com>
Authored: Tue Dec 29 22:09:29 2015 -0800
Committer: Michael Russo <michaelarusso@gmail.com>
Committed: Tue Dec 29 22:09:29 2015 -0800

----------------------------------------------------------------------
 .../usergrid/persistence/cache/ScopedCacheTest.java  | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/2867d26d/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java
b/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java
index 73cffe1..3ec6f6a 100644
--- a/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java
+++ b/stack/corepersistence/cache/src/test/java/org/apache/usergrid/persistence/cache/ScopedCacheTest.java
@@ -132,18 +132,22 @@ public class ScopedCacheTest {
         ScopedCache<String, Map<String, Object>> cache = cf.getScopedCache(scope);
         assertNotNull("should get a cache", cache);
 
-        // cache item for 1 second
+        // cache item for 3 seconds
+        final int timeout = 3000;
 
         Map<String, Object> item = new HashMap<String, Object>() {{
             put("field1", "value1");
         }};
-        cache.put("item", item, 1);
+        cache.put("item", item, timeout/1000);
+
+        // in the event that the tests have slowed c*, sleep some to ensure the write has
committed
+        try { Thread.sleep(500); } catch (InterruptedException ignored) {}
 
         Map<String, Object> retrievedItem = cache.get("item", typeRef);
         assertNotNull("should get back item", retrievedItem);
         assertEquals("value1", retrievedItem.get("field1"));
 
-        try { Thread.sleep(1000); } catch (InterruptedException ignored) {}
+        try { Thread.sleep(timeout); } catch (InterruptedException ignored) {}
 
         assertNull( cache.get("item", typeRef));
     }
@@ -155,12 +159,13 @@ public class ScopedCacheTest {
         ScopedCache<String, Map<String, Object>> cache = cf.getScopedCache(scope);
         assertNotNull("should get a cache", cache);
 
-        // cache item for 1 second
+        // cache item for 3 seconds
+        final int timeout = 3000;
 
         Map<String, Object> item = new HashMap<String, Object>() {{
             put("field1", "value1");
         }};
-        cache.put("item", item, 1);
+        cache.put("item", item, timeout/1000);
 
         Map<String, Object> retrievedItem = cache.get("item", typeRef);
         assertNotNull( "should get back item", retrievedItem );


Mime
View raw message