directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r961772 - in /directory: apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/
Date Thu, 08 Jul 2010 14:04:10 GMT
Author: kayyagari
Date: Thu Jul  8 14:04:10 2010
New Revision: 961772

URL: http://svn.apache.org/viewvc?rev=961772&view=rev
Log:
o added a new method to get SearchResultDone message from the SearchCursor
o updated a test case to test the above change

Modified:
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java?rev=961772&r1=961771&r2=961772&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
Thu Jul  8 14:04:10 2010
@@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.directory.ldap.client.api.LdapAsyncConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
+import org.apache.directory.ldap.client.api.SearchCursor;
 import org.apache.directory.ldap.client.api.future.SearchFuture;
 import org.apache.directory.ldap.client.api.message.SearchRequest;
 import org.apache.directory.ldap.client.api.message.SearchResponse;
@@ -43,6 +44,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -113,8 +115,7 @@ public class ClientSearchRequestTest ext
     @Test
     public void testSearch() throws Exception
     {
-        Cursor<SearchResponse> cursor = connection.search( "ou=system", "(objectclass=*)",
SearchScope.ONELEVEL, "*",
-            "+" );
+        SearchCursor cursor = ( SearchCursor ) connection.search( "ou=system", "(objectclass=*)",
SearchScope.ONELEVEL, "*", "+" );
         int count = 0;
         while ( cursor.next() )
         {
@@ -122,6 +123,10 @@ public class ClientSearchRequestTest ext
             count++;
         }
 
+        SearchResultDone done = cursor.getSearchDone();
+        
+        assertNotNull( done );
+        assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
         assertEquals( 5, count );
     }
     

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java?rev=961772&r1=961771&r2=961772&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java
(original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/SearchCursor.java
Thu Jul  8 14:04:10 2010
@@ -55,6 +55,9 @@ public class SearchCursor extends Abstra
 
     private boolean done;
 
+    /** a reference to hold the SearchResultDone response */
+    private SearchResultDone searchDoneResp;
+    
     public SearchCursor( SearchFuture future, long timeout, TimeUnit timeUnit )
     {
         this.future = future;
@@ -109,6 +112,7 @@ public class SearchCursor extends Abstra
 
         if ( done )
         {
+            searchDoneResp = ( SearchResultDone ) response;
             response = null;
         }
 
@@ -127,6 +131,17 @@ public class SearchCursor extends Abstra
     }
 
 
+    /**
+     * gives the SearchResultDone message received at the end of search results
+     * 
+     * @return the SearchResultDone message, null if the search operation fails for any reason

+     */
+    public SearchResultDone getSearchDone()
+    {
+        return searchDoneResp;
+    }
+    
+    
     public boolean isElementReused()
     {
         return true;



Mime
View raw message