You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/02/01 16:04:20 UTC

svn commit: r905297 [6/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...

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncInfoValueControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncInfoValueControlTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncInfoValueControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncInfoValueControlTest.java Mon Feb  1 15:04:10 2010
@@ -19,8 +19,12 @@
  */
 package org.apache.directory.shared.ldap.codec.controls.replication;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+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.DecoderException;
@@ -30,12 +34,7 @@
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControlDecoder;
 import org.apache.directory.shared.ldap.message.control.replication.SynchronizationInfoEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
-
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 /**
  * Test the SyncInfoControlValue codec
@@ -63,6 +62,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.NEW_COOKIE ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -80,10 +81,22 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x23 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x21,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x05,
+                      (byte)0x80, 0x03,                  // syncInfoValue ::= CHOICE {
+                        'a', 'b', 'c'                    //     newCookie [0] syncCookie
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -108,6 +121,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.NEW_COOKIE ) );
+        
         try
         {
             decoder.decode( bb, container );
@@ -125,10 +140,21 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x20 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x1E,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x02,
+                      (byte)0x80, 0x00                   // syncInfoValue ::= CHOICE {
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -159,6 +185,7 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_DELETE ) );
         
         try
         {
@@ -178,10 +205,23 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x25 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x23,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x07,
+                      (byte)0xA1, 0x05,                  // syncInfoValue ::= CHOICE {
+                                                         //     refreshDelete [1] SEQUENCE {
+                        0x04, 0x03, 'a', 'b', 'c'        //         cookie       syncCookie OPTIONAL,
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -209,7 +249,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_DELETE ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -228,10 +269,24 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x26,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x0A,
+                      (byte)0xA1, 0x08,                  // syncInfoValue ::= CHOICE {
+                                                         //     refreshDelete [1] SEQUENCE {
+                        0x04, 0x03, 'a', 'b', 'c',       //         cookie       syncCookie OPTIONAL,
+                        0x01, 0x01, (byte)0x00           //         refreshDone  BOOLEAN DEFAULT TRUE
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -258,7 +313,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_DELETE ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -277,26 +333,23 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDone(), redecoded.isRefreshDone() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x25 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x23,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x07,
+                      (byte)0xA1, 0x05,                  // syncInfoValue ::= CHOICE {
+                                                         //     refreshDelete [1] SEQUENCE {
+                        0x04, 0x03, 'a', 'b', 'c',       //         cookie       syncCookie OPTIONAL,
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -323,7 +376,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_DELETE ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -342,26 +396,23 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDone(), redecoded.isRefreshDone() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x23 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x21,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x05,
+                      (byte)0xA1, 0x03,                  // syncInfoValue ::= CHOICE {
+                                                         //     refreshDelete [1] SEQUENCE {
+                        0x01, 0x01, 0x00                 //         refreshDone  BOOLEAN DEFAULT TRUE
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -386,7 +437,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_DELETE ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -405,26 +457,21 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDone(), redecoded.isRefreshDone() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x20 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x1E,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x02,
+                      (byte)0xA1, 0x00,                  // syncInfoValue ::= CHOICE {
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -455,7 +502,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_PRESENT ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -474,10 +522,23 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x25 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x23,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x07,
+                      (byte)0xA2, 0x05,                  // syncInfoValue ::= CHOICE {
+                                                         //     refreshPresent [2] SEQUENCE {
+                        0x04, 0x03, 'a', 'b', 'c'        //         cookie       syncCookie OPTIONAL,
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -505,7 +566,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_PRESENT ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -524,10 +586,24 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x26,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x0A,
+                      (byte)0xA2, 0x08,                  // syncInfoValue ::= CHOICE {
+                                                         //     refreshPresent [2] SEQUENCE {
+                        0x04, 0x03, 'a', 'b', 'c',       //         cookie       syncCookie OPTIONAL,
+                        0x01, 0x01, (byte)0x00           //         refreshDone  BOOLEAN DEFAULT TRUE
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -554,7 +630,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_PRESENT ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -573,26 +650,23 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDone(), redecoded.isRefreshDone() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x25 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x23,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x07,
+                      (byte)0xA2, 0x05,                  // syncInfoValue ::= CHOICE {
+                                                         //     refreshPresent [2] SEQUENCE {
+                        0x04, 0x03, 'a', 'b', 'c',       //         cookie       syncCookie OPTIONAL,
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -619,7 +693,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_PRESENT ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -638,26 +713,23 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDone(), redecoded.isRefreshDone() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x23 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x21,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x05,
+                      (byte)0xA2, 0x03,                  // syncInfoValue ::= CHOICE {
+                                                         //     refreshPresent [2] SEQUENCE {
+                        0x01, 0x01, 0x00                 //        refreshDone  BOOLEAN DEFAULT TRUE
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -682,7 +754,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.REFRESH_PRESENT ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -701,26 +774,21 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDone(), redecoded.isRefreshDone() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x20 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x1E,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x02,
+                      (byte)0xA2, 0x00,                  // syncInfoValue ::= CHOICE {
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -748,7 +816,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -779,7 +848,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -810,7 +880,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -842,7 +913,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -873,7 +945,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -883,6 +956,7 @@
             de.printStackTrace();
             fail( de.getMessage() );
         }
+        
         SyncInfoValueControlCodec syncInfoValue = container.getSyncInfoValueControl();
         assertEquals( SynchronizationInfoEnum.SYNC_ID_SET, syncInfoValue.getType() );
         assertEquals( "", StringTools.utf8ToString( syncInfoValue.getCookie() ) );
@@ -892,27 +966,23 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertEquals( 0, redecoded.getSyncUUIDs().size() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x22 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x20,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x04,
+                      (byte)0xA3, 0x02,                  // syncInfoValue ::= CHOICE {
+                                                         //     syncIdSet [3] SEQUENCE {
+                        0x31, 0x00,                      //         syncUUIDs SET OF syncUUID
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -948,7 +1018,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -977,37 +1048,32 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertEquals( 3, redecoded.getSyncUUIDs().size() );
-            
-            for ( int i = 0; i < 3; i++ )
-            {
-                byte[] uuid = redecoded.getSyncUUIDs().get( i );
-                
-                for ( int j = 0; j < 16; j++ )
-                {
-                    assertEquals( i + 1, uuid[j] );
-                }
-            }
+            ByteBuffer buffer = ByteBuffer.allocate( 0x58 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x56,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x3A,
+                      (byte)0xA3, 0x38,                  // syncInfoValue ::= CHOICE {
+                                                         //     syncIdSet [3] SEQUENCE {
+                        0x31, 0x36,                      //         syncUUIDs SET OF syncUUID
+                          0x04, 0x10,                    // syncUUID
+                            0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+                            0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+                          0x04, 0x10,                    // syncUUID
+                            0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+                            0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+                          0x04, 0x10,                    // syncUUID
+                            0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+                            0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1035,7 +1101,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -1054,27 +1121,24 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertEquals( 0, redecoded.getSyncUUIDs().size() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x27 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x25,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x09,
+                      (byte)0xA3, 0x07,                  // syncInfoValue ::= CHOICE {
+                                                         //     syncIdSet [3] SEQUENCE {
+                        0X04, 0X03, 'a', 'b', 'c',       //         cookie         syncCookie OPTIONAL,
+                        0x31, 0x00,                      //         syncUUIDs SET OF syncUUID
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1111,7 +1175,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -1121,6 +1186,7 @@
             de.printStackTrace();
             fail( de.getMessage() );
         }
+        
         SyncInfoValueControlCodec syncInfoValue = container.getSyncInfoValueControl();
         assertEquals( SynchronizationInfoEnum.SYNC_ID_SET, syncInfoValue.getType() );
         assertEquals( "abc", StringTools.utf8ToString( syncInfoValue.getCookie() ) );
@@ -1140,37 +1206,33 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertEquals( 3, redecoded.getSyncUUIDs().size() );
-            
-            for ( int i = 0; i < 3; i++ )
-            {
-                byte[] uuid = redecoded.getSyncUUIDs().get( i );
-                
-                for ( int j = 0; j < 16; j++ )
-                {
-                    assertEquals( i + 1, uuid[j] );
-                }
-            }
+            ByteBuffer buffer = ByteBuffer.allocate( 0x5D );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x5B,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x3F,
+                      (byte)0xA3, 0x3D,                  // syncInfoValue ::= CHOICE {
+                                                         //     syncIdSet [3] SEQUENCE {
+                        0X04, 0X03, 'a', 'b', 'c',       //         cookie         syncCookie OPTIONAL,
+                        0x31, 0x36,                      //         syncUUIDs SET OF syncUUID
+                          0x04, 0x10,                    // syncUUID
+                            0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+                            0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+                          0x04, 0x10,                    // syncUUID
+                            0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+                            0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+                          0x04, 0x10,                    // syncUUID
+                            0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+                            0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1198,7 +1260,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -1217,27 +1280,24 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertEquals( 0, redecoded.getSyncUUIDs().size() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x25 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x23,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x07,
+                      (byte)0xA3, 0x05,                  // syncInfoValue ::= CHOICE {
+                                                         //     syncIdSet [3] SEQUENCE {
+                        0X01, 0X01, (byte)0xFF,          //         refreshDeletes BOOLEAN DEFAULT FALSE,
+                        0x31, 0x00,                      //         syncUUIDs SET OF syncUUID
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1274,7 +1334,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -1303,37 +1364,33 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertEquals( 3, redecoded.getSyncUUIDs().size() );
-            
-            for ( int i = 0; i < 3; i++ )
-            {
-                byte[] uuid = redecoded.getSyncUUIDs().get( i );
-                
-                for ( int j = 0; j < 16; j++ )
-                {
-                    assertEquals( i + 1, uuid[j] );
-                }
-            }
+            ByteBuffer buffer = ByteBuffer.allocate( 0x5B );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x59,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x3D,
+                      (byte)0xA3, 0x3B,                  // syncInfoValue ::= CHOICE {
+                                                         //     syncIdSet [3] SEQUENCE {
+                        0X01, 0X01, (byte)0xFF,          //         refreshDeletes BOOLEAN DEFAULT FALSE,
+                        0x31, 0x36,                      //         syncUUIDs SET OF syncUUID
+                          0x04, 0x10,                    // syncUUID
+                            0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+                            0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+                          0x04, 0x10,                    // syncUUID
+                            0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+                            0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+                          0x04, 0x10,                    // syncUUID
+                            0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+                            0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1362,7 +1419,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -1381,27 +1439,25 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertEquals( 0, redecoded.getSyncUUIDs().size() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x2A );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x28,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x0C,
+                      (byte)0xA3, 0x0A,                  // syncInfoValue ::= CHOICE {
+                                                         //     syncIdSet [3] SEQUENCE {
+                        0X04, 0X03, 'a', 'b', 'c',       //         cookie         syncCookie OPTIONAL,
+                        0X01, 0X01, (byte)0xFF,          //         refreshDeletes BOOLEAN DEFAULT FALSE,
+                        0x31, 0x00,                      //         syncUUIDs SET OF syncUUID
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1439,7 +1495,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -1449,6 +1506,7 @@
             de.printStackTrace();
             fail( de.getMessage() );
         }
+        
         SyncInfoValueControlCodec syncInfoValue = container.getSyncInfoValueControl();
         assertEquals( SynchronizationInfoEnum.SYNC_ID_SET, syncInfoValue.getType() );
         assertEquals( "abc", StringTools.utf8ToString( syncInfoValue.getCookie() ) );
@@ -1468,37 +1526,34 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncInfoValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            
-            container.clean();
-            
-            try
-            {
-                decoder.decode( encoded, container );
-            }
-            catch ( DecoderException de )
-            {
-                de.printStackTrace();
-                fail( de.getMessage() );
-            }
-            
-            SyncInfoValueControlCodec redecoded = container.getSyncInfoValueControl();
-            
-            assertTrue( Arrays.equals( syncInfoValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncInfoValue.isRefreshDeletes(), redecoded.isRefreshDeletes() );
-            assertEquals( 3, redecoded.getSyncUUIDs().size() );
-            
-            for ( int i = 0; i < 3; i++ )
-            {
-                byte[] uuid = redecoded.getSyncUUIDs().get( i );
-                
-                for ( int j = 0; j < 16; j++ )
-                {
-                    assertEquals( i + 1, uuid[j] );
-                }
-            }
+            ByteBuffer buffer = ByteBuffer.allocate( 0x60 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x5E,                            // Control
+                    0x04, 0x18,                          // OID (SyncInfoValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '4',
+                    0x04, 0x42,
+                      (byte)0xA3, 0x40,                  // syncInfoValue ::= CHOICE {
+                                                         //     syncIdSet [3] SEQUENCE {
+                        0X04, 0X03, 'a', 'b', 'c',       //         cookie         syncCookie OPTIONAL,
+                        0x01, 0x01, (byte)0xFF,          //         refreshDeletes BOOLEAN DEFAULT FALSE,
+                        0x31, 0x36,                      //         syncUUIDs SET OF syncUUID
+                          0x04, 0x10,                    // syncUUID
+                            0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+                            0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+                          0x04, 0x10,                    // syncUUID
+                            0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+                            0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+                          0x04, 0x10,                    // syncUUID
+                            0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+                            0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncInfoValue.encode( ByteBuffer.allocate( syncInfoValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1530,7 +1585,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );
@@ -1567,7 +1623,8 @@
         bb.flip();
 
         SyncInfoValueControlContainer container = new SyncInfoValueControlContainer();
-        
+        container.setSyncInfoValueControl( new SyncInfoValueControlCodec( SynchronizationInfoEnum.SYNC_ID_SET ) );
+
         try
         {
             decoder.decode( bb, container );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java Mon Feb  1 15:04:10 2010
@@ -19,8 +19,12 @@
  */
 package org.apache.directory.shared.ldap.codec.controls.replication;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+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.DecoderException;
@@ -30,12 +34,7 @@
 import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControlDecoder;
 import org.apache.directory.shared.ldap.message.control.replication.SynchronizationModeEnum;
 import org.apache.directory.shared.ldap.util.StringTools;
-
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 /**
  * Test the SyncRequestControlValue codec
@@ -64,6 +63,7 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
         
         try
         {
@@ -83,10 +83,27 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncRequestValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x26,                            // Control
+                    0x04, 0x18,                          // OID (SyncRequestValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '1',
+                    0x04, 0x0A,
+                      0x30, 0x08,                        // syncRequestValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x01,                //     mode ENUMERATED {
+                                                         //         refreshOnly (1)
+                                                         //     }
+                        0x04, 0x03, 'a', 'b', 'c'        //     cookie syncCookie OPTIONAL,
+                } );
+            buffer.flip();
+
+            bb = syncRequestValue.encode( ByteBuffer.allocate( syncRequestValue.computeLength() ) );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
         {
@@ -115,7 +132,8 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-       
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
+
         try
         {
             decoder.decode( bb, container );
@@ -134,10 +152,27 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncRequestValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x26,                            // Control
+                    0x04, 0x18,                          // OID (SyncRequestValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '1',
+                    0x04, 0x0A,
+                      0x30, 0x08,                        // syncRequestValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x03,                //     mode ENUMERATED {
+                                                         //         refreshAndPersist (3)
+                                                         //     }
+                        0x04, 0x03, 'a', 'b', 'c'        //     cookie syncCookie OPTIONAL,
+                } );
+            buffer.flip();
+
+            bb = syncRequestValue.encode( ByteBuffer.allocate( syncRequestValue.computeLength() ) );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
         {
@@ -165,7 +200,8 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
+
         try
         {
             decoder.decode( bb, container );
@@ -184,10 +220,26 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncRequestValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.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', '.', '1',
+                    0x04, 0x05,
+                      0x30, 0x03,                        // syncRequestValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x03                 //     mode ENUMERATED {
+                                                         //         refreshAndPersist (3)
+                                                         //     }
+                } );
+            buffer.flip();
+
+            bb = syncRequestValue.encode( ByteBuffer.allocate( syncRequestValue.computeLength() ) );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
         {
@@ -216,7 +268,8 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
+
         try
         {
             decoder.decode( bb, container );
@@ -235,10 +288,27 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncRequestValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x26 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x24,                            // Control
+                    0x04, 0x18,                          // OID (SyncRequestValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '1',
+                    0x04, 0x08,
+                      0x30, 0x06,                        // syncRequestValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x03,                //     mode ENUMERATED {
+                                                         //         refreshAndPersist (3)
+                                                         //     }
+                        0x01, 0x01, (byte)0xFF           //     reloadHint
+                } );
+            buffer.flip();
+
+            bb = syncRequestValue.encode( ByteBuffer.allocate( syncRequestValue.computeLength() ) );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
         {
@@ -266,7 +336,8 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
+
         try
         {
             decoder.decode( bb, container );
@@ -285,14 +356,26 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncRequestValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            SyncRequestValueControlCodec redecoded = container.getSyncRequestValueControl();
-            
-            assertEquals( syncRequestValue.getMode(), redecoded.getMode() );
-            assertTrue( Arrays.equals( syncRequestValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncRequestValue.isReloadHint(), redecoded.isReloadHint() );
+            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', '.', '1',
+                    0x04, 0x05,
+                      0x30, 0x03,                        // syncRequestValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x03,                //     mode ENUMERATED {
+                                                         //         refreshAndPersist (3)
+                                                         //     }
+                } );
+            buffer.flip();
+
+            bb = syncRequestValue.encode( ByteBuffer.allocate( syncRequestValue.computeLength() ) );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
         {
@@ -320,7 +403,8 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
-        
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
+
         try
         {
             decoder.decode( bb, container );
@@ -339,14 +423,27 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncRequestValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            SyncRequestValueControlCodec redecoded = container.getSyncRequestValueControl();
-            
-            assertEquals( syncRequestValue.getMode(), redecoded.getMode() );
-            assertTrue( Arrays.equals( syncRequestValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncRequestValue.isReloadHint(), redecoded.isReloadHint() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x26,                            // Control
+                    0x04, 0x18,                          // OID (SyncRequestValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3',
+                      '.', '1', '.', '9', '.', '1', '.', '1',
+                    0x04, 0x0A,
+                      0x30, 0x08,                        // syncRequestValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x03,                //     mode ENUMERATED {
+                                                         //         refreshAndPersist (3)
+                                                         //     }
+                        0x04, 0x03, 'a', 'b', 'c'        //     cookie syncCookie OPTIONAL,
+                } );
+            buffer.flip();
+
+            bb = syncRequestValue.encode( ByteBuffer.allocate( syncRequestValue.computeLength() ) );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
         {
@@ -374,6 +471,8 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
+
         try
         {
             decoder.decode( bb, container );
@@ -392,14 +491,26 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncRequestValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            SyncRequestValueControlCodec redecoded = container.getSyncRequestValueControl();
-            
-            assertEquals( syncRequestValue.getMode(), redecoded.getMode() );
-            assertTrue( Arrays.equals( syncRequestValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncRequestValue.isReloadHint(), redecoded.isReloadHint() );
+            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', '.', '1',
+                    0x04, 0x05,
+                      0x30, 0x03,                        // syncRequestValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x03,                //     mode ENUMERATED {
+                                                         //         refreshAndPersist (3)
+                                                         //     }
+                } );
+            buffer.flip();
+
+            bb = syncRequestValue.encode( ByteBuffer.allocate( syncRequestValue.computeLength() ) );
+            String decoded = StringTools.dumpBytes( bb.array() );
+            String expected = StringTools.dumpBytes( buffer.array() );
+            assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
         {
@@ -423,6 +534,7 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
 
         try
         {
@@ -452,6 +564,7 @@
         bb.flip();
 
         SyncRequestValueControlContainer container = new SyncRequestValueControlContainer();
+        container.setSyncRequestValueControl( new SyncRequestValueControlCodec() );
 
         try
         {

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncStateValueControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncStateValueControlTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncStateValueControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncStateValueControlTest.java Mon Feb  1 15:04:10 2010
@@ -26,7 +26,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.DecoderException;
@@ -55,7 +54,8 @@
         Asn1Decoder decoder = new SyncStateValueControlDecoder();
         ByteBuffer bb = ByteBuffer.allocate( 16 );
         bb.put( new byte[]
-            { 0x30, ( byte ) 14,               // SyncStateValue ::= SEQUENCE {
+            { 
+              0x30, ( byte ) 14,               // SyncStateValue ::= SEQUENCE {
                 0x0A, 0x01, 0x00,              //     state ENUMERATED {
                                                //         present (0)
                                                //     }
@@ -65,6 +65,7 @@
         bb.flip();
 
         SyncStateValueControlContainer container = new SyncStateValueControlContainer();
+        container.setSyncStateValueControl( new SyncStateValueControlCodec() );
 
         try
         {
@@ -76,18 +77,34 @@
             fail( de.getMessage() );
         }
 
-        SyncStateValueControlCodec SyncStateValue = container.getSyncStateValueControl();
-        assertEquals( SyncStateTypeEnum.PRESENT, SyncStateValue.getSyncStateType() );
-        assertEquals( "abc", StringTools.utf8ToString( SyncStateValue.getEntryUUID() ) );
-        assertEquals( "xkcd", StringTools.utf8ToString( SyncStateValue.getCookie() ) );
+        SyncStateValueControlCodec syncStateValue = container.getSyncStateValueControl();
+        assertEquals( SyncStateTypeEnum.PRESENT, syncStateValue.getSyncStateType() );
+        assertEquals( "abc", StringTools.utf8ToString( syncStateValue.getEntryUUID() ) );
+        assertEquals( "xkcd", StringTools.utf8ToString( syncStateValue.getCookie() ) );
 
         // Check the encoding
         try
         {
-            ByteBuffer encoded = SyncStateValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x2E );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x2C,                            // Control
+                    0x04, 0x18,                          // OID (SuncStateValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3', 
+                      '.', '1', '.', '9', '.', '1', '.', '2',
+                    0x04, 0x10,
+                      0x30, 0x0E,                        // SyncStateValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x00,                //     state ENUMERATED {
+                                                         //         present (0)
+                                                         //     }
+                        0x04, 0x03, 'a', 'b', 'c',       //     entryUUID syncUUID OPTIONAL,
+                        0x04, 0x04, 'x', 'k', 'c', 'd'   //     cookie syncCookie OPTIONAL,
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncStateValue.encode( ByteBuffer.allocate( syncStateValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -114,6 +131,7 @@
         bb.flip();
 
         SyncStateValueControlContainer container = new SyncStateValueControlContainer();
+        container.setSyncStateValueControl( new SyncStateValueControlCodec() );
 
         try
         {
@@ -124,18 +142,33 @@
             fail( de.getMessage() );
         }
 
-        SyncStateValueControlCodec SyncStateValue = container.getSyncStateValueControl();
-        assertEquals( SyncStateTypeEnum.ADD, SyncStateValue.getSyncStateType() );
-        assertEquals( "abc", StringTools.utf8ToString( SyncStateValue.getEntryUUID() ) );
-        assertNull( SyncStateValue.getCookie() );
+        SyncStateValueControlCodec syncStateValue = container.getSyncStateValueControl();
+        assertEquals( SyncStateTypeEnum.ADD, syncStateValue.getSyncStateType() );
+        assertEquals( "abc", StringTools.utf8ToString( syncStateValue.getEntryUUID() ) );
+        assertNull( syncStateValue.getCookie() );
 
         // Check the encoding
         try
         {
-            ByteBuffer encoded = SyncStateValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            assertTrue( Arrays.equals( bb.array(), encoded.array() ) );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x26,                            // Control
+                    0x04, 0x18,                          // OID (SuncStateValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3', 
+                      '.', '1', '.', '9', '.', '1', '.', '2',
+                    0x04, 0x0A,
+                      0x30, 0x08,                        // SyncStateValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x01,                //     state ENUMERATED {
+                                                         //         add (1)
+                                                         //     }
+                        0x04, 0x03, 'a', 'b', 'c'        //     entryUUID syncUUID OPTIONAL,
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncStateValue.encode( ByteBuffer.allocate( syncStateValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -151,9 +184,9 @@
     public void testDecodeSyncStateValueControlEmptyCookie()
     {
         Asn1Decoder decoder = new SyncStateValueControlDecoder();
-        ByteBuffer bb = ByteBuffer.allocate( 0x12 );
+        ByteBuffer bb = ByteBuffer.allocate( 0x0C );
         bb.put( new byte[]
-            { 0x30, 0x10,                  // SyncStateValue ::= SEQUENCE {
+            { 0x30, 0x0A,                  // SyncStateValue ::= SEQUENCE {
                 0x0A, 0x01, 0x02,          //     state ENUMERATED {
                                            //         modify (2)
                                            //     }
@@ -163,6 +196,8 @@
         bb.flip();
 
         SyncStateValueControlContainer container = new SyncStateValueControlContainer();
+        container.setSyncStateValueControl( new SyncStateValueControlCodec() );
+
         try
         {
             decoder.decode( bb, container );
@@ -181,14 +216,25 @@
         // Check the encoding
         try
         {
-            ByteBuffer encoded = syncStateValue.encode( null );
-            encoded.flip();
-            bb.flip();
-            SyncStateValueControlCodec redecoded = container.getSyncStateValueControl();
-
-            assertEquals( syncStateValue.getSyncStateType(), redecoded.getSyncStateType() );
-            assertTrue( Arrays.equals( syncStateValue.getCookie(), redecoded.getCookie() ) );
-            assertEquals( syncStateValue.getEntryUUID(), redecoded.getEntryUUID() );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
+            buffer.put( new byte[]
+                { 
+                  0x30, 0x26,                            // Control
+                    0x04, 0x18,                          // OID (SuncStateValue)
+                      '1', '.', '3', '.', '6', '.', '1', '.', 
+                      '4', '.', '1', '.', '4', '2', '0', '3', 
+                      '.', '1', '.', '9', '.', '1', '.', '2',
+                    0x04, 0x0A,
+                      0x30, 0x08,                        // SyncStateValue ::= SEQUENCE {
+                        0x0A, 0x01, 0x02,                //     state ENUMERATED {
+                                                         //         modify (2)
+                                                         //     }
+                        0x04, 0x03, 'a', 'b', 'c'        //     entryUUID syncUUID OPTIONAL,
+                } );
+            buffer.flip();
+
+            ByteBuffer encoded = syncStateValue.encode( ByteBuffer.allocate( syncStateValue.computeLength() ) );
+            assertEquals( StringTools.dumpBytes( buffer.array() ), StringTools.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -211,6 +257,7 @@
         bb.flip();
 
         SyncStateValueControlContainer container = new SyncStateValueControlContainer();
+        container.setSyncStateValueControl( new SyncStateValueControlCodec() );
 
         try
         {
@@ -239,6 +286,7 @@
         bb.flip();
 
         SyncStateValueControlContainer container = new SyncStateValueControlContainer();
+        container.setSyncStateValueControl( new SyncStateValueControlCodec() );
 
         try
         {
@@ -269,6 +317,7 @@
         bb.flip();
 
         SyncStateValueControlContainer container = new SyncStateValueControlContainer();
+        container.setSyncStateValueControl( new SyncStateValueControlCodec() );
 
         try
         {

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.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.DeleteResponseImpl;
 import org.apache.directory.shared.ldap.message.InternalMessage;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -245,13 +245,13 @@
         assertEquals( 0x44, 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/del/DelResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.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;
@@ -216,13 +216,13 @@
         assertEquals( 0x4A, 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/extended/ExtendedRequestTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.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.util.StringTools;
 import org.junit.Test;
 
@@ -165,13 +165,13 @@
         assertEquals( "value", StringTools.utf8ToString( extendedRequest.getRequestValue() ) );
 
         // 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( 0x3A, message.computeLength() );
@@ -247,13 +247,13 @@
         assertEquals( "", StringTools.utf8ToString( extendedRequest.getRequestValue() ) );
 
         // 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( 0x33, message.computeLength() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java?rev=905297&r1=905296&r2=905297&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.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;
@@ -189,13 +189,13 @@
         assertEquals( "value", StringTools.utf8ToString( ( byte[] ) extendedResponse.getResponse() ) );
 
         // 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( 0x41, message.computeLength() );
@@ -344,13 +344,13 @@
         assertEquals( "", extendedResponse.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() );
@@ -627,13 +627,13 @@
         assertEquals( "", StringTools.utf8ToString( ( byte[] ) extendedResponse.getResponse() ) );
 
         // 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( 0x3A, message.computeLength() );
@@ -789,13 +789,13 @@
         assertEquals( "", StringTools.utf8ToString( ( byte[] ) extendedResponse.getResponse() ) );
 
         // 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( 0x3C, message.computeLength() );