Added a test for DIRSERVER-2371
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 47ebf6f..30edeb2 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
@@ -259,6 +259,32 @@
 
 
     @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
     {
         SearchControls controls = new SearchControls();