directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r941683 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/ test/java/org/apache/directory/shared/ldap/codec/controls/replication/
Date Thu, 06 May 2010 11:54:10 GMT
Author: kayyagari
Date: Thu May  6 11:54:10 2010
New Revision: 941683

URL: http://svn.apache.org/viewvc?rev=941683&view=rev
Log:
o removed an extra tag written for MOVE operation
o fixed the test case

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncModifyDnControlTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java?rev=941683&r1=941682&r2=941683&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncmodifydn/SyncModifyDnControl.java
Thu May  6 11:54:10 2010
@@ -26,6 +26,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.codec.EncoderException;
+import org.apache.directory.shared.asn1.util.Asn1StringUtils;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.controls.AbstractControl;
 import org.apache.directory.shared.ldap.message.control.replication.SyncModifyDnType;
@@ -66,7 +67,6 @@ public class SyncModifyDnControl extends
     /** global length for the control */
     private int syncModDnSeqLength;
 
-    private int moveLen = 0;
     private int renameLen = 0;
     private int moveAndRenameLen = 0;
 
@@ -104,8 +104,8 @@ public class SyncModifyDnControl extends
         switch ( modDnType )
         {
             case MOVE:
-                moveLen = 1 + TLV.getNbBytes( newSuperiorDn.length() ) + newSuperiorDn.length();
-                syncModDnSeqLength += 1 + TLV.getNbBytes( moveLen ) + moveLen;
+                int moveLen = 1 + TLV.getNbBytes( newSuperiorDn.length() ) + newSuperiorDn.length();
+                syncModDnSeqLength += moveLen; //1 + TLV.getNbBytes( moveLen ) + moveLen;
                 break;
 
             case RENAME:
@@ -165,8 +165,8 @@ public class SyncModifyDnControl extends
         {
             case MOVE:
                 buffer.put( ( byte ) SyncModifyDnControlTags.MOVE_TAG.getValue() );
-                buffer.put( TLV.getBytes( moveLen ) );
-                Value.encode( buffer, newSuperiorDn );
+                buffer.put( TLV.getBytes( newSuperiorDn.length() ) );
+                buffer.put( Asn1StringUtils.getBytesUtf8( newSuperiorDn ) );
                 break;
 
             case RENAME:
@@ -212,8 +212,8 @@ public class SyncModifyDnControl extends
                 {
                     case MOVE:
                         buffer.put( ( byte ) SyncModifyDnControlTags.MOVE_TAG.getValue()
);
-                        buffer.put( TLV.getBytes( moveLen ) );
-                        Value.encode( buffer, newSuperiorDn );
+                        buffer.put( TLV.getBytes( newSuperiorDn.length() ) );
+                        buffer.put( Asn1StringUtils.getBytesUtf8( newSuperiorDn ) );
                         break;
 
                     case RENAME:

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=941683&r1=941682&r2=941683&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
Thu May  6 11:54:10 2010
@@ -81,19 +81,18 @@ public class SyncModifyDnControlTest
         try
         {
 
-            ByteBuffer buffer = ByteBuffer.allocate( 50 );
+            ByteBuffer buffer = ByteBuffer.allocate( 48 );
             buffer.put( new byte[]
                 { 
-                  0x30, 0x30,                            // Control
+                  0x30, 0x2E,                            // Control
                     0x04, 0x18,                          // OID (SuncStateValue)
                       '1', '.', '3', '.', '6', '.', '1', '.', 
                       '4', '.', '1', '.', '4', '2', '0', '3', 
                       '.', '1', '.', '9', '.', '1', '.', '5',
-                     0x04, 0x14, 
-                     0x30, 0x12, 
+                     0x04, 0x12, 
+                     0x30, 0x10, 
                       0x04, 0x07, 'u','i','d','=','j','i','m', //     entryDn entryDn
-                      ( byte )0x80, 0x07,                     //     move
-                    0x04, 0x05,
+                      ( byte )0x80, 0x05,                     //     move
                       'o','u','=','d','c'         //     newSuperiorDn LDAPDN
                 } );
             buffer.flip();



Mime
View raw message