directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1748572 [17/23] - in /directory/apacheds/branches/apacheds-value: ./ benchmarks/installers-maven-plugin/ benchmarks/installers-maven-plugin/.settings/ benchmarks/installers-maven-plugin/target/ benchmarks/installers-maven-plugin/target/cla...
Date Wed, 15 Jun 2016 12:30:01 GMT
Modified: directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java Wed Jun 15 12:29:57 2016
@@ -49,6 +49,7 @@ public class AddStoredProcedureParameter
 
     MicroInjector entryInjector = new MicroInjector()
     {
+        @Override
         public Object inject( OperationContext opContext, StoredProcedureParameter param )
             throws LdapInvalidDnException
         {

Modified: directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/ModifyDNStoredProcedureParameterInjector.java Wed Jun 15 12:29:57 2016
@@ -45,8 +45,8 @@ public class ModifyDNStoredProcedurePara
     {
         super( opContext );
         this.deleteOldRn = deleteOldRn;
-        this.oldRdn = ( Rdn ) oldRDN.clone();
-        this.newRdn = ( Rdn ) newRdn.clone();
+        this.oldRdn = oldRDN.clone();
+        this.newRdn = newRdn.clone();
         this.oldSuperiorDn = oldSuperiorDn;
         this.newSuperiorDn = newSuperiorDn;
         this.oldDn = oldDn;

Modified: directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/StoredProcedureParameterInjector.java Wed Jun 15 12:29:57 2016
@@ -28,7 +28,7 @@ import org.apache.directory.server.core.
 
 
 /**
- * TODO - can we get some documentation on this?
+ * An interface defining the way STored Procedure parameter get injected 
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */

Modified: directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Wed Jun 15 12:29:57 2016
@@ -153,9 +153,9 @@ public class TriggerInterceptor extends
             return;
         }
 
-        for ( Value<?> value : subentries )
+        for ( Value value : subentries )
         {
-            String subentryDn = value.getString();
+            Dn subentryDn = new Dn( directoryService.getSchemaManager(), value.getValue() );
             triggerSpecs.addAll( triggerSpecCache.getSubentryTriggerSpecs( subentryDn ) );
         }
     }
@@ -179,9 +179,9 @@ public class TriggerInterceptor extends
             return;
         }
 
-        for ( Value<?> value : entryTrigger )
+        for ( Value value : entryTrigger )
         {
-            String triggerString = value.getString();
+            String triggerString = value.getValue();
             TriggerSpecification item;
 
             try
@@ -212,17 +212,15 @@ public class TriggerInterceptor extends
     public Map<ActionTime, List<TriggerSpecification>> getActionTimeMappedTriggerSpecsForOperation(
         List<TriggerSpecification> triggerSpecs, LdapOperation ldapOperation )
     {
-        List<TriggerSpecification> afterTriggerSpecs = new ArrayList<TriggerSpecification>();
-        Map<ActionTime, List<TriggerSpecification>> triggerSpecMap = new HashMap<ActionTime, List<TriggerSpecification>>();
+        List<TriggerSpecification> afterTriggerSpecs = new ArrayList<>();
+        Map<ActionTime, List<TriggerSpecification>> triggerSpecMap = new HashMap<>();
 
         for ( TriggerSpecification triggerSpec : triggerSpecs )
         {
-            if ( triggerSpec.getLdapOperation().equals( ldapOperation ) )
+            if ( triggerSpec.getLdapOperation().equals( ldapOperation )
+                 && triggerSpec.getActionTime().equals( ActionTime.AFTER ) )
             {
-                if ( triggerSpec.getActionTime().equals( ActionTime.AFTER ) )
-                {
-                    afterTriggerSpecs.add( triggerSpec );
-                }
+                afterTriggerSpecs.add( triggerSpec );
             }
         }
 
@@ -236,6 +234,7 @@ public class TriggerInterceptor extends
     // Interceptor Overrides
     ////////////////////////////////////////////////////////////////////////////
 
+    @Override
     public void init( DirectoryService directoryService ) throws LdapException
     {
         super.init( directoryService );
@@ -244,16 +243,15 @@ public class TriggerInterceptor extends
 
         triggerParser = new TriggerSpecificationParser( new NormalizerMappingResolver()
         {
+            @Override
             public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
             {
                 return schemaManager.getNormalizerMapping();
             }
         } );
 
-        //StoredProcEngineConfig javaxScriptSPEngineConfig = new JavaxStoredProcEngineConfig();
         StoredProcEngineConfig javaSPEngineConfig = new JavaStoredProcEngineConfig();
-        List<StoredProcEngineConfig> spEngineConfigs = new ArrayList<StoredProcEngineConfig>();
-        //spEngineConfigs.add( javaxScriptSPEngineConfig );
+        List<StoredProcEngineConfig> spEngineConfigs = new ArrayList<>();
         spEngineConfigs.add( javaSPEngineConfig );
         String spContainer = "ou=Stored Procedures,ou=system";
         manager = new StoredProcExecutionManager( spContainer, spEngineConfigs );
@@ -268,6 +266,7 @@ public class TriggerInterceptor extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public void add( AddOperationContext addContext ) throws LdapException
     {
         Dn name = addContext.getDn();
@@ -284,7 +283,7 @@ public class TriggerInterceptor extends
         StoredProcedureParameterInjector injector = new AddStoredProcedureParameterInjector( addContext, name, entry );
 
         // Gather Trigger Specifications which apply to the entry being added.
-        List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> triggerSpecs = new ArrayList<>();
         addPrescriptiveTriggerSpecs( addContext, triggerSpecs, name, entry );
 
         /**
@@ -306,6 +305,7 @@ public class TriggerInterceptor extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public void delete( DeleteOperationContext deleteContext ) throws LdapException
     {
         Dn name = deleteContext.getDn();
@@ -323,7 +323,7 @@ public class TriggerInterceptor extends
         StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector( deleteContext, name );
 
         // Gather Trigger Specifications which apply to the entry being deleted.
-        List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> triggerSpecs = new ArrayList<>();
         addPrescriptiveTriggerSpecs( deleteContext, triggerSpecs, name, deletedEntry );
         addEntryTriggerSpecs( triggerSpecs, deletedEntry );
 
@@ -343,6 +343,7 @@ public class TriggerInterceptor extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public void modify( ModifyOperationContext modifyContext ) throws LdapException
     {
         // Bypass trigger handling if the service is disabled.
@@ -360,7 +361,7 @@ public class TriggerInterceptor extends
         StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector( modifyContext );
 
         // Gather Trigger Specifications which apply to the entry being modified.
-        List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> triggerSpecs = new ArrayList<>();
         addPrescriptiveTriggerSpecs( modifyContext, triggerSpecs, normName, originalEntry );
         addEntryTriggerSpecs( triggerSpecs, originalEntry );
 
@@ -380,6 +381,7 @@ public class TriggerInterceptor extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public void move( MoveOperationContext moveContext ) throws LdapException
     {
         // Bypass trigger handling if the service is disabled.
@@ -398,13 +400,11 @@ public class TriggerInterceptor extends
         // Gather supplementary data.
         Entry movedEntry = moveContext.getOriginalEntry();
 
-        //Rdn newRDN = dn.getRdn();
-
         StoredProcedureParameterInjector injector = new ModifyDNStoredProcedureParameterInjector( moveContext, false,
             rdn, rdn, oldSuperior, newSuperior, dn, newDn );
 
         // Gather Trigger Specifications which apply to the entry being exported.
-        List<TriggerSpecification> exportTriggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> exportTriggerSpecs = new ArrayList<>();
         addPrescriptiveTriggerSpecs( moveContext, exportTriggerSpecs, dn, movedEntry );
         addEntryTriggerSpecs( exportTriggerSpecs, movedEntry );
 
@@ -433,7 +433,7 @@ public class TriggerInterceptor extends
 
         // Gather Trigger Specifications which apply to the entry being imported.
         // Note: Entry Trigger Specifications are not valid for Import.
-        List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> importTriggerSpecs = new ArrayList<>();
         addPrescriptiveTriggerSpecs( moveContext, importTriggerSpecs, newDn, fakeImportedEntry );
 
         Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation(
@@ -456,6 +456,7 @@ public class TriggerInterceptor extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
     {
         Dn oldDn = moveAndRenameContext.getDn();
@@ -482,7 +483,7 @@ public class TriggerInterceptor extends
             deleteOldRn, oldRdn, newRdn, oldSuperiorDn, newSuperiorDn, oldDN, newDn );
 
         // Gather Trigger Specifications which apply to the entry being exported.
-        List<TriggerSpecification> exportTriggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> exportTriggerSpecs = new ArrayList<>();
         addPrescriptiveTriggerSpecs( moveAndRenameContext, exportTriggerSpecs, oldDn, movedEntry );
         addEntryTriggerSpecs( exportTriggerSpecs, movedEntry );
 
@@ -511,7 +512,7 @@ public class TriggerInterceptor extends
 
         // Gather Trigger Specifications which apply to the entry being imported.
         // Note: Entry Trigger Specifications are not valid for Import.
-        List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> importTriggerSpecs = new ArrayList<>();
         addPrescriptiveTriggerSpecs( moveAndRenameContext, importTriggerSpecs, newDn, fakeImportedEntry );
 
         Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation(
@@ -534,6 +535,7 @@ public class TriggerInterceptor extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public void rename( RenameOperationContext renameContext ) throws LdapException
     {
         Dn name = renameContext.getDn();
@@ -562,7 +564,7 @@ public class TriggerInterceptor extends
             deleteOldRn, oldRdn, newRdn, oldSuperiorDn, newSuperiorDn, oldDn, newDn );
 
         // Gather Trigger Specifications which apply to the entry being renamed.
-        List<TriggerSpecification> triggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> triggerSpecs = new ArrayList<>();
         addPrescriptiveTriggerSpecs( renameContext, triggerSpecs, name, renamedEntry );
         addEntryTriggerSpecs( triggerSpecs, renamedEntry );
 
@@ -611,12 +613,12 @@ public class TriggerInterceptor extends
     private Object executeTrigger( OperationContext opContext, TriggerSpecification tsec,
         StoredProcedureParameterInjector injector ) throws LdapException
     {
-        List<Object> returnValues = new ArrayList<Object>();
+        List<Object> returnValues = new ArrayList<>();
         List<SPSpec> spSpecs = tsec.getSPSpecs();
 
         for ( SPSpec spSpec : spSpecs )
         {
-            List<Object> arguments = new ArrayList<Object>();
+            List<Object> arguments = new ArrayList<>();
             arguments.addAll( injector.getArgumentsToInject( opContext, spSpec.getParameters() ) );
             Object[] values = arguments.toArray();
             Object returnValue = executeProcedure( opContext, spSpec.getName(), values );

Modified: directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java Wed Jun 15 12:29:57 2016
@@ -34,7 +34,6 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.entry.Modification;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapOperationException;
@@ -76,7 +75,7 @@ public class TriggerSpecCache
     private static final Logger LOG = LoggerFactory.getLogger( TriggerSpecCache.class );
 
     /** a map of strings to TriggerSpecification collections */
-    private final Map<String, List<TriggerSpecification>> triggerSpecs = new HashMap<String, List<TriggerSpecification>>();
+    private final Map<Dn, List<TriggerSpecification>> triggerSpecs = new HashMap<>();
 
     /** a handle on the partition nexus */
     private final PartitionNexus nexus;
@@ -98,6 +97,7 @@ public class TriggerSpecCache
 
         triggerSpecParser = new TriggerSpecificationParser( new NormalizerMappingResolver()
         {
+            @Override
             public Map<String, OidNormalizer> getNormalizerMapping() throws Exception
             {
                 return schemaManager.getNormalizerMapping();
@@ -122,7 +122,7 @@ public class TriggerSpecCache
         {
             Dn baseDn = directoryService.getDnFactory().create( suffix );
             ExprNode filter = new EqualityNode<String>( objectClassAt,
-                new StringValue( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC ) );
+                new Value( objectClassAt, ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC ) );
             SearchControls ctls = new SearchControls();
             ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
 
@@ -149,8 +149,14 @@ public class TriggerSpecCache
                         continue;
                     }
 
-                    Dn normSubentryName = subentryDn.apply( directoryService.getSchemaManager() );
-                    subentryAdded( normSubentryName, resultEntry );
+                    Dn normSubentryDn = subentryDn;
+                    
+                    if ( !subentryDn.isSchemaAware() )
+                    {
+                        normSubentryDn = new Dn( directoryService.getSchemaManager(), subentryDn );
+                    }
+                    
+                    subentryAdded( normSubentryDn, resultEntry );
                 }
 
                 results.close();
@@ -182,15 +188,15 @@ public class TriggerSpecCache
             return;
         }
 
-        List<TriggerSpecification> subentryTriggerSpecs = new ArrayList<TriggerSpecification>();
+        List<TriggerSpecification> subentryTriggerSpecs = new ArrayList<>();
 
-        for ( Value<?> value : triggerSpec )
+        for ( Value value : triggerSpec )
         {
             TriggerSpecification item = null;
 
             try
             {
-                item = triggerSpecParser.parse( value.getString() );
+                item = triggerSpecParser.parse( value.getValue() );
                 subentryTriggerSpecs.add( item );
             }
             catch ( ParseException e )
@@ -201,7 +207,7 @@ public class TriggerSpecCache
 
         }
 
-        triggerSpecs.put( normName.getNormName(), subentryTriggerSpecs );
+        triggerSpecs.put( normName, subentryTriggerSpecs );
     }
 
 
@@ -212,7 +218,7 @@ public class TriggerSpecCache
             return;
         }
 
-        triggerSpecs.remove( normName.toString() );
+        triggerSpecs.remove( normName );
     }
 
 
@@ -241,19 +247,21 @@ public class TriggerSpecCache
     }
 
 
-    public List<TriggerSpecification> getSubentryTriggerSpecs( String subentryDn )
+    public List<TriggerSpecification> getSubentryTriggerSpecs( Dn subentryDn )
     {
         List<TriggerSpecification> subentryTriggerSpecs = triggerSpecs.get( subentryDn );
+        
         if ( subentryTriggerSpecs == null )
         {
             return Collections.emptyList();
         }
+        
         return Collections.unmodifiableList( subentryTriggerSpecs );
     }
 
 
     public void subentryRenamed( Dn oldName, Dn newName )
     {
-        triggerSpecs.put( newName.getNormName(), triggerSpecs.remove( oldName.getNormName() ) );
+        triggerSpecs.put( newName, triggerSpecs.remove( oldName ) );
     }
 }

Modified: directory/apacheds/branches/apacheds-value/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DnSerializerComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DnSerializerComparator.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DnSerializerComparator.java (original)
+++ directory/apacheds/branches/apacheds-value/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DnSerializerComparator.java Wed Jun 15 12:29:57 2016
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 
 import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.schema.comparators.DnComparator;
 import org.apache.directory.api.ldap.model.schema.comparators.SerializableComparator;
 
 
@@ -33,6 +34,9 @@ public class DnSerializerComparator exte
 {
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
+    
+    /** The DN comparator */
+    private static DnComparator dnComparator = new DnComparator( null );
 
 
     /**
@@ -52,21 +56,6 @@ public class DnSerializerComparator exte
     @Override
     public int compare( Dn dn1, Dn dn2 )
     {
-        if ( dn1 == null )
-        {
-            if ( dn2 == null )
-            {
-                return 0;
-            }
-
-            return -1;
-        }
-
-        if ( dn2 == null )
-        {
-            return 1;
-        }
-
-        return dn1.getNormName().compareTo( dn2.getNormName() );
+        return dnComparator.compare( dn1, dn2 );
     }
 }

Modified: directory/apacheds/branches/apacheds-value/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/apacheds-value/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Wed Jun 15 12:29:57 2016
@@ -92,11 +92,11 @@ public class JdbmPartition extends Abstr
 
     private static final FilenameFilter DB_FILTER = new FilenameFilter()
     {
-
+        @Override
         public boolean accept( File dir, String name )
         {
             // really important to filter master.db and master.lg files
-            return ( name.endsWith( JDBM_DB_FILE_EXTN ) && !name.startsWith( "master." ) );
+            return name.endsWith( JDBM_DB_FILE_EXTN ) && !name.startsWith( "master." );
         }
     };
 
@@ -182,14 +182,12 @@ public class JdbmPartition extends Abstr
                 {
                     String msg = I18n.err( I18n.ERR_217, dn, entry );
                     ResultCodeEnum rc = ResultCodeEnum.OBJECT_CLASS_VIOLATION;
-                    LdapSchemaViolationException e = new LdapSchemaViolationException( rc, msg );
-                    //e.setResolvedName( entryDn );
-                    throw e;
+                    throw new LdapSchemaViolationException( rc, msg );
                 }
 
-                for ( Value<?> value : objectClass )
+                for ( Value value : objectClass )
                 {
-                    String valueStr = ( String ) value.getNormValue();
+                    String valueStr = value.getValue();
 
                     if ( valueStr.equals( SchemaConstants.TOP_OC ) )
                     {
@@ -225,9 +223,9 @@ public class JdbmPartition extends Abstr
                     // We may have more than one role
                     Attribute adminRoles = entry.get( administrativeRoleAT );
 
-                    for ( Value<?> value : adminRoles )
+                    for ( Value value : adminRoles )
                     {
-                        adminRoleIdx.add( ( String ) value.getNormValue(), id );
+                        adminRoleIdx.add( value.getValue(), id );
                     }
 
                     // Adds only those attributes that are indexed
@@ -248,9 +246,9 @@ public class JdbmPartition extends Abstr
                         // here lookup by attributeId is OK since we got attributeId from
                         // the entry via the enumeration - it's in there as is for sure
 
-                        for ( Value<?> value : attribute )
+                        for ( Value value : attribute )
                         {
-                            idx.add( value.getNormValue(), id );
+                            idx.add( value.getValue(), id );
                         }
 
                         // Adds only those attributes that are indexed
@@ -328,7 +326,7 @@ public class JdbmPartition extends Abstr
         List<String> indexDbFileNameList = Arrays.asList( partitionDir.list( DB_FILTER ) );
 
         // then add all index objects to a list
-        List<String> allIndices = new ArrayList<String>();
+        List<String> allIndices = new ArrayList<>();
 
         // Iterate on the declared indexes, deleting the old ones
         for ( Index<?, String> index : getIndexedAttributes() )
@@ -370,6 +368,7 @@ public class JdbmPartition extends Abstr
     }
 
 
+    @Override
     protected void doInit() throws Exception
     {
         if ( !initialized )
@@ -403,9 +402,9 @@ public class JdbmPartition extends Abstr
             List<String> indexDbFileNameList = Arrays.asList( partitionDir.list( DB_FILTER ) );
 
             // then add all index objects to a list
-            List<String> allIndices = new ArrayList<String>();
+            List<String> allIndices = new ArrayList<>();
 
-            List<Index<?, String>> indexToBuild = new ArrayList<Index<?, String>>();
+            List<Index<?, String>> indexToBuild = new ArrayList<>();
             
             // Iterate on the declared indexes
             for ( Index<?, String> index : getIndexedAttributes() )
@@ -458,7 +457,7 @@ public class JdbmPartition extends Abstr
             // Create the master table (the table containing all the entries)
             master = new JdbmMasterTable( recMan, schemaManager );
 
-            if ( indexToBuild.size() > 0 )
+            if ( !indexToBuild.isEmpty() )
             {
                 buildUserIndex( indexToBuild );
             }
@@ -485,7 +484,7 @@ public class JdbmPartition extends Abstr
                 // Checking if the context entry DN is schema aware
                 if ( !contextEntryDn.isSchemaAware() )
                 {
-                    contextEntryDn.apply( schemaManager );
+                    contextEntryDn = new Dn( schemaManager, contextEntryDn );
                 }
 
                 // We're only adding the entry if the two DNs are equal
@@ -554,6 +553,7 @@ public class JdbmPartition extends Abstr
      * 
      * @throws Exception on failures to sync database files to disk
      */
+    @Override
     public synchronized void sync() throws Exception
     {
         if ( !initialized )
@@ -618,9 +618,9 @@ public class JdbmPartition extends Abstr
 
                 if ( entryAttr != null )
                 {
-                    for ( Value<?> value : entryAttr )
+                    for ( Value value : entryAttr )
                     {
-                        index.add( value.getNormValue(), id );
+                        index.add( value.getValue(), id );
                     }
 
                     // Adds only those attributes that are indexed
@@ -690,6 +690,7 @@ public class JdbmPartition extends Abstr
     /**
      * {@inheritDoc}
      */
+    @Override
     protected Index<?, String> convertAndInit( Index<?, String> index ) throws Exception
     {
         JdbmIndex<?> jdbmIndex;
@@ -730,6 +731,7 @@ public class JdbmPartition extends Abstr
     /**
      * {@inheritDoc}
      */
+    @Override
     protected synchronized void doDestroy() throws Exception
     {
         MultiException errors = new MultiException( I18n.err( I18n.ERR_577 ) );
@@ -754,7 +756,7 @@ public class JdbmPartition extends Abstr
             recMan.close();
             LOG.debug( "Closed record manager for {} partition.", suffixDn );
         }
-        catch ( Throwable t )
+        catch ( IOException t )
         {
             LOG.error( I18n.err( I18n.ERR_127 ), t );
             errors.addThrowable( t );
@@ -777,6 +779,7 @@ public class JdbmPartition extends Abstr
     /**
      * {@inheritDoc}
      */
+    @Override
     protected final Index createSystemIndex( String oid, URI path, boolean withReverse ) throws Exception
     {
         LOG.debug( "Supplied index {} is not a JdbmIndex.  "
@@ -864,7 +867,7 @@ public class JdbmPartition extends Abstr
 
         if ( el != null )
         {
-            return ( Entry ) el.getValue();
+            return ( Entry ) el.getObjectValue();
         }
 
         return null;
@@ -879,12 +882,14 @@ public class JdbmPartition extends Abstr
             return;
         }
 
+        Entry addedEntry = entry;
+        
         if ( entry instanceof ClonedServerEntry )
         {
-            entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
+            addedEntry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
         }
 
-        entryCache.put( new Element( id, entry ) );
+        entryCache.put( new Element( id, addedEntry ) );
     }
 
 }

Modified: directory/apacheds/branches/apacheds-value/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java (original)
+++ directory/apacheds/branches/apacheds-value/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java Wed Jun 15 12:29:57 2016
@@ -311,16 +311,16 @@ public class JdbmIndexTest
     public void testCountOneArg() throws Exception
     {
         initIndex();
-        assertEquals( 0, idx.count( "foo" ) );
+        assertEquals( 0, idx.count( " foo " ) );
 
         idx.add( "bar", Strings.getUUID( 1234L ) );
-        assertEquals( 0, idx.count( "foo" ) );
+        assertEquals( 0, idx.count( " foo " ) );
 
-        idx.add( "foo", Strings.getUUID( 1234L ) );
-        assertEquals( 1, idx.count( "foo" ) );
+        idx.add( " foo ", Strings.getUUID( 1234L ) );
+        assertEquals( 1, idx.count( " foo " ) );
 
-        idx.add( "foo", Strings.getUUID( 333L ) );
-        assertEquals( 2, idx.count( "foo" ) );
+        idx.add( " foo ", Strings.getUUID( 333L ) );
+        assertEquals( 2, idx.count( " foo " ) );
     }
 
 
@@ -387,23 +387,23 @@ public class JdbmIndexTest
     public void testLookups() throws Exception
     {
         initIndex();
-        assertNull( idx.forwardLookup( "foo" ) );
-        assertNull( idx.forwardLookup( "bar" ) );
+        assertNull( idx.forwardLookup( " foo " ) );
+        assertNull( idx.forwardLookup( " bar " ) );
 
-        idx.add( "foo", Strings.getUUID( 0L ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
-        assertTrue( idx.forward( "foo", Strings.getUUID( 0L ) ) );
-
-        idx.add( "foo", Strings.getUUID( 1L ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
-        assertTrue( idx.forward( "foo", Strings.getUUID( 0L ) ) );
-        assertTrue( idx.forward( "foo", Strings.getUUID( 1L ) ) );
+        idx.add( " foo ", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " foo " ) );
+        assertTrue( idx.forward( " foo ", Strings.getUUID( 0L ) ) );
+
+        idx.add( " foo ", Strings.getUUID( 1L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " foo " ) );
+        assertTrue( idx.forward( " foo ", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forward( " foo ", Strings.getUUID( 1L ) ) );
 
         idx.add( "bar", Strings.getUUID( 0L ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "bar" ) );
-        assertTrue( idx.forward( "bar", Strings.getUUID( 0L ) ) );
-        assertTrue( idx.forward( "foo", Strings.getUUID( 0L ) ) );
-        assertTrue( idx.forward( "foo", Strings.getUUID( 1L ) ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " bar " ) );
+        assertTrue( idx.forward( " bar ", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forward( " foo ", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forward( " foo ", Strings.getUUID( 1L ) ) );
     }
 
 
@@ -411,32 +411,32 @@ public class JdbmIndexTest
     public void testAddDropById() throws Exception
     {
         initIndex();
-        assertNull( idx.forwardLookup( "foo" ) );
-        assertNull( idx.forwardLookup( "bar" ) );
+        assertNull( idx.forwardLookup( " foo " ) );
+        assertNull( idx.forwardLookup( " bar " ) );
 
         // test add/drop without adding any duplicates
-        idx.add( "foo", Strings.getUUID( 0L ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
+        idx.add( " foo ", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " foo " ) );
 
-        idx.drop( "foo", Strings.getUUID( 0L ) );
-        assertNull( idx.forwardLookup( "foo" ) );
+        idx.drop( " foo ", Strings.getUUID( 0L ) );
+        assertNull( idx.forwardLookup( " foo " ) );
 
         // test add/drop with duplicates in bulk
-        idx.add( "foo", Strings.getUUID( 0L ) );
-        idx.add( "foo", Strings.getUUID( 1L ) );
-        idx.add( "bar", Strings.getUUID( 0L ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "bar" ) );
-
-        idx.drop( "foo", Strings.getUUID( 0L ) );
-        idx.drop( "bar", Strings.getUUID( 0L ) );
-        assertFalse( idx.forward( "bar", Strings.getUUID( 0L ) ) );
-        assertFalse( idx.forward( "foo", Strings.getUUID( 0L ) ) );
-
-        idx.drop( "bar", Strings.getUUID( 1L ) );
-        idx.drop( "foo", Strings.getUUID( 1L ) );
-        assertNull( idx.forwardLookup( "foo" ) );
-        assertNull( idx.forwardLookup( "bar" ) );
+        idx.add( " foo ", Strings.getUUID( 0L ) );
+        idx.add( " foo ", Strings.getUUID( 1L ) );
+        idx.add( " bar ", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " foo " ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " bar " ) );
+
+        idx.drop( " foo ", Strings.getUUID( 0L ) );
+        idx.drop( " bar ", Strings.getUUID( 0L ) );
+        assertFalse( idx.forward( " bar ", Strings.getUUID( 0L ) ) );
+        assertFalse( idx.forward( " foo ", Strings.getUUID( 0L ) ) );
+
+        idx.drop( " bar ", Strings.getUUID( 1L ) );
+        idx.drop( " foo ", Strings.getUUID( 1L ) );
+        assertNull( idx.forwardLookup( " foo " ) );
+        assertNull( idx.forwardLookup( " bar " ) );
         assertEquals( 0, idx.count() );
     }
 
@@ -445,34 +445,34 @@ public class JdbmIndexTest
     public void testAddDropOneByOne() throws Exception
     {
         initIndex();
-        assertNull( idx.forwardLookup( "foo" ) );
-        assertNull( idx.forwardLookup( "bar" ) );
+        assertNull( idx.forwardLookup( " foo " ) );
+        assertNull( idx.forwardLookup( " bar " ) );
 
         // test add/drop without adding any duplicates
-        idx.add( "foo", Strings.getUUID( 0L ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
+        idx.add( " foo ", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " foo " ) );
 
-        idx.drop( "foo", Strings.getUUID( 0L ) );
-        assertNull( idx.forwardLookup( "foo" ) );
+        idx.drop( " foo ", Strings.getUUID( 0L ) );
+        assertNull( idx.forwardLookup( " foo " ) );
 
         // test add/drop with duplicates but one at a time
-        idx.add( "foo", Strings.getUUID( 0L ) );
-        idx.add( "foo", Strings.getUUID( 1L ) );
-        idx.add( "bar", Strings.getUUID( 0L ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "bar" ) );
-
-        idx.drop( "bar", Strings.getUUID( 0L ) );
-        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
-        assertFalse( idx.forward( "bar", Strings.getUUID( 0L ) ) );
-
-        idx.drop( "foo", Strings.getUUID( 0L ) );
-        assertEquals( Strings.getUUID( 1L ), idx.forwardLookup( "foo" ) );
-        assertFalse( idx.forward( "foo", Strings.getUUID( 0L ) ) );
-
-        idx.drop( "foo", Strings.getUUID( 1L ) );
-        assertNull( idx.forwardLookup( "foo" ) );
-        assertNull( idx.forwardLookup( "bar" ) );
+        idx.add( " foo ", Strings.getUUID( 0L ) );
+        idx.add( " foo ", Strings.getUUID( 1L ) );
+        idx.add( " bar ", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " foo " ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " bar " ) );
+
+        idx.drop( " bar ", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( " foo " ) );
+        assertFalse( idx.forward( " bar ", Strings.getUUID( 0L ) ) );
+
+        idx.drop( " foo ", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 1L ), idx.forwardLookup( " foo " ) );
+        assertFalse( idx.forward( " foo ", Strings.getUUID( 0L ) ) );
+
+        idx.drop( " foo ", Strings.getUUID( 1L ) );
+        assertNull( idx.forwardLookup( " foo " ) );
+        assertNull( idx.forwardLookup( " bar " ) );
         assertEquals( 0, idx.count() );
     }
 
@@ -487,10 +487,10 @@ public class JdbmIndexTest
         initIndex();
         assertEquals( 0, idx.count() );
 
-        idx.add( "foo", Strings.getUUID( 1234L ) );
+        idx.add( " foo ", Strings.getUUID( 1234L ) );
         assertEquals( 1, idx.count() );
 
-        idx.add( "foo", Strings.getUUID( 333L ) );
+        idx.add( " foo ", Strings.getUUID( 333L ) );
         assertEquals( 2, idx.count() );
 
         idx.add( "bar", Strings.getUUID( 555L ) );
@@ -510,12 +510,12 @@ public class JdbmIndexTest
         cursor.next();
         IndexEntry<String, String> e2 = cursor.get();
         assertEquals( Strings.getUUID( 333L ), e2.getId() );
-        assertEquals( "foo", e2.getKey() );
+        assertEquals( " foo ", e2.getKey() );
 
         cursor.next();
         IndexEntry<String, String> e3 = cursor.get();
         assertEquals( Strings.getUUID( 1234L ), e3.getId() );
-        assertEquals( "foo", e3.getKey() );
+        assertEquals( " foo ", e3.getKey() );
 
         cursor.close();
     }

Modified: directory/apacheds/branches/apacheds-value/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java (original)
+++ directory/apacheds/branches/apacheds-value/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java Wed Jun 15 12:29:57 2016
@@ -28,7 +28,11 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 
 import org.apache.directory.api.util.FileUtils;
@@ -63,6 +67,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.MockDirectoryService;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.ModDnAva;
 import org.apache.directory.server.core.shared.DefaultDnFactory;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexNotFoundException;
@@ -156,6 +161,8 @@ public class JdbmStoreTest
         wkdir.delete();
         wkdir = new File( wkdir.getParentFile(), getClass().getSimpleName() );
 
+        StoreUtils.createdExtraAttributes( schemaManager );
+        
         // initialize the store
         store = new JdbmPartition( schemaManager, dnFactory );
         store.setId( "example" );
@@ -489,7 +496,7 @@ public class JdbmStoreTest
         assertEquals( Strings.getUUID( 1L ), store.getEntryId( dn ) );
         assertEquals( 11, store.count() );
         assertEquals( "o=Good Times Co.", store.getEntryDn( Strings.getUUID( 1L ) ).getName() );
-        assertEquals( dn.getNormName(), store.getEntryDn( Strings.getUUID( 1L ) ).getNormName() );
+        assertEquals( dn.getName(), store.getEntryDn( Strings.getUUID( 1L ) ).getName() );
         assertEquals( dn.getName(), store.getEntryDn( Strings.getUUID( 1L ) ).getName() );
 
         // note that the suffix entry returns 0 for it's parent which does not exist
@@ -602,7 +609,7 @@ public class JdbmStoreTest
         AddOperationContext addContext = new AddOperationContext( null, entry );
         store.add( addContext );
 
-        Rdn rdn = new Rdn( "sn=James" );
+        Rdn rdn = new Rdn( schemaManager, "sn=James" );
 
         store.rename( dn, rdn, true, null );
 
@@ -629,7 +636,7 @@ public class JdbmStoreTest
         AddOperationContext addContext = new AddOperationContext( null, entry );
         store.add( addContext );
 
-        Rdn rdn = new Rdn( "sn=Ja\\+es" );
+        Rdn rdn = new Rdn( schemaManager, "sn=Ja\\+es" );
 
         store.rename( dn, rdn, true, null );
 
@@ -637,7 +644,7 @@ public class JdbmStoreTest
         String id = store.getEntryId( dn2 );
         assertNotNull( id );
         Entry entry2 = store.fetch( id, dn2 );
-        assertEquals( "ja+es", entry2.get( "sn" ).getString() );
+        assertEquals( "Ja+es", entry2.get( "sn" ).getString() );
     }
 
 
@@ -659,9 +666,17 @@ public class JdbmStoreTest
 
         Dn parentDn = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
 
-        Rdn rdn = new Rdn( "cn=Ryan" );
+        Rdn rdn = new Rdn( schemaManager, "cn=Ryan" );
+
+        // The cn=Ryan RDN that will be added. The cn=Private Ryan RDN will be removed
+        Map<String, List<ModDnAva>> modDnAvas = new HashMap<>();
+
+        List<ModDnAva> modAvas = new ArrayList<>();
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.ADD, rdn.getAva()) );
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.DELETE, childDn.getRdn().getAva()) );
+        modDnAvas.put( SchemaConstants.CN_AT_OID, modAvas );
 
-        store.moveAndRename( childDn, parentDn, rdn, childEntry, true );
+        store.moveAndRename( childDn, parentDn, rdn, modDnAvas, childEntry );
 
         // to drop the alias indices
         childDn = new Dn( schemaManager, "commonName=Jim Bean,ou=Apache,ou=Board of Directors,o=Good Times Co." );
@@ -711,16 +726,16 @@ public class JdbmStoreTest
 
         Entry lookedup = store.fetch( store.getEntryId( dn ), dn );
 
-        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getString() ); // before replacing
+        assertEquals( "WAlkeR", lookedup.get( "sn" ).get().getValue() ); // before replacing
 
         lookedup = store.modify( dn, add );
-        assertEquals( attribVal, lookedup.get( "sn" ).get().getString() );
+        assertEquals( attribVal, lookedup.get( "sn" ).get().getValue() );
 
         // testing the store.modify( dn, mod, entry ) API
         Modification replace = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, SN_AT, "JWalker" );
 
         lookedup = store.modify( dn, replace );
-        assertEquals( "JWalker", lookedup.get( "sn" ).get().getString() );
+        assertEquals( "JWalker", lookedup.get( "sn" ).get().getValue() );
         assertEquals( 1, lookedup.get( "sn" ).size() );
     }
 
@@ -779,7 +794,7 @@ public class JdbmStoreTest
         assertNull( lookedup.get( "ou" ) ); // before replacing
 
         lookedup = store.modify( dn, add );
-        assertEquals( attribVal, lookedup.get( "ou" ).get().getString() );
+        assertEquals( attribVal, lookedup.get( "ou" ).get().getValue() );
     }
 
 

Modified: directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java (original)
+++ directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java Wed Jun 15 12:29:57 2016
@@ -176,7 +176,7 @@ public class Keytab
      * @param bytes
      * @return The keytab.
      */
-    static Keytab read( byte[] bytes )
+    static Keytab read( byte[] bytes ) throws IOException
     {
         ByteBuffer buffer = ByteBuffer.wrap( bytes );
         return readKeytab( buffer );
@@ -200,7 +200,7 @@ public class Keytab
      * @param buffer
      * @return The keytab.
      */
-    private static Keytab readKeytab( ByteBuffer buffer )
+    private static Keytab readKeytab( ByteBuffer buffer ) throws IOException
     {
         KeytabDecoder reader = new KeytabDecoder();
         byte[] keytabVersion = reader.getKeytabVersion( buffer );

Modified: directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/KeytabDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/KeytabDecoder.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/KeytabDecoder.java (original)
+++ directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/KeytabDecoder.java Wed Jun 15 12:29:57 2016
@@ -20,6 +20,7 @@
 package org.apache.directory.server.kerberos.shared.keytab;
 
 
+import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
@@ -57,13 +58,19 @@ class KeytabDecoder
      * @param buffer
      * @return The keytab entries.
      */
-    List<KeytabEntry> getKeytabEntries( ByteBuffer buffer )
+    List<KeytabEntry> getKeytabEntries( ByteBuffer buffer ) throws IOException
     {
         List<KeytabEntry> entries = new ArrayList<KeytabEntry>();
 
         while ( buffer.remaining() > 0 )
         {
             int size = buffer.getInt();
+            
+            if ( ( size < 0 ) || ( size > buffer.capacity() ) )
+            {
+                throw new IOException( "Invalid size for the keytab entry" );
+            }
+            
             byte[] entry = new byte[size];
 
             buffer.get( entry );
@@ -78,7 +85,7 @@ class KeytabDecoder
      * Reads off a "keytab entry," which consists of a principal name,
      * principal type, key version number, and key material.
      */
-    private KeytabEntry getKeytabEntry( ByteBuffer buffer )
+    private KeytabEntry getKeytabEntry( ByteBuffer buffer ) throws IOException
     {
         String principalName = getPrincipalName( buffer );
 
@@ -101,7 +108,7 @@ class KeytabDecoder
      * @param buffer
      * @return The principal name.
      */
-    private String getPrincipalName( ByteBuffer buffer )
+    private String getPrincipalName( ByteBuffer buffer ) throws IOException
     {
         int count = buffer.getShort();
 
@@ -131,7 +138,7 @@ class KeytabDecoder
     /**
      * Read off a 16-bit encryption type and symmetric key material.
      */
-    private EncryptionKey getKeyBlock( ByteBuffer buffer )
+    private EncryptionKey getKeyBlock( ByteBuffer buffer ) throws IOException
     {
         int type = buffer.getShort();
         byte[] keyblock = getCountedBytes( buffer );
@@ -147,9 +154,15 @@ class KeytabDecoder
      * Use a prefixed 16-bit length to read off a String.  Realm and name
      * components are ASCII encoded text with no zero terminator.
      */
-    private String getCountedString( ByteBuffer buffer )
+    private String getCountedString( ByteBuffer buffer ) throws IOException
     {
         int length = buffer.getShort();
+        
+        if ( ( length < 0 ) || ( length > buffer.capacity() ) )
+        {
+            throw new IOException( "Invalid size for the keytab entry" );
+        }
+
         byte[] data = new byte[length];
         buffer.get( data );
 
@@ -168,9 +181,15 @@ class KeytabDecoder
     /**
      * Use a prefixed 16-bit length to read off raw bytes.
      */
-    private byte[] getCountedBytes( ByteBuffer buffer )
+    private byte[] getCountedBytes( ByteBuffer buffer ) throws IOException
     {
         int length = buffer.getShort();
+        
+        if ( ( length < 0 ) || ( length > buffer.capacity() ) )
+        {
+            throw new IOException( "Invalid size for the keytab entry" );
+        }
+
         byte[] data = new byte[length];
         buffer.get( data );
 

Modified: directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java (original)
+++ directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStoreEntryModifier.java Wed Jun 15 12:29:57 2016
@@ -27,7 +27,6 @@ import java.util.Map;
 import javax.security.auth.kerberos.KerberosPrincipal;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
-import org.apache.directory.api.ldap.model.entry.StringValue;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.server.i18n.I18n;
@@ -284,9 +283,9 @@ public class PrincipalStoreEntryModifier
     {
         Map<EncryptionType, EncryptionKey> map = new HashMap<EncryptionType, EncryptionKey>();
 
-        for ( Value<?> val : krb5key )
+        for ( Value val : krb5key )
         {
-            if ( val instanceof StringValue )
+            if ( val.isHumanReadable() )
             {
                 throw new IllegalStateException( I18n.err( I18n.ERR_626 ) );
             }

Modified: directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/HostAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/HostAddress.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/HostAddress.java (original)
+++ directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/HostAddress.java Wed Jun 15 12:29:57 2016
@@ -20,6 +20,7 @@
 package org.apache.directory.shared.kerberos.components;
 
 
+import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.BufferOverflowException;
@@ -111,7 +112,7 @@ public class HostAddress implements Asn1
      */
     public HostAddress( InetAddress internetAddress )
     {
-        addrType = HostAddrType.ADDRTYPE_INET;
+        addrType = ( internetAddress instanceof Inet6Address ) ? HostAddrType.ADDRTYPE_INET6 : HostAddrType.ADDRTYPE_INET;
         byte[] newAddress = internetAddress.getAddress();
         address = new byte[newAddress.length];
         System.arraycopy( newAddress, 0, address, 0, newAddress.length );

Modified: directory/apacheds/branches/apacheds-value/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java (original)
+++ directory/apacheds/branches/apacheds-value/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/LdapConnectionTest.java Wed Jun 15 12:29:57 2016
@@ -35,7 +35,7 @@ import org.apache.directory.api.ldap.cod
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.cursor.EntryCursor;
 import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.api.ldap.model.entry.StringValue;
+import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.filter.EqualityNode;
 import org.apache.directory.api.ldap.model.message.SearchScope;
@@ -207,7 +207,7 @@ public void testLookup() throws Exceptio
 
         String uuid = entry.get( SchemaConstants.ENTRY_UUID_AT ).getString();
 
-        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.ENTRY_UUID_AT, new StringValue( uuid ) );
+        EqualityNode<String> filter = new EqualityNode<String>( SchemaConstants.ENTRY_UUID_AT, new Value( uuid ) );
 
         EntryCursor cursor = connection.search( ADMIN_DN, filter.toString(), SearchScope.SUBTREE, "+" );
         cursor.next();

Modified: directory/apacheds/branches/apacheds-value/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAddRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAddRequestTest.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAddRequestTest.java (original)
+++ directory/apacheds/branches/apacheds-value/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAddRequestTest.java Wed Jun 15 12:29:57 2016
@@ -296,7 +296,7 @@ public class ClientAddRequestTest extend
         assertNotNull( loadedEntry );
         assertTrue( loadedEntry.containsAttribute( "cn" ) );
 
-        String cn = loadedEntry.get( "cn" ).get().getString();
+        String cn = loadedEntry.get( "cn" ).get().getValue();
 
         assertEquals( "a\\+B", cn );
     }
@@ -322,7 +322,7 @@ public class ClientAddRequestTest extend
         assertNotNull( loadedEntry );
         assertTrue( loadedEntry.containsAttribute( "cn" ) );
 
-        String cn = loadedEntry.get( "cn" ).get().getString();
+        String cn = loadedEntry.get( "cn" ).get().getValue();
 
         assertEquals( "a+b", cn );
     }
@@ -354,9 +354,9 @@ public class ClientAddRequestTest extend
         expected.add( "c" );
         int count = 0;
 
-        for ( Value<?> value : attribute )
+        for ( Value value : attribute )
         {
-            String val = value.getString();
+            String val = value.getValue();
 
             assertTrue( expected.contains( val ) );
             count++;

Modified: directory/apacheds/branches/apacheds-value/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java (original)
+++ directory/apacheds/branches/apacheds-value/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java Wed Jun 15 12:29:57 2016
@@ -151,7 +151,10 @@ public class LdifPartition extends Abstr
                 throw new LdapInvalidDnException( msg );
             }
 
-            suffixDn.apply( schemaManager );
+            if ( !suffixDn.isSchemaAware() )
+            {
+                suffixDn = new Dn( schemaManager, suffixDn );
+            }
 
             String suffixDirName = getFileName( suffixDn );
             suffixDirectory = new File( partitionDir, suffixDirName );
@@ -207,7 +210,7 @@ public class LdifPartition extends Abstr
                     // Checking if the context entry DN is schema aware
                     if ( !contextEntryDn.isSchemaAware() )
                     {
-                        contextEntryDn.apply( schemaManager );
+                        contextEntryDn = new Dn( schemaManager, contextEntryDn );
                     }
 
                     // We're only adding the entry if the two DNs are equal
@@ -501,7 +504,7 @@ public class LdifPartition extends Abstr
 
         if ( ( entries != null ) && ( entries.length != 0 ) )
         {
-            LdifReader ldifReader = new LdifReader();
+            LdifReader ldifReader = new LdifReader( schemaManager );
 
             for ( File entry : entries )
             {
@@ -529,6 +532,7 @@ public class LdifPartition extends Abstr
 
                     // call add on the wrapped partition not on the self
                     AddOperationContext addContext = new AddOperationContext( null, serverEntry );
+                    
                     super.add( addContext );
                 }
             }
@@ -635,11 +639,11 @@ public class LdifPartition extends Abstr
             
             if ( at.getSyntax().isHumanReadable() )
             {
-                normValue = ava.getValue().getNormValue().toString();
+                normValue = ava.getValue().getValue();
             }
             else
             {
-                normValue = Strings.utf8ToString( ( byte[] ) ava.getValue().getNormValue() );
+                normValue = Strings.utf8ToString( ava.getValue().getBytes() );
             }
 
             fileName.append( atName ).append( "=" ).append( normValue );
@@ -674,7 +678,7 @@ public class LdifPartition extends Abstr
             String atName = at.getName();
 
             // Now, get the normalized value
-            String normValue = rdn.getNormValue();
+            String normValue = rdn.getAva().getValue().getValue();
 
             if ( isFirst )
             {

Modified: directory/apacheds/branches/apacheds-value/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java (original)
+++ directory/apacheds/branches/apacheds-value/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java Wed Jun 15 12:29:57 2016
@@ -40,6 +40,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.ldif.LdifEntry;
 import org.apache.directory.api.ldap.model.ldif.LdifReader;
 import org.apache.directory.api.ldap.model.ldif.LdifUtils;
+import org.apache.directory.api.ldap.model.name.Dn;
 import org.apache.directory.api.ldap.model.name.Rdn;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
 import org.apache.directory.api.util.Strings;
@@ -117,7 +118,10 @@ public class SingleFileLdifPartition ext
                 throw new LdapInvalidDnException( msg );
             }
 
-            suffixDn.apply( schemaManager );
+            if ( !suffixDn.isSchemaAware() )
+            {
+                suffixDn = new Dn( schemaManager, suffixDn );
+            }
 
             super.doInit();
 
@@ -132,7 +136,7 @@ public class SingleFileLdifPartition ext
      */
     private void loadEntries() throws Exception
     {
-        RandomAccessLdifReader parser = new RandomAccessLdifReader();
+        RandomAccessLdifReader parser = new RandomAccessLdifReader( schemaManager );
 
         Iterator<LdifEntry> itr = parser.iterator();
 
@@ -182,6 +186,7 @@ public class SingleFileLdifPartition ext
     /**
      * {@inheritDoc}
      */
+    @Override
     public void add( AddOperationContext addContext ) throws LdapException
     {
         synchronized ( lock )
@@ -207,6 +212,7 @@ public class SingleFileLdifPartition ext
     /**
      * {@inheritDoc}
      */
+    @Override
     public void modify( ModifyOperationContext modifyContext ) throws LdapException
     {
         synchronized ( lock )
@@ -236,6 +242,7 @@ public class SingleFileLdifPartition ext
     /**
      * {@inheritDoc}
      */
+    @Override
     public void rename( RenameOperationContext renameContext ) throws LdapException
     {
         synchronized ( lock )
@@ -250,6 +257,7 @@ public class SingleFileLdifPartition ext
     /**
      * {@inheritDoc}
      */
+    @Override
     public void move( MoveOperationContext moveContext ) throws LdapException
     {
         synchronized ( lock )
@@ -264,6 +272,7 @@ public class SingleFileLdifPartition ext
     /**
      * {@inheritDoc}
      */
+    @Override
     public void moveAndRename( MoveAndRenameOperationContext opContext ) throws LdapException
     {
         synchronized ( lock )
@@ -351,7 +360,7 @@ public class SingleFileLdifPartition ext
         // Start with the root
         Cursor<IndexEntry<ParentIdAndRdn, String>> cursor = rdnIdx.forwardCursor();
 
-        IndexEntry<ParentIdAndRdn, String> startingPos = new IndexEntry<ParentIdAndRdn, String>();
+        IndexEntry<ParentIdAndRdn, String> startingPos = new IndexEntry<>();
         startingPos.setKey( new ParentIdAndRdn( id, ( Rdn[] ) null ) );
         cursor.before( startingPos );
         int countChildren = 0;
@@ -412,6 +421,24 @@ public class SingleFileLdifPartition ext
                 len = ldifFile.length();
                 super.init();
             }
+            catch ( IOException e )
+            {
+                LdapException le = new LdapException( e.getMessage(), e );
+                le.initCause( e );
+
+                throw le;
+            }
+        }
+
+
+        public RandomAccessLdifReader( SchemaManager schemaManager ) throws LdapException
+        {
+            try
+            {
+                this.schemaManager = schemaManager;
+                len = ldifFile.length();
+                super.init();
+            }
             catch ( IOException e )
             {
                 LdapException le = new LdapException( e.getMessage(), e );

Modified: directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java (original)
+++ directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/LdifPartitionTest.java Wed Jun 15 12:29:57 2016
@@ -28,7 +28,11 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
@@ -63,6 +67,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.ModDnAva;
 import org.apache.directory.server.core.api.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.MoveOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
@@ -142,7 +148,7 @@ public class LdifPartitionTest
         // initialize the partition
         partition = new LdifPartition( schemaManager, dnFactory );
         partition.setId( "test-ldif" );
-        partition.setSuffixDn( new Dn( "ou=test,ou=system" ) );
+        partition.setSuffixDn( new Dn( schemaManager, "ou=test,ou=system" ) );
         partition.setSchemaManager( schemaManager );
         partition.setPartitionPath( wkdir.toURI() );
 
@@ -409,8 +415,7 @@ public class LdifPartitionTest
 
         SearchOperationContext searchCtx = new SearchOperationContext( session );
 
-        Dn dn = new Dn( "dc=test,ou=test,ou=system" );
-        dn.apply( schemaManager );
+        Dn dn = new Dn( schemaManager, "dc=test,ou=test,ou=system" );
         searchCtx.setDn( dn );
         ExprNode filter = FilterParser.parse( schemaManager, "(ObjectClass=domain)" );
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
@@ -423,10 +428,10 @@ public class LdifPartitionTest
 
         assertNotNull( cursor );
 
-        Set<String> expectedDns = new HashSet<String>();
-        expectedDns.add( entry1.getDn().getNormName() );
-        expectedDns.add( entry2.getDn().getNormName() );
-        expectedDns.add( entry3.getDn().getNormName() );
+        Set<Dn> expectedDns = new HashSet<>();
+        expectedDns.add( entry1.getDn() );
+        expectedDns.add( entry2.getDn() );
+        expectedDns.add( entry3.getDn() );
 
         cursor.beforeFirst();
         int nbRes = 0;
@@ -437,7 +442,7 @@ public class LdifPartitionTest
             assertNotNull( entry );
             nbRes++;
 
-            expectedDns.remove( entry.getDn().getNormName() );
+            expectedDns.remove( entry.getDn() );
         }
 
         assertEquals( 3, nbRes );
@@ -484,7 +489,7 @@ public class LdifPartitionTest
 
         Dn childDn1 = new Dn( schemaManager, "dc=child1,ou=test,ou=system" );
 
-        Rdn newRdn = new Rdn( SchemaConstants.DC_AT + "=" + "renamedChild1" );
+        Rdn newRdn = new Rdn( schemaManager, SchemaConstants.DC_AT + "=" + "renamedChild1" );
         RenameOperationContext renameOpCtx = new RenameOperationContext( session, childDn1, newRdn, true );
         partition.rename( renameOpCtx );
 
@@ -511,7 +516,7 @@ public class LdifPartitionTest
 
         Dn childDn1 = new Dn( schemaManager, "dc=child1,ou=test,ou=system" );
 
-        Rdn newRdn = new Rdn( "dc=renamedChild1" );
+        Rdn newRdn = new Rdn( schemaManager, "dc=renamedChild1" );
         RenameOperationContext renameOpCtx = new RenameOperationContext( session, childDn1, newRdn, false );
         partition.rename( renameOpCtx );
 
@@ -532,7 +537,7 @@ public class LdifPartitionTest
         // the renamed LDIF must contain the old an new Rdn attribute
         String content = FileUtils.readFileToString( new File( wkdir, "ou=test,ou=system/dc=renamedchild1.ldif" ) );
         assertFalse( content.contains( "dc: child1" ) );
-        assertTrue( content.contains( "dc: renamedchild1" ) );
+        assertTrue( content.contains( "dc: renamedChild1" ) );
     }
 
 
@@ -545,9 +550,28 @@ public class LdifPartitionTest
 
         Dn childDn2 = new Dn( schemaManager, "dc=child2,ou=test,ou=system" );
 
-        Rdn newRdn = new Rdn( SchemaConstants.DC_AT + "=" + "movedChild1" );
+        Rdn newRdn = new Rdn( schemaManager, "dc=movedChild1" );
         MoveAndRenameOperationContext moveAndRenameOpCtx = new MoveAndRenameOperationContext( session, childDn1,
             childDn2, newRdn, true );
+        
+        Entry originalEntry = partition.lookup( new LookupOperationContext( session, childDn1 ) );
+        Entry modifiedEntry = originalEntry.clone();
+        modifiedEntry.remove( "dc", "child1" );
+        modifiedEntry.add( "dc", "movedChild1" );
+
+        moveAndRenameOpCtx.setEntry( originalEntry );
+        moveAndRenameOpCtx.setModifiedEntry( modifiedEntry );
+        
+        // The dc=movedChild1 RDN that will be added. The dc=child1 Ryan RDN will be removed
+        Map<String, List<ModDnAva>> modDnAvas = new HashMap<>();
+
+        List<ModDnAva> modAvas = new ArrayList<>();
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.ADD, newRdn.getAva() ) );
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.DELETE, childDn1.getRdn().getAva()) );
+        modDnAvas.put( SchemaConstants.DOMAIN_COMPONENT_AT_OID, modAvas );
+        
+        moveAndRenameOpCtx.setModifiedAvas( modDnAvas );
+        
         partition.moveAndRename( moveAndRenameOpCtx );
 
         assertFalse( new File( wkdir, "ou=test,ou=system/dc=child1" ).exists() );
@@ -575,9 +599,29 @@ public class LdifPartitionTest
 
         Dn childDn2 = new Dn( schemaManager, "dc=child2,ou=test,ou=system" );
 
-        Rdn newRdn = new Rdn( "dc=movedChild1" );
+        Rdn newRdn = new Rdn( schemaManager, "dc=movedChild1" );
+
         MoveAndRenameOperationContext moveAndRenameOpCtx = new MoveAndRenameOperationContext( session, childDn1,
-            childDn2, newRdn, false );
+            childDn2, newRdn, true );
+        
+        Entry originalEntry = partition.lookup( new LookupOperationContext( session, childDn1 ) );
+        Entry modifiedEntry = originalEntry.clone();
+        modifiedEntry.remove( "dc", "child1" );
+        modifiedEntry.add( "dc", "movedChild1" );
+
+        moveAndRenameOpCtx.setEntry( originalEntry );
+        moveAndRenameOpCtx.setModifiedEntry( modifiedEntry );
+        
+        // The dc=movedChild1 RDN that will be added. The dc=child1 Ryan RDN will be removed
+        Map<String, List<ModDnAva>> modDnAvas = new HashMap<>();
+
+        List<ModDnAva> modAvas = new ArrayList<>();
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.ADD, newRdn.getAva() ) );
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.DELETE, childDn1.getRdn().getAva() ) );
+        modDnAvas.put( SchemaConstants.DOMAIN_COMPONENT_AT_OID, modAvas );
+        
+        moveAndRenameOpCtx.setModifiedAvas( modDnAvas );
+
         partition.moveAndRename( moveAndRenameOpCtx );
 
         assertFalse( new File( wkdir, "ou=test,ou=system/dc=child1" ).exists() );
@@ -594,11 +638,11 @@ public class LdifPartitionTest
         assertTrue( new File( wkdir,
             "ou=test,ou=system/dc=child2/dc=movedchild1/dc=grandchild11/dc=greatgrandchild111.ldif" ).exists() );
 
-        // the renamed LDIF must contain the old an new Rdn attribute
+        // the renamed LDIF must not contain the old an new Rdn attribute, because DC is single value
         String content = FileUtils
             .readFileToString( new File( wkdir, "ou=test,ou=system/dc=child2/dc=movedchild1.ldif" ) );
         assertFalse( content.contains( "dc: child1" ) );
-        assertTrue( content.contains( "dc: movedchild1" ) );
+        assertTrue( content.contains( "dc: movedChild1" ) );
     }
 
 

Modified: directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java (original)
+++ directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionSingeValueAttribute.java Wed Jun 15 12:29:57 2016
@@ -31,8 +31,10 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.RandomAccessFile;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
@@ -76,6 +78,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.ModDnAva;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.MoveOperationContext;
@@ -111,7 +114,7 @@ public class SingleFileLdifPartitionSing
 
     private static Entry contextEntry;
 
-    private static LdifReader reader = new LdifReader();
+    private static LdifReader reader;
 
     /** the file in use during the current test method's execution */
     private File ldifFileInUse;
@@ -147,6 +150,8 @@ public class SingleFileLdifPartitionSing
             fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
 
+        reader = new LdifReader( schemaManager );
+
         defaultCSNFactory = new CsnFactory( 0 );
 
         Dn adminDn = new Dn( schemaManager, "uid=admin,ou=system" );
@@ -238,7 +243,7 @@ public class SingleFileLdifPartitionSing
         SingleFileLdifPartition partition = new SingleFileLdifPartition( schemaManager, dnFactory );
         partition.setId( "test-ldif" );
         partition.setPartitionPath( new File( fileName ).toURI() );
-        partition.setSuffixDn( new Dn( "ou=test,ou=system" ) );
+        partition.setSuffixDn( new Dn( schemaManager, "ou=test,ou=system" ) );
         partition.setSchemaManager( schemaManager );
         partition.setCacheService( cacheService );
         partition.initialize();
@@ -703,8 +708,7 @@ public class SingleFileLdifPartitionSing
 
         SearchOperationContext searchCtx = new SearchOperationContext( mockSession );
 
-        Dn dn = new Dn( "dc=test,ou=test,ou=system" );
-        dn.apply( schemaManager );
+        Dn dn = new Dn( schemaManager, "dc=test,ou=test,ou=system" );
         searchCtx.setDn( dn );
         ExprNode filter = FilterParser.parse( schemaManager, "(ObjectClass=domain)" );
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
@@ -717,10 +721,10 @@ public class SingleFileLdifPartitionSing
 
         assertNotNull( cursor );
 
-        Set<String> expectedDns = new HashSet<String>();
-        expectedDns.add( entry1.getDn().getNormName() );
-        expectedDns.add( entry2.getDn().getNormName() );
-        expectedDns.add( entry3.getDn().getNormName() );
+        Set<Dn> expectedDns = new HashSet<>();
+        expectedDns.add( entry1.getDn() );
+        expectedDns.add( entry2.getDn() );
+        expectedDns.add( entry3.getDn() );
 
         cursor.beforeFirst();
         int nbRes = 0;
@@ -731,7 +735,7 @@ public class SingleFileLdifPartitionSing
             assertNotNull( entry );
             nbRes++;
 
-            expectedDns.remove( entry.getDn().getNormName() );
+            expectedDns.remove( entry.getDn() );
         }
 
         assertEquals( 3, nbRes );
@@ -846,9 +850,32 @@ public class SingleFileLdifPartitionSing
 
         Dn childDn2 = new Dn( schemaManager, "dc=child2,ou=test,ou=system" );
 
-        Rdn newRdn = new Rdn( SchemaConstants.DC_AT + "=" + "movedChild1" );
+        Rdn newRdn = new Rdn( schemaManager, "dc=movedChild1" );
+        
         MoveAndRenameOperationContext moveAndRenameOpCtx = new MoveAndRenameOperationContext( mockSession, childDn1,
             childDn2, newRdn, true );
+        
+        Entry originalEntry = partition.lookup( new LookupOperationContext( mockSession, childDn1 ) );
+        Entry modifiedEntry = originalEntry.clone();
+        modifiedEntry.setDn( childDn2.add( newRdn ) );
+        modifiedEntry.remove( "dc", "child1" );
+        modifiedEntry.add( "dc", "movedChild1" );
+        modifiedEntry.removeAttributes( "entryDn" );
+        modifiedEntry.removeAttributes( "entryParentId" );
+
+        moveAndRenameOpCtx.setEntry( originalEntry );
+        moveAndRenameOpCtx.setModifiedEntry( modifiedEntry );
+        
+        // The dc=movedChild1 RDN that will be added. The dc=child1 Ryan RDN will be removed
+        Map<String, List<ModDnAva>> modDnAvas = new HashMap<>();
+
+        List<ModDnAva> modAvas = new ArrayList<>();
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.ADD, newRdn.getAva() ) );
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.DELETE, childDn1.getRdn().getAva() ) );
+        modDnAvas.put( SchemaConstants.DOMAIN_COMPONENT_AT_OID, modAvas );
+        
+        moveAndRenameOpCtx.setModifiedAvas( modDnAvas );
+        
         partition.moveAndRename( moveAndRenameOpCtx );
 
         partition = reloadPartition();
@@ -873,11 +900,34 @@ public class SingleFileLdifPartitionSing
 
         Dn childDn2 = new Dn( schemaManager, "dc=child2,ou=test,ou=system" );
 
-        Rdn newRdn = new Rdn( SchemaConstants.DC_AT + "=" + "movedChild1" );
+        Rdn newRdn = new Rdn( schemaManager, "dc=movedChild1" );
+
         MoveAndRenameOperationContext moveAndRenameOpCtx = new MoveAndRenameOperationContext( mockSession, childDn1,
-            childDn2, newRdn, false );
-        partition.moveAndRename( moveAndRenameOpCtx );
+            childDn2, newRdn, true );
+        
+        Entry originalEntry = partition.lookup( new LookupOperationContext( mockSession, childDn1 ) );
+        Entry modifiedEntry = originalEntry.clone();
+        modifiedEntry.setDn( childDn2.add( newRdn ) );
+        modifiedEntry.remove( "dc", "child1" );
+        modifiedEntry.add( "dc", "movedChild1" );
+        modifiedEntry.removeAttributes( "entryDn" );
+        modifiedEntry.removeAttributes( "entryParentId" );
+
+        moveAndRenameOpCtx.setEntry( originalEntry );
+        moveAndRenameOpCtx.setModifiedEntry( modifiedEntry );
+        
+        // The dc=movedChild1 RDN that will be added. The dc=child1 Ryan RDN will be removed
+        Map<String, List<ModDnAva>> modDnAvas = new HashMap<>();
+
+        List<ModDnAva> modAvas = new ArrayList<>();
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.ADD, newRdn.getAva() ) );
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.DELETE, childDn1.getRdn().getAva() ) );
+        modDnAvas.put( SchemaConstants.DOMAIN_COMPONENT_AT_OID, modAvas );
+        
+        moveAndRenameOpCtx.setModifiedAvas( modDnAvas );
 
+        partition.moveAndRename( moveAndRenameOpCtx );
+        
         partition = reloadPartition();
 
         childDn1 = new Dn( schemaManager, "dc=movedChild1,dc=child2,ou=test,ou=system" );

Modified: directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java (original)
+++ directory/apacheds/branches/apacheds-value/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java Wed Jun 15 12:29:57 2016
@@ -31,8 +31,10 @@ import static org.junit.Assert.fail;
 import java.io.File;
 import java.io.RandomAccessFile;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
@@ -76,6 +78,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.ModDnAva;
 import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.MoveAndRenameOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.MoveOperationContext;
@@ -109,7 +112,7 @@ public class SingleFileLdifPartitionTest
 
     private static Entry contextEntry;
 
-    private static LdifReader reader = new LdifReader();
+    private static LdifReader reader;
 
     /** the file in use during the current test method's execution */
     private File ldifFileInUse;
@@ -145,6 +148,8 @@ public class SingleFileLdifPartitionTest
             fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
         }
 
+        reader = new LdifReader( schemaManager );
+
         defaultCSNFactory = new CsnFactory( 0 );
 
         Dn adminDn = new Dn( schemaManager, "uid=admin,ou=system" );
@@ -236,7 +241,7 @@ public class SingleFileLdifPartitionTest
         SingleFileLdifPartition partition = new SingleFileLdifPartition( schemaManager, dnFactory );
         partition.setId( "test-ldif" );
         partition.setPartitionPath( new File( fileName ).toURI() );
-        partition.setSuffixDn( new Dn( "ou=test,ou=system" ) );
+        partition.setSuffixDn( new Dn( schemaManager, "ou=test,ou=system" ) );
         partition.setSchemaManager( schemaManager );
         partition.setCacheService( cacheService );
         partition.initialize();
@@ -701,8 +706,7 @@ public class SingleFileLdifPartitionTest
 
         SearchOperationContext searchCtx = new SearchOperationContext( mockSession );
 
-        Dn dn = new Dn( "cn=test,ou=test,ou=system" );
-        dn.apply( schemaManager );
+        Dn dn = new Dn( schemaManager, "cn=test,ou=test,ou=system" );
         searchCtx.setDn( dn );
         ExprNode filter = FilterParser.parse( schemaManager, "(ObjectClass=person)" );
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
@@ -715,10 +719,10 @@ public class SingleFileLdifPartitionTest
 
         assertNotNull( cursor );
 
-        Set<String> expectedDns = new HashSet<String>();
-        expectedDns.add( entry1.getDn().getNormName() );
-        expectedDns.add( entry2.getDn().getNormName() );
-        expectedDns.add( entry3.getDn().getNormName() );
+        Set<Dn> expectedDns = new HashSet<>();
+        expectedDns.add( entry1.getDn() );
+        expectedDns.add( entry2.getDn() );
+        expectedDns.add( entry3.getDn() );
 
         cursor.beforeFirst();
         int nbRes = 0;
@@ -729,7 +733,7 @@ public class SingleFileLdifPartitionTest
             assertNotNull( entry );
             nbRes++;
 
-            expectedDns.remove( entry.getDn().getNormName() );
+            expectedDns.remove( entry.getDn() );
         }
 
         assertEquals( 3, nbRes );
@@ -843,9 +847,28 @@ public class SingleFileLdifPartitionTest
 
         Dn childDn2 = new Dn( schemaManager, "cn=child2,ou=test,ou=system" );
 
-        Rdn newRdn = new Rdn( SchemaConstants.CN_AT + "=" + "movedChild1" );
+        Rdn newRdn = new Rdn( schemaManager, "cn=movedChild1" );
         MoveAndRenameOperationContext moveAndRenameOpCtx = new MoveAndRenameOperationContext( mockSession, childDn1,
             childDn2, newRdn, true );
+        
+        Entry originalEntry = partition.lookup( new LookupOperationContext( mockSession, childDn1 ) );
+        Entry modifiedEntry = originalEntry.clone();
+        modifiedEntry.remove( "cn", "child1" );
+        modifiedEntry.add( "cn", "movedChild1" );
+
+        moveAndRenameOpCtx.setEntry( originalEntry );
+        moveAndRenameOpCtx.setModifiedEntry( modifiedEntry );
+        
+        // The dc=movedChild1 RDN that will be added. The dc=child1 Ryan RDN will be removed
+        Map<String, List<ModDnAva>> modDnAvas = new HashMap<>();
+
+        List<ModDnAva> modAvas = new ArrayList<>();
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.ADD, newRdn.getAva() ) );
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.DELETE, childDn1.getRdn().getAva()) );
+        modDnAvas.put( SchemaConstants.CN_AT_OID, modAvas );
+        
+        moveAndRenameOpCtx.setModifiedAvas( modDnAvas );
+        
         partition.moveAndRename( moveAndRenameOpCtx );
 
         partition = reloadPartition();
@@ -870,9 +893,27 @@ public class SingleFileLdifPartitionTest
 
         Dn childDn2 = new Dn( schemaManager, "cn=child2,ou=test,ou=system" );
 
-        Rdn newRdn = new Rdn( SchemaConstants.CN_AT + "=" + "movedChild1" );
+        Rdn newRdn = new Rdn( schemaManager, "cn=movedChild1" );
+        
         MoveAndRenameOperationContext moveAndRenameOpCtx = new MoveAndRenameOperationContext( mockSession, childDn1,
-            childDn2, newRdn, false );
+            childDn2, newRdn, true );
+        
+        Entry originalEntry = partition.lookup( new LookupOperationContext( mockSession, childDn1 ) );
+        Entry modifiedEntry = originalEntry.clone();
+        modifiedEntry.add( "cn", "movedChild1" );
+
+        moveAndRenameOpCtx.setEntry( originalEntry );
+        moveAndRenameOpCtx.setModifiedEntry( modifiedEntry );
+        
+        // The dc=movedChild1 RDN that will be added. The dc=child1 Ryan RDN will be removed
+        Map<String, List<ModDnAva>> modDnAvas = new HashMap<>();
+
+        List<ModDnAva> modAvas = new ArrayList<>();
+        modAvas.add( new ModDnAva( ModDnAva.ModDnType.ADD, newRdn.getAva() ) );
+        modDnAvas.put( SchemaConstants.CN_AT_OID, modAvas );
+        
+        moveAndRenameOpCtx.setModifiedAvas( modDnAvas );
+        
         partition.moveAndRename( moveAndRenameOpCtx );
 
         partition = reloadPartition();




Mime
View raw message