You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2014/01/06 17:18:45 UTC

svn commit: r1555885 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthenticationTest.java

Author: reschke
Date: Mon Jan  6 16:18:45 2014
New Revision: 1555885

URL: http://svn.apache.org/r1555885
Log:
JCR-3710: occasional test failures in TokenBasedAuthenticationTest

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthenticationTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthenticationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthenticationTest.java?rev=1555885&r1=1555884&r2=1555885&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthenticationTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthenticationTest.java Mon Jan  6 16:18:45 2014
@@ -73,15 +73,20 @@ public class TokenBasedAuthenticationTes
         token = tokenCreds.getToken();
         tokenNode = TokenProvider.getTokenNode(token, adminSession);
 
-        tp = new TokenProvider(adminSession, 1);
+        long ttl = 1; // 1ms expiration
+        tp = new TokenProvider(adminSession, ttl);
         TokenInfo expired = tp.createToken(testUser, sc);
         expiredCreds = expired.getCredentials();
         expiredToken = expiredCreds.getToken();
+        long tokenWillExpireAfter = System.currentTimeMillis() + ttl;
         expiredNode = TokenProvider.getTokenNode(expiredToken, adminSession);
 
         nullTokenAuth = new TokenBasedAuthentication(null, -1, adminSession);
         validTokenAuth = new TokenBasedAuthentication(token, 7200, adminSession);
 
+        while (System.currentTimeMillis() <= tokenWillExpireAfter) {
+            // wait until the token is actually expired
+        }
     }
 
     @Override