directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r429093 - /directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
Date Sun, 06 Aug 2006 02:12:35 GMT
Author: akarasulu
Date: Sat Aug  5 19:12:35 2006
New Revision: 429093

URL: http://svn.apache.org/viewvc?rev=429093&view=rev
Log:
adding a few more searches to make sure DIRSERVER-635 really is working properly

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

Modified: directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java?rev=429093&r1=429092&r2=429093&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
(original)
+++ directory/branches/apacheds/1.0/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
Sat Aug  5 19:12:35 2006
@@ -19,6 +19,7 @@
 
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Set;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -109,16 +110,15 @@
     }
     
     
-    public void testDirserver635() throws NamingException
+    /**
+     * Performs a single level search from ou=system base and 
+     * returns the set of DNs found.
+     */
+    private Set search( String filter ) throws NamingException
     {
-        // create additional entry
-        Attributes attributes = this.getPersonAttributes( "Bush", "Kate Bush" );
-        ctx.createSubcontext( "cn=Kate Bush", attributes );
-        
-        // setup and search
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-        NamingEnumeration ii = ctx.search( "", "(|(cn=Kate Bush)(cn=Tori Amos))", controls
);
+        NamingEnumeration ii = ctx.search( "", filter, controls );
         
         // collect all results 
         HashSet results = new HashSet();
@@ -128,10 +128,38 @@
             results.add( result.getName() );
         }
         
-        // make sure we get the results we need
+        return results;
+    }
+
+    
+    public void testDirserver635() throws NamingException
+    {
+        // create additional entry
+        Attributes attributes = this.getPersonAttributes( "Bush", "Kate Bush" );
+        ctx.createSubcontext( "cn=Kate Bush", attributes );
+
+        // -------------------------------------------------------------------
+        Set results = search( "(|(cn=Kate*)(cn=Tori*))" );
+        assertEquals( "returned size of results", 2, results.size() );
+        assertTrue( "contains cn=Tori Amos", results.contains( "cn=Tori Amos" ) );
+        assertTrue( "contains cn=Kate Bush", results.contains( "cn=Kate Bush" ) );
+
+        // -------------------------------------------------------------------
+        results = search( "(|(cn=*Amos)(cn=Kate*))" );
         assertEquals( "returned size of results", 2, results.size() );
         assertTrue( "contains cn=Tori Amos", results.contains( "cn=Tori Amos" ) );
         assertTrue( "contains cn=Kate Bush", results.contains( "cn=Kate Bush" ) );
+
+        // -------------------------------------------------------------------
+        results = search( "(|(cn=Kate Bush)(cn=Tori*))" );
+        assertEquals( "returned size of results", 2, results.size() );
+        assertTrue( "contains cn=Tori Amos", results.contains( "cn=Tori Amos" ) );
+        assertTrue( "contains cn=Kate Bush", results.contains( "cn=Kate Bush" ) );
+
+        // -------------------------------------------------------------------
+        results = search( "(|(cn=*Amos))" );
+        assertEquals( "returned size of results", 1, results.size() );
+        assertTrue( "contains cn=Tori Amos", results.contains( "cn=Tori Amos" ) );
     }
 
 



Mime
View raw message