directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r499512 - in /directory/apacheds/trunk/core-unit/src/test: java/org/apache/directory/server/core/ java/org/apache/directory/server/core/exception/ java/org/apache/directory/server/core/jndi/ resources/org/apache/directory/server/core/schema/
Date Wed, 24 Jan 2007 18:31:20 GMT
Author: elecharny
Date: Wed Jan 24 10:31:19 2007
New Revision: 499512

URL: http://svn.apache.org/viewvc?view=rev&rev=499512
Log:
Porting fix from ADS 1.0.1 to 1.5 : fixing DIRSERVER-758 and some problems with referrals.

Modified:
    directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
    directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java
    directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java
    directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java
    directory/apacheds/trunk/core-unit/src/test/resources/org/apache/directory/server/core/schema/nonspecific.ldif

Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java?view=diff&rev=499512&r1=499511&r2=499512
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/SearchOpsITest.java
Wed Jan 24 10:31:19 2007
@@ -73,12 +73,16 @@
             attrs.put( "ou", "system" );
             sysConf.setContextEntry( attrs );
             sysConf.setSuffix( "ou=system" );
-            Set indices = new HashSet();
+            
+            Set<String> indices = new HashSet<String>();
             indices.addAll( sysConf.getIndexedAttributes() );
+            
             MutableIndexConfiguration idxConfig = new MutableIndexConfiguration();
             idxConfig.setAttributeId( "gidNumber" );
-            indices.add( idxConfig );
+            indices.add( "gidNumber" );
+            
             sysConf.setIndexedAttributes( indices );
+            
             configuration.setSystemPartitionConfiguration( sysConf );
         }
         

Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java?view=diff&rev=499512&r1=499511&r2=499512
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/exception/ExceptionServiceITest.java
Wed Jan 24 10:31:19 2007
@@ -49,6 +49,26 @@
  */
 public class ExceptionServiceITest extends AbstractAdminTestCase
 {
+    private DirContext createSubContext( String type, String value ) throws NamingException
+    {
+        return createSubContext( sysRoot, type, value );
+    }
+
+    private DirContext createSubContext( DirContext ctx, String type, String value ) throws
NamingException
+    {
+        Attributes attrs = new AttributesImpl( type, value );
+        Attribute attr = new AttributeImpl( "ObjectClass" );
+        attr.add( "top"  );
+        attr.add( "person" );
+        attr.add( "OrganizationalPerson" );
+        attrs.put( attr );
+
+        attrs.put( "sn", value );
+        attrs.put( "cn", value );
+
+        return ctx.createSubcontext( type + "=" + value, attrs );
+    }
+
     // ------------------------------------------------------------------------
     // Search Operation Tests
     // ------------------------------------------------------------------------
@@ -103,7 +123,13 @@
     {
         try
         {
-            sysRoot.createSubcontext( "ou=users,ou=groups" );
+            Attributes attrs = new AttributesImpl( "ou", "users" );
+            Attribute attr = new AttributeImpl( "ObjectClass" );
+            attr.add( "top"  );
+            attr.add( "OrganizationalUnit" );
+            attrs.put( attr );
+
+            sysRoot.createSubcontext( "ou=users,ou=groups", attrs );
             sysRoot.rename( "ou=users", "ou=users,ou=groups" );
             fail( "Execution should never get here due to exception!" );
         }
@@ -115,7 +141,13 @@
 
         try
         {
-            sysRoot.createSubcontext( "ou=uzerz,ou=groups" );
+            Attributes attrs = new AttributesImpl( "ou", "uzerz" );
+            Attribute attr = new AttributeImpl( "ObjectClass" );
+            attr.add( "top"  );
+            attr.add( "OrganizationalUnit" );
+            attrs.put( attr );
+
+            sysRoot.createSubcontext( "ou=uzerz,ou=groups", attrs );
             sysRoot.addToEnvironment( "java.naming.ldap.deleteRDN", "false" );
             sysRoot.rename( "ou=users", "ou=uzerz,ou=groups" );
             sysRoot.removeFromEnvironment( "java.naming.ldap.deleteRDN" );
@@ -402,7 +434,9 @@
         Attribute attr = new AttributeImpl( "objectClass" );
         attr.add( "top" );
         attr.add( "alias" );
+        attr.add( "person" );
         attrs.put( attr );
+        attrs.put( "sn", "test" );
         attrs.put( "aliasedObjectName", "ou=users,ou=system" );
 
         sysRoot.createSubcontext( "cn=toanother", attrs );
@@ -444,11 +478,11 @@
      */
     public void testFailAddEntryAlreadyExists() throws NamingException
     {
-        sysRoot.createSubcontext( "ou=blah" );
+        createSubContext( "ou", "blah");
 
         try
         {
-            sysRoot.createSubcontext( "ou=blah" );
+            createSubContext( "ou", "blah");
             fail( "Execution should never get here due to exception!" );
         }
         catch ( LdapNameAlreadyBoundException e )
@@ -464,8 +498,8 @@
      */
     public void testAddControl() throws NamingException
     {
-        Context ctx = sysRoot.createSubcontext( "ou=blah" );
-        ctx.createSubcontext( "ou=subctx" );
+        DirContext ctx = createSubContext( "ou", "blah");
+        createSubContext( ctx, "ou", "subctx");
         Object obj = sysRoot.lookup( "ou=subctx,ou=blah" );
         assertNotNull( obj );
     }
@@ -480,8 +514,8 @@
      */
     public void testFailDeleteNotAllowedOnNonLeaf() throws NamingException
     {
-        Context ctx = sysRoot.createSubcontext( "ou=blah" );
-        ctx.createSubcontext( "ou=subctx" );
+        DirContext ctx = createSubContext( "ou", "blah" );
+        createSubContext( ctx,  "ou", "subctx" );
 
         try
         {
@@ -520,7 +554,8 @@
      */
     public void testDeleteControl() throws NamingException
     {
-        sysRoot.createSubcontext( "ou=blah" );
+        createSubContext( "ou", "blah" );
+
         Object obj = sysRoot.lookup( "ou=blah" );
         assertNotNull( obj );
         sysRoot.destroySubcontext( "ou=blah" );

Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java?view=diff&rev=499512&r1=499511&r2=499512
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java
Wed Jan 24 10:31:19 2007
@@ -32,6 +32,7 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.ReferralException;
+import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.SearchControls;
@@ -59,7 +60,7 @@
 {
     private static final boolean SUNJNDI = false;
     private boolean sunjndi = System.getProperty( "sunjndi" ) != null || SUNJNDI;
-    TestData td = new TestData();
+    private TestData td = new TestData();
 
 
     public void setUp() throws Exception
@@ -125,7 +126,7 @@
         return new InitialLdapContext( env, null );
     }
 
-    class TestData
+    private class TestData
     {
         LdapContext rootCtx;
         Name ctxDn;
@@ -134,7 +135,7 @@
     }
 
 
-    public void addReferralEntry() throws NamingException
+    private void addReferralEntry() throws NamingException
     {
         String ref0 = "ldap://fermi:10389/ou=users,ou=system";
         String ref1 = "ldap://hertz:10389/ou=users,dc=example,dc=com";
@@ -186,22 +187,22 @@
     }
 
 
-    public void checkAncestorReferrals( ReferralException e ) throws Exception
+    private void checkAncestorReferrals( ReferralException e ) throws Exception
     {
         assertEquals( "ldap://fermi:10389", e.getReferralInfo() );
         assertTrue( e.skipReferral() );
-        assertEquals( "ldap://hertz:10389/cn=alex karasulu,ou=apache,ou=users,dc=example,dc=com",
e.getReferralInfo() );
+        assertEquals( "ldap://hertz:10389/cn=alex%20karasulu,ou=apache,ou=users,dc=example,dc=com",
e.getReferralInfo() );
         assertTrue( e.skipReferral() );
         assertEquals( "ldap://maxwell:10389", e.getReferralInfo() );
         assertFalse( e.skipReferral() );
     }
 
 
-    public void checkParentReferrals( ReferralException e ) throws Exception
+    private void checkParentReferrals( ReferralException e ) throws Exception
     {
         assertEquals( "ldap://fermi:10389", e.getReferralInfo() );
         assertTrue( e.skipReferral() );
-        assertEquals( "ldap://hertz:10389/cn=alex karasulu,ou=users,dc=example,dc=com", e.getReferralInfo()
);
+        assertEquals( "ldap://hertz:10389/cn=alex%20karasulu,ou=users,dc=example,dc=com",
e.getReferralInfo() );
         assertTrue( e.skipReferral() );
         assertEquals( "ldap://maxwell:10389", e.getReferralInfo() );
         assertFalse( e.skipReferral() );
@@ -794,7 +795,7 @@
     }
 
 
-    public void createLocalUser() throws Exception
+    private void createLocalUser() throws Exception
     {
         LdapContext userCtx = null;
         Attributes referral = new AttributesImpl( "objectClass", "top", true );
@@ -809,27 +810,31 @@
         catch ( NameNotFoundException e )
         {
         }
+        
         try
         {
             userCtx = ( LdapContext ) td.rootCtx.createSubcontext( "cn=akarasulu", referral
);
         }
         catch ( NameAlreadyBoundException e )
         {
-            td.refCtx = ( LdapContext ) td.rootCtx.lookup( "cn=akarasulu" );
+            userCtx = ( LdapContext ) td.rootCtx.lookup( "cn=akarasulu" );
         }
+        
         referral = userCtx.getAttributes( "" );
         assertTrue( referral.get( "cn" ).contains( "akarasulu" ) );
         assertTrue( referral.get( "sn" ).contains( "karasulu" ) );
     }
 
 
-    public void createDeepLocalUser() throws Exception
+    private void createDeepLocalUser() throws Exception
     {
         LdapContext userCtx = null;
         Attributes referral = new AttributesImpl( "objectClass", "top", true );
         referral.get( "objectClass" ).add( "person" );
+        referral.get( "objectClass" ).add( "organizationalUnit" );
         referral.put( "cn", "akarasulu" );
         referral.put( "sn", "karasulu" );
+        referral.put( "ou", "deep" );
 
         try
         {
@@ -847,7 +852,13 @@
         }
         try
         {
-            td.rootCtx.createSubcontext( "ou=deep" );
+            Attributes attrs = new AttributesImpl( "ou", "deep" );
+            Attribute oc = new AttributeImpl( "ObjectClass" );
+            oc.add( "top" );
+            oc.add( "organizationalUnit" );
+            attrs.put( oc );
+
+            td.rootCtx.createSubcontext( "ou=deep", attrs );
             userCtx = ( LdapContext ) td.rootCtx.createSubcontext( "cn=akarasulu,ou=deep",
referral );
         }
         catch ( NameAlreadyBoundException e )
@@ -893,11 +904,11 @@
         }
         catch ( ReferralException e )
         {
-            assertEquals( "ldap://fermi:10389/cn=alex karasulu,ou=users,ou=system??base",
e.getReferralInfo() );
+            assertEquals( "ldap://fermi:10389/cn=alex%20karasulu,ou=users,ou=system??base",
e.getReferralInfo() );
             assertTrue( e.skipReferral() );
-            assertEquals( "ldap://hertz:10389/cn=alex karasulu,ou=users,dc=example,dc=com??base",
e.getReferralInfo() );
+            assertEquals( "ldap://hertz:10389/cn=alex%20karasulu,ou=users,dc=example,dc=com??base",
e.getReferralInfo() );
             assertTrue( e.skipReferral() );
-            assertEquals( "ldap://maxwell:10389/cn=alex karasulu,ou=users,ou=system??base",
e.getReferralInfo() );
+            assertEquals( "ldap://maxwell:10389/cn=alex%20karasulu,ou=users,ou=system??base",
e.getReferralInfo() );
             assertFalse( e.skipReferral() );
         }
     }
@@ -914,12 +925,12 @@
         }
         catch ( ReferralException e )
         {
-            assertEquals( "ldap://fermi:10389/cn=alex karasulu,ou=apache,ou=users,ou=system??base",
e.getReferralInfo() );
+            assertEquals( "ldap://fermi:10389/cn=alex%20karasulu,ou=apache,ou=users,ou=system??base",
e.getReferralInfo() );
             assertTrue( e.skipReferral() );
-            assertEquals( "ldap://hertz:10389/cn=alex karasulu,ou=apache,ou=users,dc=example,dc=com??base",
e
+            assertEquals( "ldap://hertz:10389/cn=alex%20karasulu,ou=apache,ou=users,dc=example,dc=com??base",
e
                 .getReferralInfo() );
             assertTrue( e.skipReferral() );
-            assertEquals( "ldap://maxwell:10389/cn=alex karasulu,ou=apache,ou=users,ou=system??base",
e
+            assertEquals( "ldap://maxwell:10389/cn=alex%20karasulu,ou=apache,ou=users,ou=system??base",
e
                 .getReferralInfo() );
             assertFalse( e.skipReferral() );
         }

Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java?view=diff&rev=499512&r1=499511&r2=499512
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java
Wed Jan 24 10:31:19 2007
@@ -535,8 +535,12 @@
         // First let's add a some binary data representing a userCertificate
         Attributes attrs = getPersonAttributes( "Bush", "Kate Bush" );
         attrs.put( "userCertificate", certData );
+
+        Attribute objectClasses = attrs.get( "objectClass" );
+        objectClasses.add( "strongAuthenticationUser" );
+
         sysRoot.createSubcontext( "cn=Kate Bush", attrs );
-        
+
         // Search for kate by cn first
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );

Modified: directory/apacheds/trunk/core-unit/src/test/resources/org/apache/directory/server/core/schema/nonspecific.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/resources/org/apache/directory/server/core/schema/nonspecific.ldif?view=diff&rev=499512&r1=499511&r2=499512
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/resources/org/apache/directory/server/core/schema/nonspecific.ldif
(original)
+++ directory/apacheds/trunk/core-unit/src/test/resources/org/apache/directory/server/core/schema/nonspecific.ldif
Wed Jan 24 10:31:19 2007
@@ -1,15 +1,15 @@
 
 dn: cn=person0,ou=system
 objectClass: person
-cn: cn_person0
+cn: person0
 sn: sn_person0
 
 dn: cn=person1,ou=system
 objectClass: organizationalPerson
-cn: cn_person1
+cn: person1
 sn: sn_person1
 
 dn: cn=person2,ou=system
 objectClass: inetOrgPerson
-cn: cn_person2
+cn: person2
 sn: sn_person2



Mime
View raw message