directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r982648 [1/3] - in /directory: apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/ apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/trunk/jdbm-partition/src/test/java/org/ap...
Date Thu, 05 Aug 2010 14:55:10 GMT
Author: elecharny
Date: Thu Aug  5 14:55:09 2010
New Revision: 982648

URL: http://svn.apache.org/viewvc?rev=982648&view=rev
Log:
o Moving the toName and fromName methods from DN to JndiUtils
o Making the normalize(DN/String, OidMap) package protected
o The getRdns now returns an unmodifiable list of RDNs, using the revert order
o The getAllRdn() methods has been removed. One should use the Iterator() instead
o Fixed the code accordingly to the previous modifications

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/AbstractMetaSchemaObjectHandler.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxHandlerIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/ObjectClassCreateIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaPersistenceIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryIT.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
    directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
    directory/shared/trunk/ldap-jndi/src/main/java/org/apache/directory/shared/ldap/jndi/JndiUtils.java
    directory/shared/trunk/ldap/src/main/antlr/ACIItem.g
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/tree/DnNode.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/AbstractMetaSchemaObjectHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/AbstractMetaSchemaObjectHandler.java?rev=982648&r1=982647&r2=982648&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/AbstractMetaSchemaObjectHandler.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/AbstractMetaSchemaObjectHandler.java Thu Aug  5 14:55:09 2010
@@ -6,21 +6,20 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.server.core.schema;
 
 import java.io.File;
-import java.util.Enumeration;
 
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.shared.ldap.name.DN;
@@ -42,8 +41,8 @@ public abstract class AbstractMetaSchema
     {
         workingDir = service.getWorkingDirectory().getAbsolutePath();
     }
-    
-    
+
+
     /**
      * Get the path on disk where a specific SchemaObject is stored
      *
@@ -52,23 +51,21 @@ public abstract class AbstractMetaSchema
     protected String getSchemaPath( DN dn )
     {
         StringBuilder sb = new StringBuilder();
-        
+
         sb.append( workingDir ).append( '/' ).append( service.getSchemaService().getSchemaPartition().getId() ).append( '/' ).append( "ou=schema" );
-        
-        Enumeration<RDN> rdns = dn.getAllRdn();
-        
-        while ( rdns.hasMoreElements() )
+
+        for ( RDN rdn : dn )
         {
             sb.append( '/' );
-            sb.append( StringTools.toLowerCase( rdns.nextElement().getName() ) );
+            sb.append( StringTools.toLowerCase( rdn.getName() ) );
         }
-        
+
         sb.append( ".ldif" );
-        
+
         return sb.toString();
     }
 
-    
+
     /**
      * Check that a specific SchemaObject is stored on the disk at the
      * correct position in the Ldif partition
@@ -82,11 +79,11 @@ public abstract class AbstractMetaSchema
         String schemaObjectFileName = getSchemaPath( dn );
 
         File file = new File( schemaObjectFileName );
-     
+
         return file.exists();
     }
-    
-    
+
+
     /**
      * Gets relative DN to ou=schema.
      *
@@ -98,8 +95,8 @@ public abstract class AbstractMetaSchema
     {
         return new DN( "cn=" + schemaName );
     }
-    
-    
+
+
     /**
      * Gets relative DN to ou=schema.
      *
@@ -125,7 +122,7 @@ public abstract class AbstractMetaSchema
         return new DN( "ou=comparators,cn=" + schemaName );
     }
 
-    
+
     /**
      * Get relative DN to ou=schema for MatchingRules
      *
@@ -137,8 +134,8 @@ public abstract class AbstractMetaSchema
     {
         return new DN( "ou=matchingRules,cn=" + schemaName );
     }
-    
-   
+
+
     /**
      * Gets relative DN to ou=schema.
      *
@@ -177,8 +174,8 @@ public abstract class AbstractMetaSchema
     {
         return new DN( "ou=syntaxes,cn=" + schemaName );
     }
-    
-    
+
+
     /**
      * Get relative DN to ou=schema for SyntaxCheckers
      *

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java?rev=982648&r1=982647&r2=982648&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerIT.java Thu Aug  5 14:55:09 2010
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.server.core.schema;
 
@@ -40,6 +40,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
+import org.apache.directory.shared.ldap.jndi.JndiUtils;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
@@ -78,7 +79,7 @@ public class MetaAttributeTypeHandlerIT 
     @Test
     public void testAddAttributeTypeWithoutMatchingRule() throws Exception
     {
-        Attributes attrs = LdifUtils.createAttributes( 
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaAttributeType",
@@ -87,17 +88,17 @@ public class MetaAttributeTypeHandlerIT 
             "m-syntax: 1.3.6.1.4.1.1466.115.121.1.8",
             "m-description: attribute certificate use ;binary"
          );
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=2.5.4.58" );
-        
+
         // Pre-checks
         assertFalse( isOnDisk( dn ) );
         assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( "2.5.4.58" ) );
-        
+
         // Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
-        
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
+
         // Post-checks
         assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( "2.5.4.58" ) );
         assertEquals( service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( "2.5.4.58" ), "apachemeta" );
@@ -108,7 +109,7 @@ public class MetaAttributeTypeHandlerIT 
     @Test
     public void testAddAttributeTypeToEnabledSchema() throws Exception
     {
-        Attributes attrs = LdifUtils.createAttributes( 
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaAttributeType",
@@ -118,28 +119,28 @@ public class MetaAttributeTypeHandlerIT 
             "m-equality: caseIgnoreMatch",
             "m-singleValue: FALSE",
             "m-usage: directoryOperation" );
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
-        
+
         // Pre-checks
         assertFalse( isOnDisk( dn ) );
         assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
 
         // Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
-        
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
+
         // Post-checks
         assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
         assertEquals( service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
         assertTrue( isOnDisk( dn ) );
     }
-    
-    
+
+
     @Test
     public void testAddAttributeTypeToUnLoadedSchema() throws Exception
     {
-        Attributes attrs = LdifUtils.createAttributes( 
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaAttributeType",
@@ -152,29 +153,29 @@ public class MetaAttributeTypeHandlerIT 
 
         DN dn = getAttributeTypeContainer( "notloaded" );
         dn = dn.add( "m-oid=" + OID );
-        
+
         try
         {
-            getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
+            getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
             fail( "Should not be there" );
         }
         catch( NameNotFoundException nnfe )
         {
             // Expected result.
         }
-        
-        assertFalse( "adding new attributeType to disabled schema should not register it into the registries", 
+
+        assertFalse( "adding new attributeType to disabled schema should not register it into the registries",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
+
         // The added entry must not be present on disk
         assertFalse( isOnDisk( dn ) );
     }
-    
-    
+
+
     @Test
     public void testAddAttributeTypeToDisabledSchema() throws Exception
     {
-        Attributes attrs = LdifUtils.createAttributes( 
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaAttributeType",
@@ -187,20 +188,20 @@ public class MetaAttributeTypeHandlerIT 
 
         DN dn = getAttributeTypeContainer( "nis" );
         dn = dn.add( "m-oid=" + OID );
-        
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
-        
-        assertFalse( "adding new attributeType to disabled schema should not register it into the registries", 
+
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
+
+        assertFalse( "adding new attributeType to disabled schema should not register it into the registries",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
+
         // The GlobalOidRegistries must not contain the AT
         assertFalse( service.getSchemaManager().getGlobalOidRegistry().contains( OID ) );
-        
+
         // The added entry must be present on disk
         assertTrue( isOnDisk( dn ) );
     }
 
-    
+
     // ----------------------------------------------------------------------
     // Test Delete operation
     // ----------------------------------------------------------------------
@@ -213,23 +214,23 @@ public class MetaAttributeTypeHandlerIT 
         dn = dn.add( "m-oid=" + OID );
 
         // Check in Registries
-        assertTrue( "attributeType should be removed from the registry after being deleted", 
+        assertTrue( "attributeType should be removed from the registry after being deleted",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
 
         // Check on disk that the added SchemaObject exist
         assertTrue( isOnDisk( dn ) );
-        
-        getSchemaContext( service ).destroySubcontext( DN.toName( dn ) );
+
+        getSchemaContext( service ).destroySubcontext( JndiUtils.toName( dn ) );
 
         // Check in Registries
-        assertFalse( "attributeType should be removed from the registry after being deleted", 
+        assertFalse( "attributeType should be removed from the registry after being deleted",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
+
         // Check on disk that the deleted SchemaObject does not exist anymore
         assertFalse( isOnDisk( dn ) );
     }
-    
-    
+
+
     /**
      * Try to delete an AT from a disabled schema. The AT is first
      * added, then deleted. The AT should be present on disk but not
@@ -245,25 +246,25 @@ public class MetaAttributeTypeHandlerIT 
         dn = dn.add( "m-oid=" + OID );
 
         // Check in Registries
-        assertFalse( "attributeType should be removed from the registry after being deleted", 
+        assertFalse( "attributeType should be removed from the registry after being deleted",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
 
         // Check on disk that the added SchemaObject exists
         assertTrue( isOnDisk( dn ) );
-        
+
         // Remove the AT
-        getSchemaContext( service ).destroySubcontext( DN.toName( dn ) );
+        getSchemaContext( service ).destroySubcontext( JndiUtils.toName( dn ) );
 
         // Check in Registries
-        assertFalse( "attributeType should be removed from the registry after being deleted", 
+        assertFalse( "attributeType should be removed from the registry after being deleted",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
         assertFalse( service.getSchemaManager().getGlobalOidRegistry().contains( OID ) );
-        
+
         // Check on disk that the deleted SchemaObject does not exist anymore
         assertFalse( isOnDisk( dn ) );
     }
 
-    
+
     @Test
     public void testDeleteAttributeTypeWhenInUse() throws Exception
     {
@@ -272,21 +273,21 @@ public class MetaAttributeTypeHandlerIT 
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
         addDependeeAttributeType();
-        
+
         try
         {
-            getSchemaContext( service ).destroySubcontext( DN.toName( dn ) );
+            getSchemaContext( service ).destroySubcontext( JndiUtils.toName( dn ) );
             fail( "should not be able to delete a attributeType in use" );
         }
-        catch( OperationNotSupportedException e ) 
+        catch( OperationNotSupportedException e )
         {
         }
 
-        assertTrue( "attributeType should still be in the registry after delete failure", 
+        assertTrue( "attributeType should still be in the registry after delete failure",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
     }
-    
-    
+
+
     // ----------------------------------------------------------------------
     // Test Modify operation
     // ----------------------------------------------------------------------
@@ -295,62 +296,62 @@ public class MetaAttributeTypeHandlerIT 
     public void testModifyAttributeTypeWithModificationItems() throws Exception
     {
         testAddAttributeTypeToEnabledSchema();
-        
+
         AttributeType at = service.getSchemaManager().lookupAttributeTypeRegistry( OID );
         assertEquals( at.getDescription(), DESCRIPTION0 );
         assertEquals( at.getSyntax().getOid(), SchemaConstants.INTEGER_SYNTAX );
 
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
-        
+
         ModificationItem[] mods = new ModificationItem[2];
         Attribute attr = new BasicAttribute( "m-description", DESCRIPTION1 );
         mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
         attr = new BasicAttribute( "m-syntax", SchemaConstants.DIRECTORY_STRING_SYNTAX );
         mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
-        getSchemaContext( service ).modifyAttributes( DN.toName( dn ), mods );
+        getSchemaContext( service ).modifyAttributes( JndiUtils.toName( dn ), mods );
 
-        assertTrue( "attributeType OID should still be present", 
+        assertTrue( "attributeType OID should still be present",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
-        assertEquals( "attributeType schema should be set to apachemeta", 
+
+        assertEquals( "attributeType schema should be set to apachemeta",
             service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
-        
+
         at = service.getSchemaManager().lookupAttributeTypeRegistry( OID );
         assertEquals( at.getDescription(), DESCRIPTION1 );
         assertEquals( at.getSyntax().getOid(), SchemaConstants.DIRECTORY_STRING_SYNTAX );
     }
 
-    
+
     @Test
     @Ignore
     public void testModifyAttributeTypeWithAttributes() throws Exception
     {
         testAddAttributeTypeToEnabledSchema();
-        
+
         AttributeType at = service.getSchemaManager().lookupAttributeTypeRegistry( OID );
         assertEquals( at.getDescription(), DESCRIPTION0 );
         assertEquals( at.getSyntax().getOid(), SchemaConstants.INTEGER_SYNTAX );
 
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
-        
+
         Attributes mods = new BasicAttributes( true );
         mods.put( "m-description", DESCRIPTION1 );
         mods.put( "m-syntax", SchemaConstants.DIRECTORY_STRING_SYNTAX );
-        getSchemaContext( service ).modifyAttributes( DN.toName( dn ), DirContext.REPLACE_ATTRIBUTE, mods );
+        getSchemaContext( service ).modifyAttributes( JndiUtils.toName( dn ), DirContext.REPLACE_ATTRIBUTE, mods );
 
-        assertTrue( "attributeType OID should still be present", 
+        assertTrue( "attributeType OID should still be present",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
-        assertEquals( "attributeType schema should be set to apachemeta", 
+
+        assertEquals( "attributeType schema should be set to apachemeta",
             service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
 
         at = service.getSchemaManager().lookupAttributeTypeRegistry( OID );
         assertEquals( at.getDescription(), DESCRIPTION1 );
         assertEquals( at.getSyntax().getOid(), SchemaConstants.DIRECTORY_STRING_SYNTAX );
     }
-    
+
 
     // ----------------------------------------------------------------------
     // Test Rename operation
@@ -364,14 +365,14 @@ public class MetaAttributeTypeHandlerIT 
         LdapContext schemaRoot = getSchemaContext( service );
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
-        
+
         DN newdn = getAttributeTypeContainer( "apachemeta" );
         dn = newdn.add( "m-oid=" + NEW_OID );
-        schemaRoot.rename( DN.toName( dn ), DN.toName( newdn ) );
+        schemaRoot.rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 
-        assertFalse( "old attributeType OID should be removed from the registry after being renamed", 
+        assertFalse( "old attributeType OID should be removed from the registry after being renamed",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
+
         service.getSchemaManager().getAttributeTypeRegistry().lookup( OID );
         fail( "attributeType lookup should fail after renaming the attributeType" );
 
@@ -388,21 +389,21 @@ public class MetaAttributeTypeHandlerIT 
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
         addDependeeAttributeType();
-        
+
         DN newdn = getAttributeTypeContainer( "apachemeta" );
         newdn = newdn.add( "m-oid=" + NEW_OID );
-        
+
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to rename a attributeType in use" );
         }
-        catch( LdapUnwillingToPerformException e ) 
+        catch( LdapUnwillingToPerformException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        assertTrue( "attributeType should still be in the registry after rename failure", 
+        assertTrue( "attributeType should still be in the registry after rename failure",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
     }
 
@@ -415,19 +416,19 @@ public class MetaAttributeTypeHandlerIT 
     public void testMoveAttributeType() throws Exception
     {
         testAddAttributeTypeToEnabledSchema();
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
 
         DN newdn = getAttributeTypeContainer( "apache" );
         newdn = newdn.add( "m-oid=" + OID );
-        
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 
         assertTrue( "attributeType OID should still be present",
                 service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
-        assertEquals( "attributeType schema should be set to apache not apachemeta", 
+
+        assertEquals( "attributeType schema should be set to apache not apachemeta",
             service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apache" );
     }
 
@@ -437,22 +438,22 @@ public class MetaAttributeTypeHandlerIT 
     public void testMoveAttributeTypeAndChangeRdn() throws Exception
     {
         testAddAttributeTypeToEnabledSchema();
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
 
         DN newdn = getAttributeTypeContainer( "apache" );
         newdn = newdn.add( "m-oid=" + NEW_OID );
-        
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
 
-        assertFalse( "old attributeType OID should NOT be present", 
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
+
+        assertFalse( "old attributeType OID should NOT be present",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
-        assertTrue( "new attributeType OID should be present", 
+
+        assertTrue( "new attributeType OID should be present",
             service.getSchemaManager().getAttributeTypeRegistry().contains( NEW_OID ) );
-        
-        assertEquals( "attributeType with new oid should have schema set to apache NOT apachemeta", 
+
+        assertEquals( "attributeType with new oid should have schema set to apache NOT apachemeta",
             service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( NEW_OID ), "apache" );
     }
 
@@ -462,24 +463,24 @@ public class MetaAttributeTypeHandlerIT 
     public void testMoveAttributeTypeToTop() throws Exception
     {
         testAddAttributeTypeToEnabledSchema();
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
 
         DN top = new DN();
         top = top.add( "m-oid=" + OID );
-        
+
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( top ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( top ) );
             fail( "should not be able to move a attributeType up to ou=schema" );
         }
-        catch( LdapInvalidDnException e ) 
+        catch( LdapInvalidDnException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.NAMING_VIOLATION );
         }
 
-        assertTrue( "attributeType should still be in the registry after move failure", 
+        assertTrue( "attributeType should still be in the registry after move failure",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
     }
 
@@ -489,44 +490,44 @@ public class MetaAttributeTypeHandlerIT 
     public void testMoveAttributeTypeToComparatorContainer() throws Exception
     {
         testAddAttributeTypeToEnabledSchema();
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
 
         DN newdn = new DN( "ou=comparators,cn=apachemeta" );
         newdn = newdn.add( "m-oid=" + OID );
-        
+
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to move a attributeType into comparators container" );
         }
-        catch( LdapInvalidDnException e ) 
+        catch( LdapInvalidDnException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.NAMING_VIOLATION );
         }
 
-        assertTrue( "attributeType should still be in the registry after move failure", 
+        assertTrue( "attributeType should still be in the registry after move failure",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
     }
-    
-    
+
+
     @Test
     @Ignore
     public void testMoveAttributeTypeToDisabledSchema() throws Exception
     {
         testAddAttributeTypeToEnabledSchema();
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
 
         // nis is inactive by default
         DN newdn = getAttributeTypeContainer( "nis" );
         newdn = newdn.add( "m-oid=" + OID );
-        
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
 
-        assertFalse( "attributeType OID should no longer be present", 
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
+
+        assertFalse( "attributeType OID should no longer be present",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
     }
 
@@ -537,24 +538,24 @@ public class MetaAttributeTypeHandlerIT 
     {
         testAddAttributeTypeToEnabledSchema();
         addDependeeAttributeType();
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
 
         DN newdn = getAttributeTypeContainer( "apache" );
         newdn = newdn.add( "m-oid=" + OID );
-        
+
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to move a attributeType in use" );
         }
-        catch( LdapUnwillingToPerformException e ) 
+        catch( LdapUnwillingToPerformException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        assertTrue( "attributeType should still be in the registry after move failure", 
+        assertTrue( "attributeType should still be in the registry after move failure",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
     }
 
@@ -565,34 +566,34 @@ public class MetaAttributeTypeHandlerIT 
     {
         testAddAttributeTypeToEnabledSchema();
         addDependeeAttributeType();
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + OID );
 
         DN newdn = getAttributeTypeContainer( "apache" );
         newdn = newdn.add( "m-oid=" + NEW_OID );
-        
+
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to move a attributeType in use" );
         }
-        catch( LdapUnwillingToPerformException e ) 
+        catch( LdapUnwillingToPerformException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        assertTrue( "attributeType should still be in the registry after move failure", 
+        assertTrue( "attributeType should still be in the registry after move failure",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
     }
 
-    
+
     // ----------------------------------------------------------------------
     // Test move, rename, and delete when a MR exists and uses the Normalizer
     // ----------------------------------------------------------------------
     private void addDependeeAttributeType() throws Exception
     {
-        Attributes attrs = LdifUtils.createAttributes( 
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaAttributeType",
@@ -603,11 +604,11 @@ public class MetaAttributeTypeHandlerIT 
             "m-singleValue: FALSE",
             "m-usage: directoryOperation",
             "m-supAttributeType", OID );
-        
+
         DN dn = getAttributeTypeContainer( "apachemeta" );
         dn = dn.add( "m-oid=" + DEPENDEE_OID );
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
-        
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
+
         assertTrue( service.getSchemaManager().getAttributeTypeRegistry().contains( DEPENDEE_OID ) );
         assertEquals( service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( DEPENDEE_OID ), "apachemeta" );
     }
@@ -622,23 +623,23 @@ public class MetaAttributeTypeHandlerIT 
     public void testMoveMatchingRuleToEnabledSchema() throws Exception
     {
         testAddAttributeTypeToDisabledSchema();
-        
+
         // nis is inactive by default
         DN dn = getAttributeTypeContainer( "nis" );
         dn.add( "m-oid=" + OID );
 
-        assertFalse( "attributeType OID should NOT be present when added to disabled nis schema", 
+        assertFalse( "attributeType OID should NOT be present when added to disabled nis schema",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
 
         DN newdn = getAttributeTypeContainer( "apachemeta" );
         newdn.add( "m-oid=" + OID );
-        
+
         getSchemaContext( service ).rename( dn, newdn );
 
-        assertTrue( "attributeType OID should be present when moved to enabled schema", 
+        assertTrue( "attributeType OID should be present when moved to enabled schema",
             service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
-        
-        assertEquals( "attributeType should be in apachemeta schema after move", 
+
+        assertEquals( "attributeType should be in apachemeta schema after move",
             service.getSchemaManager().getAttributeTypeRegistry().getSchemaName( OID ), "apachemeta" );
     }
     */

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java?rev=982648&r1=982647&r2=982648&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerIT.java Thu Aug  5 14:55:09 2010
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.server.core.schema;
 
@@ -43,6 +43,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
+import org.apache.directory.shared.ldap.jndi.JndiUtils;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
@@ -109,7 +110,7 @@ public class MetaComparatorHandlerIT ext
         assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
 
         // Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
 
         // Post-checks
         assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
@@ -136,7 +137,7 @@ public class MetaComparatorHandlerIT ext
         assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
 
         // Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
 
         // Post-checks
         assertFalse( "adding new comparator to disabled schema should not register it into the registries",
@@ -163,7 +164,7 @@ public class MetaComparatorHandlerIT ext
         // Addition
         try
         {
-            getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
+            getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
             fail( "Should not be there" );
         }
         catch ( NameNotFoundException nnfe )
@@ -202,7 +203,7 @@ public class MetaComparatorHandlerIT ext
         assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
 
         // Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
 
         // Post-checks
         assertTrue( schemaManager.getComparatorRegistry().contains( OID ) );
@@ -238,7 +239,7 @@ public class MetaComparatorHandlerIT ext
         assertFalse( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
 
         // Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
 
         // Post-checks
         assertFalse( "adding new comparator to disabled schema should not register it into the registries",
@@ -264,7 +265,7 @@ public class MetaComparatorHandlerIT ext
         assertTrue( isOnDisk( dn ) );
 
         // Deletion
-        getSchemaContext( service ).destroySubcontext( DN.toName( dn ) );
+        getSchemaContext( service ).destroySubcontext( JndiUtils.toName( dn ) );
 
         // Post-checks
         assertFalse( "comparator should be removed from the registry after being deleted", schemaManager
@@ -296,7 +297,7 @@ public class MetaComparatorHandlerIT ext
         assertTrue( isOnDisk( dn ) );
 
         // Deletion
-        getSchemaContext( service ).destroySubcontext( DN.toName( dn ) );
+        getSchemaContext( service ).destroySubcontext( JndiUtils.toName( dn ) );
 
         // Post-checks
         assertFalse( "comparator should be removed from the registry after being deleted", schemaManager
@@ -325,9 +326,9 @@ public class MetaComparatorHandlerIT ext
         testAddComparatorToEnabledSchema();
         assertTrue( isOnDisk( cDn ) );
         assertTrue( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
-        
+
         // Create a MR using this comparator
-        Attributes attrs = LdifUtils.createAttributes( 
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaMatchingRule",
@@ -343,7 +344,7 @@ public class MetaComparatorHandlerIT ext
         assertFalse( service.getSchemaManager().getMatchingRuleRegistry().contains( OID ) );
 
         // MatchingRule Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( mrDn ), attrs );
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( mrDn ), attrs );
 
         // Post-checks
         assertTrue( isOnDisk( mrDn ) );
@@ -351,7 +352,7 @@ public class MetaComparatorHandlerIT ext
 
         try
         {
-            getSchemaContext( service ).destroySubcontext( DN.toName( cDn ) );
+            getSchemaContext( service ).destroySubcontext( JndiUtils.toName( cDn ) );
             fail( "should not be able to delete a comparator in use" );
         }
         catch ( OperationNotSupportedException e )
@@ -378,7 +379,7 @@ public class MetaComparatorHandlerIT ext
         ModificationItem[] mods = new ModificationItem[1];
         Attribute attr = new BasicAttribute( "m-fqcn", BooleanComparator.class.getName() );
         mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
-        getSchemaContext( service ).modifyAttributes( DN.toName( dn ), mods );
+        getSchemaContext( service ).modifyAttributes( JndiUtils.toName( dn ), mods );
 
         assertTrue( "comparator OID should still be present", schemaManager.getComparatorRegistry().contains( OID ) );
 
@@ -401,7 +402,7 @@ public class MetaComparatorHandlerIT ext
 
         Attributes mods = new BasicAttributes( true );
         mods.put( "m-fqcn", BooleanComparator.class.getName() );
-        getSchemaContext( service ).modifyAttributes( DN.toName( dn ), DirContext.REPLACE_ATTRIBUTE, mods );
+        getSchemaContext( service ).modifyAttributes( JndiUtils.toName( dn ), DirContext.REPLACE_ATTRIBUTE, mods );
 
         assertTrue( "comparator OID should still be present", schemaManager.getComparatorRegistry().contains( OID ) );
 
@@ -426,7 +427,7 @@ public class MetaComparatorHandlerIT ext
 
         DN newdn = getComparatorContainer( "apachemeta" );
         newdn = newdn.add( "m-oid" + "=" + NEW_OID );
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 
         assertFalse( "old comparator OID should be removed from the registry after being renamed", schemaManager
             .getComparatorRegistry().contains( OID ) );
@@ -460,7 +461,7 @@ public class MetaComparatorHandlerIT ext
 
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to rename a comparator in use" );
         }
         catch ( LdapUnwillingToPerformException e )
@@ -490,7 +491,7 @@ public class MetaComparatorHandlerIT ext
         DN newdn = getComparatorContainer( "apache" );
         newdn = newdn.add( "m-oid" + "=" + OID );
 
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 
         assertTrue( "comparator OID should still be present", schemaManager.getComparatorRegistry().contains( OID ) );
 
@@ -514,7 +515,7 @@ public class MetaComparatorHandlerIT ext
         DN newdn = getComparatorContainer( "apache" );
         newdn = newdn.add( "m-oid" + "=" + NEW_OID );
 
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 
         assertFalse( "old comparator OID should NOT be present", schemaManager.getComparatorRegistry().contains( OID ) );
 
@@ -546,7 +547,7 @@ public class MetaComparatorHandlerIT ext
 
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to move a comparator in use" );
         }
         catch ( LdapUnwillingToPerformException e )
@@ -576,7 +577,7 @@ public class MetaComparatorHandlerIT ext
 
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to move a comparator in use" );
         }
         catch ( LdapUnwillingToPerformException e )
@@ -609,7 +610,7 @@ public class MetaComparatorHandlerIT ext
 
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( top ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( top ) );
             fail( "should not be able to move a comparator up to ou=schema" );
         }
         catch ( LdapInvalidDnException e )
@@ -636,7 +637,7 @@ public class MetaComparatorHandlerIT ext
 
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to move a comparator up to normalizers container" );
         }
         catch ( LdapInvalidDnException e )
@@ -662,7 +663,7 @@ public class MetaComparatorHandlerIT ext
         DN newdn = getComparatorContainer( "nis" );
         newdn = newdn.add( "m-oid" + "=" + OID );
 
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 
         assertFalse( "comparator OID should no longer be present", schemaManager.getComparatorRegistry().contains( OID ) );
     }
@@ -684,7 +685,7 @@ public class MetaComparatorHandlerIT ext
         DN newdn = getComparatorContainer( "apachemeta" );
         newdn = newdn.add( "m-oid" + "=" + OID );
 
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 
         assertTrue( "comparator OID should be present when moved to enabled schema", schemaManager
             .getComparatorRegistry().contains( OID ) );

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java?rev=982648&r1=982647&r2=982648&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerIT.java Thu Aug  5 14:55:09 2010
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ *
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.directory.server.core.schema;
 
@@ -38,6 +38,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.jndi.JndiUtils;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.DN;
@@ -78,25 +79,25 @@ public class MetaMatchingRuleHandlerIT e
 
     private void createComparator() throws Exception
     {
-        Attributes attrs = LdifUtils.createAttributes( 
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaComparator",
             "m-fqcn: " + StringComparator.class.getName(),
             "m-oid: " + OID,
             "m-description: A test comparator" );
-        
+
         DN dn = getComparatorContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
-        
+
         // Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
-        
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
+
         assertTrue( isOnDisk( dn ) );
         assertTrue( service.getSchemaManager().getComparatorRegistry().contains( OID ) );
     }
-    
-    
+
+
     // ----------------------------------------------------------------------
     // Test all core methods with normal operational pathways
     // ----------------------------------------------------------------------
@@ -106,8 +107,8 @@ public class MetaMatchingRuleHandlerIT e
     public void testAddMatchingRuleToEnabledSchema() throws Exception
     {
         createComparator();
-        
-        Attributes attrs = LdifUtils.createAttributes( 
+
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaMatchingRule",
@@ -117,76 +118,76 @@ public class MetaMatchingRuleHandlerIT e
 
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
-        
+
         // Pre-checks
         assertFalse( isOnDisk( dn ) );
         assertFalse( service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
 
         // Addition
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
-        
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
+
         // Post-checks
         assertTrue( service.getSchemaManager().getMatchingRuleRegistry().contains( OID ) );
         assertEquals( service.getSchemaManager().getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
         assertTrue( isOnDisk( dn ) );
     }
-    
-    
+
+
     @Test
     public void testAddMatchingRuleToDisabledSchema() throws Exception
     {
         createComparator();
-        
-        Attributes attrs = LdifUtils.createAttributes( 
+
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaMatchingRule",
             "m-oid", OID,
             "m-syntax", SchemaConstants.INTEGER_SYNTAX,
             "m-description", DESCRIPTION0 );
-        
+
         DN dn = getMatchingRuleContainer( "nis" );
         dn = dn.add( "m-oid" + "=" + OID );
-        getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
-        
-        assertFalse( "adding new matchingRule to disabled schema should not register it into the registries", 
+        getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
+
+        assertFalse( "adding new matchingRule to disabled schema should not register it into the registries",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
     }
-    
-    
+
+
     @Test
     public void testAddMatchingRuleToUnloadedSchema() throws Exception
     {
         createComparator();
-        
-        Attributes attrs = LdifUtils.createAttributes( 
+
+        Attributes attrs = LdifUtils.createAttributes(
             "objectClass: top",
             "objectClass: metaTop",
             "objectClass: metaMatchingRule",
             "m-oid", OID,
             "m-syntax", SchemaConstants.INTEGER_SYNTAX,
             "m-description", DESCRIPTION0 );
-        
+
         DN dn = getMatchingRuleContainer( "notloaded" );
         dn = dn.add( "m-oid" + "=" + OID );
-        
+
         try
         {
-            getSchemaContext( service ).createSubcontext( DN.toName( dn ), attrs );
+            getSchemaContext( service ).createSubcontext( JndiUtils.toName( dn ), attrs );
             fail( "Should not be there" );
         }
         catch( NameNotFoundException nnfe )
         {
             // Expected result
         }
-        
-        assertFalse( "adding new matchingRule to disabled schema should not register it into the registries", 
+
+        assertFalse( "adding new matchingRule to disabled schema should not register it into the registries",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
         assertFalse( isOnDisk( dn ) );
     }
-    
-    
+
+
     // ----------------------------------------------------------------------
     // Test Delete operation
     // ----------------------------------------------------------------------
@@ -196,16 +197,16 @@ public class MetaMatchingRuleHandlerIT e
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
         testAddMatchingRuleToEnabledSchema();
-        
-        assertTrue( "matchingRule should be removed from the registry after being deleted", 
+
+        assertTrue( "matchingRule should be removed from the registry after being deleted",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
-        
-        getSchemaContext( service ).destroySubcontext( DN.toName( dn ) );
 
-        assertFalse( "matchingRule should be removed from the registry after being deleted", 
+        getSchemaContext( service ).destroySubcontext( JndiUtils.toName( dn ) );
+
+        assertFalse( "matchingRule should be removed from the registry after being deleted",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
-        
+
         try
         {
             schemaManager.getMatchingRuleRegistry().lookup( OID );
@@ -225,14 +226,14 @@ public class MetaMatchingRuleHandlerIT e
         DN dn = getMatchingRuleContainer( "nis" );
         dn = dn.add( "m-oid" + "=" + OID );
         testAddMatchingRuleToDisabledSchema();
-        
-        assertFalse( "matchingRule should be removed from the registry after being deleted", 
+
+        assertFalse( "matchingRule should be removed from the registry after being deleted",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
         assertTrue( isOnDisk( dn ) );
-        
-        getSchemaContext( service ).destroySubcontext( DN.toName( dn ) );
 
-        assertFalse( "matchingRule should be removed from the registry after being deleted", 
+        getSchemaContext( service ).destroySubcontext( JndiUtils.toName( dn ) );
+
+        assertFalse( "matchingRule should be removed from the registry after being deleted",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
         assertFalse( isOnDisk( dn ) );
     }
@@ -246,55 +247,55 @@ public class MetaMatchingRuleHandlerIT e
     public void testModifyMatchingRuleWithModificationItems() throws Exception
     {
         testAddMatchingRuleToEnabledSchema();
-        
+
         MatchingRule mr = schemaManager.getMatchingRuleRegistry().lookup( OID );
         assertEquals( mr.getDescription(), DESCRIPTION0 );
         assertEquals( mr.getSyntax().getOid(), SchemaConstants.INTEGER_SYNTAX );
 
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
-        
+
         ModificationItem[] mods = new ModificationItem[2];
         Attribute attr = new BasicAttribute( "m-description", DESCRIPTION1 );
         mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
         attr = new BasicAttribute( "m-syntax", SchemaConstants.DIRECTORY_STRING_SYNTAX );
         mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
-        getSchemaContext( service ).modifyAttributes( DN.toName( dn ), mods );
+        getSchemaContext( service ).modifyAttributes( JndiUtils.toName( dn ), mods );
 
-        assertTrue( "matchingRule OID should still be present", 
+        assertTrue( "matchingRule OID should still be present",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
-        
-        assertEquals( "matchingRule schema should be set to apachemeta", 
+
+        assertEquals( "matchingRule schema should be set to apachemeta",
             schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
-        
+
         mr = schemaManager.getMatchingRuleRegistry().lookup( OID );
         assertEquals( mr.getDescription(), DESCRIPTION1 );
         assertEquals( mr.getSyntax().getOid(), SchemaConstants.DIRECTORY_STRING_SYNTAX );
     }
 
-    
+
     @Test
     @Ignore
     public void testModifyMatchingRuleWithAttributes() throws Exception
     {
         testAddMatchingRuleToEnabledSchema();
-        
+
         MatchingRule mr = schemaManager.getMatchingRuleRegistry().lookup( OID );
         assertEquals( mr.getDescription(), DESCRIPTION0 );
         assertEquals( mr.getSyntax().getOid(), SchemaConstants.INTEGER_SYNTAX );
 
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
-        
+
         Attributes mods = new BasicAttributes( true );
         mods.put( "m-description", DESCRIPTION1 );
         mods.put( "m-syntax", SchemaConstants.DIRECTORY_STRING_SYNTAX );
-        getSchemaContext( service ).modifyAttributes( DN.toName( dn ), DirContext.REPLACE_ATTRIBUTE, mods );
+        getSchemaContext( service ).modifyAttributes( JndiUtils.toName( dn ), DirContext.REPLACE_ATTRIBUTE, mods );
 
-        assertTrue( "matchingRule OID should still be present", 
+        assertTrue( "matchingRule OID should still be present",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
-        
-        assertEquals( "matchingRule schema should be set to apachemeta", 
+
+        assertEquals( "matchingRule schema should be set to apachemeta",
             schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
 
         mr = schemaManager.getMatchingRuleRegistry().lookup( OID );
@@ -313,14 +314,14 @@ public class MetaMatchingRuleHandlerIT e
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
         testAddMatchingRuleToEnabledSchema();
-        
+
         DN newdn = getMatchingRuleContainer( "apachemeta" );
         newdn = newdn.add( "m-oid" + "=" + NEW_OID );
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 
-        assertFalse( "old matchingRule OID should be removed from the registry after being renamed", 
+        assertFalse( "old matchingRule OID should be removed from the registry after being renamed",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
-        
+
         try
         {
             schemaManager.getMatchingRuleRegistry().lookup( OID );
@@ -333,7 +334,7 @@ public class MetaMatchingRuleHandlerIT e
         assertTrue( schemaManager.getMatchingRuleRegistry().contains( NEW_OID ) );
     }
 
-    
+
     // ----------------------------------------------------------------------
     // Test Move operation
     // ----------------------------------------------------------------------
@@ -342,19 +343,19 @@ public class MetaMatchingRuleHandlerIT e
     public void testMoveMatchingRule() throws Exception
     {
         testAddMatchingRuleToEnabledSchema();
-        
+
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
 
         DN newdn = getMatchingRuleContainer( "apache" );
         newdn = newdn.add( "m-oid" + "=" + OID );
-        
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
 
-        assertTrue( "matchingRule OID should still be present", 
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
+
+        assertTrue( "matchingRule OID should still be present",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
-        
-        assertEquals( "matchingRule schema should be set to apache not apachemeta", 
+
+        assertEquals( "matchingRule schema should be set to apache not apachemeta",
             schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apache" );
     }
 
@@ -364,22 +365,22 @@ public class MetaMatchingRuleHandlerIT e
     public void testMoveMatchingRuleAndChangeRdn() throws Exception
     {
         testAddMatchingRuleToEnabledSchema();
-        
+
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
 
         DN newdn = getMatchingRuleContainer( "apache" );
         newdn = newdn.add( "m-oid" + "=" + NEW_OID );
-        
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
 
-        assertFalse( "old matchingRule OID should NOT be present", 
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
+
+        assertFalse( "old matchingRule OID should NOT be present",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
-        
-        assertTrue( "new matchingRule OID should be present", 
+
+        assertTrue( "new matchingRule OID should be present",
             schemaManager.getMatchingRuleRegistry().contains( NEW_OID ) );
-        
-        assertEquals( "matchingRule with new oid should have schema set to apache NOT apachemeta", 
+
+        assertEquals( "matchingRule with new oid should have schema set to apache NOT apachemeta",
             schemaManager.getMatchingRuleRegistry().getSchemaName( NEW_OID ), "apache" );
     }
 
@@ -388,51 +389,51 @@ public class MetaMatchingRuleHandlerIT e
     // Test move, rename, and delete when a MR exists and uses the Normalizer
     // ----------------------------------------------------------------------
 
-    
+
 //    public void testDeleteSyntaxWhenInUse() throws NamingException
 //    {
 //        DN dn = getSyntaxContainer( "apachemeta" );
 //        dn.add( "m-oid" + "=" + OID );
 //        testAddSyntax();
 //        addDependeeMatchingRule();
-//        
+//
 //        try
 //        {
-//            super.schemaRoot.destroySubcontext( DN.toName( dn ) );
+//            super.schemaRoot.destroySubcontext( JndiUtils.toName( dn ) );
 //            fail( "should not be able to delete a syntax in use" );
 //        }
-//        catch( LdapUnwillingToPerformException e ) 
+//        catch( LdapUnwillingToPerformException e )
 //        {
 //            assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
 //        }
 //
-//        assertTrue( "syntax should still be in the registry after delete failure", 
+//        assertTrue( "syntax should still be in the registry after delete failure",
 //            getLdapSyntaxRegistry().hasSyntax( OID ) );
 //    }
-//    
-//    
+//
+//
 //    public void testMoveSyntaxWhenInUse() throws NamingException
 //    {
 //        testAddSyntax();
 //        addDependeeMatchingRule();
-//        
+//
 //        DN dn = getSyntaxContainer( "apachemeta" );
 //        dn.add( "m-oid" + "=" + OID );
 //
 //        DN newdn = getSyntaxContainer( "apache" );
 //        newdn = newdn.add( "m-oid" + "=" + OID );
-//        
+//
 //        try
 //        {
-//            super.schemaRoot.rename( DN.toName( dn ), DN.toName( newdn ) );
+//            super.schemaRoot.rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 //            fail( "should not be able to move a syntax in use" );
 //        }
-//        catch( LdapUnwillingToPerformException e ) 
+//        catch( LdapUnwillingToPerformException e )
 //        {
 //            assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
 //        }
 //
-//        assertTrue( "syntax should still be in the registry after move failure", 
+//        assertTrue( "syntax should still be in the registry after move failure",
 //            registries.getLdapSyntaxRegistry().hasSyntax( OID ) );
 //    }
 //
@@ -441,58 +442,58 @@ public class MetaMatchingRuleHandlerIT e
 //    {
 //        testAddSyntax();
 //        addDependeeMatchingRule()
-//        
+//
 //        DN dn = getSyntaxContainer( "apachemeta" );
 //        dn.add( "m-oid" + "=" + OID );s
 //
 //        DN newdn = getSyntaxContainer( "apache" );
 //        newdn = newdn.add( "m-oid" + "=" + NEW_OID );
-//        
+//
 //        try
 //        {
-//            super.schemaRoot.rename( DN.toName( dn ), DN.toName( newdn ) );
+//            super.schemaRoot.rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 //            fail( "should not be able to move a syntax in use" );
 //        }
-//        catch( LdapUnwillingToPerformException e ) 
+//        catch( LdapUnwillingToPerformException e )
 //        {
 //            assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
 //        }
 //
-//        assertTrue( "syntax should still be in the registry after move failure", 
+//        assertTrue( "syntax should still be in the registry after move failure",
 //            registries.getSyntaxRegistry().hasSyntax( OID ) );
 //    }
 //
-//    
+//
 
-    // Need to add body to this method which creates a new matchingRule after 
+    // Need to add body to this method which creates a new matchingRule after
     // the matchingRule addition code has been added.
-    
+
 //    private void addDependeeMatchingRule()
 //    {
 //        throw new NotImplementedException();
 //    }
-//    
+//
 //    public void testRenameNormalizerWhenInUse() throws NamingException
 //    {
 //        DN dn = getSyntaxContainer( "apachemeta" );
 //        dn.add( "m-oid" + "=" + OID );
 //        testAddSyntax();
 //        addDependeeMatchingRule();
-//        
+//
 //        DN newdn = getSyntaxContainer( "apachemeta" );
 //        newdn = newdn.add( "m-oid" + "=" + NEW_OID );
-//        
+//
 //        try
 //        {
-//            super.schemaRoot.rename( DN.toName( dn ), DN.toName( newdn ) );
+//            super.schemaRoot.rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
 //            fail( "should not be able to rename a syntax in use" );
 //        }
-//        catch( LdapUnwillingToPerformException e ) 
+//        catch( LdapUnwillingToPerformException e )
 //        {
 //            assertEquals( e.getResultCode(), ResultCodeEnum.UNWILLING_TO_PERFORM );
 //        }
 //
-//        assertTrue( "syntax should still be in the registry after rename failure", 
+//        assertTrue( "syntax should still be in the registry after rename failure",
 //            registries.getSyntaxRegistry().hasSyntax( OID ) );
 //    }
 
@@ -507,24 +508,24 @@ public class MetaMatchingRuleHandlerIT e
     public void testMoveMatchingRuleToTop() throws Exception
     {
         testAddMatchingRuleToEnabledSchema();
-        
+
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
 
         DN top = new DN();
         top = top.add( "m-oid" + "=" + OID );
-        
+
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( top ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( top ) );
             fail( "should not be able to move a matchingRule up to ou=schema" );
         }
-        catch( LdapInvalidDnException e ) 
+        catch( LdapInvalidDnException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.NAMING_VIOLATION );
         }
 
-        assertTrue( "matchingRule should still be in the registry after move failure", 
+        assertTrue( "matchingRule should still be in the registry after move failure",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
     }
 
@@ -534,44 +535,44 @@ public class MetaMatchingRuleHandlerIT e
     public void testMoveMatchingRuleToComparatorContainer() throws Exception
     {
         testAddMatchingRuleToEnabledSchema();
-        
+
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
 
         DN newdn = new DN( "ou=comparators,cn=apachemeta" );
         newdn = newdn.add( "m-oid" + "=" + OID );
-        
+
         try
         {
-            getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
+            getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
             fail( "should not be able to move a matchingRule into comparators container" );
         }
-        catch( LdapInvalidDnException e ) 
+        catch( LdapInvalidDnException e )
         {
             assertEquals( e.getResultCode(), ResultCodeEnum.NAMING_VIOLATION );
         }
 
-        assertTrue( "matchingRule should still be in the registry after move failure", 
+        assertTrue( "matchingRule should still be in the registry after move failure",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
     }
-    
-    
+
+
     @Test
     @Ignore
     public void testMoveMatchingRuleToDisabledSchema() throws Exception
     {
         testAddMatchingRuleToEnabledSchema();
-        
+
         DN dn = getMatchingRuleContainer( "apachemeta" );
         dn = dn.add( "m-oid" + "=" + OID );
 
         // nis is inactive by default
         DN newdn = getMatchingRuleContainer( "nis" );
         newdn = newdn.add( "m-oid" + "=" + OID );
-        
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
 
-        assertFalse( "matchingRule OID should no longer be present", 
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
+
+        assertFalse( "matchingRule OID should no longer be present",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
     }
 
@@ -581,23 +582,23 @@ public class MetaMatchingRuleHandlerIT e
     public void testMoveMatchingRuleToEnabledSchema() throws Exception
     {
         testAddMatchingRuleToDisabledSchema();
-        
+
         // nis is inactive by default
         DN dn = getMatchingRuleContainer( "nis" );
         dn = dn.add( "m-oid" + "=" + OID );
 
-        assertFalse( "matchingRule OID should NOT be present when added to disabled nis schema", 
+        assertFalse( "matchingRule OID should NOT be present when added to disabled nis schema",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
 
         DN newdn = getMatchingRuleContainer( "apachemeta" );
         newdn = newdn.add( "m-oid" + "=" + OID );
-        
-        getSchemaContext( service ).rename( DN.toName( dn ), DN.toName( newdn ) );
 
-        assertTrue( "matchingRule OID should be present when moved to enabled schema", 
+        getSchemaContext( service ).rename( JndiUtils.toName( dn ), JndiUtils.toName( newdn ) );
+
+        assertTrue( "matchingRule OID should be present when moved to enabled schema",
             schemaManager.getMatchingRuleRegistry().contains( OID ) );
-        
-        assertEquals( "matchingRule should be in apachemeta schema after move", 
+
+        assertEquals( "matchingRule should be in apachemeta schema after move",
             schemaManager.getMatchingRuleRegistry().getSchemaName( OID ), "apachemeta" );
     }
 }



Mime
View raw message