directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r502522 - in /directory/apacheds/trunk: core-unit/src/test/java/org/apache/directory/server/core/schema/ core/src/main/java/org/apache/directory/server/core/exception/ core/src/main/java/org/apache/directory/server/core/schema/ server-unit/...
Date Fri, 02 Feb 2007 06:50:12 GMT
Author: akarasulu
Date: Thu Feb  1 22:50:12 2007
New Revision: 502522

URL: http://svn.apache.org/viewvc?view=rev&rev=502522
Log:
fixed various tests to accomodate global subschema subentry name change

Modified:
    directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
    directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SearchTest.java

Modified: directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java?view=diff&rev=502522&r1=502521&r2=502522
==============================================================================
--- directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
(original)
+++ directory/apacheds/trunk/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
Thu Feb  1 22:50:12 2007
@@ -189,7 +189,7 @@
         controls.setSearchScope( SearchControls.OBJECT_SCOPE );
         
         Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration results = sysRoot.search( "cn=schema", "(objectClass=*)", controls
);
+        NamingEnumeration results = rootDSE.search( "cn=schema", "(objectClass=*)", controls
);
 
         while ( results.hasMore() )
         {
@@ -200,8 +200,8 @@
         // We should have only one entry in the result
         assertEquals( 1, subSchemaEntry.size() );
         
-        // It should be the normalized form of cn=schema,ou=system
-        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema,2.5.4.11=system" );
+        // It should be the normalized form of cn=schema
+        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema" );
         
         assertNotNull( attrs );
         
@@ -222,7 +222,7 @@
         controls.setReturningAttributes( new String[]{ "+" } );
         
         Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration results = sysRoot.search( "cn=schema", "(objectClass=*)", controls
);
+        NamingEnumeration results = rootDSE.search( "cn=schema", "(objectClass=*)", controls
);
 
         while ( results.hasMore() )
         {
@@ -233,8 +233,8 @@
         // We should have only one entry in the result
         assertEquals( 1, subSchemaEntry.size() );
         
-        // It should be the normalized form of cn=schema,ou=system
-        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema,2.5.4.11=system" );
+        // It should be the normalized form of cn=schema
+        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema" );
         
         assertNotNull( attrs );
         
@@ -278,7 +278,7 @@
         controls.setReturningAttributes( new String[]{ "nameForms" } );
         
         Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration results = sysRoot.search( "cn=schema", "(objectClass=*)", controls
);
+        NamingEnumeration results = rootDSE.search( "cn=schema", "(objectClass=*)", controls
);
 
         while ( results.hasMore() )
         {
@@ -289,8 +289,8 @@
         // We should have only one entry in the result
         assertEquals( 1, subSchemaEntry.size() );
         
-        // It should be the normalized form of cn=schema,ou=system
-        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema,2.5.4.11=system" );
+        // It should be the normalized form of cn=schema
+        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema" );
         
         assertNotNull( attrs );
         
@@ -321,7 +321,7 @@
         controls.setReturningAttributes( new String[]{ "+" } );
         
         Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration results = sysRoot.search( "cn=schema", "(objectClass=nothing)",
controls );
+        NamingEnumeration results = rootDSE.search( "cn=schema", "(objectClass=nothing)",
controls );
 
         while ( results.hasMore() )
         {
@@ -340,7 +340,7 @@
         controls.setReturningAttributes( new String[]{ "+" } );
         
         Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration results = sysRoot.search( "cn=schema", "(objectClass=top)", controls
);
+        NamingEnumeration results = rootDSE.search( "cn=schema", "(objectClass=top)", controls
);
 
         while ( results.hasMore() )
         {
@@ -351,8 +351,8 @@
         // We should have only one entry in the result
         assertEquals( 1, subSchemaEntry.size() );
         
-        // It should be the normalized form of cn=schema,ou=system
-        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema,2.5.4.11=system" );
+        // It should be the normalized form of cn=schema
+        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema" );
         
         assertNotNull( attrs );
         
@@ -383,7 +383,7 @@
         controls.setReturningAttributes( new String[]{ "+" } );
         
         Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration results = sysRoot.search( "cn=schema", "(objectClass=subSchema)",
controls );
+        NamingEnumeration results = rootDSE.search( "cn=schema", "(objectClass=subSchema)",
controls );
 
         while ( results.hasMore() )
         {
@@ -394,8 +394,8 @@
         // We should have only one entry in the result
         assertEquals( 1, subSchemaEntry.size() );
         
-        // It should be the normalized form of cn=schema,ou=system
-        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema,2.5.4.11=system" );
+        // It should be the normalized form of cn=schema
+        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema" );
         
         assertNotNull( attrs );
         
@@ -426,7 +426,7 @@
         controls.setReturningAttributes( new String[]{ "+" } );
         
         Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration results = sysRoot.search( "cn=schema", "(objectClass=nothing)",
controls );
+        NamingEnumeration results = rootDSE.search( "cn=schema", "(objectClass=nothing)",
controls );
 
         while ( results.hasMore() )
         {
@@ -445,7 +445,7 @@
         controls.setReturningAttributes( new String[]{ "+" } );
         
         Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration results = sysRoot.search( "cn=schema", "(&(objectClass=*)(objectClass=top))",
controls );
+        NamingEnumeration results = rootDSE.search( "cn=schema", "(&(objectClass=*)(objectClass=top))",
controls );
 
         while ( results.hasMore() )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java?view=diff&rev=502522&r1=502521&r2=502522
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
Thu Feb  1 22:50:12 2007
@@ -465,6 +465,11 @@
      */
     private void assertHasEntry( NextInterceptor nextInterceptor, String msg, LdapDN dn )
throws NamingException
     {
+        if ( subschemSubentryDn.getNormName().equals( dn.getNormName() ) )
+        {
+            return;
+        }
+        
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
         if ( !nextInterceptor.hasEntry( dn ) )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?view=diff&rev=502522&r1=502521&r2=502522
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
Thu Feb  1 22:50:12 2007
@@ -550,4 +550,37 @@
 
         throw new LdapNamingException( ResultCodeEnum.UNWILLING_TO_PERFORM );
     }
+
+
+    /**
+     * Translates modify operations on schema subentries into one or more operations 
+     * on meta schema entities within the ou=schema partition and updates the registries
+     * accordingly.  This uses direct access to the partition to bypass all interceptors.
+     * 
+     * @param name the name of the subentry
+     * @param mods the modification operations performed on the subentry
+     * @param subentry the attributes of the subentry
+     * @param targetSubentry the target subentry after being modified
+     */
+    public void modifySchemaSubentry( LdapDN name, ModificationItemImpl[] mods, Attributes
subentry, 
+        Attributes targetSubentry ) throws NamingException
+    {
+    }
+
+
+    /**
+     * Translates modify operations on schema subentries into one or more operations 
+     * on meta schema entities within the ou=schema partition and updates the registries
+     * accordingly.  This uses direct access to the partition to bypass all interceptors.
+     * 
+     * @param name the name of the subentry
+     * @param modOp the modification operation performed on the subentry
+     * @param mods the modification operations performed on the subentry
+     * @param subentry the attributes of the subentry
+     * @param targetSubentry the target subentry after being modified
+     */
+    public void modifySchemaSubentry( LdapDN name, int modOp, Attributes mods, Attributes
subentry, 
+        Attributes targetSubentry ) throws NamingException
+    {
+    }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=502522&r1=502521&r2=502522
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
Thu Feb  1 22:50:12 2007
@@ -1198,6 +1198,11 @@
         {
             schemaManager.modify( name, modOp, mods, entry, targetEntry );
         }
+        else if ( subschemaSubentryDn.getNormName().equals( name.getNormName() ) )
+        {
+            schemaManager.modifySchemaSubentry( name, modOp, mods, entry, targetEntry );
+            return;
+        }
         
         next.modify( name, modOp, mods );
     }
@@ -1528,6 +1533,11 @@
         if ( name.startsWith( schemaBaseDN ) )
         {
             schemaManager.modify( name, mods, entry, targetEntry );
+        }
+        else if ( subschemaSubentryDn.getNormName().equals( name.getNormName() ) )
+        {
+            schemaManager.modifySchemaSubentry( name, mods, entry, targetEntry );
+            return;
         }
         
         next.modify( name, mods );

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=502522&r1=502521&r2=502522
==============================================================================
--- 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 Feb  1 22:50:12 2007
@@ -466,6 +466,16 @@
         controls.setSearchScope( SearchControls.OBJECT_SCOPE );
         controls.setReturningAttributes( new String[] { "objectClasses" } );
         
+        Hashtable env = new Hashtable();
+        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
+        env.put( "java.naming.provider.url", "ldap://localhost:" + port );
+        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
+        env.put( "java.naming.security.credentials", "secret" );
+        env.put( "java.naming.security.authentication", "simple" );
+
+        ctx = new InitialLdapContext( env, null );
+        assertNotNull( ctx );
+
         NamingEnumeration results = ctx.search( "cn=schema", "objectClass=subschema", controls
);
         assertTrue( results.hasMore() );
         SearchResult result = ( SearchResult ) results.next();



Mime
View raw message