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 2015/04/26 18:16:03 UTC

svn commit: r1676120 - in /directory: apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/ shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/

Author: elecharny
Date: Sun Apr 26 16:16:03 2015
New Revision: 1676120

URL: http://svn.apache.org/r1676120
Log:
o Cancel all the future in the session map when an unbind is sent
o Improve the test that was hanging for ever before (DIRAPI-236)

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java?rev=1676120&r1=1676119&r2=1676120&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java Sun Apr 26 16:16:03 2015
@@ -55,7 +55,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -93,8 +92,7 @@ import org.junit.runner.RunWith;
         "displayName: Directory Superuser",
         "uid: superuser2",
         "userPassword: test1",
-        "userPassword: test2"
-    })
+        "userPassword: test2" })
 public class SimpleBindRequestTest extends AbstractLdapTestUnit
 {
     private LdapAsyncConnection connection;
@@ -631,18 +629,21 @@ public class SimpleBindRequestTest exten
      * @throws Exception
      */
     @Test
-    @Ignore
     public void testUnbindDuringSearch() throws Exception
     {
         connection.bind( "uid=admin, ou=system", "secret" );
 
         assertTrue( connection.isAuthenticated() );
 
-        EntryCursor cursor = connection.search( new Dn( "ou=system" ), "(uid=*)", SearchScope.SUBTREE, "*" );
+        EntryCursor cursor1 = connection.search( new Dn( "ou=system" ), "(uid=*)", SearchScope.SUBTREE, "*" );
+        EntryCursor cursor2 = connection.search( new Dn( "ou=system" ), "(uid=*)", SearchScope.ONELEVEL, "*" );
+        EntryCursor cursor3 = connection.search( new Dn( "ou=system" ), "(ObjectClass=*)", SearchScope.OBJECT, "*" );
 
         connection.unBind();
 
         // this call hangs forever
-        cursor.next();
+        assertFalse( cursor1.next() );
+        assertFalse( cursor2.next() );
+        assertFalse( cursor3.next() );
     }
 }

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1676120&r1=1676119&r2=1676120&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java (original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java Sun Apr 26 16:16:03 2015
@@ -1817,6 +1817,12 @@ public class LdapNetworkConnection exten
 
         authenticated.set( false );
 
+        // Close all the Future for this session
+        for ( ResponseFuture<? extends Response> responseFuture : futureMap.values() )
+        {
+            responseFuture.cancel();
+        }
+
         // clear the mappings
         clearMaps();