directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r905862 - in /directory/clients/ldap/trunk: ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
Date Wed, 03 Feb 2010 01:38:28 GMT
Author: elecharny
Date: Wed Feb  3 01:38:28 2010
New Revision: 905862

URL: http://svn.apache.org/viewvc?rev=905862&view=rev
Log:
o Closed the connection when doing an Unbind
o Fixed the Bind tests 

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

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=905862&r1=905861&r2=905862&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
(original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
Wed Feb  3 01:38:28 2010
@@ -1053,6 +1053,8 @@
         }
         catch ( Exception ie )
         {
+            ie.printStackTrace();
+            
             // Catch all other exceptions
             LOG.error( NO_RESPONSE_ERROR, ie );
             LdapException ldapException = new LdapException( NO_RESPONSE_ERROR );
@@ -1468,9 +1470,11 @@
         WriteFuture unbindFuture = ldapSession.write( unbindMessage );
 
         unbindFuture.awaitUninterruptibly();
+        
+        authenticated = false;
 
         //  We now have to close the connection
-        //close();
+        close();
 
         // And get out
         LOG.debug( "Unbind successful" );

Modified: directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java?rev=905862&r1=905861&r2=905862&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
(original)
+++ directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
Wed Feb  3 01:38:28 2010
@@ -25,17 +25,14 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import java.io.IOException;
 import java.util.concurrent.Semaphore;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.exception.LdapException;
-import org.apache.directory.ldap.client.api.future.BindFuture;
 import org.apache.directory.ldap.client.api.listener.BindListener;
 import org.apache.directory.ldap.client.api.message.BindRequest;
 import org.apache.directory.ldap.client.api.message.BindResponse;
 import org.apache.directory.ldap.client.api.message.LdapResult;
-import org.apache.directory.ldap.client.api.message.Response;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
@@ -43,7 +40,6 @@
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -83,9 +79,12 @@
     {
         try
         {
-            connection.close();
+            if ( connection != null )
+            {
+                connection.unBind();
+            }
         }
-        catch( IOException ioe )
+        catch( Exception ioe )
         {
             fail();
         }
@@ -105,8 +104,6 @@
         assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode()
);
         assertEquals( 1, bindResponse.getMessageId() );
         assertTrue( connection.isAuthenticated() );
-
-        connection.unBind();
     }
 
     
@@ -149,7 +146,6 @@
      * Test an Anonymous BindRequest
      */
     @Test
-    @Ignore
     public void testSimpleBindAnonymous() throws Exception
     {
         // Try with no parameters
@@ -162,8 +158,10 @@
         assertTrue( connection.isAuthenticated() );
 
         connection.unBind();
+        assertFalse( connection.isConnected() );
 
         // Try with empty strings
+        connection = new LdapConnection( "localhost", ldapServer.getPort() );
         bindResponse = connection.bind( "", "" );
         
         assertNotNull( bindResponse );
@@ -173,8 +171,10 @@
         assertTrue( connection.isAuthenticated() );
 
         connection.unBind();
+        assertFalse( connection.isConnected() );
 
         // Try with null parameters
+        connection = new LdapConnection( "localhost", ldapServer.getPort() );
         bindResponse = connection.bind( (String)null, (String)null );
         
         assertNotNull( bindResponse );
@@ -182,8 +182,6 @@
         assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode()
);
         assertEquals( 1, bindResponse.getMessageId() );
         assertTrue( connection.isAuthenticated() );
-
-        connection.unBind();
     }
 
     
@@ -212,7 +210,6 @@
         assertEquals( ResultCodeEnum.UNWILLING_TO_PERFORM, ldapResult.getResultCode() );
         assertEquals( 1, response.getMessageId() );
         assertFalse( connection.isAuthenticated() );
-
     }
 
     
@@ -227,8 +224,6 @@
         assertEquals( ResultCodeEnum.SUCCESS, ldapResult.getResultCode() );
         assertEquals( 1, response.getMessageId() );
         assertTrue( connection.isAuthenticated() );
-
-        connection.unBind();
     }
 
     



Mime
View raw message