directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r513440 - in /directory/apacheds/branches/1.0: core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java
Date Thu, 01 Mar 2007 19:05:15 GMT
Author: akarasulu
Date: Thu Mar  1 11:05:14 2007
New Revision: 513440

URL: http://svn.apache.org/viewvc?view=rev&rev=513440
Log:
fixing bug noted with subtree search and the negation operator

Modified:
    directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
    directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java

Modified: directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java?view=diff&rev=513440&r1=513439&r2=513440
==============================================================================
--- directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
(original)
+++ directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
Thu Mar  1 11:05:14 2007
@@ -107,10 +107,15 @@
      *  Convenience method that performs a one level search using the 
      *  specified filter returning their DNs as Strings in a set.
      */
-    public Set searchGroups( String filter ) throws NamingException
+    public Set searchGroups( String filter, SearchControls controls ) throws NamingException
     {
+        if ( controls == null )
+        {
+            controls = new SearchControls();
+        }
+        
         Set results = new HashSet();
-        NamingEnumeration list = sysRoot.search( "ou=groups", filter, new SearchControls()
);
+        NamingEnumeration list = sysRoot.search( "ou=groups", filter, controls );
         while( list.hasMore() )
         {
             SearchResult result = ( SearchResult ) list.next();
@@ -120,6 +125,16 @@
     }
     
     
+    /**
+     *  Convenience method that performs a one level search using the 
+     *  specified filter returning their DNs as Strings in a set.
+     */
+    public Set searchGroups( String filter ) throws NamingException
+    {
+        return searchGroups( filter, null );
+    }
+    
+    
     public void testSetup() throws Exception
     {
         Set results = searchGroups( "(objectClass=posixGroup)" );
@@ -295,6 +310,21 @@
     public void testNotOperator() throws NamingException
     {
         Set results = searchGroups( "(!(gidNumber=4))" );
+        assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
+        assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
+        assertTrue( results.contains( "cn=testGroup2,ou=groups,ou=system" ) );
+        assertFalse( results.contains( "cn=testGroup3,ou=groups,ou=system" ) );
+        assertFalse( results.contains( "cn=testGroup4,ou=groups,ou=system" ) );
+        assertTrue( results.contains( "cn=testGroup5,ou=groups,ou=system" ) );
+    }
+    
+    
+    public void testNotOperatorSubtree() throws NamingException
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        
+        Set results = searchGroups( "(!(gidNumber=4))", controls );
         assertTrue( results.contains( "cn=testGroup0,ou=groups,ou=system" ) );
         assertTrue( results.contains( "cn=testGroup1,ou=groups,ou=system" ) );
         assertTrue( results.contains( "cn=testGroup2,ou=groups,ou=system" ) );

Modified: directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java?view=diff&rev=513440&r1=513439&r2=513440
==============================================================================
--- directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java
(original)
+++ directory/apacheds/branches/1.0/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java
Thu Mar  1 11:05:14 2007
@@ -183,8 +183,16 @@
         if ( node.getChild().isLeaf() )
         {
             LeafNode child = ( LeafNode ) node.getChild();
-            idx = db.getUserIndex( child.getAttribute() );
-            childEnumeration = idx.listIndices();
+            
+            if ( db.hasUserIndexOn( child.getAttribute() ) )
+            {
+                idx = db.getUserIndex( child.getAttribute() );
+                childEnumeration = idx.listIndices();
+            }
+            else
+            {
+                childEnumeration = db.getNdnIndex().listIndices();
+            }
         }
         // Iterates over the entire set of entries
         else



Mime
View raw message