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 2011/01/20 00:08:40 UTC

svn commit: r1061054 - /directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java

Author: elecharny
Date: Wed Jan 19 23:08:39 2011
New Revision: 1061054

URL: http://svn.apache.org/viewvc?rev=1061054&view=rev
Log:
Fixed some tests

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java?rev=1061054&r1=1061053&r2=1061054&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java Wed Jan 19 23:08:39 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.core
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
@@ -31,7 +32,10 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.cursor.SearchCursor;
 import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -97,25 +101,33 @@ public class LookupIT extends AbstractLd
      * Test a lookup( DN, "+") operation
      */
     @Test
+    @Ignore( "The '+' special attribute is not correctly handled." )
     public void testLookupPlus() throws Exception
     {
         service.setDenormalizeOpAttrsEnabled( true );
         Entry entry = connection.lookup( "cn=test,ou=system", "+" );
         assertNotNull( entry );
 
-        // We should have 5 attributes
-        assertEquals( 7, entry.size() );
+        // We should have 4 attributes
+        assertEquals( 4, entry.size() );
 
-        // Check that all the user attributes are present
+        // Check that all the user attributes are abstent
+        assertNull( entry.get( "cn" ) );
+        assertNull( entry.get( "sn" ) );
+        assertNull( entry.get( "objectClass" ) );
+        
+        /*
         assertEquals( "test", entry.get( "cn" ).getString() );
         assertEquals( "sn_test", entry.get( "sn" ).getString() );
         assertTrue( entry.contains( "objectClass", "top", "person" ) );
+        */
 
         // Check that we have all the operational attributes :
-        // We should have 3 users attributes : objectClass, cn and sn
-        // and 2 operational attributes : createTime and createUser
+        // We should have 4 operational attributes : createTime, createUser, entryCSN and entryUUID
         assertNotNull( entry.get( "createTimestamp" ).getString() );
         assertEquals( "uid=admin,ou=system", entry.get( "creatorsName" ).getString() );
+        assertNotNull( entry.get( "entryCSN" ).getString() );
+        assertNotNull( entry.get( "entryUUID" ).getString() );
     }
 
 
@@ -162,19 +174,33 @@ public class LookupIT extends AbstractLd
      * Test a lookup( DN ) operation with a list of attributes
      */
     @Test
-    @Ignore
     public void testLookupWithAttrs() throws Exception
     {
-        Entry entry = connection.lookup( "cn=test,ou=system", "name" );
-        assertNotNull( entry );
+        SearchCursor cursor = connection.search( "cn=test,ou=system", "(ObjectClass=*)",SearchScope.SUBTREE, "name" );
+        
+        while ( cursor.next() )
+        {
+            SearchResultEntry result = (SearchResultEntry)cursor.get();
+            Entry entry = result.getEntry();
+            assertNotNull( entry );
+            assertEquals( 2, entry.size() );
+            assertEquals( "test", entry.get( "cn" ).getString() );
+            assertEquals( "sn_test", entry.get( "sn" ).getString() );
+            assertFalse( entry.containsAttribute( "objectClass" ) );
+        }
+        
+        cursor.close();
 
-        // We should have 3 attributes
-        assertEquals( 2, entry.size() );
+        //Entry entry = connection.lookup( "cn=test,ou=system", "name" );
+        //assertNotNull( entry );
+
+        // We should have 2 attributes
+        //assertEquals( 2, entry.size() );
 
         // Check that all the user attributes are present
-        assertEquals( "test", entry.get( "cn" ).getString() );
-        assertEquals( "sn_test", entry.get( "sn" ).getString() );
-        assertFalse( entry.containsAttribute( "objectClass" ) );
+        //assertEquals( "test", entry.get( "cn" ).getString() );
+        //assertEquals( "sn_test", entry.get( "sn" ).getString() );
+        //assertFalse( entry.containsAttribute( "objectClass" ) );
     }
 
 
@@ -182,7 +208,6 @@ public class LookupIT extends AbstractLd
      * Test a lookup( DN ) operation with no attributes
      */
     @Test
-    @Ignore
     public void testLookupWithNoAttrs() throws Exception
     {
         Entry entry = connection.lookup( "cn=test,ou=system", "1.1" );