directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r770617 - in /directory/apacheds/trunk: core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
Date Fri, 01 May 2009 10:26:58 GMT
Author: elecharny
Date: Fri May  1 10:26:58 2009
New Revision: 770617

URL: http://svn.apache.org/viewvc?rev=770617&view=rev
Log:
Added a fix for DIRSERVER-1333.

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java?rev=770617&r1=770616&r2=770617&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchIT.java
Fri May  1 10:26:58 2009
@@ -1695,4 +1695,31 @@
        assertEquals( "Expected number of results returned was incorrect", 1, map.size() );
        assertTrue( map.containsKey( "cn=with-dn, ou=system" ) );
    }
+
+
+   @Test
+   public void testComplexFilter() throws Exception
+   {
+       LdapContext sysRoot = getSystemContext( service );
+       createData( sysRoot );
+
+       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>();
+       String filter = "(|(&(|(2.5.4.0=posixgroup)(2.5.4.0=groupofuniquenames)(2.5.4.0=groupofnames)(2.5.4.0=group))(!(|(2.5.4.50=uid=admin,ou=system)(2.5.4.31=0.9.2342.19200300.100.1.1=admin,2.5.4.11=system))))(objectClass=referral))";
+       NamingEnumeration<SearchResult> list = sysRoot.search( "", filter, controls
);
+       
+       while ( list.hasMore() )
+       {
+           SearchResult result = list.next();
+           map.put( result.getName(), result.getAttributes() );
+       }
+       
+       assertEquals( "size of results", 1, map.size() );
+       assertTrue( "contains cn=Administrators,ou=groups,ou=system", map.containsKey( "cn=Administrators,ou=groups,ou=system"
) ); 
+   }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java?rev=770617&r1=770616&r2=770617&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
Fri May  1 10:26:58 2009
@@ -387,15 +387,10 @@
 
             ExprNode result = ( ExprNode ) visit( child );
 
-            if ( result == null )
+            if ( ( result == null ) || ( result instanceof BranchNode ) )
             {
                 return result;
             }
-            else if ( result instanceof BranchNode )
-            {
-                node.setChildren( ( ( BranchNode ) result ).getChildren() );
-                return node;
-            }
             else if ( result instanceof LeafNode )
             {
                 List<ExprNode> newChildren = new ArrayList<ExprNode>( 1 );



Mime
View raw message