You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2013/04/15 15:34:51 UTC

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

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();
     }