directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1785432 - /directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.java
Date Sat, 04 Mar 2017 06:53:04 GMT
Author: elecharny
Date: Sat Mar  4 06:53:04 2017
New Revision: 1785432

URL: http://svn.apache.org/viewvc?rev=1785432&view=rev
Log:
Added a test to check that special filter chars are handled correctly

Modified:
    directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.java

Modified: directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.java?rev=1785432&r1=1785431&r2=1785432&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.java
(original)
+++ directory/shared/branches/shared-value/ldap/model/src/test/java/org/apache/directory/api/ldap/model/filter/FilterParserTest.java
Sat Mar  4 06:53:04 2017
@@ -29,6 +29,7 @@ import static org.junit.Assert.fail;
 import java.nio.charset.StandardCharsets;
 import java.text.ParseException;
 import java.util.List;
+import java.util.Locale;
 
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
@@ -1157,4 +1158,17 @@ public class FilterParserTest
         assertTrue( child instanceof PresenceNode );
         assertEquals( "cn", ((PresenceNode)child).attribute );
     }
+    
+    
+    @Test
+    public void testFilterWithSpecialChars() throws ParseException
+    {
+        String filterStr = String.format( Locale.ROOT, "(%s=%s)", "cn", FilterEncoder.encodeFilterValue(
"ACME(tm)" ) );
+        
+        assertEquals( "(cn=ACME\\28tm\\29)", filterStr );
+        
+        String filterStr2 = new EqualityNode<>( "cn", "ACME(tm)" ).toString();
+        
+        assertEquals( "(cn=ACME\\28tm\\29)", filterStr2 );
+    }
 }



Mime
View raw message