You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/01/25 14:44:38 UTC

svn commit: r499794 - /directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchTest.java

Author: elecharny
Date: Thu Jan 25 05:44:37 2007
New Revision: 499794

URL: http://svn.apache.org/viewvc?view=rev&rev=499794
Log:
Added two more tests for DIRSERVER-826 (imported Stefan's sample)

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

Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchTest.java?view=diff&rev=499794&r1=499793&r2=499794
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchTest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchTest.java Thu Jan 25 05:44:37 2007
@@ -1014,6 +1014,66 @@
     }
     
     /**
+     * Check if operational attributes are present, if "+" is requested.
+     */
+    public void testSearchOperationalAttributes() throws NamingException
+    {
+        SearchControls ctls = new SearchControls();
+
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        ctls.setReturningAttributes( new String[]
+            { "+" } );
+
+        NamingEnumeration result = ctx.search( HEATHER_RDN, filter, ctls );
+
+        if ( result.hasMore() )
+        {
+            SearchResult entry = ( SearchResult ) result.next();
+
+            String[] opAttrNames =
+                { "creatorsName", "createTimestamp" };
+
+            checkForAttributes( entry.getAttributes(), opAttrNames );
+        }
+        else
+        {
+            fail( "entry " + HEATHER_RDN + " not found" );
+        }
+
+        result.close();
+    }
+
+    /**
+     * Check if user attributes are present, if "*" is requested.
+     */
+    public void testSearchUserAttributes() throws NamingException
+    {
+        SearchControls ctls = new SearchControls();
+
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        ctls.setReturningAttributes( new String[]
+            { "*" } );
+
+        NamingEnumeration result = ctx.search( HEATHER_RDN, filter, ctls );
+
+        if ( result.hasMore() )
+        {
+            SearchResult entry = ( SearchResult ) result.next();
+
+            String[] userAttrNames =
+                { "objectClass", "sn", "cn" };
+
+            checkForAttributes( entry.getAttributes(), userAttrNames );
+        }
+        else
+        {
+            fail( "entry " + HEATHER_RDN + " not found" );
+        }
+
+        result.close();
+    }
+    
+    /**
      * Check if user and operational attributes are present, if both "*" and "+" are requested.
      */
     public void testSearchOperationalAndUserAttributes() throws NamingException