directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r985686 [3/4] - in /directory: apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/ apacheds/branches/apacheds-codec-merge/core-api/src/test/java/org/apache/directory/server/core/ apacheds/branches...
Date Sun, 15 Aug 2010 14:54:58 GMT
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java Sun Aug 15 14:54:56 2010
@@ -22,10 +22,8 @@ package org.apache.directory.shared.ldap
 
 import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.ldap.codec.add.AddRequestCodec;
-import org.apache.directory.shared.ldap.codec.bind.BindRequestCodec;
 import org.apache.directory.shared.ldap.codec.compare.CompareRequestCodec;
 import org.apache.directory.shared.ldap.codec.controls.AbstractControl;
-import org.apache.directory.shared.ldap.codec.del.DelRequestCodec;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
 import org.apache.directory.shared.ldap.codec.modify.ModifyRequestCodec;
 import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
@@ -182,15 +180,6 @@ public class LdapMessageContainer extend
     /**
      * @return Returns the BindRequest stored in the container
      */
-    public BindRequestCodec getBindRequest()
-    {
-        return ( BindRequestCodec ) ldapMessage;
-    }
-
-
-    /**
-     * @return Returns the BindRequest stored in the container
-     */
     public InternalBindRequest getInternalBindRequest()
     {
         return ( InternalBindRequest ) internalMessage;
@@ -236,15 +225,6 @@ public class LdapMessageContainer extend
     /**
      * @return Returns the DelRequest stored in the container
      */
-    public DelRequestCodec getDelRequest()
-    {
-        return ( DelRequestCodec ) ldapMessage;
-    }
-
-
-    /**
-     * @return Returns the InternalDeleleteRequest stored in the container
-     */
     public InternalDeleteRequest getInternalDeleteRequest()
     {
         return ( InternalDeleteRequest ) internalMessage;

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java Sun Aug 15 14:54:56 2010
@@ -101,27 +101,27 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.SearchResultReferenceImpl;
 import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
 import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
 import org.apache.directory.shared.ldap.message.internal.AddResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.BindResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.CompareResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalIntermediateResponse;
-import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
+import org.apache.directory.shared.ldap.message.internal.InternalReferral;
+import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
+import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.ModifyDnResponse;
 import org.apache.directory.shared.ldap.message.internal.ModifyResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalReferral;
 import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.directory.shared.ldap.message.internal.SearchResultDone;
 import org.apache.directory.shared.ldap.message.internal.SearchResultEntry;
 import org.apache.directory.shared.ldap.message.internal.SearchResultReference;
-import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -1386,8 +1386,7 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the SearchResultDone Object
-                    SearchResultDone searchResultDone = new SearchResultDoneImpl( ldapMessageContainer
-                        .getMessageId() );
+                    SearchResultDone searchResultDone = new SearchResultDoneImpl( ldapMessageContainer.getMessageId() );
                     ldapMessageContainer.setInternalMessage( searchResultDone );
 
                     log.debug( "Search Result Done found" );
@@ -2470,8 +2469,7 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the ModifyDnResponse Object
-                    ModifyDnResponse modifyDnResponse = new ModifyDnResponseImpl( ldapMessageContainer
-                        .getMessageId() );
+                    ModifyDnResponse modifyDnResponse = new ModifyDnResponseImpl( ldapMessageContainer.getMessageId() );
                     ldapMessageContainer.setInternalMessage( modifyDnResponse );
 
                     log.debug( "Modify DN response " );
@@ -2727,8 +2725,7 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the CompareResponse Object
-                    CompareResponse compareResponse = new CompareResponseImpl( ldapMessageContainer
-                        .getMessageId() );
+                    CompareResponse compareResponse = new CompareResponseImpl( ldapMessageContainer.getMessageId() );
                     ldapMessageContainer.setInternalMessage( compareResponse );
 
                     // We will check that the request is not null
@@ -2776,8 +2773,8 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the SearchResultReference Object
-                    SearchResultReference searchResultReference = new SearchResultReferenceImpl(
-                        ldapMessageContainer.getMessageId() );
+                    SearchResultReference searchResultReference = new SearchResultReferenceImpl( ldapMessageContainer
+                        .getMessageId() );
                     ldapMessageContainer.setInternalMessage( searchResultReference );
 
                     log.debug( "SearchResultReference response " );
@@ -2987,8 +2984,7 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the ExtendedResponse Object
-                    ExtendedResponse extendedResponse = new ExtendedResponseImpl( ldapMessageContainer
-                        .getMessageId() );
+                    ExtendedResponse extendedResponse = new ExtendedResponseImpl( ldapMessageContainer.getMessageId() );
                     ldapMessageContainer.setInternalMessage( extendedResponse );
 
                     log.debug( "Extended Response" );
@@ -3487,7 +3483,7 @@ public class LdapMessageGrammar extends 
                             control = new ControlImpl( oidValue );
                         }
 
-                        message.add( control );
+                        message.addControl( control );
                     }
 
                     // We can have an END transition

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java Sun Aug 15 14:54:56 2010
@@ -25,9 +25,6 @@ import java.util.List;
 
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.codec.bind.BindRequestCodec;
-import org.apache.directory.shared.ldap.codec.bind.SaslCredentials;
-import org.apache.directory.shared.ldap.codec.bind.SimpleAuthentication;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
 import org.apache.directory.shared.ldap.codec.modify.ModifyRequestCodec;
 import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
@@ -59,7 +56,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
 import org.apache.directory.shared.ldap.message.ModifyDnRequestImpl;
 import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
@@ -603,40 +599,6 @@ public class LdapTransformer
 
 
     /**
-     * Transform a Internal BindRequest to a Codec BindRequest
-     * 
-     * @param internalMessage The incoming Internal BindRequest
-     * @return The BindRequestCodec instance
-     */
-    private static LdapMessageCodec transformBindRequest( InternalMessage internalMessage )
-    {
-        BindRequestImpl internalBindRequest = ( BindRequestImpl ) internalMessage;
-
-        BindRequestCodec bindRequest = new BindRequestCodec();
-
-        if ( internalBindRequest.isSimple() )
-        {
-            SimpleAuthentication simple = new SimpleAuthentication();
-            simple.setSimple( internalBindRequest.getCredentials() );
-            bindRequest.setAuthentication( simple );
-        }
-        else
-        {
-            SaslCredentials sasl = new SaslCredentials();
-            sasl.setCredentials( internalBindRequest.getCredentials() );
-            sasl.setMechanism( internalBindRequest.getSaslMechanism() );
-            bindRequest.setAuthentication( sasl );
-        }
-
-        bindRequest.setMessageId( internalBindRequest.getMessageId() );
-        bindRequest.setName( internalBindRequest.getName() );
-        bindRequest.setVersion( internalBindRequest.isVersion3() ? 3 : 2 );
-
-        return bindRequest;
-    }
-
-
-    /**
      * Transform the internal message to a codec message.
      * 
      * @param msg the message to transform
@@ -652,13 +614,6 @@ public class LdapTransformer
 
         LdapMessageCodec codecMessage = null;
 
-        switch ( msg.getType() )
-        {
-            case BIND_REQUEST:
-                codecMessage = transformBindRequest( msg );
-                break;
-        }
-
         codecMessage.setMessageId( msg.getMessageId() );
 
         // We also have to transform the controls...
@@ -691,7 +646,7 @@ public class LdapTransformer
 
         for ( final Control codecControl : codecMessage.getControls() )
         {
-            internalMessage.add( codecControl );
+            internalMessage.addControl( codecControl );
         }
     }
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java Sun Aug 15 14:54:56 2010
@@ -24,8 +24,8 @@ import java.util.Arrays;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.BindResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -49,7 +49,7 @@ public class BindRequestImpl extends Abs
 
     /** The passwords, keys or tickets used to verify user identity */
     private byte[] credentials;
-    
+
     /** A storage for credentials hashCode */
     private int hCredentials;
 
@@ -65,6 +65,15 @@ public class BindRequestImpl extends Abs
     /** The associated response */
     public BindResponse response;
 
+    /** The bind request length */
+    private int bindRequestLength;
+
+    /** The SASL Mechanism length */
+    private int saslMechanismLength;
+
+    /** The SASL credentials length */
+    private int saslCredentialsLength;
+
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -82,6 +91,16 @@ public class BindRequestImpl extends Abs
     }
 
 
+    /**
+     * Creates an BindRequest implementation to bind to an LDAP server.
+     */
+    public BindRequestImpl()
+    {
+        super( -1, TYPE );
+        hCredentials = 0;
+    }
+
+
     // -----------------------------------------------------------------------
     // BindRequest Interface Method Implementations
     // -----------------------------------------------------------------------
@@ -136,32 +155,37 @@ public class BindRequestImpl extends Abs
 
 
     /**
-     * Sets the simple credentials associated with a simple authentication
-     * attempt ignored if this request uses SASL authentication mechanisms.
-     * 
-     * @param credentials
-     *            the credentials if authentication is simple, null otherwise
+     * {@inheritDoc}
+     */
+    public void setCredentials( String credentials )
+    {
+        setCredentials( StringTools.getBytesUtf8( credentials ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
      */
     public void setCredentials( byte[] credentials )
     {
         if ( credentials != null )
         {
-            this.credentials = new byte[ credentials.length ];
+            this.credentials = new byte[credentials.length];
             System.arraycopy( credentials, 0, this.credentials, 0, credentials.length );
-        } 
-        else 
+        }
+        else
         {
             this.credentials = null;
         }
-        
+
         // Compute the hashcode
         if ( credentials != null )
         {
             hCredentials = 0;
-            
-            for ( byte b:credentials )
+
+            for ( byte b : credentials )
             {
-                hCredentials = hCredentials*31 + b;
+                hCredentials = hCredentials * 31 + b;
             }
         }
         else
@@ -308,7 +332,6 @@ public class BindRequestImpl extends Abs
 
         return response;
     }
-    
 
 
     /**
@@ -335,7 +358,7 @@ public class BindRequestImpl extends Abs
         {
             return false;
         }
-        
+
         if ( !super.equals( obj ) )
         {
             return false;
@@ -355,7 +378,7 @@ public class BindRequestImpl extends Abs
 
         DN dn1 = req.getName();
         DN dn2 = getName();
-        
+
         if ( dn1 == null )
         {
             if ( dn2 != null )
@@ -373,9 +396,9 @@ public class BindRequestImpl extends Abs
             {
                 return false;
             }
-                
+
         }
-        
+
         if ( !Arrays.equals( req.getCredentials(), getCredentials() ) )
         {
             return false;
@@ -383,8 +406,8 @@ public class BindRequestImpl extends Abs
 
         return true;
     }
-    
-    
+
+
     /**
      * @see Object#hashCode()
      * @return the instance's hash code 
@@ -392,18 +415,75 @@ public class BindRequestImpl extends Abs
     public int hashCode()
     {
         int hash = 37;
-        hash = hash*17 + ( credentials == null ? 0 : hCredentials );
-        hash = hash*17 + ( isSimple ? 0 : 1 );
-        hash = hash*17 + ( isVersion3 ? 0 : 1 );
-        hash = hash*17 + ( mechanism == null ? 0 : mechanism.hashCode() );
-        hash = hash*17 + ( name == null ? 0 : name.hashCode() );
-        hash = hash*17 + ( response == null ? 0 : response.hashCode() );
-        hash = hash*17 + super.hashCode();
-        
+        hash = hash * 17 + ( credentials == null ? 0 : hCredentials );
+        hash = hash * 17 + ( isSimple ? 0 : 1 );
+        hash = hash * 17 + ( isVersion3 ? 0 : 1 );
+        hash = hash * 17 + ( mechanism == null ? 0 : mechanism.hashCode() );
+        hash = hash * 17 + ( name == null ? 0 : name.hashCode() );
+        hash = hash * 17 + ( response == null ? 0 : response.hashCode() );
+        hash = hash * 17 + super.hashCode();
+
         return hash;
     }
 
-    
+
+    /**
+     * Stores the encoded length for the BindRequest
+     * @param bindRequestLength The encoded length
+     */
+    /* No qualifier*/void setBindRequestLength( int bindRequestLength )
+    {
+        this.bindRequestLength = bindRequestLength;
+    }
+
+
+    /**
+     * @return The encoded BindRequest's length
+     */
+    /* No qualifier */int getBindRequestLength()
+    {
+        return bindRequestLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the SaslCredentials
+     * @param saslCredentialsLength The encoded length
+     */
+    /* No qualifier*/void setSaslCredentialsLength( int saslCredentialsLength )
+    {
+        this.saslCredentialsLength = saslCredentialsLength;
+    }
+
+
+    /**
+     * @return The encoded SaslCredentials's length
+     */
+    /* No qualifier */int getSaslCredentialsLength()
+    {
+        return saslCredentialsLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the Mechanism
+     * @param saslMechanismLength The encoded length
+     */
+    /* No qualifier*/void setSaslMechanismLength( int saslMechanismLength )
+    {
+        this.saslMechanismLength = saslMechanismLength;
+    }
+
+
+    /**
+     * @return The encoded SaslMechanism's length
+     */
+    /* No qualifier */int getSaslMechanismLength()
+    {
+        return saslMechanismLength;
+    }
+
+
     /**
      * Get a String representation of a BindRequest
      * 
@@ -432,22 +512,22 @@ public class BindRequestImpl extends Abs
             {
                 sb.append( "        Sasl credentials\n" );
                 sb.append( "            Mechanism :'" ).append( mechanism ).append( "'\n" );
-                
+
                 if ( credentials == null )
                 {
                     sb.append( "            Credentials : null" );
                 }
                 else
                 {
-                    sb.append( "            Credentials : '" ).
-                        append( StringTools.utf8ToString( credentials ) ).
-                        append( '/' ).
-                        append( StringTools.dumpBytes( credentials ) ).
-                        append( "'\n" );
+                    sb.append( "            Credentials : '" ).append( StringTools.utf8ToString( credentials ) )
+                        .append( '/' ).append( StringTools.dumpBytes( credentials ) ).append( "'\n" );
                 }
             }
         }
 
+        // The controls if any
+        sb.append( super.toString() );
+
         return sb.toString();
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java Sun Aug 15 14:54:56 2010
@@ -21,8 +21,8 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.directory.shared.ldap.name.DN;
 
@@ -39,6 +39,7 @@ public class DeleteRequestImpl extends A
     /** The distinguished name of the entry to delete */
     private DN name;
 
+    /** The deleteResponse associated with this request */
     private DeleteResponse response;
 
 
@@ -47,11 +48,10 @@ public class DeleteRequestImpl extends A
     // ------------------------------------------------------------------------
 
     /**
-     * Creates a Lockable DeleteRequest implementing object used to delete a
+     * Creates a DeleteRequest implementing object used to delete a
      * leaf entry from the DIT.
      * 
-     * @param id
-     *            the sequential message identifier
+     * @param id the sequential message identifier
      */
     public DeleteRequestImpl( final int id )
     {
@@ -79,8 +79,7 @@ public class DeleteRequestImpl extends A
      * Sets the distinguished name of the leaf entry to be deleted by this
      * request.
      * 
-     * @param name
-     *            the DN of the leaf entry to delete.
+     * @param name the DN of the leaf entry to delete.
      */
     public void setName( DN name )
     {
@@ -127,10 +126,12 @@ public class DeleteRequestImpl extends A
     public int hashCode()
     {
         int hash = 37;
+
         if ( name != null )
         {
             hash = hash * 17 + name.hashCode();
         }
+
         hash = hash * 17 + super.hashCode();
 
         return hash;
@@ -144,8 +145,7 @@ public class DeleteRequestImpl extends A
      * Then the name of the entry is compared - if not the same false is
      * returned. Finally the method exists returning true.
      * 
-     * @param obj
-     *            the object to test for equality to this
+     * @param obj the object to test for equality to this
      * @return true if the obj is equal to this DeleteRequest, false otherwise
      */
     public boolean equals( Object obj )
@@ -189,10 +189,11 @@ public class DeleteRequestImpl extends A
     public String toString()
     {
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append( "    Del request\n" );
         sb.append( "        Entry : '" ).append( name.toString() ).append( "'\n" );
+        sb.append( super.toString() );
 
         return sb.toString();
     }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java Sun Aug 15 14:54:56 2010
@@ -47,6 +47,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalIntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalReferral;
@@ -124,7 +126,8 @@ public class LdapProtocolEncoder extends
             || ( message instanceof ModifyDnResponse ) || ( message instanceof InternalIntermediateResponse )
             || ( message instanceof SearchResultDone ) || ( message instanceof SearchResultEntry )
             || ( message instanceof SearchResultReference ) || ( message instanceof InternalAbandonRequest )
-            || ( message instanceof InternalUnbindRequest ) )
+            || ( message instanceof InternalDeleteRequest ) || ( message instanceof InternalUnbindRequest )
+            || ( message instanceof InternalBindRequest ) )
         {
             try
             {
@@ -429,9 +432,71 @@ public class LdapProtocolEncoder extends
     }
 
 
+    /**
+     * Compute the BindRequest length 
+     * 
+     * BindRequest : 
+     * <pre>
+     * 0x60 L1 
+     *   | 
+     *   +--> 0x02 0x01 (1..127) version 
+     *   +--> 0x04 L2 name 
+     *   +--> authentication 
+     *   
+     * L2 = Length(name)
+     * L3/4 = Length(authentication) 
+     * Length(BindRequest) = Length(0x60) + Length(L1) + L1 + Length(0x02) + 1 + 1 + 
+     *      Length(0x04) + Length(L2) + L2 + Length(authentication)
+     * </pre>
+     */
     private int computeBindRequestLength( BindRequestImpl bindRequest )
     {
-        return 0;
+        int bindRequestLength = 1 + 1 + 1; // Initialized with version
+
+        // The name
+        bindRequestLength += 1 + TLV.getNbBytes( DN.getNbBytes( bindRequest.getName() ) )
+            + DN.getNbBytes( bindRequest.getName() );
+
+        byte[] credentials = bindRequest.getCredentials();
+
+        // The authentication
+        if ( bindRequest.isSimple() )
+        {
+            // Compute a SimpleBind operation
+            if ( credentials != null )
+            {
+                bindRequestLength += 1 + TLV.getNbBytes( credentials.length ) + credentials.length;
+            }
+            else
+            {
+                bindRequestLength += 1 + 1;
+            }
+        }
+        else
+        {
+            byte[] mechanismBytes = StringTools.getBytesUtf8( bindRequest.getSaslMechanism() );
+            int saslMechanismLength = 1 + TLV.getNbBytes( mechanismBytes.length ) + mechanismBytes.length;
+            int saslCredentialsLength = 0;
+
+            if ( credentials != null )
+            {
+                saslCredentialsLength = 1 + TLV.getNbBytes( credentials.length ) + credentials.length;
+            }
+
+            int saslLength = 1 + TLV.getNbBytes( saslMechanismLength + saslCredentialsLength ) + saslMechanismLength
+                + saslCredentialsLength;
+
+            bindRequestLength += saslLength;
+
+            // Store the mechanism and credentials lengths
+            bindRequest.setSaslMechanismLength( saslMechanismLength );
+            bindRequest.setSaslCredentialsLength( saslCredentialsLength );
+        }
+
+        bindRequest.setBindRequestLength( bindRequestLength );
+
+        // Return the result.
+        return 1 + TLV.getNbBytes( bindRequestLength ) + bindRequestLength;
     }
 
 
@@ -492,6 +557,22 @@ public class LdapProtocolEncoder extends
 
 
     /**
+     * Compute the DelRequest length 
+     * 
+     * DelRequest : 
+     * 0x4A L1 entry 
+     * 
+     * L1 = Length(entry) 
+     * Length(DelRequest) = Length(0x4A) + Length(L1) + L1
+     */
+    private int computeDeleteRequestLength( DeleteRequestImpl deleteRequest )
+    {
+        // The entry
+        return 1 + TLV.getNbBytes( DN.getNbBytes( deleteRequest.getName() ) ) + DN.getNbBytes( deleteRequest.getName() );
+    }
+
+
+    /**
      * Compute the DelResponse length 
      * 
      * DelResponse :
@@ -937,9 +1018,98 @@ public class LdapProtocolEncoder extends
     }
 
 
-    private void encodeBindRequest( ByteBuffer bb, BindRequestImpl bindRequest ) throws EncoderException
+    /**
+     * Encode the BindRequest message to a PDU. 
+     * 
+     * BindRequest : 
+     * <pre>
+     * 0x60 LL 
+     *   0x02 LL version         0x80 LL simple 
+     *   0x04 LL name           /   
+     *   authentication.encode() 
+     *                          \ 0x83 LL mechanism [0x04 LL credential]
+     * </pre>
+     * 
+     * @param buffer The buffer where to put the PDU
+     * @return The PDU.
+     */
+    private void encodeBindRequest( ByteBuffer buffer, BindRequestImpl bindRequest ) throws EncoderException
     {
+        try
+        {
+            // The BindRequest Tag
+            buffer.put( LdapConstants.BIND_REQUEST_TAG );
+            buffer.put( TLV.getBytes( bindRequest.getBindRequestLength() ) );
+
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
+        }
 
+        // The version (LDAP V3 only)
+        Value.encode( buffer, 3 );
+
+        // The name
+        Value.encode( buffer, DN.getBytes( bindRequest.getName() ) );
+
+        byte[] credentials = bindRequest.getCredentials();
+
+        // The authentication
+        if ( bindRequest.isSimple() )
+        {
+            // Simple authentication
+            try
+            {
+                // The simpleAuthentication Tag
+                buffer.put( ( byte ) LdapConstants.BIND_REQUEST_SIMPLE_TAG );
+
+                if ( credentials != null )
+                {
+                    buffer.put( TLV.getBytes( credentials.length ) );
+
+                    if ( credentials.length != 0 )
+                    {
+                        buffer.put( credentials );
+                    }
+                }
+                else
+                {
+                    buffer.put( ( byte ) 0 );
+                }
+            }
+            catch ( BufferOverflowException boe )
+            {
+                String msg = I18n.err( I18n.ERR_04005 );
+                throw new EncoderException( msg );
+            }
+        }
+        else
+        {
+            // SASL Bind
+            try
+            {
+                // The saslAuthentication Tag
+                buffer.put( ( byte ) LdapConstants.BIND_REQUEST_SASL_TAG );
+
+                byte[] mechanismBytes = StringTools.getBytesUtf8( bindRequest.getSaslMechanism() );
+
+                buffer.put( TLV
+                    .getBytes( bindRequest.getSaslMechanismLength() + bindRequest.getSaslCredentialsLength() ) );
+
+                Value.encode( buffer, mechanismBytes );
+
+                if ( credentials != null )
+                {
+                    Value.encode( buffer, credentials );
+                }
+            }
+            catch ( BufferOverflowException boe )
+            {
+                String msg = I18n.err( I18n.ERR_04005 );
+                throw new EncoderException( msg );
+            }
+        }
     }
 
 
@@ -1013,6 +1183,32 @@ public class LdapProtocolEncoder extends
 
 
     /**
+     * Encode the DelRequest message to a PDU. 
+     * 
+     * DelRequest : 
+     * 0x4A LL entry
+     * 
+     * @param buffer The buffer where to put the PDU
+     */
+    private void encodeDeleteRequest( ByteBuffer buffer, DeleteRequestImpl deleteRequest ) throws EncoderException
+    {
+        try
+        {
+            // The DelRequest Tag
+            buffer.put( LdapConstants.DEL_REQUEST_TAG );
+
+            // The entry
+            buffer.put( TLV.getBytes( DN.getNbBytes( deleteRequest.getName() ) ) );
+            buffer.put( DN.getBytes( deleteRequest.getName() ) );
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
+        }
+    }
+
+
+    /**
      * Encode the DelResponse message to a PDU.
      * 
      * @param buffer The buffer where to put the PDU
@@ -1389,6 +1585,9 @@ public class LdapProtocolEncoder extends
             case COMPARE_RESPONSE:
                 return computeCompareResponseLength( ( CompareResponseImpl ) message );
 
+            case DEL_REQUEST:
+                return computeDeleteRequestLength( ( DeleteRequestImpl ) message );
+
             case DEL_RESPONSE:
                 return computeDeleteResponseLength( ( DeleteResponseImpl ) message );
 
@@ -1446,6 +1645,10 @@ public class LdapProtocolEncoder extends
                 encodeCompareResponse( bb, ( CompareResponseImpl ) message );
                 break;
 
+            case DEL_REQUEST:
+                encodeDeleteRequest( bb, ( DeleteRequestImpl ) message );
+                break;
+
             case DEL_RESPONSE:
                 encodeDeleteResponse( bb, ( DeleteResponseImpl ) message );
                 break;

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java Sun Aug 15 14:54:56 2010
@@ -26,7 +26,6 @@ import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.control.Control;
 
@@ -47,7 +46,7 @@ public abstract class InternalAbstractMe
     private int controlsLength;
 
     /** The session unique message sequence identifier */
-    private final int id;
+    private int id;
 
     /** The message type enumeration */
     private final MessageTypeEnum type;
@@ -65,10 +64,8 @@ public abstract class InternalAbstractMe
     /**
      * Completes the instantiation of a Message.
      * 
-     * @param id
-     *            the seq id of the message
-     * @param type
-     *            the type of the message
+     * @param id the seq id of the message
+     * @param type the type of the message
      */
     protected InternalAbstractMessage( final int id, final MessageTypeEnum type )
     {
@@ -93,11 +90,14 @@ public abstract class InternalAbstractMe
     }
 
 
+    public void setMessageId( int id )
+    {
+        this.id = id;
+    }
+
+
     /**
-     * Gets the controls associated with this message mapped by OID.
-     * 
-     * @return Map of OID strings to Control object instances.
-     * @see CodecControl
+     * {@inheritDoc}
      */
     public Map<String, Control> getControls()
     {
@@ -106,6 +106,15 @@ public abstract class InternalAbstractMe
 
 
     /**
+     * {@inheritDoc}
+     */
+    public Control getControl( String oid )
+    {
+        return controls.get( oid );
+    }
+
+
+    /**
      * Get the current Control Object
      * 
      * @return The current Control Object
@@ -117,7 +126,7 @@ public abstract class InternalAbstractMe
 
 
     /**
-     * @see org.apache.directory.shared.ldap.message.internal.InternalMessage#hasControl(java.lang.String)
+     * {@inheritDoc}
      */
     public boolean hasControl( String oid )
     {
@@ -126,15 +135,9 @@ public abstract class InternalAbstractMe
 
 
     /**
-     * Adds a control to this Message.
-     * 
-     * @param control
-     *            the control to add.
-     * @throws MessageException
-     *             if controls cannot be added to this Message or the control is
-     *             not known etc.
+     * {@inheritDoc}
      */
-    public void add( Control control ) throws MessageException
+    public void addControl( Control control ) throws MessageException
     {
         controls.put( control.getOid(), control );
         currentControl = control;
@@ -144,13 +147,11 @@ public abstract class InternalAbstractMe
     /**
      * Deletes a control removing it from this Message.
      * 
-     * @param control
-     *            the control to remove.
-     * @throws MessageException
-     *             if controls cannot be added to this Message or the control is
+     * @param control the control to remove.
+     * @throws MessageException if controls cannot be added to this Message or the control is
      *             not known etc.
      */
-    public void remove( Control control ) throws MessageException
+    public void removeControl( Control control ) throws MessageException
     {
         controls.remove( control.getOid() );
     }
@@ -179,8 +180,7 @@ public abstract class InternalAbstractMe
      * without firing LockExceptions even when this Lockable is in the locked
      * state.
      * 
-     * @param key
-     *            the key used to access a message parameter.
+     * @param key the key used to access a message parameter.
      * @return the transient message parameter value.
      */
     public Object get( Object key )
@@ -194,10 +194,8 @@ public abstract class InternalAbstractMe
      * down so modifications can occur without firing LockExceptions even when
      * this Lockable is in the locked state.
      * 
-     * @param key
-     *            the parameter key
-     * @param value
-     *            the parameter value
+     * @param key the parameter key
+     * @param value the parameter value
      * @return the old value or null
      */
     public Object put( Object key, Object value )
@@ -212,8 +210,7 @@ public abstract class InternalAbstractMe
      * operations, nor do they factor in the Lockable properties of the Message.
      * Only the type, controls, and the messageId are evaluated for equality.
      * 
-     * @param obj
-     *            the object to compare this Message to for equality
+     * @param obj the object to compare this Message to for equality
      */
     public boolean equals( Object obj )
     {
@@ -276,7 +273,10 @@ public abstract class InternalAbstractMe
     }
 
 
-    public void addAll( Control[] controls ) throws MessageException
+    /**
+     * {@inheritDoc}
+     */
+    public void addAllControls( Control[] controls ) throws MessageException
     {
         for ( Control c : controls )
         {

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalBindRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalBindRequest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalBindRequest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalBindRequest.java Sun Aug 15 14:54:56 2010
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.message.internal;
 
+
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.SingleReplyRequest;
 import org.apache.directory.shared.ldap.name.DN;
@@ -80,8 +81,16 @@ public interface InternalBindRequest ext
      * Sets the simple credentials associated with a simple authentication
      * attempt ignored if this request uses SASL authentication mechanisms.
      * 
-     * @param credentials
-     *            the credentials if authentication is simple, null otherwise
+     * @param credentials the credentials if authentication is simple, null otherwise
+     */
+    void setCredentials( String credentials );
+
+
+    /**
+     * Sets the simple credentials associated with a simple authentication
+     * attempt ignored if this request uses SASL authentication mechanisms.
+     * 
+     * @param credentials the credentials if authentication is simple, null otherwise
      */
     void setCredentials( byte[] credentials );
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java Sun Aug 15 14:54:56 2010
@@ -55,6 +55,16 @@ public interface InternalMessage
 
 
     /**
+     * Gets the control associated with the given OID.
+     * 
+     * @param oid The Cntrol's OID we are looking for
+     * @return The Control object instance with ths OID.
+     * @see CodecControl
+     */
+    Control getControl( String oid );
+
+
+    /**
      * Get the current Control Object
      * 
      * @return The current Control Object
@@ -100,13 +110,11 @@ public interface InternalMessage
     /**
      * Adds a control to this Message.
      * 
-     * @param control
-     *            the control to add.
-     * @throws MessageException
-     *             if controls cannot be added to this Message or the control is
+     * @param control the control to add.
+     * @throws MessageException if controls cannot be added to this Message or the control is
      *             not known etc.
      */
-    void add( Control control ) throws MessageException;
+    void addControl( Control control ) throws MessageException;
 
 
     /**
@@ -115,19 +123,17 @@ public interface InternalMessage
      * @param controls the controls to add.
      * @throws MessageException if controls cannot be added to this Message or they are not known etc.
      */
-    void addAll( Control[] controls ) throws MessageException;
+    void addAllControls( Control[] controls ) throws MessageException;
 
 
     /**
      * Deletes a control removing it from this Message.
      * 
-     * @param control
-     *            the control to remove.
-     * @throws MessageException
-     *             if controls cannot be added to this Message or the control is
+     * @param control the control to remove.
+     * @throws MessageException if controls cannot be added to this Message or the control is
      *             not known etc.
      */
-    void remove( Control control ) throws MessageException;
+    void removeControl( Control control ) throws MessageException;
 
 
     /**
@@ -151,8 +157,7 @@ public interface InternalMessage
      * without firing LockExceptions even when this Lockable is in the locked
      * state.
      * 
-     * @param key
-     *            the key used to access a message parameter.
+     * @param key the key used to access a message parameter.
      * @return the transient message parameter value.
      */
     Object get( Object key );
@@ -163,11 +168,16 @@ public interface InternalMessage
      * down so modifications can occur without firing LockExceptions even when
      * this Lockable is in the locked state.
      * 
-     * @param key
-     *            the parameter key
-     * @param value
-     *            the parameter value
+     * @param key the parameter key
+     * @param value the parameter value
      * @return the old value or null
      */
     Object put( Object key, Object value );
+
+
+    /**
+     * Sets the Message ID for this request
+     * @param messageId The message Id
+     */
+    void setMessageId( int messageId );
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java Sun Aug 15 14:54:56 2010
@@ -119,25 +119,25 @@ public class LdapControlTest
         assertEquals( "1.3.6.1.5.5.1", control.getOid() );
         assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
         assertTrue( control.isCritical() );
-        internalAbandonRequest.add( control );
+        internalAbandonRequest.addControl( control );
 
         control = controls.get( "1.3.6.1.5.5.2" );
         assertEquals( "1.3.6.1.5.5.2", control.getOid() );
         assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
         assertFalse( control.isCritical() );
-        internalAbandonRequest.add( control );
+        internalAbandonRequest.addControl( control );
 
         control = controls.get( "1.3.6.1.5.5.3" );
         assertEquals( "1.3.6.1.5.5.3", control.getOid() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
         assertTrue( control.isCritical() );
-        internalAbandonRequest.add( control );
+        internalAbandonRequest.addControl( control );
 
         control = controls.get( "1.3.6.1.5.5.4" );
         assertEquals( "1.3.6.1.5.5.4", control.getOid() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
         assertFalse( control.isCritical() );
-        internalAbandonRequest.add( control );
+        internalAbandonRequest.addControl( control );
 
         // Check the encoding
         try

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java Sun Aug 15 14:54:56 2010
@@ -125,25 +125,25 @@ public class AbandonRequestTest
         assertEquals( "1.3.6.1.5.5.1", control.getOid() );
         assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
         assertTrue( control.isCritical() );
-        internalAbandonRequest.add( control );
+        internalAbandonRequest.addControl( control );
 
         control = controls.get( "1.3.6.1.5.5.2" );
         assertEquals( "1.3.6.1.5.5.2", control.getOid() );
         assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
         assertFalse( control.isCritical() );
-        internalAbandonRequest.add( control );
+        internalAbandonRequest.addControl( control );
 
         control = controls.get( "1.3.6.1.5.5.3" );
         assertEquals( "1.3.6.1.5.5.3", control.getOid() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
         assertTrue( control.isCritical() );
-        internalAbandonRequest.add( control );
+        internalAbandonRequest.addControl( control );
 
         control = controls.get( "1.3.6.1.5.5.4" );
         assertEquals( "1.3.6.1.5.5.4", control.getOid() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
         assertFalse( control.isCritical() );
-        internalAbandonRequest.add( control );
+        internalAbandonRequest.addControl( control );
 
         // Check the encoding
         try

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java Sun Aug 15 14:54:56 2010
@@ -35,10 +35,13 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.EncoderException;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
+import org.apache.directory.shared.ldap.message.BindRequestImpl;
+import org.apache.directory.shared.ldap.message.LdapProtocolEncoder;
 import org.apache.directory.shared.ldap.message.control.Control;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -50,11 +53,16 @@ import org.junit.runner.RunWith;
 @Concurrent()
 public class BindRequestPerfTest
 {
+    /** The encoder instance */
+    LdapProtocolEncoder encoder = new LdapProtocolEncoder();
+
+
     /**
      * Test the decoding of a BindRequest with Simple authentication and no
      * controls
      */
     @Test
+    @Ignore
     public void testDecodeBindRequestSimpleNoControlsPerf()
     {
         Asn1Decoder ldapDecoder = new Asn1Decoder();
@@ -95,8 +103,8 @@ public class BindRequestPerfTest
         // Decode the BindRequest PDU
         try
         {
-            int nbLoops = 1;
-            //long t0 = System.currentTimeMillis();
+            int nbLoops = 1000000;
+            long t0 = System.currentTimeMillis();
 
             for ( int i = 0; i < nbLoops; i++ )
             {
@@ -105,8 +113,9 @@ public class BindRequestPerfTest
                 stream.flip();
             }
 
-            //long t1 = System.currentTimeMillis();
-            //System.out.println( "testDecodeBindRequestSimpleNoControlsPerf, " + nbLoops + " loops, Delta = " + ( t1 - t0 ) );
+            long t1 = System.currentTimeMillis();
+            System.out.println( "testDecodeBindRequestSimpleNoControlsPerf, " + nbLoops + " loops, Delta = "
+                + ( t1 - t0 ) );
 
             ldapDecoder.decode( stream, ldapMessageContainer );
         }
@@ -134,23 +143,13 @@ public class BindRequestPerfTest
         assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-        bindRequestCodec.addControl( control );
-
-        SimpleAuthentication simple = new SimpleAuthentication();
-        simple.setSimple( bindRequest.getCredentials() );
-        bindRequestCodec.setAuthentication( simple );
-
-        assertEquals( 0x52, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x52, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -169,32 +168,29 @@ public class BindRequestPerfTest
      * controls
      */
     @Test
+    @Ignore
     public void testEncodeBindRequestPerf() throws Exception
     {
         DN name = new DN( "uid=akarasulu,dc=example,dc=com" );
-        int nbLoops = 1;
+        int nbLoops = 1000000;
         long t0 = System.currentTimeMillis();
 
         for ( int i = 0; i < nbLoops; i++ )
         {
             // Check the decoded BindRequest
-            BindRequestCodec bindRequest = new BindRequestCodec();
-            bindRequest.setMessageId( 1 );
+            InternalBindRequest bindRequest = new BindRequestImpl( 1 );
 
+            bindRequest.setSimple( true );
             bindRequest.setName( name );
-
+            bindRequest.setCredentials( StringTools.getBytesUtf8( "password" ) );
             Control control = new ControlImpl( "2.16.840.1.113730.3.4.2" );
 
-            LdapAuthentication authentication = new SimpleAuthentication();
-            ( ( SimpleAuthentication ) authentication ).setSimple( StringTools.getBytesUtf8( "password" ) );
-
             bindRequest.addControl( control );
-            bindRequest.setAuthentication( authentication );
 
             // Check the encoding
             try
             {
-                bindRequest.encode();
+                ByteBuffer bb = encoder.encodeMessage( bindRequest );
             }
             catch ( EncoderException ee )
             {
@@ -204,6 +200,6 @@ public class BindRequestPerfTest
         }
 
         long t1 = System.currentTimeMillis();
-        //System.out.println( "BindRequest testEncodeBindRequestPerf, " + nbLoops + " loops, Delta = " + (t1 - t0));
+        System.out.println( "BindRequest testEncodeBindRequestPerf, " + nbLoops + " loops, Delta = " + ( t1 - t0 ) );
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java Sun Aug 15 14:54:56 2010
@@ -37,6 +37,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.message.BindResponseImpl;
+import org.apache.directory.shared.ldap.message.LdapProtocolEncoder;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.control.Control;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
@@ -53,6 +54,10 @@ import org.junit.runner.RunWith;
 @Concurrent()
 public class BindRequestTest
 {
+    /** The encoder instance */
+    LdapProtocolEncoder encoder = new LdapProtocolEncoder();
+
+
     /**
      * Test the decoding of a BindRequest with Simple authentication and no
      * controls
@@ -206,22 +211,13 @@ public class BindRequestTest
         assertTrue( bindRequest.isSimple() );
         assertEquals( "password", StringTools.utf8ToString( bindRequest.getCredentials() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-
-        SimpleAuthentication simple = new SimpleAuthentication();
-        simple.setSimple( bindRequest.getCredentials() );
-        bindRequestCodec.setAuthentication( simple );
-
-        assertEquals( 0x35, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x35, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -377,22 +373,13 @@ public class BindRequestTest
         assertTrue( bindRequest.isSimple() );
         assertEquals( "password", StringTools.utf8ToString( bindRequest.getCredentials() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-
-        SimpleAuthentication simple = new SimpleAuthentication();
-        simple.setSimple( bindRequest.getCredentials() );
-        bindRequestCodec.setAuthentication( simple );
-
-        assertEquals( 0x16, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x16, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -463,23 +450,13 @@ public class BindRequestTest
         assertFalse( bindRequest.isSimple() );
         assertEquals( "KERBEROS_V4", bindRequest.getSaslMechanism() );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-
-        SaslCredentials sasl = new SaslCredentials();
-        sasl.setCredentials( bindRequest.getCredentials() );
-        sasl.setMechanism( bindRequest.getSaslMechanism() );
-        bindRequestCodec.setAuthentication( sasl );
-
-        assertEquals( 0x3A, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x3A, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -556,23 +533,13 @@ public class BindRequestTest
         assertEquals( "KERBEROS_V4", bindRequest.getSaslMechanism() );
         assertEquals( "abcdef", StringTools.utf8ToString( bindRequest.getCredentials() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-
-        SaslCredentials sasl = new SaslCredentials();
-        sasl.setCredentials( bindRequest.getCredentials() );
-        sasl.setMechanism( bindRequest.getSaslMechanism() );
-        bindRequestCodec.setAuthentication( sasl );
-
-        assertEquals( 0x42, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x42, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -643,23 +610,13 @@ public class BindRequestTest
         assertEquals( "KERBEROS_V4", bindRequest.getSaslMechanism() );
         assertEquals( "abcdef", StringTools.utf8ToString( bindRequest.getCredentials() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-
-        SaslCredentials sasl = new SaslCredentials();
-        sasl.setCredentials( bindRequest.getCredentials() );
-        sasl.setMechanism( bindRequest.getSaslMechanism() );
-        bindRequestCodec.setAuthentication( sasl );
-
-        assertEquals( 0x23, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x23, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -966,22 +923,13 @@ public class BindRequestTest
         assertTrue( bindRequest.isSimple() );
         assertEquals( "", StringTools.utf8ToString( bindRequest.getCredentials() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-
-        SimpleAuthentication simple = new SimpleAuthentication();
-        simple.setSimple( bindRequest.getCredentials() );
-        bindRequestCodec.setAuthentication( simple );
-
-        assertEquals( 0x0E, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x0E, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -1077,23 +1025,13 @@ public class BindRequestTest
         assertFalse( bindRequest.isSimple() );
         assertEquals( "", bindRequest.getSaslMechanism() );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-
-        SaslCredentials sasl = new SaslCredentials();
-        sasl.setCredentials( bindRequest.getCredentials() );
-        sasl.setMechanism( bindRequest.getSaslMechanism() );
-        bindRequestCodec.setAuthentication( sasl );
-
-        assertEquals( 0x10, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x10, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -1194,23 +1132,13 @@ public class BindRequestTest
         assertEquals( "", bindRequest.getSaslMechanism() );
         assertEquals( "", StringTools.utf8ToString( bindRequest.getCredentials() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-
-        SaslCredentials sasl = new SaslCredentials();
-        sasl.setCredentials( bindRequest.getCredentials() );
-        sasl.setMechanism( bindRequest.getSaslMechanism() );
-        bindRequestCodec.setAuthentication( sasl );
-
-        assertEquals( 0x12, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x12, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -1284,24 +1212,13 @@ public class BindRequestTest
         assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-        bindRequestCodec.addControl( control );
-
-        SaslCredentials sasl = new SaslCredentials();
-        sasl.setCredentials( bindRequest.getCredentials() );
-        sasl.setMechanism( bindRequest.getSaslMechanism() );
-        bindRequestCodec.setAuthentication( sasl );
-
-        assertEquals( 0x2F, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x2F, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -1374,24 +1291,13 @@ public class BindRequestTest
         assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
-        // Check the length
-        BindRequestCodec bindRequestCodec = new BindRequestCodec();
-        bindRequestCodec.setMessageId( bindRequest.getMessageId() );
-        bindRequestCodec.setName( bindRequest.getName() );
-        bindRequestCodec.setVersion( bindRequest.getVersion3() ? 3 : 2 );
-        bindRequestCodec.addControl( control );
-
-        SaslCredentials sasl = new SaslCredentials();
-        sasl.setCredentials( bindRequest.getCredentials() );
-        sasl.setMechanism( bindRequest.getSaslMechanism() );
-        bindRequestCodec.setAuthentication( sasl );
-
-        assertEquals( 0x2D, bindRequestCodec.computeLength() );
-
         // Check the encoding
         try
         {
-            ByteBuffer bb = bindRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( bindRequest );
+
+            // Check the length
+            assertEquals( 0x2D, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java Sun Aug 15 14:54:56 2010
@@ -33,10 +33,11 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.EncoderException;
-import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
+import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
+import org.apache.directory.shared.ldap.message.LdapProtocolEncoder;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.control.Control;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
@@ -55,6 +56,10 @@ import org.junit.runner.RunWith;
 @Concurrent()
 public class DelRequestTest
 {
+    /** The encoder instance */
+    LdapProtocolEncoder encoder = new LdapProtocolEncoder();
+
+
     /**
      * Test the decoding of a full DelRequest
      */
@@ -100,16 +105,16 @@ public class DelRequestTest
         assertEquals( "cn=testModify,ou=users,ou=system", delRequest.getName().toString() );
 
         // Check the length
-        DelRequestCodec delRequestCodec = new DelRequestCodec();
-        delRequestCodec.setEntry( delRequest.getName() );
-        delRequestCodec.setMessageId( delRequest.getMessageId() );
-
-        assertEquals( 0x27, delRequestCodec.computeLength() );
+        InternalDeleteRequest internalDeleteRequest = new DeleteRequestImpl( delRequest.getMessageId() );
+        internalDeleteRequest.setName( delRequest.getName() );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb = delRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( internalDeleteRequest );
+
+            // Check the length
+            assertEquals( 0x27, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
@@ -261,18 +266,17 @@ public class DelRequestTest
         assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
         assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
-        // Check the length
-        DelRequestCodec delRequestCodec = new DelRequestCodec();
-        delRequestCodec.setEntry( delRequest.getName() );
-        delRequestCodec.setMessageId( delRequest.getMessageId() );
-        ( ( LdapMessageCodec ) delRequestCodec ).addControl( control );
-
-        assertEquals( 0x44, delRequestCodec.computeLength() );
+        InternalDeleteRequest internalDeleteRequest = new DeleteRequestImpl( delRequest.getMessageId() );
+        internalDeleteRequest.setName( delRequest.getName() );
+        internalDeleteRequest.addControl( control );
 
         // Check the encoding
         try
         {
-            ByteBuffer bb = delRequestCodec.encode();
+            ByteBuffer bb = encoder.encodeMessage( internalDeleteRequest );
+
+            // Check the length
+            assertEquals( 0x44, bb.limit() );
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java Sun Aug 15 14:54:56 2010
@@ -165,7 +165,7 @@ public class UnBindRequestTest
 
         // Check the encoding
         InternalUnbindRequest internalUnbindRequest = new UnbindRequestImpl( unbindRequest.getMessageId() );
-        internalUnbindRequest.add( control );
+        internalUnbindRequest.addControl( control );
 
         try
         {

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java Sun Aug 15 14:54:56 2010
@@ -128,13 +128,13 @@ public class AbstractMessageTest
     {
         InternalAbstractMessage msg0;
         InternalAbstractMessage msg1;
-        
+
         msg0 = new InternalAbstractMessage( 5, MessageTypeEnum.BIND_REQUEST )
         {
             private static final long serialVersionUID = 1L;
         };
-        
-        msg0.add( new ControlImpl( "0.0" )
+
+        msg0.addControl( new ControlImpl( "0.0" )
         {
             private static final long serialVersionUID = 1L;
 
@@ -161,7 +161,7 @@ public class AbstractMessageTest
                 return null;
             }
         } );
-        
+
         msg1 = new InternalAbstractMessage( 5, MessageTypeEnum.BIND_REQUEST )
         {
             private static final long serialVersionUID = 1L;

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java Sun Aug 15 14:54:56 2010
@@ -29,8 +29,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
 import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
-import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.InternalReferral;
+import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -188,13 +188,13 @@ public class AbstractResultResponseTest
     {
         InternalAbstractResultResponse msg0;
         InternalAbstractResultResponse msg1;
-        
+
         msg0 = new InternalAbstractResultResponse( 5, MessageTypeEnum.BIND_REQUEST )
         {
             private static final long serialVersionUID = 1L;
         };
-        
-        msg0.add( new ControlImpl( "0.0" )
+
+        msg0.addControl( new ControlImpl( "0.0" )
         {
             private static final long serialVersionUID = 1L;
 
@@ -221,7 +221,7 @@ public class AbstractResultResponseTest
                 return null;
             }
         } );
-        
+
         msg1 = new InternalAbstractResultResponse( 5, MessageTypeEnum.BIND_REQUEST )
         {
             private static final long serialVersionUID = 1L;

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java Sun Aug 15 14:54:56 2010
@@ -246,12 +246,12 @@ public class AddRequestImplTest
             }
 
 
-            public void add( Control control ) throws MessageException
+            public void addControl( Control control ) throws MessageException
             {
             }
 
 
-            public void remove( Control control ) throws MessageException
+            public void removeControl( Control control ) throws MessageException
             {
             }
 
@@ -296,7 +296,7 @@ public class AddRequestImplTest
             }
 
 
-            public void addAll( Control[] controls ) throws MessageException
+            public void addAllControls( Control[] controls ) throws MessageException
             {
             }
 
@@ -359,6 +359,17 @@ public class AddRequestImplTest
             public void setMessageLength( int messageLength )
             {
             }
+
+
+            public Control getControl( String oid )
+            {
+                return null;
+            }
+
+
+            public void setMessageId( int messageId )
+            {
+            }
         };
 
         AddRequestImpl req1 = new AddRequestImpl( 5 );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java Sun Aug 15 14:54:56 2010
@@ -225,7 +225,12 @@ public class BindRequestImplTest
             }
 
 
-            public void setCredentials( byte[] a_credentials )
+            public void setCredentials( String credentials )
+            {
+            }
+
+
+            public void setCredentials( byte[] credentials )
             {
             }
 
@@ -282,12 +287,12 @@ public class BindRequestImplTest
             }
 
 
-            public void add( Control control ) throws MessageException
+            public void addControl( Control control ) throws MessageException
             {
             }
 
 
-            public void remove( Control control ) throws MessageException
+            public void removeControl( Control control ) throws MessageException
             {
             }
 
@@ -327,7 +332,7 @@ public class BindRequestImplTest
             }
 
 
-            public void addAll( Control[] controls ) throws MessageException
+            public void addAllControls( Control[] controls ) throws MessageException
             {
             }
 
@@ -380,6 +385,17 @@ public class BindRequestImplTest
             public void setMessageLength( int messageLength )
             {
             }
+
+
+            public Control getControl( String oid )
+            {
+                return null;
+            }
+
+
+            public void setMessageId( int messageId )
+            {
+            }
         };
 
         BindRequestImpl req1 = new BindRequestImpl( 5 );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java Sun Aug 15 14:54:56 2010
@@ -247,12 +247,12 @@ public class CompareRequestImplTest
             }
 
 
-            public void add( Control a_control ) throws MessageException
+            public void addControl( Control a_control ) throws MessageException
             {
             }
 
 
-            public void remove( Control a_control ) throws MessageException
+            public void removeControl( Control a_control ) throws MessageException
             {
             }
 
@@ -297,7 +297,7 @@ public class CompareRequestImplTest
             }
 
 
-            public void addAll( Control[] controls ) throws MessageException
+            public void addAllControls( Control[] controls ) throws MessageException
             {
             }
 
@@ -334,6 +334,17 @@ public class CompareRequestImplTest
             public void setMessageLength( int messageLength )
             {
             }
+
+
+            public Control getControl( String oid )
+            {
+                return null;
+            }
+
+
+            public void setMessageId( int messageId )
+            {
+            }
         };
 
         CompareRequestImpl req1 = new CompareRequestImpl( 5 );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java Sun Aug 15 14:54:56 2010
@@ -180,12 +180,12 @@ public class DeleteRequestImplTest
             }
 
 
-            public void add( Control control ) throws MessageException
+            public void addControl( Control control ) throws MessageException
             {
             }
 
 
-            public void remove( Control control ) throws MessageException
+            public void removeControl( Control control ) throws MessageException
             {
             }
 
@@ -230,7 +230,7 @@ public class DeleteRequestImplTest
             }
 
 
-            public void addAll( Control[] controls ) throws MessageException
+            public void addAllControls( Control[] controls ) throws MessageException
             {
             }
 
@@ -267,6 +267,17 @@ public class DeleteRequestImplTest
             public void setMessageLength( int messageLength )
             {
             }
+
+
+            public Control getControl( String oid )
+            {
+                return null;
+            }
+
+
+            public void setMessageId( int messageId )
+            {
+            }
         };
 
         DeleteRequestImpl req1 = new DeleteRequestImpl( 5 );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java Sun Aug 15 14:54:56 2010
@@ -174,12 +174,6 @@ public class ExtendedRequestImplTest
             private static final long serialVersionUID = 1L;
 
 
-            public String getOid()
-            {
-                return null;
-            }
-
-
             public void setID( String oid )
             {
             }
@@ -220,12 +214,12 @@ public class ExtendedRequestImplTest
             }
 
 
-            public void add( Control control ) throws MessageException
+            public void addControl( Control control ) throws MessageException
             {
             }
 
 
-            public void remove( Control control ) throws MessageException
+            public void removeControl( Control control ) throws MessageException
             {
             }
 
@@ -267,7 +261,7 @@ public class ExtendedRequestImplTest
             }
 
 
-            public void addAll( Control[] controls ) throws MessageException
+            public void addAllControls( Control[] controls ) throws MessageException
             {
             }
 
@@ -304,6 +298,17 @@ public class ExtendedRequestImplTest
             public void setMessageLength( int messageLength )
             {
             }
+
+
+            public Control getControl( String oid )
+            {
+                return null;
+            }
+
+
+            public void setMessageId( int messageId )
+            {
+            }
         };
 
         ExtendedRequestImpl req1 = new ExtendedRequestImpl( 5 );



Mime
View raw message