directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r905693 - /directory/clients/ldap/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
Date Tue, 02 Feb 2010 16:30:35 GMT
Author: kayyagari
Date: Tue Feb  2 16:30:20 2010
New Revision: 905693

URL: http://svn.apache.org/viewvc?rev=905693&view=rev
Log:
fixed the testAsyncBindRequest

Modified:
    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-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=905693&r1=905692&r2=905693&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
Tue Feb  2 16:30:20 2010
@@ -26,6 +26,7 @@
 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;
@@ -113,12 +114,13 @@
      * Test a successful asynchronous bind request, 10 times.
      */
     @Test
-    @Ignore
     public void testAsyncBindRequest() throws Exception
     {
         int i = 0;
         int nbLoop = 10;
 
+        final Semaphore lock = new Semaphore( 2 );
+        
         for ( ; i < nbLoop; i++)
         {
             BindRequest bindRequest = new BindRequest();
@@ -126,7 +128,9 @@
             bindRequest.setCredentials( "secret" );
             final int loop = i;
 
-            BindFuture bindFuture = connection.bind( bindRequest, new BindListener()
+            lock.acquire();
+            
+            connection.bind( bindRequest, new BindListener()
             {
                 public void bindCompleted( LdapConnection connection, BindResponse bindResponse
) throws LdapException
                 {
@@ -134,14 +138,9 @@
                     assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode()
);
                     assertEquals( 1, bindResponse.getMessageId() );
                     System.out.println( "Bound " + loop );
+                    lock.release();
                 }
             } );
-            
-            Response bindResponse = (Response)bindFuture.get();
-            bindResponse.wait();
-            assertTrue( connection.isAuthenticated() );
-
-            connection.unBind();
         }
     }
     



Mime
View raw message