directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r429554 - in /directory/trunks/apacheds: core/src/main/java/org/apache/directory/server/core/exception/ core/src/main/java/org/apache/directory/server/core/schema/ server-unit/src/test/java/org/apache/directory/server/
Date Tue, 08 Aug 2006 03:25:16 GMT
Author: akarasulu
Date: Mon Aug  7 20:25:15 2006
New Revision: 429554

URL: http://svn.apache.org/viewvc?rev=429554&view=rev
Log:
Fix for DIRSERVER-673: Can not query schema

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

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java?rev=429554&r1=429553&r2=429554&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
Mon Aug  7 20:25:15 2006
@@ -50,7 +50,8 @@
 public class ExceptionService extends BaseInterceptor
 {
     private PartitionNexus nexus;
-
+    private LdapDN subschemSubentryDn;
+    
     /**
      * The OIDs normalizer map
      */
@@ -68,6 +69,9 @@
     {
         nexus = factoryCfg.getPartitionNexus();
         normalizerMap = factoryCfg.getGlobalRegistries().getAttributeTypeRegistry().getNormalizerMapping();
+        Attribute attr = nexus.getRootDSE().get( "subschemaSubentry" );
+        subschemSubentryDn = new LdapDN( ( String ) attr.get() );
+        subschemSubentryDn.normalize( normalizerMap );
     }
 
 
@@ -372,8 +376,7 @@
             return nextInterceptor.search( base, env, filter, searchCtls );
         }
 
-        Attribute attr = nextInterceptor.getRootDSE().get( "subschemaSubentry" );
-        if ( ( ( String ) attr.get() ).equalsIgnoreCase( base.toString() ) )
+        if ( ( subschemSubentryDn.toNormName() ).equalsIgnoreCase( base.toNormName() ) )
         {
             return nextInterceptor.search( base, env, filter, searchCtls );
         }

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=429554&r1=429553&r2=429554&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
Mon Aug  7 20:25:15 2006
@@ -111,7 +111,7 @@
     /**
      * subschemaSubentry attribute's value from Root DSE
      */
-    private String subschemaSubentryDn;
+    private LdapDN subschemaSubentryDn;
 
     /**
      * The time when the server started up.
@@ -147,7 +147,8 @@
 
         // stuff for dealing with subentries (garbage for now)
         String subschemaSubentry = ( String ) nexus.getRootDSE().get( "subschemaSubentry"
).get();
-        subschemaSubentryDn = new LdapDN( subschemaSubentry ).toString().toLowerCase();
+        subschemaSubentryDn = new LdapDN( subschemaSubentry );
+        subschemaSubentryDn.normalize( globalRegistries.getAttributeTypeRegistry().getNormalizerMapping()
);
     }
 
 
@@ -187,7 +188,7 @@
         SearchControls searchCtls ) throws NamingException
     {
         // check to make sure the DN searched for is a subentry
-        if ( !subschemaSubentryDn.equals( base.toString() ) )
+        if ( !subschemaSubentryDn.toNormName().equals( base.toNormName() ) )
         {
             NamingEnumeration e = nextInterceptor.search( base, env, filter, searchCtls );
             if ( searchCtls.getReturningAttributes() != null )
@@ -203,7 +204,8 @@
         {
             SimpleNode node = ( SimpleNode ) filter;
 
-            if ( node.getAttribute().equalsIgnoreCase( "objectClass" )
+            // see if node attribute is objectClass
+            if ( node.getAttribute().equalsIgnoreCase( "2.5.4.0" )
                 && node.getValue().equalsIgnoreCase( "subschema" ) && node.getAssertionType()
== SimpleNode.EQUALITY )
             {
                 // call.setBypass( true );
@@ -216,7 +218,8 @@
         {
             PresenceNode node = ( PresenceNode ) filter;
 
-            if ( node.getAttribute().equalsIgnoreCase( "objectClass" ) )
+            // see if node attribute is objectClass
+            if ( node.getAttribute().equalsIgnoreCase( "2.5.4.0" ) )
             {
                 // call.setBypass( true );
                 Attributes attrs = getSubschemaEntry( searchCtls.getReturningAttributes()
);

Modified: directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java?rev=429554&r1=429553&r2=429554&view=diff
==============================================================================
--- directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
(original)
+++ directory/trunks/apacheds/server-unit/src/test/java/org/apache/directory/server/SearchTest.java
Mon Aug  7 20:25:15 2006
@@ -374,4 +374,20 @@
         results = search( "(&(sn=Bush)(numberOfOctaves=4))" );
         assertEquals( "returned size of results", 0, results.size() );
     }
+    
+    
+    public void testSearchSchema() throws Exception
+    {
+        SearchControls controls = new SearchControls();
+        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        controls.setReturningAttributes( new String[] { "objectClasses" } );
+        
+        NamingEnumeration results = ctx.search( "cn=schema", "objectClass=subschema", controls
);
+        assertTrue( results.hasMore() );
+        SearchResult result = ( SearchResult ) results.next();
+        assertNotNull( result );
+        assertFalse( results.hasMore() );
+        assertNotNull( result.getAttributes().get( "objectClasses" ) );
+        assertEquals( 1, result.getAttributes().size() );
+    }
 }



Mime
View raw message