You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2010/04/24 19:18:51 UTC

svn commit: r937654 - /directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java

Author: kayyagari
Date: Sat Apr 24 17:18:51 2010
New Revision: 937654

URL: http://svn.apache.org/viewvc?rev=937654&view=rev
Log:
added a test to test the CursorList when a search request on rootDSE goes over wire

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

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java?rev=937654&r1=937653&r2=937654&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java (original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java Sat Apr 24 17:18:51 2010
@@ -27,10 +27,11 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.List;
 
-import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.ldap.client.api.exception.LdapException;
 import org.apache.directory.ldap.client.api.message.BindResponse;
 import org.apache.directory.ldap.client.api.message.SearchResponse;
@@ -41,8 +42,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.cursor.Cursor;
-import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
@@ -194,5 +195,28 @@ public class LdapConnectionTest extends 
         assertTrue( manager.isEnabled( "nis" ) );
         assertEquals( manager.getLoader().getAllSchemas().size(), manager.getEnabled().size() );
     }
+
     
+    /**
+     * this test is intended to test the behavior of CursorList when the RootDSE searchrequest was sent over
+     *  wire 
+     */
+    @Test
+    public void testSearchEmptyDNWithOneLevelScopeAndNoObjectClassPresenceFilter() throws Exception
+    {
+        Cursor<SearchResponse> cursor = connection.search( "", "(objectClass=*)", SearchScope.ONELEVEL, "*", "+" );
+        HashMap<String, Entry> map = new HashMap<String, Entry>();
+        
+        while ( cursor.next() )
+        {
+            Entry result = ( ( SearchResultEntry ) cursor.get() ).getEntry();
+            map.put( result.getDn().getName(), result );
+        }
+
+        assertEquals( 2, map.size() );
+        
+        assertTrue( map.containsKey( "ou=system" ) );
+        assertTrue( map.containsKey( "ou=schema" ) );
+    }
+
 }