directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r905297 [5/7] - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/event/ apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/ apacheds/trunk/core-api/src/main/java/o...
Date Mon, 01 Feb 2010 15:04:20 GMT
Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlContainer.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlContainer.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlContainer.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlContainer.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlContainer.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlContainer.java Mon Feb  1 15:04:10 2010
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.pSearch;
+package org.apache.directory.shared.ldap.codec.search.controls.persistentSearch;
 
 
 import org.apache.directory.shared.asn1.ber.AbstractContainer;
@@ -27,29 +27,29 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class PSearchControlContainer extends AbstractContainer
+public class PersistentSearchControlContainer extends AbstractContainer
 {
     /** PSearchControl */
-    private PSearchControlCodec control;
+    private PersistentSearchControlCodec control;
 
 
     /**
      * Creates a new PSearchControlContainer object. We will store one grammar,
      * it's enough ...
      */
-    public PSearchControlContainer()
+    public PersistentSearchControlContainer()
     {
         super();
         stateStack = new int[1];
-        grammar = PSearchControlGrammar.getInstance();
-        states = PSearchControlStatesEnum.getInstance();
+        grammar = PersistentSearchControlGrammar.getInstance();
+        states = PersistentSearchControlStatesEnum.getInstance();
     }
 
 
     /**
      * @return Returns the persistent search control.
      */
-    public PSearchControlCodec getPSearchControl()
+    public PersistentSearchControlCodec getPSearchControl()
     {
 
         return control;
@@ -62,7 +62,7 @@
      * 
      * @param control the PSearchControl to set.
      */
-    public void setPSearchControl( PSearchControlCodec control )
+    public void setPSearchControl( PersistentSearchControlCodec control )
     {
         this.control = control;
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlDecoder.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlDecoder.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlDecoder.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlDecoder.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlDecoder.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlDecoder.java Mon Feb  1 15:04:10 2010
@@ -17,15 +17,18 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.pSearch;
+package org.apache.directory.shared.ldap.codec.search.controls.persistentSearch;
 
 
 import java.nio.ByteBuffer;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.ldap.codec.ControlDecoder;
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
+import org.apache.directory.shared.ldap.codec.controls.ControlDecoder;
 
 
 /**
@@ -34,25 +37,12 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class PSearchControlDecoder extends Asn1Decoder implements ControlDecoder
+public class PersistentSearchControlDecoder extends Asn1Decoder implements ControlDecoder
 {
-    /** The persistence search OID */
-    private final static String CONTROL_TYPE_OID = "2.16.840.1.113730.3.4.3";
-
     /** An instance of this decoder */
     private static final Asn1Decoder decoder = new Asn1Decoder();
 
     /**
-     * Return the persistence search OID
-     * 
-     * @see org.apache.directory.shared.ldap.codec.ControlDecoder#getControlType()
-     */
-    public String getControlType()
-    {
-        return CONTROL_TYPE_OID;
-    }
-
-    /**
      * Decode the persistence search control
      * 
      * @param controlBytes The bytes array which contains the encoded persistence search
@@ -62,10 +52,12 @@
      * @throws DecoderException If the decoding found an error
      * @throws NamingException It will never be throw by this method
      */
-    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    public Asn1Object decode( byte[] controlBytes, CodecControl control ) throws DecoderException
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
-        PSearchControlContainer container = new PSearchControlContainer();
+        PersistentSearchControlContainer container = new PersistentSearchControlContainer();
+        container.setPSearchControl( (PersistentSearchControlCodec)control );
+
         decoder.decode( bb, container );
         return container.getPSearchControl();
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlGrammar.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlGrammar.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlGrammar.java Mon Feb  1 15:04:10 2010
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.pSearch;
+package org.apache.directory.shared.ldap.codec.search.controls.persistentSearch;
 
 
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
@@ -58,28 +58,28 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class PSearchControlGrammar extends AbstractGrammar
+public class PersistentSearchControlGrammar extends AbstractGrammar
 {
     /** The logger */
-    static final Logger log = LoggerFactory.getLogger( PSearchControlGrammar.class );
+    static final Logger log = LoggerFactory.getLogger( PersistentSearchControlGrammar.class );
 
     /** Speedup for logs */
     static final boolean IS_DEBUG = log.isDebugEnabled();
 
     /** The instance of grammar. PSearchControlGrammar is a singleton */
-    private static IGrammar instance = new PSearchControlGrammar();
+    private static IGrammar instance = new PersistentSearchControlGrammar();
 
 
     /**
      * Creates a new PSearchControlGrammar object.
      */
-    private PSearchControlGrammar()
+    private PersistentSearchControlGrammar()
     {
-        name = PSearchControlGrammar.class.getName();
-        statesEnum = PSearchControlStatesEnum.getInstance();
+        name = PersistentSearchControlGrammar.class.getName();
+        statesEnum = PersistentSearchControlStatesEnum.getInstance();
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[PSearchControlStatesEnum.LAST_PSEARCH_STATE][256];
+        super.transitions = new GrammarTransition[PersistentSearchControlStatesEnum.LAST_PSEARCH_STATE][256];
 
         /** 
          * Transition from initial state to Psearch sequence
@@ -90,17 +90,8 @@
          */
         super.transitions[IStates.INIT_GRAMMAR_STATE][UniversalTag.SEQUENCE_TAG] = 
             new GrammarTransition( IStates.INIT_GRAMMAR_STATE, 
-                                    PSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE, 
-                                    UniversalTag.SEQUENCE_TAG, 
-                new GrammarAction( "Init PSearchControl" )
-            {
-                public void action( IAsn1Container container )
-                {
-                    PSearchControlContainer psearchContainer = ( PSearchControlContainer ) container;
-                    PSearchControlCodec control = new PSearchControlCodec();
-                    psearchContainer.setPSearchControl( control );
-                }
-            } );
+                                    PersistentSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE, 
+                                    UniversalTag.SEQUENCE_TAG, null );
 
 
         /** 
@@ -111,23 +102,23 @@
          *     
          * Stores the change types value
          */
-        super.transitions[PSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE][UniversalTag.INTEGER_TAG] = 
-            new GrammarTransition( PSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE, 
-                PSearchControlStatesEnum.CHANGE_TYPES_STATE, 
+        super.transitions[PersistentSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE][UniversalTag.INTEGER_TAG] = 
+            new GrammarTransition( PersistentSearchControlStatesEnum.PSEARCH_SEQUENCE_STATE, 
+                PersistentSearchControlStatesEnum.CHANGE_TYPES_STATE, 
                 UniversalTag.INTEGER_TAG,
                 new GrammarAction( "Set PSearchControl changeTypes" )
             {
                 public void action( IAsn1Container container ) throws DecoderException
                 {
-                    PSearchControlContainer psearchContainer = ( PSearchControlContainer ) container;
+                    PersistentSearchControlContainer psearchContainer = ( PersistentSearchControlContainer ) container;
                     Value value = psearchContainer.getCurrentTLV().getValue();
 
                     try
                     {
                         // Check that the value is into the allowed interval
                         int changeTypes = IntegerDecoder.parse( value, 
-                            PSearchControlCodec.CHANGE_TYPES_MIN, 
-                            PSearchControlCodec.CHANGE_TYPES_MAX );
+                            PersistentSearchControlCodec.CHANGE_TYPES_MIN, 
+                            PersistentSearchControlCodec.CHANGE_TYPES_MAX );
                         
                         if ( IS_DEBUG )
                         {
@@ -154,14 +145,14 @@
          *     
          * Stores the change only flag
          */
-        super.transitions[PSearchControlStatesEnum.CHANGE_TYPES_STATE][UniversalTag.BOOLEAN_TAG] = 
-            new GrammarTransition( PSearchControlStatesEnum.CHANGE_TYPES_STATE,
-                                    PSearchControlStatesEnum.CHANGES_ONLY_STATE, UniversalTag.BOOLEAN_TAG,
+        super.transitions[PersistentSearchControlStatesEnum.CHANGE_TYPES_STATE][UniversalTag.BOOLEAN_TAG] = 
+            new GrammarTransition( PersistentSearchControlStatesEnum.CHANGE_TYPES_STATE,
+                                    PersistentSearchControlStatesEnum.CHANGES_ONLY_STATE, UniversalTag.BOOLEAN_TAG,
                 new GrammarAction( "Set PSearchControl changesOnly" )
             {
                 public void action( IAsn1Container container ) throws DecoderException
                 {
-                    PSearchControlContainer psearchContainer = ( PSearchControlContainer ) container;
+                    PersistentSearchControlContainer psearchContainer = ( PersistentSearchControlContainer ) container;
                     Value value = psearchContainer.getCurrentTLV().getValue();
 
                     try
@@ -193,14 +184,14 @@
          *     
          * Stores the return ECs flag 
          */
-        super.transitions[PSearchControlStatesEnum.CHANGES_ONLY_STATE][UniversalTag.BOOLEAN_TAG] = 
-            new GrammarTransition( PSearchControlStatesEnum.CHANGES_ONLY_STATE, 
-                                    PSearchControlStatesEnum.RETURN_ECS_STATE, UniversalTag.BOOLEAN_TAG,
+        super.transitions[PersistentSearchControlStatesEnum.CHANGES_ONLY_STATE][UniversalTag.BOOLEAN_TAG] = 
+            new GrammarTransition( PersistentSearchControlStatesEnum.CHANGES_ONLY_STATE, 
+                                    PersistentSearchControlStatesEnum.RETURN_ECS_STATE, UniversalTag.BOOLEAN_TAG,
                 new GrammarAction( "Set PSearchControl returnECs" )
             {
                 public void action( IAsn1Container container ) throws DecoderException
                 {
-                    PSearchControlContainer psearchContainer = ( PSearchControlContainer ) container;
+                    PersistentSearchControlContainer psearchContainer = ( PersistentSearchControlContainer ) container;
                     Value value = psearchContainer.getCurrentTLV().getValue();
 
                     try

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlStatesEnum.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlStatesEnum.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pSearch/PSearchControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchControlStatesEnum.java Mon Feb  1 15:04:10 2010
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.pSearch;
+package org.apache.directory.shared.ldap.codec.search.controls.persistentSearch;
 
 
 import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
@@ -31,7 +31,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class PSearchControlStatesEnum implements IStates
+public class PersistentSearchControlStatesEnum implements IStates
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
@@ -71,7 +71,7 @@
         };
 
     /** The instance */
-    private static PSearchControlStatesEnum instance = new PSearchControlStatesEnum();
+    private static PersistentSearchControlStatesEnum instance = new PersistentSearchControlStatesEnum();
 
 
     // ~ Constructors
@@ -80,7 +80,7 @@
     /**
      * This is a private constructor. This class is a singleton
      */
-    private PSearchControlStatesEnum()
+    private PersistentSearchControlStatesEnum()
     {
     }
 
@@ -119,7 +119,7 @@
      */
     public String getGrammarName( IGrammar grammar )
     {
-        if ( grammar instanceof PSearchControlGrammar )
+        if ( grammar instanceof PersistentSearchControlGrammar )
         {
             return "PSEARCH_GRAMMAR";
         }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlCodec.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlCodec.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlCodec.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlCodec.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlCodec.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlCodec.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlCodec.java Mon Feb  1 15:04:10 2010
@@ -17,33 +17,40 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.subEntry;
+package org.apache.directory.shared.ldap.codec.search.controls.subentries;
 
 
 import java.nio.ByteBuffer;
 
-import org.apache.directory.shared.asn1.AbstractAsn1Object;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
+import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.ldap.codec.controls.AbstractControlCodec;
 
 
 /**
- * A searchRequest control : SubEntry
+ * A searchRequest control : Subentries
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class SubEntryControlCodec extends AbstractAsn1Object
+public class SubentriesControlCodec extends AbstractControlCodec
 {
+    /** Ths control OID */
+    public static final String CONTROL_OID = "1.3.6.1.4.1.4203.1.10.1";
+
     private boolean visibility = false;
 
     /**
      * Default constructor
      *
      */
-    public SubEntryControlCodec()
+    public SubentriesControlCodec()
     {
-        super();
+        super( CONTROL_OID );
+        
+        decoder = new SubentriesControlDecoder();
     }
 
     /**
@@ -73,12 +80,16 @@
      */
     public int computeLength()
     {
-        return 1 + 1 + 1;
+        int subentriesLength =  1 + 1 + 1;
+        int valueLength = subentriesLength;
+
+        // Call the super class to compute the global control length
+        return super.computeLength( valueLength );
     }
 
 
     /**
-     * Encodes the subEntry control.
+     * Encodes the Subentries control.
      * 
      * @param buffer The encoded sink
      * @return A ByteBuffer that contains the encoded PDU
@@ -86,11 +97,49 @@
      */
     public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
     {
-        // Allocate the bytes buffer.
-        ByteBuffer bb = ByteBuffer.allocate( computeLength() );
-        Value.encode( bb, visibility );
-
-        return bb;
+        if ( buffer == null )
+        {
+            throw new EncoderException( "Cannot put a PDU in a null buffer !" );
+        }
+
+        // Encode the Control envelop
+        super.encode( buffer );
+        
+        // Encode the OCTET_STRING tag
+        buffer.put( UniversalTag.OCTET_STRING_TAG );
+        buffer.put( TLV.getBytes( valueLength ) );
+
+        // Now encode the Subentries specific part
+        Value.encode( buffer, visibility );
+
+        return buffer;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getValue()
+    {
+        if ( value == null )
+        {
+            try
+            { 
+                computeLength();
+                ByteBuffer buffer = ByteBuffer.allocate( valueLength );
+                
+                // Now encode the Subentries specific part
+                Value.encode( buffer, visibility );
+                
+                value = buffer.array();
+            }
+            catch ( Exception e )
+            {
+                return null;
+            }
+        }
+        
+        return value;
     }
 
 
@@ -101,7 +150,9 @@
     {
         StringBuffer sb = new StringBuffer();
 
-        sb.append( "    SubEntry Control\n" );
+        sb.append( "    Subentries Control\n" );
+        sb.append( "        oid : " ).append( getOid() ).append( '\n' );
+        sb.append( "        critical : " ).append( isCritical() ).append( '\n' );
         sb.append( "        Visibility   : '" ).append( visibility ).append( "'\n" );
 
         return sb.toString();

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlContainer.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlContainer.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlContainer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlContainer.java Mon Feb  1 15:04:10 2010
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.subEntry;
+package org.apache.directory.shared.ldap.codec.search.controls.subentries;
 
 
 import org.apache.directory.shared.asn1.ber.AbstractContainer;
@@ -27,28 +27,28 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class SubEntryControlContainer extends AbstractContainer
+public class SubentriesControlContainer extends AbstractContainer
 {
     /** PSearchControl */
-    private SubEntryControlCodec control;
+    private SubentriesControlCodec control;
 
 
     /**
      * Creates a new SubEntryControlContainer object. 
      */
-    public SubEntryControlContainer()
+    public SubentriesControlContainer()
     {
         super();
         stateStack = new int[1];
-        grammar = SubEntryControlGrammar.getInstance();
-        states = SubEntryControlStatesEnum.getInstance();
+        grammar = SubentriesControlGrammar.getInstance();
+        states = SubentriesControlStatesEnum.getInstance();
     }
 
 
     /**
      * @return Returns the persistent search control.
      */
-    public SubEntryControlCodec getSubEntryControl()
+    public SubentriesControlCodec getSubEntryControl()
     {
         return control;
     }
@@ -60,7 +60,7 @@
      * 
      * @param control the SubEntryControl to set.
      */
-    public void setSubEntryControl( SubEntryControlCodec control )
+    public void setSubEntryControl( SubentriesControlCodec control )
     {
         this.control = control;
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlDecoder.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlDecoder.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlDecoder.java Mon Feb  1 15:04:10 2010
@@ -17,15 +17,18 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.subEntry;
+package org.apache.directory.shared.ldap.codec.search.controls.subentries;
 
 
 import java.nio.ByteBuffer;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.ldap.codec.ControlDecoder;
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
+import org.apache.directory.shared.ldap.codec.controls.ControlDecoder;
 
 
 /**
@@ -34,23 +37,12 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class SubEntryControlDecoder extends Asn1Decoder implements ControlDecoder
+public class SubentriesControlDecoder extends Asn1Decoder implements ControlDecoder
 {
-    /** The sub entry OID */
-    private final static String CONTROL_TYPE_OID = "1.3.6.1.4.1.4203.1.10.1";
-
     /** The sub entry decoder */
     private static final Asn1Decoder decoder = new Asn1Decoder();
 
     /**
-     * @return the sub entry OID
-     */
-    public String getControlType()
-    {
-        return CONTROL_TYPE_OID;
-    }
-
-    /**
      * Decode the sub entry control
      * 
      * @param controlBytes The bytes array which contains the encoded sub entry
@@ -60,10 +52,12 @@
      * @throws DecoderException If the decoding found an error
      * @throws NamingException It will never be throw by this method
      */
-    public Asn1Object decode( byte[] controlBytes ) throws DecoderException
+    public Asn1Object decode( byte[] controlBytes, CodecControl control ) throws DecoderException
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
-        SubEntryControlContainer container = new SubEntryControlContainer();
+        SubentriesControlContainer container = new SubentriesControlContainer();
+        container.setSubEntryControl( (SubentriesControlCodec)control );
+
         decoder.decode( bb, container );
         return container.getSubEntryControl();
     }

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlGrammar.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlGrammar.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlGrammar.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlGrammar.java Mon Feb  1 15:04:10 2010
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.subEntry;
+package org.apache.directory.shared.ldap.codec.search.controls.subentries;
 
 
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
@@ -43,36 +43,35 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class SubEntryControlGrammar extends AbstractGrammar
+public class SubentriesControlGrammar extends AbstractGrammar
 {
     /** The logger */
-    static final Logger log = LoggerFactory.getLogger( SubEntryControlGrammar.class );
+    static final Logger log = LoggerFactory.getLogger( SubentriesControlGrammar.class );
 
     /** The instance of grammar. SubEntryControlGrammar is a singleton */
-    private static IGrammar instance = new SubEntryControlGrammar();
+    private static IGrammar instance = new SubentriesControlGrammar();
 
 
     /**
      * Creates a new SubEntryGrammar object.
      */
-    private SubEntryControlGrammar()
+    private SubentriesControlGrammar()
     {
-        name = SubEntryControlGrammar.class.getName();
-        statesEnum = SubEntryControlStatesEnum.getInstance();
+        name = SubentriesControlGrammar.class.getName();
+        statesEnum = SubentriesControlStatesEnum.getInstance();
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SubEntryControlStatesEnum.LAST_SUB_ENTRY_STATE][256];
+        super.transitions = new GrammarTransition[SubentriesControlStatesEnum.LAST_SUB_ENTRY_STATE][256];
 
-        super.transitions[SubEntryControlStatesEnum.START_STATE][UniversalTag.BOOLEAN_TAG] = 
-            new GrammarTransition( SubEntryControlStatesEnum.START_STATE, 
-                                    SubEntryControlStatesEnum.SUB_ENTRY_VISIBILITY_STATE, UniversalTag.BOOLEAN_TAG, 
+        super.transitions[SubentriesControlStatesEnum.START_STATE][UniversalTag.BOOLEAN_TAG] = 
+            new GrammarTransition( SubentriesControlStatesEnum.START_STATE, 
+                                    SubentriesControlStatesEnum.SUB_ENTRY_VISIBILITY_STATE, UniversalTag.BOOLEAN_TAG, 
                 new GrammarAction( "SubEntryControl visibility" )
             {
                 public void action( IAsn1Container container ) throws DecoderException
                 {
-                    SubEntryControlContainer subEntryContainer = ( SubEntryControlContainer ) container;
-                    SubEntryControlCodec control = new SubEntryControlCodec();
-                    subEntryContainer.setSubEntryControl( control );
+                    SubentriesControlContainer subEntryContainer = ( SubentriesControlContainer ) container;
+                    SubentriesControlCodec control = subEntryContainer.getSubEntryControl();
 
                     TLV tlv = subEntryContainer.getCurrentTLV();
 

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java (from r903704, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlStatesEnum.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlStatesEnum.java&r1=903704&r2=905297&rev=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subEntry/SubEntryControlStatesEnum.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesControlStatesEnum.java Mon Feb  1 15:04:10 2010
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.search.controls.subEntry;
+package org.apache.directory.shared.ldap.codec.search.controls.subentries;
 
 
 import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
@@ -31,7 +31,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$, 
  */
-public class SubEntryControlStatesEnum implements IStates
+public class SubentriesControlStatesEnum implements IStates
 {
     // ~ Static fields/initializers
     // -----------------------------------------------------------------
@@ -60,7 +60,7 @@
         };
 
     /** The instance */
-    private static SubEntryControlStatesEnum instance = new SubEntryControlStatesEnum();
+    private static SubentriesControlStatesEnum instance = new SubentriesControlStatesEnum();
 
 
     // ~ Constructors
@@ -69,7 +69,7 @@
     /**
      * This is a private constructor. This class is a singleton
      */
-    private SubEntryControlStatesEnum()
+    private SubentriesControlStatesEnum()
     {
     }
 
@@ -108,7 +108,7 @@
      */
     public String getGrammarName( IGrammar grammar )
     {
-        if ( grammar instanceof SubEntryControlGrammar )
+        if ( grammar instanceof SubentriesControlGrammar )
         {
             return "SUB_ENTRY_GRAMMAR";
         }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/InternalAbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/InternalAbstractMessage.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/InternalAbstractMessage.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/InternalAbstractMessage.java Mon Feb  1 15:04:10 2010
@@ -24,6 +24,7 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.message.control.Control;
 
 
@@ -86,7 +87,7 @@
      * Gets the controls associated with this message mapped by OID.
      * 
      * @return Map of OID strings to Control object instances.
-     * @see InternalControl
+     * @see CodecControl
      */
     public Map<String, Control> getControls()
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/InternalMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/InternalMessage.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/InternalMessage.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/InternalMessage.java Mon Feb  1 15:04:10 2010
@@ -22,6 +22,7 @@
 
 import java.util.Map;
 
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.message.control.Control;
 
 
@@ -47,7 +48,7 @@
      * Gets the controls associated with this message mapped by OID.
      * 
      * @return Map of OID strings to Control object instances.
-     * @see InternalControl
+     * @see CodecControl
      */
     Map<String, Control> getControls();
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/Control.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/Control.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/Control.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/control/Control.java Mon Feb  1 15:04:10 2010
@@ -36,14 +36,6 @@
     
     
     /**
-     * Sets the OID of the Control to identify the control type.
-     * 
-     * @param oid the OID of this Control.
-     */
-    void setOid( String oid );
-
-    
-    /**
      * Tells if the control is critical or not.
      *
      * @return <code>true/code> if the control is critical, <code>false</code> otherwise 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java Mon Feb  1 15:04:10 2010
@@ -32,6 +32,7 @@
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.EncoderException;
 import org.apache.directory.shared.ldap.codec.abandon.AbandonRequestCodec;
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
 
@@ -105,29 +106,29 @@
         assertEquals( 2, abandonRequest.getAbandonedMessageId() );
 
         // Check the Controls
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 4, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "1.3.6.1.5.5.1", control.getControlType() );
-        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
-        assertTrue( control.getCriticality() );
+        CodecControl control = message.getControls( 0 );
+        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() );
 
         control = message.getControls( 1 );
-        assertEquals( "1.3.6.1.5.5.2", control.getControlType() );
-        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
-        assertFalse( control.getCriticality() );
+        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() );
 
         control = message.getControls( 2 );
-        assertEquals( "1.3.6.1.5.5.3", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
-        assertTrue( control.getCriticality() );
+        assertEquals( "1.3.6.1.5.5.3", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
+        assertTrue( control.isCritical() );
 
         control = message.getControls( 3 );
-        assertEquals( "1.3.6.1.5.5.4", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
-        assertFalse( control.getCriticality() );
+        assertEquals( "1.3.6.1.5.5.4", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
+        assertFalse( control.isCritical() );
 
         // Check the length
         assertEquals( 0x64, message.computeLength() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java Mon Feb  1 15:04:10 2010
@@ -32,9 +32,9 @@
 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.ControlCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
 
@@ -69,10 +69,12 @@
                                         // criticality BOOLEAN DEFAULT FALSE,
                     0x01, 0x01, ( byte ) 0xFF, 
                                         // controlValue OCTET STRING OPTIONAL }
-                    0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f', 
-                    0x30, 0x17,         // Control ::= SEQUENCE {
+                    0x04, 0x06, 
+                      'a', 'b', 'c', 'd', 'e', 'f', 
+                  0x30, 0x17,         // Control ::= SEQUENCE {
                                         // controlType LDAPOID,
-                    0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '2',
+                    0x04, 0x0D, 
+                      '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '2',
                                         // controlValue OCTET STRING OPTIONAL }
                     0x04, 0x06, 'g', 'h', 'i', 'j', 'k', 'l', 
                   0x30, 0x12,           // Control ::= SEQUENCE {
@@ -83,7 +85,8 @@
                     0x01, 0x01, ( byte ) 0xFF, 
                   0x30, 0x0F,           // Control ::= SEQUENCE {
                                         // controlType LDAPOID}
-                    0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '4' 
+                    0x04, 0x0D, 
+                      '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '4' 
             } );
 
         String decodedPdu = StringTools.dumpBytes( stream.array() );
@@ -111,29 +114,29 @@
         assertEquals( 2, abandonRequest.getAbandonedMessageId() );
 
         // Check the Controls
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 4, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "1.3.6.1.5.5.1", control.getControlType() );
-        assertEquals( "0x61 0x62 0x63 0x64 0x65 0x66 ", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
-        assertTrue( control.getCriticality() );
+        CodecControl control = message.getControls( 0 );
+        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() );
 
         control = message.getControls( 1 );
-        assertEquals( "1.3.6.1.5.5.2", control.getControlType() );
-        assertEquals( "0x67 0x68 0x69 0x6A 0x6B 0x6C ", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
-        assertFalse( control.getCriticality() );
+        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() );
 
         control = message.getControls( 2 );
-        assertEquals( "1.3.6.1.5.5.3", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
-        assertTrue( control.getCriticality() );
+        assertEquals( "1.3.6.1.5.5.3", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
+        assertTrue( control.isCritical() );
 
         control = message.getControls( 3 );
-        assertEquals( "1.3.6.1.5.5.4", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
-        assertFalse( control.getCriticality() );
+        assertEquals( "1.3.6.1.5.5.4", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
+        assertFalse( control.isCritical() );
 
         // Check the length
         assertEquals( 0x64, message.computeLength() );
@@ -145,7 +148,7 @@
 
             String encodedPdu = StringTools.dumpBytes( bb.array() );
 
-            assertEquals( encodedPdu, decodedPdu );
+            assertEquals( decodedPdu, encodedPdu );
         }
         catch ( EncoderException ee )
         {

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddRequestTest.java Mon Feb  1 15:04:10 2010
@@ -37,10 +37,10 @@
 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.ControlCodec;
 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.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.entry.Entry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
@@ -718,13 +718,13 @@
         assertEquals( 0x51, message.computeLength() );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         // Check the encoding
         try

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/add/AddResponseTest.java Mon Feb  1 15:04:10 2010
@@ -31,9 +31,9 @@
 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.ControlCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
@@ -207,13 +207,13 @@
         assertEquals( 0x2B, message.computeLength() );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         try
         {

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java Mon Feb  1 15:04:10 2010
@@ -30,9 +30,10 @@
 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.ControlCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
+import org.apache.directory.shared.ldap.codec.controls.CodecControlImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
@@ -116,13 +117,13 @@
             .getSimple() ) );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         // Check the length
         assertEquals( 0x52, message.computeLength() );
@@ -163,8 +164,7 @@
             BindRequestCodec br = new BindRequestCodec();
             br.setName( name );
             
-            ControlCodec control = new ControlCodec();
-            control.setControlType( "2.16.840.1.113730.3.4.2" );
+            CodecControl control = new CodecControlImpl( "2.16.840.1.113730.3.4.2" );
 
             LdapAuthentication authentication = new SimpleAuthentication();
             ((SimpleAuthentication)authentication).setSimple( StringTools.getBytesUtf8( "password" ) );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java Mon Feb  1 15:04:10 2010
@@ -31,10 +31,10 @@
 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.ControlCodec;
 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.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.message.BindResponseImpl;
 import org.apache.directory.shared.ldap.message.InternalMessage;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -123,8 +123,8 @@
         assertEquals( 1, controls.size() );
 
         Control control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         // Check the length
         assertEquals( 0x52, message.computeLength() );
@@ -1232,13 +1232,13 @@
         assertEquals( 0x2F, message.computeLength() );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         // Check the encoding
         try
@@ -1312,13 +1312,13 @@
         assertEquals( 0x2D, message.computeLength() );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         // Check the encoding
         try

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java Mon Feb  1 15:04:10 2010
@@ -32,10 +32,10 @@
 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.ControlCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedSearchControlCodec;
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
+import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsControlCodec;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
@@ -186,15 +186,15 @@
         assertEquals( 0x3C, message.computeLength() );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "1.2.840.113556.1.4.319", control.getControlType() );
-        assertTrue( control.getControlValue() instanceof PagedSearchControlCodec );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "1.2.840.113556.1.4.319", control.getOid() );
+        assertTrue( control instanceof PagedResultsControlCodec );
         
-        PagedSearchControlCodec pagedSearchControl = (PagedSearchControlCodec)control.getControlValue();
+        PagedResultsControlCodec pagedSearchControl = (PagedResultsControlCodec)control;
         
         assertEquals( 5, pagedSearchControl.getSize() );
         assertTrue( Arrays.equals( "abcdef".getBytes(), pagedSearchControl.getCookie() ) );
@@ -348,13 +348,13 @@
         assertEquals( "", StringTools.utf8ToString( br.getServerSaslCreds() ) );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         // Check the length
         assertEquals( 0x2D, message.computeLength() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareRequestTest.java Mon Feb  1 15:04:10 2010
@@ -31,10 +31,10 @@
 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.ControlCodec;
 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.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.message.InternalMessage;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -469,13 +469,13 @@
         assertEquals( "value", compareRequest.getAssertionValue().toString() );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         // Check the length
         assertEquals( 0x55, message.computeLength() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/compare/CompareResponseTest.java Mon Feb  1 15:04:10 2010
@@ -31,9 +31,9 @@
 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.ControlCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.Test;
@@ -173,13 +173,13 @@
         assertEquals( "", compareResponse.getLdapResult().getErrorMessage() );
 
         // Check the Control
-        List<ControlCodec> controls = message.getControls();
+        List<CodecControl> controls = message.getControls();
 
         assertEquals( 1, controls.size() );
 
-        ControlCodec control = message.getControls( 0 );
-        assertEquals( "2.16.840.1.113730.3.4.2", control.getControlType() );
-        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getControlValue() ) );
+        CodecControl control = message.getControls( 0 );
+        assertEquals( "2.16.840.1.113730.3.4.2", control.getOid() );
+        assertEquals( "", StringTools.dumpBytes( ( byte[] ) control.getValue() ) );
 
         // Check the length
         assertEquals( 0x2B, message.computeLength() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncDoneValueControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncDoneValueControlTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncDoneValueControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncDoneValueControlTest.java Mon Feb  1 15:04:10 2010
@@ -27,7 +27,6 @@
 import static org.junit.Assert.fail;
 
 import java.nio.ByteBuffer;
-import java.util.Arrays;
 
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.codec.EncoderException;
@@ -57,13 +56,14 @@
         bb.put( new byte[]
             { 
               0x30, 0x09, 
-              0x04, 0x04, 'x', 'k', 'c', 'd', // the cookie 
-              0x01, 0x01, ( byte ) 0xFF // refreshDeletes flag TRUE
+                0x04, 0x04, 'x', 'k', 'c', 'd', // the cookie 
+                0x01, 0x01, ( byte ) 0xFF       // refreshDeletes flag TRUE
             } );
 
         bb.flip();
 
         SyncDoneValueControlContainer container = new SyncDoneValueControlContainer();
+        container.setSyncDoneValueControl( new SyncDoneValueControlCodec() );
 
         try
         {
@@ -81,11 +81,26 @@
         // test encoding
         try
         {
-            ByteBuffer encodedBuf = control.encode( null );
-            encodedBuf.flip();
-            bb.flip();
-            
-            assertTrue( Arrays.equals( encodedBuf.array(), bb.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x29 );
+            buffer.put( new byte[]
+                { 
+                0x30, 0x27,                            // Control
+                  0x04, 0x18,                          // OID (SyncRequestValue)
+                    '1', '.', '3', '.', '6', '.', '1', '.', 
+                    '4', '.', '1', '.', '4', '2', '0', '3', 
+                    '.', '1', '.', '9', '.', '1', '.', '3',
+                  0x04, 0x0B,
+                    0x30, 0x09, 
+                      0x04, 0x04, 'x', 'k', 'c', 'd',  // the cookie 
+                      0x01, 0x01, ( byte ) 0xFF        // refreshDeletes flag TRUE
+                } );
+
+            buffer.flip();
+
+            bb = control.encode( ByteBuffer.allocate( control.computeLength() ) );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            assertEquals( expected, decoded );
         }
         catch( EncoderException e )
         {
@@ -104,12 +119,13 @@
             { 
               0x30, 0x03, 
               // null cookie
-              0x01, 0x01, 0x00 // refreshDeletes flag FALSE
+                0x01, 0x01, 0x10 // refreshDeletes flag TRUE
             } );
 
         bb.flip();
 
         SyncDoneValueControlContainer container = new SyncDoneValueControlContainer();
+        container.setSyncDoneValueControl( new SyncDoneValueControlCodec() );
 
         try
         {
@@ -122,16 +138,30 @@
 
         SyncDoneValueControlCodec control = container.getSyncDoneValueControl();
         assertNull( control.getCookie() );
-        assertFalse( control.isRefreshDeletes() );
+        assertTrue( control.isRefreshDeletes() );
 
         // test encoding
         try
         {
-            ByteBuffer encodedBuf = control.encode( null );
-            encodedBuf.flip();
-            bb.flip();
-            
-            assertTrue( Arrays.equals( encodedBuf.array(), bb.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x23 );
+            buffer.put( new byte[]
+                { 
+                0x30, 0x21,                            // Control
+                  0x04, 0x18,                          // OID (SyncRequestValue)
+                    '1', '.', '3', '.', '6', '.', '1', '.', 
+                    '4', '.', '1', '.', '4', '2', '0', '3', 
+                    '.', '1', '.', '9', '.', '1', '.', '3',
+                  0x04, 0x05,
+                    0x30, 0x03, 
+                      0x01, 0x01, ( byte ) 0xFF        // refreshDeletes flag TRUE
+                } );
+
+            buffer.flip();
+
+            bb = control.encode( ByteBuffer.allocate( control.computeLength() ) );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            assertEquals( expected, decoded );
         }
         catch( EncoderException e )
         {
@@ -154,6 +184,7 @@
         bb.flip();
 
         SyncDoneValueControlContainer container = new SyncDoneValueControlContainer();
+        container.setSyncDoneValueControl( new SyncDoneValueControlCodec() );
 
         try
         {
@@ -179,13 +210,14 @@
         bb.put( new byte[]
             { 
               0x30, 0x05, 
-              0x04, 0x00,      // empty cookie
-              0x01, 0x01, 0x00 // refreshDeletes flag FALSE
+                0x04, 0x00,      // empty cookie
+                0x01, 0x01, 0x00 // refreshDeletes flag FALSE
             } );
 
         bb.flip();
 
         SyncDoneValueControlContainer container = new SyncDoneValueControlContainer();
+        container.setSyncDoneValueControl( new SyncDoneValueControlCodec() );
 
         try
         {
@@ -203,15 +235,24 @@
         // test encoding
         try
         {
-            ByteBuffer encodedBuf = control.encode( null );
-            encodedBuf.flip();
-            bb.flip();
-            
-            decoder.decode( encodedBuf, container );
-            SyncDoneValueControlCodec redecoded = container.getSyncDoneValueControl();
-            
-            assertEquals( control.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertTrue( Arrays.equals( control.getCookie(), redecoded.getCookie() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x20 );
+            buffer.put( new byte[]
+                { 
+                0x30, 0x1E,                            // Control
+                  0x04, 0x18,                          // OID (SyncRequestValue)
+                    '1', '.', '3', '.', '6', '.', '1', '.', 
+                    '4', '.', '1', '.', '4', '2', '0', '3', 
+                    '.', '1', '.', '9', '.', '1', '.', '3',
+                  0x04, 0x02,
+                    0x30, 0x00
+                } );
+
+            buffer.flip();
+
+            bb = control.encode( ByteBuffer.allocate( control.computeLength() ) );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            assertEquals( expected, decoded );
         }
         catch( Exception e )
         {



Mime
View raw message