directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1468052 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java
Date Mon, 15 Apr 2013 13:34:51 GMT
Author: elecharny
Date: Mon Apr 15 13:34:51 2013
New Revision: 1468052

URL: http://svn.apache.org/r1468052
Log:
Added a test for the pwdMaxIdle parameter

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java?rev=1468052&r1=1468051&r2=1468052&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java
Mon Apr 15 13:34:51 2013
@@ -1127,39 +1127,28 @@ public class PasswordPolicyIT extends Ab
 
 
     /**
-     * Check the minDelay/maxDelay.
+     * Check the maxIdle : if the user does not bind for more than this delay,
+     * the password is locked.
      */
     @Test
-    @Ignore("Failing test atm")
-    public void testPwdMinMaxDelay() throws Exception
+    public void testPwMaxIdle() throws Exception
     {
-        policyConfig.setPwdMinDelay( 2 );
-        policyConfig.setPwdMaxDelay( 16 );
+        policyConfig.setPwdMaxIdle( 5 );
 
         Dn userDn = new Dn( "cn=userLockout4,ou=system" );
         LdapConnection adminConnection = getAdminNetworkConnection( getLdapServer() );
 
         addUser( adminConnection, "userLockout4", "12345" );
 
-        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort()
);
-        userConnection.setTimeOut( 0L );
+        // We should succeed
+        checkBindSuccess( userDn, "12345" );
 
-        // First attempt
-        long t0 = System.currentTimeMillis();
-        long t1 = 0L;
-
-        try
-        {
-            userConnection.bind( userDn, "badPassword" );
-        }
-        catch ( LdapAuthenticationException le )
-        {
-            t0 = System.currentTimeMillis();
-        }
+        // Wait 5 seconds now
+        Thread.sleep( 5000 );
 
-        assertTrue( 1 < ( t1 - t0 ) );
+        // We shpuld not be able to succeed now
+        checkBindFailure( userDn, "12345" );
 
-        userConnection.close();
         adminConnection.close();
     }
 



Mime
View raw message