directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r681242 - /directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
Date Wed, 30 Jul 2008 23:19:23 GMT
Author: akarasulu
Date: Wed Jul 30 16:19:23 2008
New Revision: 681242

URL: http://svn.apache.org/viewvc?rev=681242&view=rev
Log:
making sure manage dsa it control works

Modified:
    directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java

Modified: directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java?rev=681242&r1=681241&r2=681242&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
(original)
+++ directory/apacheds/branches/bigbang/server-integ/src/test/java/org/apache/directory/server/referral/ReferralIT.java
Wed Jul 30 16:19:23 2008
@@ -22,6 +22,9 @@
 
 import static org.junit.Assert.*;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
@@ -33,14 +36,12 @@
 import org.apache.directory.server.core.integ.Level;
 import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
 import org.apache.directory.server.core.integ.annotations.CleanupLevel;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.integ.ServerIntegrationUtils;
 import org.apache.directory.server.integ.SiRunner;
 import org.apache.directory.server.newldap.LdapServer;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.ManageDsaITControl;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.slf4j.Logger;
@@ -55,6 +56,24 @@
  */
 @RunWith ( SiRunner.class ) 
 @CleanupLevel ( Level.CLASS )
+@ApplyLdifs( {
+    // Entry # 1
+    "dn: uid=akarasulu,ou=users,ou=system\n" +
+    "objectClass: uidObject\n" +
+    "objectClass: person\n" +
+    "objectClass: top\n" +
+    "uid: akarasulu\n" +
+    "cn: Alex Karasulu\n" +
+    "sn: karasulu\n\n" + 
+    // Entry # 2
+    "dn: uid=akarasuluref,ou=users,ou=system\n" +
+    "objectClass: uidObject\n" +
+    "objectClass: referral\n" +
+    "objectClass: top\n" +
+    "uid: akarasuluref\n" +
+    "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system\n\n" 
+    }
+)
 public class ReferralIT
 {
     private static final Logger LOG = LoggerFactory.getLogger( ReferralIT.class );
@@ -63,24 +82,6 @@
     
 
     @Test
-    @ApplyLdifs( {
-        // Entry # 1
-        "dn: uid=akarasulu,ou=users,ou=system\n" +
-        "objectClass: uidObject\n" +
-        "objectClass: person\n" +
-        "objectClass: top\n" +
-        "uid: akarasulu\n" +
-        "cn: Alex Karasulu\n" +
-        "sn: karasulu\n\n" + 
-        // Entry # 2
-        "dn: uid=akarasuluref,ou=users,ou=system\n" +
-        "objectClass: uidObject\n" +
-        "objectClass: referral\n" +
-        "objectClass: top\n" +
-        "uid: akarasuluref\n" +
-        "ref: ldap://localhost:10389/uid=akarasulu,ou=users,ou=system\n\n" 
-        }
-    )
     public void testSearch() throws Exception
     {
         LdapContext ctx = ServerIntegrationUtils.getWiredContext( ldapServer,
@@ -88,23 +89,15 @@
         
         NamingEnumeration<SearchResult> results = ctx.search( "ou=users,ou=system",

             "(objectClass=*)", new SearchControls() );
+        Map<String, Attributes> entries = new HashMap<String, Attributes>();
         while ( results.hasMore() )
         {
-            LOG.debug( "testSearch() search result = {}", results.next() );
+            SearchResult result = results.next();
+            LOG.debug( "testSearch() search result = {}", result );
+            entries.put( result.getNameInNamespace(), result.getAttributes() );
         }
         
-        ServerEntry entry = ldapServer.getDirectoryService().getAdminSession().lookup( 
-            new LdapDN( "uid=akarasuluref,ou=users,ou=system" ) );
-        LOG.debug( "Entry for uid=akarasuluref,ou=users,ou=system => \n{}", entry );
-        
-        assertNotNull( entry );
-        assertTrue( entry.contains( SchemaConstants.OBJECT_CLASS_AT, "referral" ) );
-        assertTrue( entry.contains( SchemaConstants.REF_AT, "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system"
) );
-        
-//        ctx.getAttributes( "uid=akarasulu,ou=users,ou=system" );
-        Attributes attrs = ctx.getAttributes( "uid=akarasuluref,ou=users,ou=system" );
-        assertNotNull( attrs );
-        LOG.debug( "Entry over wire for uid=akarasuluref,ou=users,ou=system => \n{}",
attrs );
-        assertEquals( attrs.get( SchemaConstants.REF_AT ).get(), "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system"
);
+        assertTrue( entries.containsKey( "uid=akarasulu,ou=users,ou=system" ) );
+        assertTrue( entries.containsKey( "uid=akarasuluref,ou=users,ou=system" ) );
     }
 }



Mime
View raw message