You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2015/12/30 07:10:05 UTC

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

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 <mi...@gmail.com>
Authored: Tue Dec 29 22:09:29 2015 -0800
Committer: Michael Russo <mi...@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 );