directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r613608 [15/15] - in /directory/sandbox/akarasulu/bigbang/apacheds: ./ bootstrap-plugin/ bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ core-entry/ core-entry/src/main/java/org/apache/directory/server/core...
Date Sun, 20 Jan 2008 16:59:36 GMT
Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/DIRSERVER951ITest.java
Sun Jan 20 08:59:10 2008
@@ -20,20 +20,18 @@
 package org.apache.directory.server;
 
 
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.Oid;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.unit.AbstractServerTest;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.DateUtils;
-import org.apache.directory.shared.ldap.util.NamespaceTools;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
@@ -68,7 +66,7 @@
 
 
     @Override
-    protected void configureDirectoryService()
+    protected void configureDirectoryService() throws NamingException
     {
         JdbmPartition systemCfg = new JdbmPartition();
         systemCfg.setId( "system" );
@@ -92,16 +90,13 @@
         systemCfg.setIndexedAttributes( indexedAttrs );
 
         // Add context entry for system partition
-        Attributes systemEntry = new AttributesImpl();
-        Attribute objectClassAttr = new AttributeImpl( "objectClass" );
-        objectClassAttr.add( "top" );
-        objectClassAttr.add( "account" );
-        //objectClassAttr.add( "extensibleObject" );
-        systemEntry.put( objectClassAttr );
+        LdapDN systemDn = new LdapDN( "ou=system" );
+        ServerEntry systemEntry = new DefaultServerEntry( directoryService.getRegistries(),
systemDn );
+        
+        systemEntry.put( "objectClass", "top", "account" );
         systemEntry.put( "creatorsName", "uid=admin,ou=system" );
         systemEntry.put( "createTimestamp", DateUtils.getGeneralizedTime() );
-        systemEntry.put( NamespaceTools.getRdnAttribute( "ou=system" ),
-            NamespaceTools.getRdnValue( "ou=system" ) );
+        systemEntry.put( "ou", "system" );
         systemEntry.put( "uid", "testUid" );
         systemCfg.setContextEntry( systemEntry );
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java
Sun Jan 20 08:59:10 2008
@@ -20,6 +20,8 @@
 package org.apache.directory.server;
 
 
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.kerberos.KeyDerivationInterceptor;
 import org.apache.directory.server.core.partition.Partition;
@@ -34,6 +36,7 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.crypto.spec.DESKeySpec;
 import javax.naming.Context;
@@ -75,15 +78,9 @@
     public void setUp() throws Exception
     {
         super.setUp();
-//        setAllowAnonymousAccess( false );
 
         Attributes attrs;
 
-//        doDelete( directoryService.getWorkingDirectory() );
-//        port = AvailablePortFinder.getNextAvailable( 1024 );
-//        ldapServer.setIpPort( port );
-//        directoryService.setShutdownHookEnabled( false );
-
 
         setContexts( "uid=admin,ou=system", "secret" );
 
@@ -94,6 +91,7 @@
         // check if krb5kdc is disabled
         Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=Krb5kdc" );
         boolean isKrb5KdcDisabled = false;
+        
         if ( krb5kdcAttrs.get( "m-disabled" ) != null )
         {
             isKrb5KdcDisabled = ( ( String ) krb5kdcAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase(
"TRUE" );
@@ -117,9 +115,9 @@
         users.createSubcontext( "uid=hnelson", attrs );
     }
 
-    protected void configureDirectoryService()
+    protected void configureDirectoryService() throws NamingException
     {
-        Attributes attrs;
+        ServerEntry serverEntry;
         Set<Partition> partitions = new HashSet<Partition>();
 
         JdbmPartition partition;
@@ -135,15 +133,11 @@
         indexedAttrs.add( new JdbmIndex( "objectClass" ) );
         partition.setIndexedAttributes( indexedAttrs );
 
-        attrs = new AttributesImpl( true );
-        Attribute attr = new AttributeImpl( "objectClass" );
-        attr.add( "top" );
-        attr.add( "domain" );
-        attrs.put( attr );
-        attr = new AttributeImpl( "dc" );
-        attr.add( "example" );
-        attrs.put( attr );
-        partition.setContextEntry( attrs );
+        LdapDN exampleDn = new LdapDN( "dc=example,dc=com" );
+        serverEntry = new DefaultServerEntry( directoryService.getRegistries(), exampleDn
);
+        serverEntry.put( "objectClass", "top", "domain" );
+        serverEntry.put( "dc", "example" );
+        partition.setContextEntry( serverEntry );
 
         partitions.add( partition );
         directoryService.setPartitions( partitions );
@@ -175,7 +169,7 @@
         DirContext ctx = new InitialDirContext( env );
 
         String[] attrIDs =
-            { "uid", "userPassword", KerberosAttribute.KEY, KerberosAttribute.VERSION };
+            { "uid", "userPassword", KerberosAttribute.KRB5_KEY_AT, KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
};
 
         Attributes attributes = ctx.getAttributes( RDN, attrIDs );
 
@@ -202,7 +196,7 @@
             { ( byte ) 0x73, ( byte ) 0x65, ( byte ) 0x63, ( byte ) 0x72, ( byte ) 0x65,
( byte ) 0x74 };
         assertTrue( Arrays.equals( userPassword, testPasswordBytes ) );
 
-        Attribute krb5key = attributes.get( KerberosAttribute.KEY );
+        Attribute krb5key = attributes.get( KerberosAttribute.KRB5_KEY_AT );
         Map<EncryptionType, EncryptionKey> map = reconstituteKeyMap( krb5key );
         EncryptionKey encryptionKey = map.get( EncryptionType.DES_CBC_MD5 );
 
@@ -215,9 +209,9 @@
 
         int keyVersionNumber = -1;
 
-        if ( attributes.get( KerberosAttribute.VERSION ) != null )
+        if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
         {
-            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION
).get() );
+            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
).get() );
         }
 
         assertEquals( "Key version number", 0, keyVersionNumber );
@@ -251,7 +245,7 @@
         Attributes attributes = new AttributesImpl( true );
         Attribute attr = new AttributeImpl( "userPassword", newUserPassword );
         attributes.put( attr );
-        attr = new AttributeImpl( KerberosAttribute.PRINCIPAL, newPrincipalName );
+        attr = new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, newPrincipalName
);
         attributes.put( attr );
 
         DirContext person = ( DirContext ) ctx.lookup( RDN );
@@ -289,9 +283,9 @@
 
         int keyVersionNumber = -1;
 
-        if ( attributes.get( KerberosAttribute.VERSION ) != null )
+        if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
         {
-            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION
).get() );
+            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
).get() );
         }
 
         assertEquals( "Key version number", 1, keyVersionNumber );
@@ -302,7 +296,7 @@
         attributes = new AttributesImpl( true );
         attr = new AttributeImpl( "userPassword", newUserPassword );
         attributes.put( attr );
-        attr = new AttributeImpl( KerberosAttribute.PRINCIPAL, newPrincipalName );
+        attr = new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, newPrincipalName
);
         attributes.put( attr );
 
         person = ( DirContext ) ctx.lookup( RDN );
@@ -320,9 +314,9 @@
 
         assertEquals( "password length", 18, userPassword.length );
 
-        if ( attributes.get( KerberosAttribute.VERSION ) != null )
+        if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
         {
-            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION
).get() );
+            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
).get() );
         }
 
         assertEquals( "Key version number", 2, keyVersionNumber );
@@ -333,7 +327,7 @@
         attributes = new AttributesImpl( true );
         attr = new AttributeImpl( "userPassword", newUserPassword );
         attributes.put( attr );
-        attr = new AttributeImpl( KerberosAttribute.PRINCIPAL, newPrincipalName );
+        attr = new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, newPrincipalName
);
         attributes.put( attr );
 
         person = ( DirContext ) ctx.lookup( RDN );
@@ -351,9 +345,9 @@
 
         assertEquals( "password length", 24, userPassword.length );
 
-        if ( attributes.get( KerberosAttribute.VERSION ) != null )
+        if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
         {
-            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION
).get() );
+            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
).get() );
         }
 
         assertEquals( "Key version number", 3, keyVersionNumber );
@@ -423,9 +417,9 @@
 
         int keyVersionNumber = -1;
 
-        if ( attributes.get( KerberosAttribute.VERSION ) != null )
+        if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
         {
-            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION
).get() );
+            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
).get() );
         }
 
         assertEquals( "Key version number", 1, keyVersionNumber );
@@ -452,9 +446,9 @@
 
         assertEquals( "password length", 18, userPassword.length );
 
-        if ( attributes.get( KerberosAttribute.VERSION ) != null )
+        if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
         {
-            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION
).get() );
+            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
).get() );
         }
 
         assertEquals( "Key version number", 2, keyVersionNumber );
@@ -481,9 +475,9 @@
 
         assertEquals( "password length", 24, userPassword.length );
 
-        if ( attributes.get( KerberosAttribute.VERSION ) != null )
+        if ( attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ) != null )
         {
-            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.VERSION
).get() );
+            keyVersionNumber = Integer.valueOf( ( String ) attributes.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT
).get() );
         }
 
         assertEquals( "Key version number", 3, keyVersionNumber );
@@ -630,8 +624,8 @@
         attrs.put( "sn", sn );
         attrs.put( "uid", uid );
         attrs.put( "userPassword", userPassword );
-        attrs.put( KerberosAttribute.PRINCIPAL, principal );
-        attrs.put( KerberosAttribute.VERSION, "0" );
+        attrs.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal );
+        attrs.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, "0" );
 
         return attrs;
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/MiscTest.java
Sun Jan 20 08:59:10 2008
@@ -26,6 +26,7 @@
 
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
 import javax.naming.NoPermissionException;
 import javax.naming.OperationNotSupportedException;
 import javax.naming.directory.Attribute;
@@ -39,6 +40,9 @@
 import netscape.ldap.LDAPAttribute;
 import netscape.ldap.LDAPConnection;
 import netscape.ldap.LDAPException;
+
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
@@ -48,6 +52,7 @@
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.MutableControl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
 
@@ -89,7 +94,7 @@
 
 
     @Override
-    protected void configureDirectoryService()
+    protected void configureDirectoryService() throws NamingException
     {
         if ( this.getName().equals( "testUserAuthOnMixedCaseSuffix" ) )
         {
@@ -97,32 +102,35 @@
             partitions.addAll( directoryService.getPartitions() );
             JdbmPartition partition = new JdbmPartition();
             partition.setSuffix( "dc=aPache,dc=org" );
-            Attributes entry = new AttributesImpl( "dc", "aPache", true );
-            Attribute oc = new AttributeImpl( "objectClass" );
-            entry.put( oc );
-            oc.add( "top" );
-            oc.add( "domain" );
+            
+            LdapDN apacheDn = new LdapDN( "dc=aPache,dc=org" );
+            ServerEntry serverEntry = new DefaultServerEntry( directoryService.getRegistries(),
apacheDn );
+            serverEntry.put( "dc", "aPache" );
+            serverEntry.put( "objectClass", "top", "domain" );
+
             partition.setId( "apache" );
-            partition.setContextEntry( entry );
+            partition.setContextEntry( serverEntry );
             Set<Index> indexedAttributes = new HashSet<Index>();
             indexedAttributes.add( new JdbmIndex( "dc" ) );
             partition.setIndexedAttributes( indexedAttributes );
             partitions.add( partition );
             directoryService.setPartitions( partitions );
-        } else if ( this.getName().equals( "testAnonymousBindsEnabledBaseSearch" ) )
+        } 
+        else if ( this.getName().equals( "testAnonymousBindsEnabledBaseSearch" ) )
         {
             // create a partition to search
             Set partitions = new HashSet();
             partitions.addAll( directoryService.getPartitions() );
             JdbmPartition partition = new JdbmPartition();
             partition.setSuffix( "dc=apache,dc=org" );
-            Attributes entry = new AttributesImpl( "dc", "apache", true );
-            Attribute oc = new AttributeImpl( "objectClass" );
-            entry.put( oc );
-            oc.add( "top" );
-            oc.add( "domain" );
+            
+            LdapDN apacheDn = new LdapDN( "dc=apache,dc=org" );
+            ServerEntry serverEntry = new DefaultServerEntry( directoryService.getRegistries(),
apacheDn );
+            serverEntry.put( "dc", "apache" );
+            serverEntry.put( "objectClass", "top", "domain" );
+            
             partition.setId( "apache" );
-            partition.setContextEntry( entry );
+            partition.setContextEntry( serverEntry );
             Set<Index> indexedAttributes = new HashSet<Index>();
             indexedAttributes.add( new JdbmIndex( "dc" ) );
             partition.setIndexedAttributes( indexedAttributes );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/NegationOperatorITest.java
Sun Jan 20 08:59:10 2008
@@ -26,23 +26,20 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
 
-import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.ldif.Entry;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.DateUtils;
-import org.apache.directory.shared.ldap.util.NamespaceTools;
 
 
 /**
@@ -74,7 +71,7 @@
 
 
     @Override
-    protected void configureDirectoryService()
+    protected void configureDirectoryService() throws NamingException
     {
         if ( this.getName().indexOf( "Indexed" ) != -1 )
         {
@@ -93,16 +90,14 @@
             system.setIndexedAttributes( indexedAttrs );
 
             // Add context entry for system partition
-            Attributes systemEntry = new AttributesImpl();
-            Attribute objectClassAttr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT
);
-            objectClassAttr.add( SchemaConstants.TOP_OC );
-            objectClassAttr.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC );
-            objectClassAttr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
-            systemEntry.put( objectClassAttr );
+            LdapDN systemDn = new LdapDN( "ou=system" );
+            ServerEntry systemEntry = new DefaultServerEntry( directoryService.getRegistries(),
systemDn );
+            
+            systemEntry.put( "objectClass", "top", "organizationalUnit", "extensibleObject"
); 
+
             systemEntry.put( SchemaConstants.CREATORS_NAME_AT, "uid=admin, ou=system" );
             systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
-            systemEntry.put( NamespaceTools.getRdnAttribute( "ou=system" ),
-                NamespaceTools.getRdnValue( "ou=system" ) );
+            systemEntry.put( "ou", "system" );
             system.setContextEntry( systemEntry );
 
             directoryService.setSystemPartition( system );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/PasswordPolicyServiceITest.java
Sun Jan 20 08:59:10 2008
@@ -20,6 +20,8 @@
 package org.apache.directory.server;
 
 
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.kerberos.PasswordPolicyInterceptor;
 import org.apache.directory.server.core.partition.Partition;
@@ -29,6 +31,7 @@
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -77,9 +80,8 @@
         users = ctx.createSubcontext( "ou=users", attrs );
     }
 
-    protected void configureDirectoryService()
+    protected void configureDirectoryService() throws NamingException
     {
-        Attributes attrs;
         Set<Partition> partitions = new HashSet<Partition>();
 
         // Add partition 'example'
@@ -93,15 +95,12 @@
         indexedAttrs.add( new JdbmIndex( "objectClass" ) );
         partition.setIndexedAttributes( indexedAttrs );
 
-        attrs = new AttributesImpl( true );
-        Attribute attr = new AttributeImpl( "objectClass" );
-        attr.add( "top" );
-        attr.add( "domain" );
-        attrs.put( attr );
-        attr = new AttributeImpl( "dc" );
-        attr.add( "example" );
-        attrs.put( attr );
-        partition.setContextEntry( attrs );
+        LdapDN exampleDn = new LdapDN( "dc=example,dc=com" );
+        ServerEntry serverEntry = new DefaultServerEntry( directoryService.getRegistries(),
exampleDn );
+        serverEntry.put( "objectClass", "top", "domain" );
+        serverEntry.put( "dc", "example" );
+        
+        partition.setContextEntry( serverEntry );
 
         partitions.add( partition );
         directoryService.setPartitions( partitions );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
Sun Jan 20 08:59:10 2008
@@ -20,6 +20,8 @@
 package org.apache.directory.server;
 
 
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
@@ -27,6 +29,7 @@
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.Context;
 import javax.naming.NamingEnumeration;
@@ -79,7 +82,7 @@
 
 
     @Override
-    protected void configureDirectoryService()
+    protected void configureDirectoryService() throws NamingException
     {
 
         Set<Partition> partitions = new HashSet<Partition>();
@@ -93,15 +96,13 @@
         indexedAttrs.add( new JdbmIndex( "objectClass" ) );
         partition.setIndexedAttributes( indexedAttrs );
 
-        Attributes attrs = new AttributesImpl( true );
-        Attribute attr = new AttributeImpl( "objectClass" );
-        attr.add( "top" );
-        attr.add( "domain" );
-        attrs.put( attr );
-        attr = new AttributeImpl( "dc" );
-        attr.add( "example" );
-        attrs.put( attr );
-        partition.setContextEntry( attrs );
+        LdapDN exampleDn = new LdapDN( "dc=example,dc=com" );
+        ServerEntry serverEntry = new DefaultServerEntry( directoryService.getRegistries(),
exampleDn );
+        serverEntry.put( "objectClass", "top", "domain" );
+        serverEntry.put( "dc", "example" );
+
+        partition.setContextEntry( serverEntry );
+
 
         partitions.add( partition );
         directoryService.setPartitions( partitions );
@@ -173,11 +174,11 @@
             Attributes attrs = ctx.getAttributes( "ldap://localhost:" + port, new String[]
                 { "supportedSASLMechanisms" } );
 
-            NamingEnumeration answer = attrs.getAll();
+            NamingEnumeration<? extends Attribute> answer = attrs.getAll();
 
             if ( answer.hasMore() )
             {
-                Attribute result = ( Attribute ) answer.next();
+                Attribute result = answer.next();
                 assertTrue( result.size() == 3 );
                 assertTrue( result.contains( "GSSAPI" ) );
                 assertTrue( result.contains( "DIGEST-MD5" ) );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/StoredProcedureExecutionITest.java
Sun Jan 20 08:59:10 2008
@@ -25,16 +25,23 @@
 import org.apache.directory.server.unit.AbstractServerTest;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.sp.JavaStoredProcUtils;
 import org.apache.directory.shared.ldap.sp.LdapContextParameter;
+import org.junit.Before;
+import org.junit.Test;
 
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.ldap.InitialLdapContext;
 import javax.naming.ldap.LdapContext;
+
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Map;
 import java.util.Set;
 
 
@@ -46,9 +53,10 @@
 {
     private LdapContext ctx;
     private LdapContext spCtx;
+    private Map<String, OidNormalizer> oids;
 
     
-    public void setUp() throws Exception
+    @Before public void setUp() throws Exception
     {
 
         super.setUp();
@@ -65,6 +73,13 @@
         spContainer.get( "objectClass" ).add( "organizationalUnit" );
         spContainer.put( "ou", "Stored Procedures" );
         spCtx = ( LdapContext ) ctx.createSubcontext( "ou=Stored Procedures", spContainer
);
+        
+        // Initialize OIDs maps for normalization
+        oids = new HashMap<String, OidNormalizer>();
+
+        oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer()
) );
+        oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() )
);
     }
 
 
@@ -112,7 +127,7 @@
     }
     
     
-    public void testSPDeleteSubtree() throws NamingException
+    @Test public void testSPDeleteSubtree() throws NamingException
     {
         String ldif =
             "version: 1\n" +
@@ -138,9 +153,13 @@
         
         JavaStoredProcUtils.loadStoredProcedureClass( spCtx, DITUtilitiesSP.class );
         
+        LdapDN people = new LdapDN( "ou=People" );
+        people = LdapDN.normalize(  people, oids );
+        
         String spName = DITUtilitiesSP.class.getName() + ":deleteSubtree";
         Object[] params = new Object[] { new LdapContextParameter( "ou=system" ),
-                                         new LdapDN( "ou=People" ) };
+                                         people };
+        
         
         JavaStoredProcUtils.callStoredProcedure( ctx, spName, params );
         

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
Sun Jan 20 08:59:10 2008
@@ -20,23 +20,21 @@
 package org.apache.directory.server.jndi;
 
 
-import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
-import org.apache.directory.server.core.unit.AbstractAdminTestCase;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.server.unit.AbstractServerTest;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.Context;
-import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
+
 import java.util.HashSet;
-import java.util.Hashtable;
 import java.util.Set;
 
 
@@ -46,16 +44,18 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class ServerContextFactoryTest extends AbstractAdminTestCase
+public class ServerContextFactoryTest extends AbstractServerTest
 {
-    public ServerContextFactoryTest()
+    public ServerContextFactoryTest() throws NamingException
     {
     }
 
+    private DirContext ctx = null;
+
 
     public void setUp() throws Exception
     {
-        Attributes attrs;
+        super.setUp();
         Set<Index> indexedAttrs;
         Set<Partition> partitions = new HashSet<Partition>();
 
@@ -69,16 +69,10 @@
         indexedAttrs.add( new JdbmIndex( "objectClass" ) );
         partition.setIndexedAttributes( indexedAttrs );
 
-        attrs = new AttributesImpl( true );
-        Attribute attr = new AttributeImpl( "objectClass" );
-        attr.add( "top" );
-        attr.add( "organizationalUnit" );
-        attr.add( "extensibleObject" );
-        attrs.put( attr );
-        attr = new AttributeImpl( "ou" );
-        attr.add( "testing" );
-        attrs.put( attr );
-        partition.setContextEntry( attrs );
+        ServerEntry serverEntry = new DefaultServerEntry( directoryService.getRegistries(),
new LdapDN( "ou=testing" ) );
+        serverEntry.put( "objectClass", "top", "organizationalUnit", "extensibleObject" );
+        serverEntry.put( "ou", "testing" );
+        partition.setContextEntry( serverEntry );
 
         partitions.add( partition );
 
@@ -93,16 +87,10 @@
         indexedAttrs.add( new JdbmIndex( "objectClass" ) );
         partition.setIndexedAttributes( indexedAttrs );
 
-        attrs = new AttributesImpl( true );
-        attr = new AttributeImpl( "objectClass" );
-        attr.add( "top" );
-        attr.add( "domain" );
-        attr.add( "extensibleObject" );
-        attrs.put( attr );
-        attr = new AttributeImpl( "dc" );
-        attr.add( "example" );
-        attrs.put( attr );
-        partition.setContextEntry( attrs );
+        serverEntry = new DefaultServerEntry( directoryService.getRegistries(), new LdapDN(
"dc=example" ) );
+        serverEntry.put( "objectClass", "top", "organizationalUnit", "extensibleObject" );
+        serverEntry.put( "dc", "example" );
+        partition.setContextEntry( serverEntry );
 
         partitions.add( partition );
 
@@ -116,20 +104,14 @@
         indexedAttrs.add( new JdbmIndex( "objectClass" ) );
         partition.setIndexedAttributes( indexedAttrs );
 
-        attrs = new AttributesImpl( true );
-        attr = new AttributeImpl( "objectClass" );
-        attr.add( "top" );
-        attr.add( "domain" );
-        attr.add( "extensibleObject" );
-        attrs.put( attr );
-        attr = new AttributeImpl( "dc" );
-        attr.add( "MixedCase" );
-        attrs.put( attr );
-        partition.setContextEntry( attrs );
+        serverEntry = new DefaultServerEntry( directoryService.getRegistries(), new LdapDN(
"dc=MixedCase" ) );
+        serverEntry.put( "objectClass", "top", "organizationalUnit", "extensibleObject" );
+        serverEntry.put( "dc", "MixedCase" );
+        partition.setContextEntry( serverEntry );
 
         partitions.add( partition );
 
-        service.setPartitions( partitions );
+        directoryService.setPartitions( partitions );
 
         super.setUp();
     }
@@ -178,12 +160,13 @@
     }
 
 
+    /*
     public void testAppPartitionExample() throws NamingException
     {
         Hashtable<String,Object> env = new Hashtable<String,Object>();
 
         env.put( Context.PROVIDER_URL, "dc=example" );
-        env.put( DirectoryService.JNDI_KEY, service );
+        env.put( DirectoryService.JNDI_KEY, directoryService );
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
@@ -207,7 +190,7 @@
         Hashtable<String,Object> env = new Hashtable<String,Object>();
 
         env.put( Context.PROVIDER_URL, "ou=testing" );
-        env.put( DirectoryService.JNDI_KEY, service );
+        env.put( DirectoryService.JNDI_KEY, directoryService );
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
@@ -231,7 +214,7 @@
         Hashtable<String,Object> env = new Hashtable<String,Object>();
 
         env.put( Context.PROVIDER_URL, "dc=MixedCase" );
-        env.put( DirectoryService.JNDI_KEY, service );
+        env.put( DirectoryService.JNDI_KEY, directoryService );
         env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
         env.put( Context.SECURITY_CREDENTIALS, "secret" );
         env.put( Context.SECURITY_AUTHENTICATION, "simple" );
@@ -248,4 +231,5 @@
         assertTrue( attribute.contains( "top" ) );
         assertTrue( attribute.contains( "domain" ) );
     }
+    */
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-xml/src/main/resources/server.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-xml/src/main/resources/server.xml?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-xml/src/main/resources/server.xml
(original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-xml/src/main/resources/server.xml
Sun Jan 20 08:59:10 2008
@@ -24,14 +24,15 @@
           <jdbmIndex attributeId="uid" cacheSize="100"/>
           <jdbmIndex attributeId="objectClass" cacheSize="100"/>
         </indexedAttributes>
-        <contextEntry>
+        <contextEntry>#systemContextEntry</contextEntry>
+        <!-- contextEntry>
           <value xmlns="http://www.springframework.org/schema/beans">
             objectClass: top
             objectClass: organizationalUnit
             objectClass: extensibleObject
             ou: system
           </value>
-        </contextEntry>
+        </contextEntry -->
       </jdbmPartition>
     </systemPartition>
 
@@ -55,14 +56,15 @@
           <jdbmIndex attributeId="uid" cacheSize="100"/>
           <jdbmIndex attributeId="objectClass" cacheSize="100"/>
         </indexedAttributes>
-        <contextEntry>
+        <contextEntry>#exampleContextEntry</contextEntry>
+        <!-- contextEntry>
           <value xmlns="http://www.springframework.org/schema/beans">
             objectClass: top
             objectClass: domain
             objectClass: extensibleObject
             dc: example
           </value>
-        </contextEntry>
+        </contextEntry -->
       </jdbmPartition>
     </partitions>
 
@@ -190,6 +192,40 @@
     <ldapServer>#ldapServer</ldapServer>
     <ldapsServer>#ldapsServer</ldapsServer>
   </apacheDS>
+
+  <spring:bean id="systemContextEntry" 
+	class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+    <spring:property name="targetObject"><spring:ref local='directoryService'/></spring:property>
+    <spring:property name="targetMethod"><spring:value>newEntry</spring:value></spring:property>
+    <spring:property name="arguments">
+      <spring:list>
+        <spring:value xmlns="http://www.springframework.org/schema/beans">
+          objectClass: top
+          objectClass: organizationalUnit
+          objectClass: extensibleObject
+          ou: system
+        </spring:value>
+        <spring:value>ou=system</spring:value>
+      </spring:list>
+    </spring:property>
+  </spring:bean>
+  
+  <spring:bean id="exampleContextEntry" 
+	class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+    <spring:property name="targetObject"><spring:ref local='directoryService'/></spring:property>
+    <spring:property name="targetMethod"><spring:value>newEntry</spring:value></spring:property>
+    <spring:property name="arguments">
+      <spring:list>
+        <spring:value xmlns="http://www.springframework.org/schema/beans">
+          objectClass: top
+          objectClass: domain
+          objectClass: extensibleObject
+          dc: example
+        </spring:value>
+        <spring:value>dc=example,dc=com</spring:value>
+      </spring:list>
+    </spring:property>
+  </spring:bean>
 
   <!-- another bean I didn't convert -->
   <spring:bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">



Mime
View raw message