directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r420136 - /directory/branches/apacheds/optimization/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
Date Sat, 08 Jul 2006 15:44:22 GMT
Author: elecharny
Date: Sat Jul  8 08:44:22 2006
New Revision: 420136

URL: http://svn.apache.org/viewvc?rev=420136&view=rev
Log:
Added a test for DIRSERVER-642 (searches with surrounding "" in the DN)

Modified:
    directory/branches/apacheds/optimization/server-unit/src/test/java/org/apache/directory/server/SearchTest.java

Modified: directory/branches/apacheds/optimization/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/server-unit/src/test/java/org/apache/directory/server/SearchTest.java?rev=420136&r1=420135&r2=420136&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
(original)
+++ directory/branches/apacheds/optimization/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
Sat Jul  8 08:44:22 2006
@@ -26,6 +26,7 @@
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
 
@@ -91,6 +92,7 @@
         attributes = this.getPersonAttributes( "Jagger", "Rolling-Stones" );
         attributes.put( "description", "an English singer-songwriter" );
         ctx.createSubcontext( RDN2, attributes );
+        
     }
 
 
@@ -192,4 +194,34 @@
         results = ctx.search( RDN2, "(cn=*ri*os)", ctls );
         assertFalse( results.hasMore() );
     }
+    
+    /**
+     * Search operation with a base DN with quotes
+     */
+    public void testSearchWithQuotesInBase() throws NamingException {
+
+        SearchControls sctls = new SearchControls();
+        sctls.setSearchScope(SearchControls.OBJECT_SCOPE);
+        String filter = "(cn=Tori Amos)";
+
+        // sn="Kylie Minogue" (with quotes)
+        String base = "cn=\"Tori Amos\"";
+
+        try {
+            // Check entry
+            NamingEnumeration enm = ctx.search( base, filter, sctls );
+            assertTrue( enm.hasMore() );
+            
+            while ( enm.hasMore() ) {
+                SearchResult sr = (SearchResult) enm.next();
+                Attributes attrs = sr.getAttributes();
+                Attribute sn = attrs.get("sn");
+                assertNotNull(sn);
+                assertTrue( sn.contains( "Amos" ) );
+            }
+        } catch (Exception e) {
+            fail( e.getMessage() );
+        }
+    }
+    
 }



Mime
View raw message