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 2022/07/25 12:02:24 UTC

[directory-server] 01/03: Added a test for DIRSERVER-2371

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit 7f9dd6dd50c63e45184a13d4932615f8257a3a92
Author: emmanuel lecharny <el...@apache.org>
AuthorDate: Mon Jul 25 13:53:23 2022 +0200

    Added a test for DIRSERVER-2371
---
 .../server/core/operations/search/SearchIT.java    | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java b/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
index 47ebf6fb2e..30edeb244e 100644
--- a/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
@@ -258,6 +258,32 @@ public class SearchIT extends AbstractLdapTestUnit
     }
 
 
+    @Test
+    public void testSearchWithTop() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        controls.setDerefLinkFlag( false );
+        sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, AliasDerefMode.NEVER_DEREF_ALIASES
+            .getJndiValue() );
+        HashMap<String, Attributes> map = new HashMap<String, Attributes>();
+
+        NamingEnumeration<SearchResult> list = sysRoot.search( "", "(&(objectClass=top)(objectClass=person)"
+            + "(objectClass=organizationalPerson)(objectClass=inetOrgPerson)(cn=si*))", controls );
+
+        while ( list.hasMore() )
+        {
+            SearchResult result = list.next();
+            map.put( result.getName(), result.getAttributes() );
+        }
+
+        list.close();
+
+        assertEquals( 1, map.size(), "Expected number of results returned was incorrect!" );
+        assertTrue( map.containsKey( "cn=with-dn,ou=system" ) );
+    }
+
+
     @Test
     public void testSearchSubTreeLevel() throws Exception
     {