directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r493601 - in /directory/trunks/shared/ldap/src: main/antlr/filter-parser.g test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java
Date Sat, 06 Jan 2007 23:44:53 GMT
Author: seelmann
Date: Sat Jan  6 15:44:52 2007
New Revision: 493601

URL: http://svn.apache.org/viewvc?view=rev&rev=493601
Log:
Fix for DIRSERVER-813, added test

Modified:
    directory/trunks/shared/ldap/src/main/antlr/filter-parser.g
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java

Modified: directory/trunks/shared/ldap/src/main/antlr/filter-parser.g
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/antlr/filter-parser.g?view=diff&rev=493601&r1=493600&r2=493601
==============================================================================
--- directory/trunks/shared/ldap/src/main/antlr/filter-parser.g (original)
+++ directory/trunks/shared/ldap/src/main/antlr/filter-parser.g Sat Jan  6 15:44:52 2007
@@ -182,7 +182,7 @@
       {
           children.add( child );
       }
-    )+
+    )*
     {
         node = new BranchNode( AssertionEnum.AND, children );
     }
@@ -207,7 +207,7 @@
       {
           children.add( child );
       }
-    )+
+    )*
     {
         node = new BranchNode( AssertionEnum.OR, children );
     }

Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java?view=diff&rev=493601&r1=493600&r2=493601
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java
(original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/filter/FilterParserImplTest.java
Sat Jan  6 15:44:52 2007
@@ -74,6 +74,14 @@
     }
 
 
+    public void testAndFilterOneChildOnly() throws IOException, ParseException
+    {
+        BranchNode node = ( BranchNode ) parser.parse( "(& ( ou ~= people ) ) " );
+        assertEquals( 1, node.getChildren().size() );
+        assertEquals( AssertionEnum.AND, node.getOperator() );
+    }
+
+
     public void testOrFilter() throws IOException, ParseException
     {
         BranchNode node = ( BranchNode ) parser.parse( "(| ( ou ~= people ) (age>=30)
) " );
@@ -82,6 +90,14 @@
     }
 
 
+    public void testOrFilterOneChildOnly() throws IOException, ParseException
+    {
+        BranchNode node = ( BranchNode ) parser.parse( "(| (age>=30) ) " );
+        assertEquals( 1, node.getChildren().size() );
+        assertEquals( AssertionEnum.OR, node.getOperator() );
+    }
+
+
     public void testNotFilter() throws IOException, ParseException
     {
         BranchNode node = ( BranchNode ) parser.parse( "( ! (& ( ou ~= people ) (age>=30)
) )" );
@@ -180,11 +196,11 @@
         try
         {
             parser.parse( "ou = people" );
-            
+
             // The parsing should fail
             fail( "should fail with bad filter" );
         }
-        catch( ParseException pe )
+        catch ( ParseException pe )
         {
         }
     }



Mime
View raw message