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 2009/05/05 01:28:25 UTC

svn commit: r771497 - /directory/apacheds/branches/apacheds-replication/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java

Author: elecharny
Date: Mon May  4 23:28:24 2009
New Revision: 771497

URL: http://svn.apache.org/viewvc?rev=771497&view=rev
Log:
Added a very simplistic search test

Modified:
    directory/apacheds/branches/apacheds-replication/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java

Modified: directory/apacheds/branches/apacheds-replication/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-replication/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java?rev=771497&r1=771496&r2=771497&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-replication/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java (original)
+++ directory/apacheds/branches/apacheds-replication/ldap-api-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java Mon May  4 23:28:24 2009
@@ -31,7 +31,9 @@
 import org.apache.directory.shared.ldap.client.api.messages.BindRequest;
 import org.apache.directory.shared.ldap.client.api.messages.BindRequestImpl;
 import org.apache.directory.shared.ldap.client.api.messages.BindResponse;
-import org.apache.directory.shared.ldap.client.api.messages.future.BindFuture;
+import org.apache.directory.shared.ldap.client.api.messages.SearchResponse;
+import org.apache.directory.shared.ldap.cursor.Cursor;
+import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -149,4 +151,46 @@
             }
         }
     }
+    
+    /**
+     * Test a simple search request
+     */
+    @Test
+    public void testSearchRequest()
+    {
+        LdapConnection connection = new LdapConnection( "localhost", ldapService.getPort() );
+        
+        try
+        {
+            connection.bind( "uid=admin,ou=system", "secret" );
+            
+            Cursor<SearchResponse> cursor = 
+                connection.search( "uid=admin,ou=system", "(objectClass=*)", SearchScope.SUBTREE, "*" );
+            
+            SearchResponse response = cursor.get();
+            
+            // TODO: check return.
+            
+            connection.unBind();
+        }
+        catch ( LdapException le )
+        {
+            fail();
+        }
+        catch ( Exception e )
+        {
+            fail();
+        }
+        finally
+        {
+            try
+            {
+                connection.close();
+            }
+            catch( IOException ioe )
+            {
+                fail();
+            }
+        }
+    }
 }