directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1771898 - in /directory/shared/branches/shared-value/ldap/extras: codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/ codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/ codec/src/test/java/org/...
Date Tue, 29 Nov 2016 12:38:21 GMT
Author: elecharny
Date: Tue Nov 29 12:38:21 2016
New Revision: 1771898

URL: http://svn.apache.org/viewvc?rev=1771898&view=rev
Log:
Applied the DIRAPI-286 patch

Modified:
    directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
    directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncFlag.java
    directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java
    directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncDecorator.java
    directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncGrammar.java
    directory/shared/branches/shared-value/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java

Modified: directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java?rev=1771898&r1=1771897&r2=1771898&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
(original)
+++ directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSync.java
Tue Nov 29 12:38:21 2016
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.api.ldap.extras.controls.ad;
 
+import java.util.EnumSet;
+import java.util.Set;
 
 import org.apache.directory.api.ldap.model.message.Control;
 
@@ -39,9 +41,9 @@ import org.apache.directory.api.ldap.mod
  * 
  * Client side :
  * realReplControlValue ::= SEQUENCE {
- *     parentsFirst            integer
- *     maxReturnLength         integer
- *     cookie                  OCTET STRING
+ *     flags                 integer
+ *     maxBytes              integer
+ *     cookie                OCTET STRING
  * }
  * 
  * or
@@ -64,18 +66,6 @@ public interface AdDirSync extends Contr
 
 
     /**
-     * @return 1 if the parents are guaranteed to be returned before the children.
-     */
-    int getParentFirst();
-
-
-    /**
-     * @param parentFirst The parentFirst flag. A value of 1 will tell the server to return
the parents first.
-     */
-    void setParentFirst( int parentFirst );
-
-
-    /**
      * @return The maximum length of attributes to be returned
      */
     int getMaxReturnLength();
@@ -101,7 +91,7 @@ public interface AdDirSync extends Contr
 
 
     /**
-     * @return The flag returned by the server. One of :
+     * @return The flags returned by the server. Zero or more of :
      * <ul>
      * <li>LDAP_DIRSYNC_OBJECT_SECURITY (0x0001)</li>
      * <li>LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER (0x0800)</li>
@@ -109,11 +99,23 @@ public interface AdDirSync extends Contr
      * <li>LDAP_DIRSYNC_INCREMENTAL_VALUES (0x7FFFFFFF)</li>
      * </ul>
      */
-    AdDirSyncFlag getFlag();
+    Set<AdDirSyncFlag> getFlags();
+
+
+    /**
+     * @param flags The flags to be set. See {@link EnumSet} for how to generate EnumSets.
+     */
+    void setFlags( Set<AdDirSyncFlag> flags );
+
+
+    /**
+     * @param flag The flag to be added to the current collection of flags.
+     */
+    void addFlag( AdDirSyncFlag flag );
 
 
     /**
-     * @param flag The flag. 
+     * @param flag The flag to be removed from the current collection of flags. 
      */
-    void setFlag( AdDirSyncFlag flag );
+    void removeFlag( AdDirSyncFlag flag );
 }

Modified: directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncFlag.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncFlag.java?rev=1771898&r1=1771897&r2=1771898&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncFlag.java
(original)
+++ directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncFlag.java
Tue Nov 29 12:38:21 2016
@@ -19,6 +19,9 @@
  */
 package org.apache.directory.api.ldap.extras.controls.ad;
 
+import java.util.EnumSet;
+import java.util.Set;
+
 /**
  * The flags used in the AdDirSync response.
  *
@@ -26,19 +29,22 @@ package org.apache.directory.api.ldap.ex
  */
 public enum AdDirSyncFlag
 {
-    DEFAULT( 0x0000 ),
-    LDAP_DIRSYNC_OBJECT_SECURITY( 0x0001 ),
-    LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER( 0x0800 ),
-    LDAP_DIRSYNC_PUBLIC_DATA_ONLY( 0x2000 ),
-    LDAP_DIRSYNC_INCREMENTAL_VALUES( 0x7FFFFFFF );
+    LDAP_DIRSYNC_OBJECT_SECURITY( 0x0001, "Object Security" ),
+    LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER( 0x0800, "Ancestors First Order" ),
+    LDAP_DIRSYNC_PUBLIC_DATA_ONLY( 0x2000, "Public Data Only" ),
+    LDAP_DIRSYNC_INCREMENTAL_VALUES( 0x80000000, "Incremental Values" );
 
-    /** The interned value */
+    /** The int value */
     private int value;
+
+    /** The string description **/
+    private String description;
     
-    /** A private constructor that associates a value to each flag */
-    AdDirSyncFlag( int value )
+    /** A private constructor that associates a value and description to each flag */
+    AdDirSyncFlag( int value, String description )
     {
         this.value = value;
+        this.description = description;
     }
     
     
@@ -52,20 +58,48 @@ public enum AdDirSyncFlag
     
     
     /**
-     * Get back the flag associated with a given value
+     * @see Object#toString()
+     */
+    @Override
+    public String toString()
+    {
+        return this.description;
+    }
+
+
+    /**
+     * Get back the combination of flags associated with a given value
      * @param value The integer value
-     * @return The associated flag
+     * @return a set of all flags associated with the integer value
+     */
+    public static Set<AdDirSyncFlag> getFlags( int value )
+    {
+        EnumSet<AdDirSyncFlag> result = EnumSet.noneOf( AdDirSyncFlag.class );
+        for ( AdDirSyncFlag flag : EnumSet.allOf( AdDirSyncFlag.class ) )
+        {
+            if ( ( flag.getValue() & value ) == flag.getValue() )
+            {
+                result.add( flag );
+            }
+        }
+        return result;
+    }
+
+
+    /**
+     * Get back the bitmask (as an integer) associated with the given flags
+     * @param flags The AdDirSync flags
+     * @return a bitmask in integer form associated with the set of flags
      */
-    public static AdDirSyncFlag getFlag( int value )
+    public static int getBitmask( Set<AdDirSyncFlag> flags )
     {
-        switch ( value )
+        int mask = 0;
+        
+        for ( AdDirSyncFlag flag : flags )
         {
-            case 0x0000 : return DEFAULT;
-            case 0x0001 : return LDAP_DIRSYNC_OBJECT_SECURITY;
-            case 0x0800 : return LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER;
-            case 0x2000 : return LDAP_DIRSYNC_PUBLIC_DATA_ONLY;
-            case 0x7FFFFFFF : return LDAP_DIRSYNC_INCREMENTAL_VALUES;
-            default : return null;
+            mask += flag.getValue();
         }
+        
+        return mask;
     }
 }

Modified: directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java?rev=1771898&r1=1771897&r2=1771898&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java
(original)
+++ directory/shared/branches/shared-value/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncImpl.java
Tue Nov 29 12:38:21 2016
@@ -21,6 +21,8 @@
 package org.apache.directory.api.ldap.extras.controls.ad;
 
 import java.util.Arrays;
+import java.util.EnumSet;
+import java.util.Set;
 
 import org.apache.directory.api.ldap.model.message.controls.AbstractControl;
 import org.apache.directory.api.util.Strings;
@@ -32,14 +34,12 @@ import org.apache.directory.api.util.Str
  */
 public class AdDirSyncImpl extends AbstractControl implements AdDirSync
 {
-    /** A flag used to tell the server to return the parent before the children */
-    int parentFirst = 1;
-    
-    /** A flag used to indicate that there are more data to return */
-    AdDirSyncFlag flag = AdDirSyncFlag.DEFAULT;
+    /** Flags used to control return values (client-to-server) or indicate that there are
more data to return (server-to-client) */
+    private Set<AdDirSyncFlag> flags = EnumSet.noneOf( AdDirSyncFlag.class );
+     
 
     /** The maximum number of attributes to return */
-    int maxReturnLength = 0;
+    private int maxReturnLength = 0;
     
     /** The DirSync cookie */
     private byte[] cookie;
@@ -56,42 +56,47 @@ public class AdDirSyncImpl extends Abstr
     /**
      * {@inheritDoc}
      */
-    public int getParentFirst()
+    @Override
+    public Set<AdDirSyncFlag> getFlags()
     {
-        return parentFirst;
+        return flags;
     }
 
     
     /**
      * {@inheritDoc}
      */
-    public void setParentFirst( int parentFirst )
+    @Override
+    public void setFlags( Set<AdDirSyncFlag> flags )
     {
-        this.parentFirst = parentFirst;
+        this.flags = flags;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public AdDirSyncFlag getFlag()
+    @Override
+    public void addFlag( AdDirSyncFlag flag )
     {
-        return flag;
+        flags.add( flag );
     }
     
 
     /**
      * {@inheritDoc}
      */
-    public void setFlag( AdDirSyncFlag flag )
+    @Override
+    public void removeFlag( AdDirSyncFlag flag )
     {
-        this.flag = flag;
+        flags.remove( flag );
     }
 
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public int getMaxReturnLength()
     {
         return maxReturnLength;
@@ -101,6 +106,7 @@ public class AdDirSyncImpl extends Abstr
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setMaxReturnLength( int maxReturnLength )
     {
         this.maxReturnLength = maxReturnLength;
@@ -110,6 +116,7 @@ public class AdDirSyncImpl extends Abstr
     /**
      * {@inheritDoc}
      */
+    @Override
     public byte[] getCookie()
     {
         return cookie;
@@ -119,6 +126,7 @@ public class AdDirSyncImpl extends Abstr
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setCookie( byte[] cookie )
     {
         if ( cookie != null )
@@ -142,7 +150,7 @@ public class AdDirSyncImpl extends Abstr
         int h = 37;
 
         h = h * 17 + super.hashCode();
-        h = h * 17 + parentFirst;
+        h = h * 17 + AdDirSyncFlag.getBitmask( flags );
         h = h * 17 + maxReturnLength;
 
         if ( cookie != null )
@@ -176,7 +184,7 @@ public class AdDirSyncImpl extends Abstr
         AdDirSync otherControl = ( AdDirSync ) o;
 
         return ( maxReturnLength == otherControl.getMaxReturnLength() )
-            && ( parentFirst == otherControl.getParentFirst() )
+            && ( flags.equals( otherControl.getFlags() ) )
             && ( Arrays.equals( cookie, otherControl.getCookie() ) )
             && ( isCritical() == otherControl.isCritical() );
     }
@@ -193,7 +201,8 @@ public class AdDirSyncImpl extends Abstr
         sb.append( "    DirSync control :\n" );
         sb.append( "        oid : " ).append( getOid() ).append( '\n' );
         sb.append( "        critical : " ).append( isCritical() ).append( '\n' );
-        sb.append( "        parentFirst : '" ).append( getParentFirst() ).append( "'\n" );
+        sb.append( "        flags : 0x" ).append( Integer.toHexString( AdDirSyncFlag.getBitmask(
flags ) ) )
+                        .append( ' ' ).append( flags.toString() ).append( "\n" );
         sb.append( "        maxReturnLength : '" ).append( getMaxReturnLength() ).append(
"'\n" );
         sb.append( "        cookie            : '" ).append( Strings.dumpBytes( getCookie()
) ).append( "'\n" );
 

Modified: directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncDecorator.java?rev=1771898&r1=1771897&r2=1771898&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncDecorator.java
(original)
+++ directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncDecorator.java
Tue Nov 29 12:38:21 2016
@@ -20,6 +20,7 @@
 package org.apache.directory.api.ldap.extras.controls.ad_impl;
 
 import java.nio.ByteBuffer;
+import java.util.Set;
 
 import org.apache.directory.api.asn1.Asn1Object;
 import org.apache.directory.api.asn1.DecoderException;
@@ -77,9 +78,9 @@ public class AdDirSyncDecorator extends
      * {@inheritDoc}
      */
     @Override
-    public int getParentFirst()
+    public Set<AdDirSyncFlag> getFlags()
     {
-        return getDecorated().getParentFirst();
+        return getDecorated().getFlags();
     }
 
     
@@ -87,9 +88,9 @@ public class AdDirSyncDecorator extends
      * {@inheritDoc}
      */
     @Override
-    public void setParentFirst( int parentFirst )
+    public void setFlags( Set<AdDirSyncFlag> flags )
     {
-        getDecorated().setParentFirst( parentFirst );
+        getDecorated().setFlags( flags );
     }
     
     
@@ -97,9 +98,9 @@ public class AdDirSyncDecorator extends
      * {@inheritDoc}
      */
     @Override
-    public AdDirSyncFlag getFlag()
+    public void addFlag( AdDirSyncFlag flag )
     {
-        return getDecorated().getFlag();
+        getDecorated().addFlag( flag );
     }
 
     
@@ -107,9 +108,9 @@ public class AdDirSyncDecorator extends
      * {@inheritDoc}
      */
     @Override
-    public void setFlag( AdDirSyncFlag flag )
+    public void removeFlag( AdDirSyncFlag flag )
     {
-        getDecorated().setFlag( flag );
+        getDecorated().removeFlag( flag );
     }
 
     
@@ -168,7 +169,7 @@ public class AdDirSyncDecorator extends
      * <pre>
      * 0x30 L1
      * |
-     * +--&gt; 0x02 0x0(1-4) nnn  (parentFirst)
+     * +--&gt; 0x02 0x0(1-4) nnn  (flags)
      * +--&gt; 0x02 0x0(1-4) nnn  (maxReturnLength)
      * +--&gt; 0x04 L2 xkcd!!!...     (cookie)
      * </pre>
@@ -176,11 +177,13 @@ public class AdDirSyncDecorator extends
     @Override
     public int computeLength()
     {
-        // the parentFirst flag length
-        adDirSyncLength = 1 + TLV.getNbBytes( getParentFirst() ) + BerValue.getNbBytes( getParentFirst()
);
+        // the flags length
+        int flagsLength = BerValue.getNbBytes( AdDirSyncFlag.getBitmask( getFlags() ) );
+        adDirSyncLength = 1 + TLV.getNbBytes( flagsLength ) + flagsLength;
 
         // the maxReturnLength length
-        adDirSyncLength += 1 + TLV.getNbBytes( getMaxReturnLength() ) + BerValue.getNbBytes(
getMaxReturnLength() );
+        int maxReturnLengthLength = BerValue.getNbBytes( getMaxReturnLength() );
+        adDirSyncLength += 1 + TLV.getNbBytes( maxReturnLengthLength ) + maxReturnLengthLength;
 
         // cookie's length
         byte[] cookie = getCookie();
@@ -220,8 +223,8 @@ public class AdDirSyncDecorator extends
         buffer.put( UniversalTag.SEQUENCE.getValue() );
         buffer.put( TLV.getBytes( adDirSyncLength ) );
 
-        // Encode the ParentFirst flag
-        BerValue.encode( buffer, getParentFirst() );
+        // Encode the flags
+        BerValue.encode( buffer, AdDirSyncFlag.getBitmask( getFlags() ) );
 
         // Encode the MaxReturnLength
         BerValue.encode( buffer, getMaxReturnLength() );
@@ -250,8 +253,8 @@ public class AdDirSyncDecorator extends
                 buffer.put( UniversalTag.SEQUENCE.getValue() );
                 buffer.put( TLV.getBytes( adDirSyncLength ) );
 
-                // Encode the ParentFirst flag
-                BerValue.encode( buffer, getParentFirst() );
+                // Encode the Flags flag
+                BerValue.encode( buffer, AdDirSyncFlag.getBitmask( getFlags() ) );
 
                 // Encode the MaxReturnLength
                 BerValue.encode( buffer, getMaxReturnLength() );

Modified: directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncGrammar.java?rev=1771898&r1=1771897&r2=1771898&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncGrammar.java
(original)
+++ directory/shared/branches/shared-value/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncGrammar.java
Tue Nov 29 12:38:21 2016
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.api.ldap.extras.controls.ad_impl;
 
+import java.util.Set;
 
 import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.ber.grammar.AbstractGrammar;
@@ -117,9 +118,9 @@ public final class AdDirSyncGrammar exte
                         {
                             int flagValue = IntegerDecoder.parse( value );
                             
-                            AdDirSyncFlag flag = AdDirSyncFlag.getFlag( flagValue );
+                            Set<AdDirSyncFlag> flags = AdDirSyncFlag.getFlags( flagValue
);
                             
-                            if ( flag == null )
+                            if ( flags == null )
                             {
                                 String msg = "Error while decoding the AdDirSync flag, unknown
value : " + flagValue;
                                 LOG.error( msg );
@@ -128,10 +129,10 @@ public final class AdDirSyncGrammar exte
                             
                             if ( IS_DEBUG )
                             {
-                                LOG.debug( "flag = {}", flagValue );
+                                LOG.debug( "flags = {}", flags.toString() );
                             }
                             
-                            container.getAdDirSyncControl().setFlag( flag );
+                            container.getAdDirSyncControl().setFlags( flags );
                         }
                         catch ( IntegerDecoderException ide )
                         {

Modified: directory/shared/branches/shared-value/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java?rev=1771898&r1=1771897&r2=1771898&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java
(original)
+++ directory/shared/branches/shared-value/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/controls/ad/AdDirSyncControlTest.java
Tue Nov 29 12:38:21 2016
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.fail;
 
 import java.nio.ByteBuffer;
+import java.util.EnumSet;
 
 import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.EncoderException;
@@ -50,12 +51,12 @@ public class AdDirSyncControlTest extend
     @Test
     public void testAdDirSyncControl() throws Exception
     {
-        ByteBuffer bb = ByteBuffer.allocate( 0x0E );
+        ByteBuffer bb = ByteBuffer.allocate( 0x0F );
 
         bb.put( new byte[]
             {
-                0x30, 0x0C,
-                  0x02, 0x01, 0x01,  // flag (LDAP_DIRSYNC_OBJECT_SECURITY)
+                0x30, 0x0D,
+                  0x02, 0x02, 0x08, 0x01,  // flag (LDAP_DIRSYNC_OBJECT_SECURITY, LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER)
                   0x02, 0x01, 0x00,  // maxReturnLength (no limit)
                   0x04, 0x04, 'x', 'k', 'c', 'd' // the cookie 
         } );
@@ -66,18 +67,19 @@ public class AdDirSyncControlTest extend
 
         AdDirSync adDirSync = ( AdDirSync ) ( ( AdDirSyncDecorator ) decorator ).decode(
bb.array() );
 
-        assertEquals( AdDirSyncFlag.LDAP_DIRSYNC_OBJECT_SECURITY, adDirSync.getFlag() );
+        assertEquals( EnumSet.of( 
+            AdDirSyncFlag.LDAP_DIRSYNC_OBJECT_SECURITY, 
+            AdDirSyncFlag.LDAP_DIRSYNC_ANCESTORS_FIRST_ORDER ), 
+            adDirSync.getFlags() );
         assertEquals( 0, adDirSync.getMaxReturnLength() );
         assertEquals( "xkcd", Strings.utf8ToString( adDirSync.getCookie() ) );
 
         // test encoding
-        adDirSync.setParentFirst( 1 );
-        
         try
         {
             ByteBuffer buffer = ( ( AdDirSyncDecorator ) adDirSync ).encode( ByteBuffer
                 .allocate( ( ( AdDirSyncDecorator ) adDirSync ).computeLength() ) );
-            String expected = "0x30 0x0C 0x02 0x01 0x01 0x02 0x01 0x00 0x04 0x04 0x78 0x6B
0x63 0x64 ";
+            String expected = "0x30 0x0D 0x02 0x02 0x08 0x01 0x02 0x01 0x00 0x04 0x04 0x78
0x6B 0x63 0x64 ";
             String decoded = Strings.dumpBytes( buffer.array() );
             assertEquals( expected, decoded );
         }
@@ -107,13 +109,11 @@ public class AdDirSyncControlTest extend
 
         AdDirSync adDirSync = ( AdDirSync ) ( ( AdDirSyncDecorator ) decorator ).decode(
bb.array() );
 
-        assertEquals( AdDirSyncFlag.LDAP_DIRSYNC_OBJECT_SECURITY, adDirSync.getFlag() );
+        assertEquals( EnumSet.of( AdDirSyncFlag.LDAP_DIRSYNC_OBJECT_SECURITY ), adDirSync.getFlags()
);
         assertEquals( 0, adDirSync.getMaxReturnLength() );
         assertEquals( "", Strings.utf8ToString( adDirSync.getCookie() ) );
 
         // test encoding
-        adDirSync.setParentFirst( 1 );
-
         try
         {
             ByteBuffer buffer = ( ( AdDirSyncDecorator ) adDirSync ).encode( ByteBuffer



Mime
View raw message