directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r158968 - directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
Date Thu, 24 Mar 2005 23:48:09 GMT
Author: akarasulu
Date: Thu Mar 24 15:48:06 2005
New Revision: 158968

URL: http://svn.apache.org/viewcvs?view=rev&rev=158968
Log:
trying to reproduce bug posted to jira: http://issues.apache.org/jira/browse/DIRLDAP-38 but
cannot

Modified:
    directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java

Modified: directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java?view=diff&r1=158967&r2=158968
==============================================================================
--- directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
(original)
+++ directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
Thu Mar 24 15:48:06 2005
@@ -574,6 +574,65 @@
     }
 
 
+    /** Filter From http://issues.apache.org/jira/browse/DIRLDAP-38 */
+    public static final String REARRANGING_FILTER = "(& (a=A) (| (b=B) (c=C) ) )";
+
+
+    /**
+     * Test case for problem described in http://issues.apache.org/jira/browse/DIRLDAP-38.
+     *
+     * @throws IOException when parser cannot form pipe
+     * @throws ParseException when parsing bad input
+     */
+    public void testFilterRearrangement() throws IOException, ParseException
+    {
+//        From http://issues.apache.org/jira/browse/DIRLDAP-38
+//
+//        (& (a=A) (| (b=B) (c=C) ) )
+//
+//        The resulting expression object after the BER parser is finished is:
+//
+//        (& (| (c=C) (b=B) (a=A) ) )
+
+        // let's just try printing out first using a standard visitor
+
+        FilterParserImpl parser = new FilterParserImpl();
+
+        ExprNode rootNode = parser.parse( REARRANGING_FILTER );
+
+        StringBuffer buf = new StringBuffer();
+
+        rootNode.printToBuffer( buf );
+
+        String regenerated = buf.toString().trim();
+
+        assertEquals( REARRANGING_FILTER, regenerated );
+
+        System.err.println( regenerated );
+
+        // let's now try normalizing then printing out: start with fresh stuff
+
+        parser = new FilterParserImpl();
+
+        rootNode = parser.parse( REARRANGING_FILTER );
+
+        buf = new StringBuffer();
+
+        BranchNormalizedVisitor visitor = new BranchNormalizedVisitor();
+
+        visitor.visit( rootNode );
+
+        rootNode.printToBuffer( buf );
+
+        regenerated = buf.toString().trim();
+
+        assertEquals( REARRANGING_FILTER, regenerated );
+
+        System.err.println( regenerated );
+
+    }
+
+
     /* @todo look at custom error handlers for the parser */
     /////// Causes parser to hang rather than really bombing out.  Looks like
     /////// we may need to implement a custom error handler for this parser.



Mime
View raw message