directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1643503 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/ core-integ/src/test/java/org/apache/directory/server/core/operations/search/
Date Sat, 06 Dec 2014 08:56:52 GMT
Author: kayyagari
Date: Sat Dec  6 08:56:52 2014
New Revision: 1643503

URL: http://svn.apache.org/r1643503
Log:
o added the controls and non-null result from SearchRequest
o removed @Ignore

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java?rev=1643503&r1=1643502&r2=1643503&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/EntryToResponseCursor.java
Sat Dec  6 08:56:52 2014
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
 
 
 import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.directory.api.ldap.model.constants.Loggers;
 import org.apache.directory.api.ldap.model.cursor.AbstractCursor;
@@ -31,10 +32,14 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.cursor.SearchCursor;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.IntermediateResponse;
+import org.apache.directory.api.ldap.model.message.LdapResult;
 import org.apache.directory.api.ldap.model.message.Referral;
 import org.apache.directory.api.ldap.model.message.Response;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.api.ldap.model.message.ResultResponse;
+import org.apache.directory.api.ldap.model.message.SearchRequest;
 import org.apache.directory.api.ldap.model.message.SearchResultDone;
 import org.apache.directory.api.ldap.model.message.SearchResultDoneImpl;
 import org.apache.directory.api.ldap.model.message.SearchResultEntry;
@@ -69,14 +74,17 @@ public class EntryToResponseCursor exten
     /** The messsage ID */
     private int messageId;
 
+    /** The search request */
+    private SearchRequest searchRequest;
 
-    public EntryToResponseCursor( int messageId, Cursor<Entry> wrapped )
+    public EntryToResponseCursor( SearchRequest searchRequest, int messageId, Cursor<Entry>
wrapped )
     {
         if ( IS_DEBUG )
         {
             LOG_CURSOR.debug( "Creating EntryToResponseCursor {}", this );
         }
 
+        this.searchRequest = searchRequest;
         this.wrapped = wrapped;
         this.messageId = messageId;
     }
@@ -222,7 +230,30 @@ public class EntryToResponseCursor exten
         if ( !next )
         {
             searchDoneResp = new SearchResultDoneImpl( messageId );
-            searchDoneResp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+            
+            ResultCodeEnum re = ResultCodeEnum.SUCCESS;
+            
+            ResultResponse processedResp = searchRequest.getResultResponse();
+            LdapResult filledResult = processedResp.getLdapResult();
+            
+            if ( filledResult.getResultCode() != re )
+            {
+                re = filledResult.getResultCode();
+            }
+            
+            searchDoneResp.getLdapResult().setResultCode( re );
+            
+            Map<String,Control> ctrls = processedResp.getControls();
+            
+            if ( ctrls != null )
+            {
+                Iterator<Control> itr = ctrls.values().iterator();
+                while ( itr.hasNext() )
+                {
+                    searchDoneResp.addControl( itr.next() );
+                }
+            }
+            
             done = true;
         }
 

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java?rev=1643503&r1=1643502&r2=1643503&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
Sat Dec  6 08:56:52 2014
@@ -1001,14 +1001,14 @@ public class LdapCoreSessionConnection e
             entryCursor.beforeFirst();
 
             //TODO enforce the size and time limits, similar in the way SearchHandler does
-            return new EntryToResponseCursor( newId, entryCursor );
+            return new EntryToResponseCursor( searchRequest, newId, entryCursor );
         }
         catch ( Exception e )
         {
             LOG.warn( e.getMessage(), e );
         }
 
-        return new EntryToResponseCursor( -1, new EmptyCursor<Entry>() );
+        return new EntryToResponseCursor( searchRequest, -1, new EmptyCursor<Entry>()
);
     }
 
 

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java?rev=1643503&r1=1643502&r2=1643503&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
Sat Dec  6 08:56:52 2014
@@ -54,7 +54,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.IntegrationUtils;
 import org.junit.AfterClass;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -124,7 +123,6 @@ public class SortedSearchIT extends Abst
      * @throws Exception
      */
     @Test
-    @Ignore
     public void testWithInvalidAttributeAndCriticality() throws Exception
     {
         sk.setAttributeTypeDesc( "Non-existing-At" );
@@ -152,7 +150,6 @@ public class SortedSearchIT extends Abst
      * @throws Exception
      */
     @Test
-    @Ignore
     public void testWithInvalidAttributeAndNoCriticality() throws Exception
     {
         sk.setAttributeTypeDesc( "Non-existing-At" );



Mime
View raw message