directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1664799 - in /directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl: StoreAssertionValue.java VirtualListViewRequestDecorator.java
Date Sat, 07 Mar 2015 06:29:34 GMT
Author: elecharny
Date: Sat Mar  7 06:29:34 2015
New Revision: 1664799

URL: http://svn.apache.org/r1664799
Log:
Many other fixes in the VLV codec implementation. tests are GOOD.

Modified:
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java?rev=1664799&r1=1664798&r2=1664799&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/StoreAssertionValue.java
Sat Mar  7 06:29:34 2015
@@ -20,7 +20,9 @@
 package org.apache.directory.api.ldap.extras.controls.vlv_impl;
 
 
-import org.apache.directory.api.asn1.actions.AbstractReadOctetString;
+import org.apache.directory.api.asn1.ber.grammar.GrammarAction;
+import org.apache.directory.api.asn1.ber.tlv.TLV;
+import org.apache.directory.api.util.Strings;
 
 
 /**
@@ -28,7 +30,7 @@ import org.apache.directory.api.asn1.act
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoreAssertionValue extends AbstractReadOctetString<VirtualListViewRequestContainer>
+public class StoreAssertionValue extends GrammarAction<VirtualListViewRequestContainer>
 {
 
     /**
@@ -36,7 +38,7 @@ public class StoreAssertionValue extends
      */
     public StoreAssertionValue()
     {
-        super( "VirtualListViewRequest offset" );
+        super( "VirtualListViewRequest assertionValue" );
     }
 
 
@@ -44,9 +46,20 @@ public class StoreAssertionValue extends
      * {@inheritDoc}
      */
     @Override
-    protected void setOctetString( byte[] value, VirtualListViewRequestContainer vlvContainer
)
+    public void action( VirtualListViewRequestContainer vlvContainer )
     {
-        vlvContainer.getDecorator().setAssertionValue( value );
+        TLV tlv = vlvContainer.getCurrentTLV();
+
+        if ( tlv.getLength() != 0 )
+        {
+            byte[] assertionValue = tlv.getValue().getData();
+
+            vlvContainer.getDecorator().setAssertionValue( assertionValue );
+        }
+        else
+        {
+            vlvContainer.getDecorator().setAssertionValue( Strings.EMPTY_BYTES );
+        }
 
         // The last element is optional, we can quit here
         vlvContainer.setGrammarEndAllowed( true );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java?rev=1664799&r1=1664798&r2=1664799&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java
(original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java
Sat Mar  7 06:29:34 2015
@@ -84,12 +84,14 @@ public class VirtualListViewRequestDecor
 
             if ( assertionValue != null )
             {
-                vlvSeqLength += 1 + TLV.getNbBytes( assertionValue.length ) + assertionValue.length;
+                targetSeqLength = 1 + TLV.getNbBytes( assertionValue.length ) + assertionValue.length;
             }
             else
             {
-                vlvSeqLength += 1 + 1;
+                targetSeqLength = 1 + 1;
             }
+
+            vlvSeqLength += targetSeqLength;
         }
 
         if ( getContextId() != null )
@@ -132,10 +134,19 @@ public class VirtualListViewRequestDecor
         else
         {
             buffer.put( ( byte ) VirtualListViewerTags.ASSERTION_VALUE_TAG.getValue() );
-            buffer.put( TLV.getBytes( targetSeqLength ) );
+            byte[] value = getAssertionValue();
+
+            if ( value != null )
+            {
+                buffer.put( TLV.getBytes( value.length ) );
+            }
+            else
+            {
+                buffer.put( TLV.getBytes( 0 ) );
+            }
 
-            // The by assertionValue values
-            BerValue.encode( buffer, getAssertionValue() );
+            // The by assertionValue value
+            buffer.put( value );
         }
 
         if ( getContextId() != null )
@@ -290,7 +301,7 @@ public class VirtualListViewRequestDecor
     @Override
     public byte[] getAssertionValue()
     {
-        return null;
+        return getDecorated().getAssertionValue();
     }
 
 
@@ -300,6 +311,7 @@ public class VirtualListViewRequestDecor
     @Override
     public void setAssertionValue( byte[] assertionValue )
     {
+        getDecorated().setAssertionValue( assertionValue );
     }
 
 



Mime
View raw message