directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1065732 [1/2] - in /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec: abandon/ bind/ controls/ppolicy/ controls/replication/ del/ search/controls/
Date Mon, 31 Jan 2011 19:57:17 GMT
Author: elecharny
Date: Mon Jan 31 19:57:17 2011
New Revision: 1065732

URL: http://svn.apache.org/viewvc?rev=1065732&view=rev
Log:
Fixed the control tests

Modified:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindResponseTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncDoneValueControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncInfoValueControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncStateValueControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelResponseTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PagedSearchControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlTest.java

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=1065732&r1=1065731&r2=1065732&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 Jan 31 19:57:17 2011
@@ -78,27 +78,27 @@ public class AbandonRequestTest
                 0x02, 0x01, 0x03, // messageID MessageID
                 0x50, 0x01, 0x02, // CHOICE { ..., abandonRequest
                 // AbandonRequest,...
-                  ( byte ) 0xA0, 0x5A, // controls [0] Controls OPTIONAL }
-                    0x30, 0x1A, // Control ::= SEQUENCE {
-                                // controlType LDAPOID,
-                      0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '1',
-                                  // criticality BOOLEAN DEFAULT FALSE,
-                      0x01, 0x01, ( byte ) 0xFF,
-                                  // controlValue OCTET STRING OPTIONAL }
-                      0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f', 
-                    0x30, 0x17, // Control ::= SEQUENCE {
-                                // controlType LDAPOID,
-                      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 {
-                                // controlType LDAPOID,
-                      0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '3',
-                                  // criticality BOOLEAN DEFAULT FALSE }
-                      0x01, 0x01, ( byte ) 0xFF, 
-                    0x30, 0x0F, // Control ::= SEQUENCE {
-                                // controlType LDAPOID}
-                      0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '4' } );
+                ( byte ) 0xA0, 0x5A, // controls [0] Controls OPTIONAL }
+                  0x30, 0x1A, // Control ::= SEQUENCE {
+                              // controlType LDAPOID,
+                    0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '1',
+                                // criticality BOOLEAN DEFAULT FALSE,
+                    0x01, 0x01, ( byte ) 0xFF,
+                                // controlValue OCTET STRING OPTIONAL }
+                    0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f', 
+                  0x30, 0x17, // Control ::= SEQUENCE {
+                              // controlType LDAPOID,
+                    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 {
+                              // controlType LDAPOID,
+                    0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '3',
+                                // criticality BOOLEAN DEFAULT FALSE }
+                    0x01, 0x01, ( byte ) 0xFF, 
+                  0x30, 0x0F, // Control ::= SEQUENCE {
+                              // controlType LDAPOID}
+                    0x04, 0x0D, '1', '.', '3', '.', '6', '.', '1', '.', '5', '.', '5', '.', '4' } );
 
         stream.flip();
 

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=1065732&r1=1065731&r2=1065732&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 Jan 31 19:57:17 2011
@@ -32,8 +32,8 @@ import org.apache.directory.junit.tools.
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.shared.asn1.DecoderException;
 import org.apache.directory.shared.asn1.EncoderException;
-import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.Asn1Container;
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
 import org.apache.directory.shared.ldap.codec.ICodecControl;
 import org.apache.directory.shared.ldap.codec.ILdapCodecService;
@@ -145,38 +145,30 @@ public class BindResponseTest
         ByteBuffer stream = ByteBuffer.allocate( 0x3C );
 
         stream.put( new byte[]
-            { 0x30,
-                0x3A, // LDAPMessage ::=SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x61,
-                0x07, // CHOICE { ..., bindResponse BindResponse, ...
-                // BindResponse ::= APPLICATION[1] SEQUENCE {
-                // COMPONENTS OF LDAPResult,
-                0x0A,
-                0x01,
-                0x00, // LDAPResult ::= SEQUENCE {
-                // resultCode ENUMERATED {
-                // success (0), ...
-                // },
-                0x04,
-                0x00, // matchedDN LDAPDN,
-                0x04,
-                0x00, // errorMessage LDAPString,
-                // referral [3] Referral OPTIONAL }
-                // serverSaslCreds [7] OCTET STRING OPTIONAL }
-                ( byte ) 0xa0,
-                0x2C, // controls
-                0x30,
-                0x2A, // The PagedSearchControl
-                0x04,
-                0x16, // Oid : 1.2.840.113556.1.4.319
-                0x31, 0x2e, 0x32, 0x2e, 0x38, 0x34, 0x30, 0x2e, 0x31, 0x31, 0x33, 0x35, 0x35, 0x36, 0x2e, 0x31, 0x2e,
-                0x34, 0x2e, 0x33, 0x31, 0x39, // control
-                0x01, 0x01, ( byte ) 0xff, // criticality: false
-                0x04, 0x0D, 0x30, 0x0B, 0x02, 0x01, 0x05, // Size = 5, cookie = "abcdef" 
-                0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f' } );
+            { 0x30, 0x3A,                               // LDAPMessage ::=SEQUENCE {
+                0x02, 0x01, 0x01,                       // messageID MessageID
+                0x61, 0x07,                             // CHOICE { ..., bindResponse BindResponse, ...
+                                                        // BindResponse ::= APPLICATION[1] SEQUENCE {
+                                                        // COMPONENTS OF LDAPResult,
+                  0x0A,  0x01, 0x00,                    // LDAPResult ::= SEQUENCE {
+                                                        // resultCode ENUMERATED {
+                                                        // success (0), ...
+                                                        // },
+                  0x04, 0x00,                           // matchedDN LDAPDN,
+                  0x04, 0x00,                           // errorMessage LDAPString,
+                                                        // referral [3] Referral OPTIONAL }
+                                                        // serverSaslCreds [7] OCTET STRING OPTIONAL }
+                ( byte ) 0xa0, 0x2C,                    // controls
+                  0x30, 0x2A,                           // The PagedSearchControl
+                    0x04, 0x16,                         // Oid : 1.2.840.113556.1.4.319
+                      0x31, 0x2e, 0x32, 0x2e, 0x38, 0x34, 0x30, 0x2e, 
+                      0x31, 0x31, 0x33, 0x35, 0x35, 0x36, 0x2e, 0x31, 
+                      0x2e, 0x34, 0x2e, 0x33, 0x31, 0x39, 
+                    0x01, 0x01, ( byte ) 0xff,          // criticality: false
+                    0x04, 0x0D, 
+                      0x30, 0x0B, 
+                        0x02, 0x01, 0x05,               // Size = 5, cookie = "abcdef" 
+                        0x04, 0x06, 'a', 'b', 'c', 'd', 'e', 'f' } );
 
         String decodedPdu = Strings.dumpBytes(stream.array());
         stream.flip();
@@ -225,7 +217,7 @@ public class BindResponseTest
             // Check the length
             assertEquals( 0x3C, bb.limit() );
 
-            String encodedPdu = Strings.dumpBytes(bb.array());
+            String encodedPdu = Strings.dumpBytes( bb.array() );
 
             assertEquals( encodedPdu, decodedPdu );
         }
@@ -322,33 +314,27 @@ public class BindResponseTest
         ByteBuffer stream = ByteBuffer.allocate( 0x2D );
 
         stream.put( new byte[]
-            { 0x30,
-                0x2B, // LDAPMessage ::=SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x61,
-                0x09, // CHOICE { ..., bindResponse BindResponse, ...
+            { 0x30, 0x2B, // LDAPMessage ::=SEQUENCE {
+                0x02, 0x01, 0x01, // messageID MessageID
+                0x61, 0x09, // CHOICE { ..., bindResponse BindResponse, ...
                 // BindResponse ::= APPLICATION[1] SEQUENCE {
                 // COMPONENTS OF LDAPResult,
-                0x0A,
-                0x01,
-                0x00, // LDAPResult ::= SEQUENCE {
+                  0x0A, 0x01, 0x00, // LDAPResult ::= SEQUENCE {
                 // resultCode ENUMERATED {
                 // success (0), ...
                 // },
-                0x04,
-                0x00, // matchedDN LDAPDN,
-                0x04,
-                0x00, // errorMessage LDAPString,
+                  0x04, 0x00, // matchedDN LDAPDN,
+                  0x04, 0x00, // errorMessage LDAPString,
                 // referral [3] Referral OPTIONAL }
-                ( byte ) 0x87,
-                0x00, // serverSaslCreds [7] OCTET STRING
+                  ( byte ) 0x87, 0x00, // serverSaslCreds [7] OCTET STRING
                 // OPTIONAL }
-                ( byte ) 0xA0,
-                0x1B, // A control
-                0x30, 0x19, 0x04, 0x17, 0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x31,
-                0x33, 0x37, 0x33, 0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 } );
+                ( byte ) 0xA0, 0x1B, // A control
+                  0x30, 0x19, 
+                    0x04, 0x17, 
+                      0x32, 0x2E, 0x31, 0x36, 0x2E, 0x38, 0x34, 0x30,
+                      0x2E, 0x31, 0x2E, 0x31, 0x31, 0x33, 0x37, 0x33, 
+                      0x30, 0x2E, 0x33, 0x2E, 0x34, 0x2E, 0x32 
+              } );
 
         String decodedPdu = Strings.dumpBytes(stream.array());
         stream.flip();

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java?rev=1065732&r1=1065731&r2=1065732&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/ppolicy/PasswordPolicyResponseControlTest.java Mon Jan 31 19:57:17 2011
@@ -63,24 +63,8 @@ public class PasswordPolicyResponseContr
         assertEquals( 1, passwordPolicyResponse.getTimeBeforeExpiration() );
         assertEquals( 1, passwordPolicyResponse.getPasswordPolicyError().getValue() );
         
-        ByteBuffer buffer = ByteBuffer.allocate( 0x29 );
-        buffer.put( new byte[]
-               {
-                 0x30, 0x27,
-                  0x04, 0x19,
-                   '1','.', '3', '.', '6', '.', '1', '.', '4',
-                   '.', '1', '.', '4', '2', '.', '2', '.', '2',
-                   '7', '.', '8', '.', '5', '.', '1',
-                   0x04, 0x0A,
-                    0x30, 0x08,
-                     (byte)0xA0, 0x03,         // timeBeforeExpiration
-                            (byte)0x80, 0x01, 0x01, 
-                     (byte)0x81, 0x01, 0x01   // ppolicyError
-               } );
-        buffer.flip();
-        
         ByteBuffer encoded = ((PasswordPolicyResponseDecorator)passwordPolicyResponse).encode( ByteBuffer.allocate( ((PasswordPolicyResponseDecorator)passwordPolicyResponse).computeLength() ) );
-        assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+        assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
     }
     
 
@@ -106,24 +90,8 @@ public class PasswordPolicyResponseContr
         assertEquals( 1, passwordPolicyResponse.getGraceAuthNsRemaining() );
         assertEquals( 1, passwordPolicyResponse.getPasswordPolicyError().getValue() );
         
-        ByteBuffer buffer = ByteBuffer.allocate( 0x29 );
-        buffer.put( new byte[]
-               {
-                 0x30, 0x27,
-                  0x04, 0x19,
-                   '1','.', '3', '.', '6', '.', '1', '.', '4',
-                   '.', '1', '.', '4', '2', '.', '2', '.', '2',
-                   '7', '.', '8', '.', '5', '.', '1',
-                   0x04, 0x0A,
-                     0x30, 0x08,
-                       (byte)0xA0, 0x03,           // warning
-                         (byte)0x81, 0x01, 0x01,   // graceAuthNsRemaining
-                       (byte)0x81, 0x01, 0x01      // error
-               } );
-        buffer.flip();
-        
         ByteBuffer encoded = ((PasswordPolicyResponseDecorator)passwordPolicyResponse).encode( ByteBuffer.allocate( ((PasswordPolicyResponseDecorator)passwordPolicyResponse).computeLength() ) );
-        assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+        assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array())  );
     }
 
     
@@ -147,23 +115,8 @@ public class PasswordPolicyResponseContr
 
         assertEquals( 1, passwordPolicyResponse.getTimeBeforeExpiration() );
         
-        ByteBuffer buffer = ByteBuffer.allocate( 0x26 );
-        buffer.put( new byte[]
-               {
-                 0x30, 0x24,
-                  0x04, 0x19,
-                   '1','.', '3', '.', '6', '.', '1', '.', '4',
-                   '.', '1', '.', '4', '2', '.', '2', '.', '2',
-                   '7', '.', '8', '.', '5', '.', '1',
-                   0x04, 0x07,
-                    0x30, 0x05,
-                     (byte)0xA0, 0x03,
-                            (byte)0x80, 0x01, 0x01  // timeBeforeExpiration
-               } );
-        buffer.flip();
-        
         ByteBuffer encoded = ((PasswordPolicyResponseDecorator)passwordPolicyResponse).encode( ByteBuffer.allocate( ((PasswordPolicyResponseDecorator)passwordPolicyResponse).computeLength() ) );
-        assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+        assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
     }
     
 
@@ -187,23 +140,8 @@ public class PasswordPolicyResponseContr
 
         assertEquals( 1, passwordPolicyResponse.getGraceAuthNsRemaining() );
         
-        ByteBuffer buffer = ByteBuffer.allocate( 0x26 );
-        buffer.put( new byte[]
-               {
-                 0x30, 0x24,
-                  0x04, 0x19,
-                   '1','.', '3', '.', '6', '.', '1', '.', '4',
-                   '.', '1', '.', '4', '2', '.', '2', '.', '2',
-                   '7', '.', '8', '.', '5', '.', '1',
-                   0x04, 0x07,
-                    0x30, 0x05,
-                     (byte)0xA0, 0x03,
-                          (byte)0x81, 0x01, 0x01  // graceAuthNsRemaining
-               } );
-        buffer.flip();
-        
         ByteBuffer encoded = ((PasswordPolicyResponseDecorator)passwordPolicyResponse).encode( ByteBuffer.allocate( ((PasswordPolicyResponseDecorator)passwordPolicyResponse).computeLength() ) );
-        assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+        assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
     }
     
     
@@ -226,22 +164,8 @@ public class PasswordPolicyResponseContr
         
         assertEquals( 1, passwordPolicyResponse.getPasswordPolicyError().getValue() );
         
-        ByteBuffer buffer = ByteBuffer.allocate( 0x24 );
-        buffer.put( new byte[]
-               {
-                 0x30, 0x22,
-                  0x04, 0x19,
-                   '1','.', '3', '.', '6', '.', '1', '.', '4',
-                   '.', '1', '.', '4', '2', '.', '2', '.', '2',
-                   '7', '.', '8', '.', '5', '.', '1',
-                   0x04, 0x05,
-                     0x30, 0x03,
-                      (byte)0x81, 0x01, 0x01  // error
-               } );
-        buffer.flip();
-        
         ByteBuffer encoded = ((PasswordPolicyResponseDecorator)passwordPolicyResponse).encode( ByteBuffer.allocate( ((PasswordPolicyResponseDecorator)passwordPolicyResponse).computeLength() ) );
-        assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+        assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
     }
 
     
@@ -263,18 +187,7 @@ public class PasswordPolicyResponseContr
         
         assertNotNull( passwordPolicyResponse );
         
-        ByteBuffer buffer = ByteBuffer.allocate( 0x1D );
-        buffer.put( new byte[]
-               {
-                 0x30, 0x1B,
-                   0x04, 0x19,
-                     '1','.', '3', '.', '6', '.', '1', '.', '4',
-                     '.', '1', '.', '4', '2', '.', '2', '.', '2',
-                     '7', '.', '8', '.', '5', '.', '1',
-               } );
-        buffer.flip();
-        
         ByteBuffer encoded = ((PasswordPolicyResponseDecorator)passwordPolicyResponse).encode( ByteBuffer.allocate( ((PasswordPolicyResponseDecorator)passwordPolicyResponse).computeLength() ) );
-        assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+        assertEquals( "", Strings.dumpBytes( encoded.array() ) );
     }
 }

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=1065732&r1=1065731&r2=1065732&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 Jan 31 19:57:17 2011
@@ -77,25 +77,9 @@ public class SyncDoneValueControlTest
         // test encoding
         try
         {
-            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 = ((SyncDoneValueDecorator)control).encode( ByteBuffer.allocate( ((SyncDoneValueDecorator)control).computeLength() ) );
-            String expected = Strings.dumpBytes(buffer.array());
-            String decoded = Strings.dumpBytes(bb.array());
+            ByteBuffer buffer = ((SyncDoneValueDecorator)control).encode( ByteBuffer.allocate( ((SyncDoneValueDecorator)control).computeLength() ) );
+            String expected = Strings.dumpBytes( bb.array() );
+            String decoded = Strings.dumpBytes( buffer.array() );
             assertEquals( expected, decoded );
         }
         catch( EncoderException e )
@@ -114,7 +98,7 @@ public class SyncDoneValueControlTest
             { 
               0x30, 0x03, 
               // null cookie
-                0x01, 0x01, 0x10 // refreshDeletes flag TRUE
+                0x01, 0x01, (byte)0xFF // refreshDeletes flag TRUE
             } );
 
         bb.flip();
@@ -129,24 +113,9 @@ public class SyncDoneValueControlTest
         // test encoding
         try
         {
-            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 = ((SyncDoneValueDecorator)control).encode( ByteBuffer.allocate( ((SyncDoneValueDecorator)control).computeLength() ) );
-            String expected = Strings.dumpBytes(buffer.array());
-            String decoded = Strings.dumpBytes(bb.array());
+            ByteBuffer buffer = ((SyncDoneValueDecorator)control).encode( ByteBuffer.allocate( ((SyncDoneValueDecorator)control).computeLength() ) );
+            String expected = Strings.dumpBytes( bb.array() );
+            String decoded = Strings.dumpBytes( buffer.array() );
             assertEquals( expected, decoded );
         }
         catch( EncoderException e )
@@ -201,24 +170,9 @@ public class SyncDoneValueControlTest
         // test encoding
         try
         {
-            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 = ((SyncDoneValueDecorator)control).encode( ByteBuffer.allocate( ((SyncDoneValueDecorator)control).computeLength() ) );
-            String expected = Strings.dumpBytes(buffer.array());
-            String decoded = Strings.dumpBytes(bb.array());
-            assertEquals( expected, decoded );
+            ByteBuffer buffer = ((SyncDoneValueDecorator)control).encode( ByteBuffer.allocate( ((SyncDoneValueDecorator)control).computeLength() ) );
+            String decoded = Strings.dumpBytes( buffer.array() );
+            assertEquals( "0x30 0x00 ", decoded );
         }
         catch( Exception e )
         {

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=1065732&r1=1065731&r2=1065732&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 Jan 31 19:57:17 2011
@@ -78,22 +78,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -127,21 +113,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -183,23 +156,17 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x25 );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x07 );
             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,
+                  (byte)0xA1, 0x05,                  // syncInfoValue ::= CHOICE {
+                                                     //     refreshDelete [1] SEQUENCE {
+                    0x04, 0x03, 'a', 'b', 'c'        //         cookie       syncCookie OPTIONAL,
                 } );
             buffer.flip();
 
             ByteBuffer encoded = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( buffer.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -238,24 +205,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -293,23 +244,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -347,23 +283,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -399,21 +320,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -455,23 +363,17 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x25 );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x07 );
             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,
+                  (byte)0xA2, 0x05,                  // syncInfoValue ::= CHOICE {
+                                                     //     refreshPresent [2] SEQUENCE {
+                    0x04, 0x03, 'a', 'b', 'c'        //         cookie       syncCookie OPTIONAL,
                 } );
             buffer.flip();
 
             ByteBuffer encoded = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( buffer.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -510,24 +412,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -565,23 +451,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -619,23 +490,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -671,21 +527,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -854,23 +697,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -928,32 +756,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -974,7 +778,7 @@ public class SyncInfoValueControlTest
             { 
             (byte)0xA3, 0x07,               // syncInfoValue ::= CHOICE {
                                             //     syncIdSet [3] SEQUENCE {
-              0X04, 0X03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
+              0x04, 0x03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
               0x31, 0x00,                   //         syncUUIDs SET OF syncUUID
             } );
         bb.flip();
@@ -993,24 +797,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1031,7 +819,7 @@ public class SyncInfoValueControlTest
             { 
             (byte)0xA3, 0x3D,               // syncInfoValue ::= CHOICE {
                                             //     syncIdSet [3] SEQUENCE {
-              0X04, 0X03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
+              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,
@@ -1069,33 +857,8 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1116,7 +879,7 @@ public class SyncInfoValueControlTest
             { 
             (byte)0xA3, 0x05,               // syncInfoValue ::= CHOICE {
                                             //     syncIdSet [3] SEQUENCE {
-              0X01, 0X01, 0x10,             //         refreshDeletes BOOLEAN DEFAULT FALSE,
+              0x01, 0x01, 0x10,             //         refreshDeletes BOOLEAN DEFAULT FALSE,
               0x31, 0x00,                   //         syncUUIDs SET OF syncUUID
             } );
         bb.flip();
@@ -1135,24 +898,18 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x25 );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x07 );
             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,
+                        0x01, 0x01, (byte)0xFF,          //         refreshDeletes BOOLEAN DEFAULT FALSE,
                         0x31, 0x00,                      //         syncUUIDs SET OF syncUUID
                 } );
             buffer.flip();
 
             ByteBuffer encoded = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( buffer.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1173,7 +930,7 @@ public class SyncInfoValueControlTest
             { 
             (byte)0xA3, 0x3B,               // syncInfoValue ::= CHOICE {
                                             //     syncIdSet [3] SEQUENCE {
-              0X01, 0X01, 0x10,             //         refreshDeletes BOOLEAN DEFAULT FALSE,
+              0x01, 0x01, 0x10,             //         refreshDeletes BOOLEAN DEFAULT FALSE,
               0x31, 0x36,                   //         syncUUIDs SET OF syncUUID
                 0x04, 0x10,                 // syncUUID
                   0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
@@ -1211,33 +968,27 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x5B );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x3D );
             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
+                  (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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( buffer.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1258,7 +1009,7 @@ public class SyncInfoValueControlTest
             { 
             (byte)0xA3, 0x0A,               // syncInfoValue ::= CHOICE {
                                             //     syncIdSet [3] SEQUENCE {
-              0X04, 0X03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
+              0x04, 0x03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
               0x01, 0x01, 0x10,             //         refreshDeletes BOOLEAN DEFAULT FALSE,
               0x31, 0x00,                   //         syncUUIDs SET OF syncUUID
             } );
@@ -1278,25 +1029,19 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x2A );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x0C );
             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
+                  (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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( buffer.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1317,7 +1062,7 @@ public class SyncInfoValueControlTest
             { 
             (byte)0xA3, 0x40,               // syncInfoValue ::= CHOICE {
                                             //     syncIdSet [3] SEQUENCE {
-              0X04, 0X03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
+              0x04, 0x03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
               0x01, 0x01, 0x10,             //         refreshDeletes BOOLEAN DEFAULT FALSE,
               0x31, 0x36,                   //         syncUUIDs SET OF syncUUID
                 0x04, 0x10,                 // syncUUID
@@ -1356,34 +1101,28 @@ public class SyncInfoValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x60 );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x42 );
             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
+                (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 = ((SyncInfoValueDecorator)syncInfoValue).encode( ByteBuffer.allocate( ((SyncInfoValueDecorator)syncInfoValue).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( buffer.array() ), Strings.dumpBytes( encoded.array() ) );
         }
         catch ( EncoderException ee )
         {
@@ -1404,7 +1143,7 @@ public class SyncInfoValueControlTest
             { 
             (byte)0xA3, 0x1B,               // syncInfoValue ::= CHOICE {
                                             //     syncIdSet [3] SEQUENCE {
-              0X04, 0X03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
+              0x04, 0x03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
               0x01, 0x01, 0x10,             //         refreshDeletes BOOLEAN DEFAULT FALSE,
               0x31, 0x11,                   //         syncUUIDs SET OF syncUUID
                 0x04, 0x0F,                 // syncUUID
@@ -1441,7 +1180,7 @@ public class SyncInfoValueControlTest
             { 
             (byte)0xA3, 0x1E,               // syncInfoValue ::= CHOICE {
                                             //     syncIdSet [3] SEQUENCE {
-              0X04, 0X03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
+              0x04, 0x03, 'a', 'b', 'c',    //         cookie         syncCookie OPTIONAL,
               0x01, 0x01, 0x10,             //         refreshDeletes BOOLEAN DEFAULT FALSE,
               0x31, 0x13,                   //         syncUUIDs SET OF syncUUID
                 0x04, 0x11,                 // syncUUID

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java?rev=1065732&r1=1065731&r2=1065732&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java Mon Jan 31 19:57:17 2011
@@ -75,25 +75,8 @@ public class SyncModifyDnControlTest
         // Check the encoding
         try
         {
-
-            ByteBuffer buffer = ByteBuffer.allocate( 48 );
-            buffer.put( new byte[]
-                { 
-                  0x30, 0x2E,                            // Control
-                    0x04, 0x18,                          // OID (SuncStateValue)
-                      '1', '.', '3', '.', '6', '.', '1', '.', 
-                      '4', '.', '1', '.', '4', '2', '0', '3', 
-                      '.', '1', '.', '9', '.', '1', '.', '5',
-                     0x04, 0x12, 
-                     0x30, 0x10, 
-                      0x04, 0x07, 'u','i','d','=','j','i','m', //     entryDn entryDn
-                      ( byte )0x80, 0x05,                     //     move
-                      'o','u','=','d','c'         //     newSuperiorDn LDAPDN
-                } );
-            buffer.flip();
-
             ByteBuffer encoded = ((SyncModifyDnDecorator)syncmodDnControl).encode( ByteBuffer.allocate( ((SyncModifyDnDecorator)syncmodDnControl).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes(encoded.array()) );
         }
         catch ( EncoderException ee )
         {
@@ -127,26 +110,8 @@ public class SyncModifyDnControlTest
         // Check the encoding
         try
         {
-
-            ByteBuffer buffer = ByteBuffer.allocate( 53 );
-            buffer.put( new byte[]
-                { 
-                  0x30, 0x33,                            // Control
-                    0x04, 0x18,                          // OID (SuncStateValue)
-                      '1', '.', '3', '.', '6', '.', '1', '.', 
-                      '4', '.', '1', '.', '4', '2', '0', '3', 
-                      '.', '1', '.', '9', '.', '1', '.', '5',
-                      0x04, 0x17,
-                      0x30, 0x15,                                // SyncModifyDnControl ::= SEQUENCE {
-                      0x04, 0x07, 'u','i','d','=','j','i','m', //     entryDn LDAPDN
-                      ( byte )0x00A1, 0x0A,                    //     rename
-                        0x04, 0x05, 'u','i','d','=','j',       //     newRdn
-                        0x01, 0x01, ( byte ) 0xFF                       //     deleteOldRdn
-                } );
-            buffer.flip();
-
             ByteBuffer encoded = ((SyncModifyDnDecorator)syncmodDnControl).encode( ByteBuffer.allocate( ((SyncModifyDnDecorator)syncmodDnControl).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes(encoded.array()) );
                 }
         catch ( EncoderException ee )
         {
@@ -181,27 +146,8 @@ public class SyncModifyDnControlTest
         // Check the encoding
         try
         {
-
-            ByteBuffer buffer = ByteBuffer.allocate( 60 );
-            buffer.put( new byte[]
-                { 
-                  0x30, 0x3A,                            // Control
-                    0x04, 0x18,                          // OID (SuncStateValue)
-                      '1', '.', '3', '.', '6', '.', '1', '.', 
-                      '4', '.', '1', '.', '4', '2', '0', '3', 
-                      '.', '1', '.', '9', '.', '1', '.', '5',
-                      0x04, 0x1E,
-                      0x30, 0x1C,                                // SyncModifyDnControl ::= SEQUENCE {
-                      0x04, 0x07, 'u','i','d','=','j','i','m', //     entryDn LDAPDN
-                      ( byte )0x00A2, 0x11,                    //     rename
-                        0x04, 0x05, 'o','u','=','d','c',       //     newSuperiorDn
-                        0x04, 0x05, 'u','i','d','=','j',       //     newRdn
-                        0x01, 0x01, ( byte ) 0xFF                       //     deleteOldRdn
-                } );
-            buffer.flip();
-
             ByteBuffer encoded = ((SyncModifyDnDecorator)syncmodDnControl).encode( ByteBuffer.allocate( ((SyncModifyDnDecorator)syncmodDnControl).computeLength() ) );
-            assertEquals( Strings.dumpBytes(buffer.array()), Strings.dumpBytes(encoded.array()) );
+            assertEquals( Strings.dumpBytes( bb.array() ), Strings.dumpBytes(encoded.array()) );
                 }
         catch ( EncoderException ee )
         {

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=1065732&r1=1065731&r2=1065732&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 Jan 31 19:57:17 2011
@@ -82,26 +82,20 @@ public class SyncRequestValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
-            buffer.put( new byte[]
+            bb = ByteBuffer.allocate( 0x0A );
+            bb.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,
+                0x30, 0x08,                     // syncRequestValue ::= SEQUENCE {
+                  0x0A, 0x01, 0x01,             //     mode ENUMERATED {
+                                                //         refreshOnly (1)
+                                                //     }
+                  0x04, 0x03, 'a', 'b', 'c'     //     cookie syncCookie OPTIONAL,
                 } );
-            buffer.flip();
+            bb.flip();
 
-            bb = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
-            String decoded = Strings.dumpBytes(bb.array());
-            String expected = Strings.dumpBytes(buffer.array());
+            ByteBuffer buffer = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
+            String decoded = Strings.dumpBytes( bb.array()) ;
+            String expected = Strings.dumpBytes( buffer.array() );
             assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
@@ -140,26 +134,20 @@ public class SyncRequestValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x28 );
+            ByteBuffer buffer = ByteBuffer.allocate( 0x0A );
             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,
+                  0x30, 0x08,                        // syncRequestValue ::= SEQUENCE {
+                    0x0A, 0x01, 0x03,                //     mode ENUMERATED {
+                                                     //         refreshAndPersist (3)
+                                                     //     }
+                    0x04, 0x03, 'a', 'b', 'c'        //     cookie syncCookie OPTIONAL,
                 } );
             buffer.flip();
 
             bb = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
-            String decoded = Strings.dumpBytes(bb.array());
-            String expected = Strings.dumpBytes(buffer.array());
+            String decoded = Strings.dumpBytes( bb.array() );
+            String expected = Strings.dumpBytes( buffer.array() );
             assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
@@ -197,25 +185,19 @@ public class SyncRequestValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x23 );
-            buffer.put( new byte[]
+            bb = ByteBuffer.allocate( 0x05 );
+            bb.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)
-                                                         //     }
+                0x30, 0x03,                     // syncRequestValue ::= SEQUENCE {
+                  0x0A, 0x01, 0x03              //     mode ENUMERATED {
+                                                //         refreshAndPersist (3)
+                                                //     }
                 } );
-            buffer.flip();
-
-            bb = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
-            String decoded = Strings.dumpBytes(bb.array());
-            String expected = Strings.dumpBytes(buffer.array());
+            bb.flip();
+            
+            ByteBuffer buffer = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
+            String decoded = Strings.dumpBytes( buffer.array() );
+            String expected = Strings.dumpBytes( bb.array() );
             assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
@@ -232,8 +214,8 @@ public class SyncRequestValueControlTest
     @Test
     public void testDecodeSyncRequestValueControlNoCookieReloadHintTrue() throws Exception
     {
-        ByteBuffer bb = ByteBuffer.allocate( 0x08 );
-        bb.put( new byte[]
+        ByteBuffer buffer = ByteBuffer.allocate( 0x08 );
+        buffer.put( new byte[]
             { 
             0x30, 0x06,                     // syncRequestValue ::= SEQUENCE {
               0x0A, 0x01, 0x03,             //     mode ENUMERATED {
@@ -241,11 +223,11 @@ public class SyncRequestValueControlTest
                                             //     }
               0x01, 0x01, (byte)0xFF        //     reloadHint BOOLEAN DEFAULT FALSE
             } );
-        bb.flip();
+        buffer.flip();
 
         SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec );
         
-        ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( bb.array() );
+        ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( buffer.array() );
 
         assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
         assertNull( syncRequestValue.getCookie() );
@@ -254,26 +236,9 @@ public class SyncRequestValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
-            String decoded = Strings.dumpBytes(bb.array());
-            String expected = Strings.dumpBytes(buffer.array());
+            ByteBuffer bb = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
+            String decoded = Strings.dumpBytes( bb.array() );
+            String expected = Strings.dumpBytes( buffer.array() );
             assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
@@ -311,25 +276,9 @@ public class SyncRequestValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
-            String decoded = Strings.dumpBytes(bb.array());
-            String expected = Strings.dumpBytes(buffer.array());
+            ByteBuffer buffer = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
+            String decoded = Strings.dumpBytes( buffer.array() );
+            String expected = Strings.dumpBytes( bb.array() );
             assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
@@ -345,7 +294,7 @@ public class SyncRequestValueControlTest
     @Test
     public void testDecodeSyncRequestValueControlNoReloadHintSuccess() throws Exception
     {
-        ByteBuffer bb = ByteBuffer.allocate( 0x0D );
+        ByteBuffer bb = ByteBuffer.allocate( 0x0A );
         bb.put( new byte[]
             { 
             0x30, 0x08,                     // syncRequestValue ::= SEQUENCE {
@@ -367,26 +316,9 @@ public class SyncRequestValueControlTest
         // Check the encoding
         try
         {
-            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 = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
-            String decoded = Strings.dumpBytes(bb.array());
-            String expected = Strings.dumpBytes(buffer.array());
+            ByteBuffer buffer = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
+            String decoded = Strings.dumpBytes( buffer.array() );
+            String expected = Strings.dumpBytes( bb.array() );
             assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )
@@ -424,25 +356,19 @@ public class SyncRequestValueControlTest
         // Check the encoding
         try
         {
-            ByteBuffer buffer = ByteBuffer.allocate( 0x23 );
-            buffer.put( new byte[]
+            bb = ByteBuffer.allocate( 0x05 );
+            bb.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)
-                                                         //     }
+                0x30, 0x03,                     // syncRequestValue ::= SEQUENCE {
+                  0x0A, 0x01, 0x03              //     mode ENUMERATED {
+                                                //         refreshAndPersist (3)
+                                                //     }
                 } );
-            buffer.flip();
+            bb.flip();
 
-            bb = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
-            String decoded = Strings.dumpBytes(bb.array());
-            String expected = Strings.dumpBytes(buffer.array());
+            ByteBuffer buffer = ((SyncRequestValueDecorator)syncRequestValue).encode( ByteBuffer.allocate( ((SyncRequestValueDecorator)syncRequestValue).computeLength() ) );
+            String decoded = Strings.dumpBytes( buffer.array() );
+            String expected = Strings.dumpBytes( bb.array() );
             assertEquals( expected, decoded );
         }
         catch ( EncoderException ee )



Mime
View raw message