directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r764693 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
Date Tue, 14 Apr 2009 07:27:55 GMT
Author: seelmann
Date: Tue Apr 14 07:27:55 2009
New Revision: 764693

URL: http://svn.apache.org/viewvc?rev=764693&view=rev
Log:
DIRSERVER-1347: fixed with DIRSERVER-1247, added an additional test

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

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java?rev=764693&r1=764692&r2=764693&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
Tue Apr 14 07:27:55 2009
@@ -1481,4 +1481,66 @@
         assertEquals( "x*y*z*", res.next().getAttributes().get( "cn" ).get() );
         assertFalse( res.hasMore() );
     }
+
+
+    /**
+     * Test for DIRSERVER-1347: Unicode characters in filter value.
+     */
+    @Test
+    public void testUnicodeFilter_DIRSERVER_1347() throws Exception
+    {
+        LdapContext ctx = ( LdapContext ) getWiredContext( ldapService ).lookup( BASE );
+
+        Attributes groupOfNames = new BasicAttributes( true );
+        Attribute groupOfNamesOC = new BasicAttribute( "objectClass" );
+        groupOfNamesOC.add( "top" );
+        groupOfNamesOC.add( "groupOfNames" );
+        groupOfNames.put( groupOfNamesOC );
+        groupOfNames.put( "cn", "groupOfNames" );
+        Attribute member = new BasicAttribute( "member" );
+        member.add( "uid=test,ou=system" );
+        member.add( "uid=r\u00e9dacteur1,ou=system" );
+        groupOfNames.put( member );
+        ctx.createSubcontext( "cn=groupOfNames", groupOfNames );
+
+        Attributes groupOfUniqueNames = new BasicAttributes( true );
+        Attribute groupOfUniqueNamesOC = new BasicAttribute( "objectClass" );
+        groupOfUniqueNamesOC.add( "top" );
+        groupOfUniqueNamesOC.add( "groupOfUniqueNames" );
+        groupOfUniqueNames.put( groupOfUniqueNamesOC );
+        groupOfUniqueNames.put( "cn", "groupOfUniqueNames" );
+        Attribute uniqueMember = new BasicAttribute( "uniqueMember" );
+        uniqueMember.add( "uid=test,ou=system" );
+        uniqueMember.add( "uid=r\u00e9dacteur1,ou=system" );
+        groupOfUniqueNames.put( uniqueMember );
+        ctx.createSubcontext( "cn=groupOfUniqueNames", groupOfUniqueNames );
+
+        SearchControls controls = new SearchControls();
+        NamingEnumeration<SearchResult> res;
+
+        // search with unicode filter value
+        res = ctx.search( "", "(member=uid=r\u00e9dacteur1,ou=system)", controls );
+        assertTrue( res.hasMore() );
+        assertEquals( "groupOfNames", res.next().getAttributes().get( "cn" ).get() );
+        assertFalse( res.hasMore() );
+
+        // search with escaped filter value
+        res = ctx.search( "", "(member=uid=r\\c3\\a9dacteur1,ou=system)", controls );
+        assertTrue( res.hasMore() );
+        assertEquals( "groupOfNames", res.next().getAttributes().get( "cn" ).get() );
+        assertFalse( res.hasMore() );
+
+        // search with unicode filter value
+        res = ctx.search( "", "(uniqueMember=uid=r\u00e9dacteur1,ou=system)", controls );
+        assertTrue( res.hasMore() );
+        assertEquals( "groupOfUniqueNames", res.next().getAttributes().get( "cn" ).get()
);
+        assertFalse( res.hasMore() );
+
+        // search with escaped filter value
+        res = ctx.search( "", "(uniqueMember=uid=r\\c3\\a9dacteur1,ou=system)", controls
);
+        assertTrue( res.hasMore() );
+        assertEquals( "groupOfUniqueNames", res.next().getAttributes().get( "cn" ).get()
);
+        assertFalse( res.hasMore() );
+    }
+
 }



Mime
View raw message