Update of /var/cvs/tests/cloudcontext/org/mmbase/security/cloudcontext
In directory james.mmbase.org:/tmp/cvs-serv20395

Modified Files:
        CloudContext.java 
Log Message:
centralized the 'sleeps' to a method (which can be eaisly replaced by an actual 
wait()


See also: 
http://cvs.mmbase.org/viewcvs/tests/cloudcontext/org/mmbase/security/cloudcontext


Index: CloudContext.java
===================================================================
RCS file: 
/var/cvs/tests/cloudcontext/org/mmbase/security/cloudcontext/CloudContext.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- CloudContext.java   16 Dec 2008 18:45:33 -0000      1.9
+++ CloudContext.java   22 Dec 2008 11:29:32 -0000      1.10
@@ -16,6 +16,7 @@
 import org.mmbase.bridge.*;
 import org.mmbase.bridge.util.SearchUtil;
 import org.mmbase.util.functions.Parameters;
+import org.mmbase.security.implementation.cloudcontext.Caches;
 
 /**
  *
@@ -34,6 +35,13 @@
         }
     }
 
+    protected void waitForCache() {
+        //Caches.waitForCacheInvalidation();
+        Thread.sleep(10000);
+
+    }
+
+
     public void testImplementation() {
         
assertEquals(org.mmbase.security.implementation.cloudcontext.Authenticate.class,
 
                      
getCloud().getCloudContext().getAuthentication().getClass());
@@ -176,8 +184,7 @@
 
         //assertFalse(cloud.getUser().isValid());
 
-        // a certain latency is allowed
-        Thread.sleep(5000);
+        waitForCache();
 
         // now foo should be allowed to create new contexts
         cloud = getCloud("foo");
@@ -200,7 +207,8 @@
 
         assertTrue(contextNode.getFunctionValue("revoke", params).toBoolean());
         // a certain latency is allowed
-        Thread.sleep(5000);
+
+        waitForCache();
 
         // now foo should be disallowed to create new contexts again
         cloud = getCloud("foo");
@@ -227,7 +235,7 @@
 
         assertTrue(contextNode.getFunctionValue("grant", params).toBoolean());
         // a certain latency is allowed
-        Thread.sleep(10000); // TODO
+        waitForCache();
         // now foo should be allowed to create new contexts again, because is 
in the 'users' group
         Cloud cloud = getCloud("foo");
         assertTrue(cloud.getNodeManager("mmbasecontexts").mayCreateNode());
@@ -249,7 +257,7 @@
 
         assertTrue(contextNode.getFunctionValue("revoke", params).toBoolean());
         // a certain latency is allowed
-        Thread.sleep(10000); // TODO
+        waitForCache();
 
         // now foo should be disallowed to create new contexts again
         Cloud cloud = getCloud("foo");
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to