You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2018/12/17 14:01:00 UTC
[directory-ldap-api] branch master updated: o Don't write Decorated
messages anymore o Minor cleanups
This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git
The following commit(s) were added to refs/heads/master by this push:
new d4c1805 o Don't write Decorated messages anymore o Minor cleanups
d4c1805 is described below
commit d4c180562f15e754e0800058e55542b8a366d8e8
Author: elecharny <el...@emmanuels-mbp.home>
AuthorDate: Mon Dec 17 07:09:48 2018 +0100
o Don't write Decorated messages anymore
o Minor cleanups
---
.../ldap/client/api/LdapNetworkConnection.java | 33 ++++++++--------------
.../directory/api/ldap/codec/LdapControlTest.java | 7 +++--
.../ldap/model/message/ExtendedResponseImpl.java | 3 --
3 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
index 36c250b..7ea74ae 100644
--- a/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
+++ b/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
@@ -64,15 +64,6 @@ import org.apache.directory.api.ldap.codec.api.LdapDecoder;
import org.apache.directory.api.ldap.codec.api.LdapMessageContainer;
import org.apache.directory.api.ldap.codec.api.MessageEncoderException;
import org.apache.directory.api.ldap.codec.api.SchemaBinaryAttributeDetector;
-import org.apache.directory.api.ldap.codec.decorators.AbandonRequestDecorator;
-import org.apache.directory.api.ldap.codec.decorators.AddRequestDecorator;
-import org.apache.directory.api.ldap.codec.decorators.BindRequestDecorator;
-import org.apache.directory.api.ldap.codec.decorators.CompareRequestDecorator;
-import org.apache.directory.api.ldap.codec.decorators.DeleteRequestDecorator;
-import org.apache.directory.api.ldap.codec.decorators.ModifyDnRequestDecorator;
-import org.apache.directory.api.ldap.codec.decorators.ModifyRequestDecorator;
-import org.apache.directory.api.ldap.codec.decorators.SearchRequestDecorator;
-import org.apache.directory.api.ldap.codec.decorators.UnbindRequestDecorator;
import org.apache.directory.api.ldap.extras.extended.startTls.StartTlsRequestImpl;
import org.apache.directory.api.ldap.model.constants.LdapConstants;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
@@ -1143,7 +1134,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
addToFutureMap( newId, addFuture );
// Send the request to the server
- writeRequest( new AddRequestDecorator( codec, addRequest ) );
+ writeRequest( addRequest );
// Ok, done return the future
return addFuture;
@@ -1215,7 +1206,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
abandonRequest.setMessageId( newId );
// Send the request to the server
- ldapSession.write( new AbandonRequestDecorator( codec, abandonRequest ) );
+ ldapSession.write( abandonRequest );
// remove the associated listener if any
int abandonId = abandonRequest.getAbandoned();
@@ -1561,7 +1552,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
addToFutureMap( newId, bindFuture );
- writeRequest( new BindRequestDecorator( codec, bindRequest ) );
+ writeRequest( bindRequest );
// Ok, done return the future
return bindFuture;
@@ -2267,7 +2258,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
addToFutureMap( searchRequest.getMessageId(), searchFuture );
// Send the request to the server
- writeRequest( new SearchRequestDecorator( codec, searchRequest ) );
+ writeRequest( searchRequest );
// Check that the future hasn't be canceled
if ( searchFuture.isCancelled() )
@@ -2334,7 +2325,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
// Send the request to the server
// Use this for logging instead: WriteFuture unbindFuture = ldapSession.write( unbindRequest )
- WriteFuture unbindFuture = ldapSession.write( new UnbindRequestDecorator( codec, unbindRequest ) );
+ WriteFuture unbindFuture = ldapSession.write( unbindRequest );
unbindFuture.awaitUninterruptibly( timeout );
@@ -3020,7 +3011,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
addToFutureMap( newId, modifyFuture );
// Send the request to the server
- writeRequest( new ModifyRequestDecorator( codec, modRequest ) );
+ writeRequest( modRequest );
// Ok, done return the future
return modifyFuture;
@@ -3422,7 +3413,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
addToFutureMap( newId, modifyDnFuture );
// Send the request to the server
- writeRequest( new ModifyDnRequestDecorator( codec, modDnRequest ) );
+ writeRequest( modDnRequest );
// Ok, done return the future
return modifyDnFuture;
@@ -3635,7 +3626,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
addToFutureMap( newId, deleteFuture );
// Send the request to the server
- writeRequest( new DeleteRequestDecorator( codec, deleteRequest ) );
+ writeRequest( deleteRequest );
// Ok, done return the future
return deleteFuture;
@@ -3847,7 +3838,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
addToFutureMap( newId, compareFuture );
// Send the request to the server
- writeRequest( new CompareRequestDecorator( codec, compareRequest ) );
+ writeRequest( compareRequest );
// Ok, done return the future
return compareFuture;
@@ -4821,7 +4812,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
// Stores the challenge's response, and send it to the server
bindRequest.setCredentials( challengeResponse );
- writeRequest( new BindRequestDecorator( codec, bindRequest ) );
+ writeRequest( bindRequest );
// Get the server's response, blocking
bindResponse = bindFuture.get( timeout, TimeUnit.MILLISECONDS );
@@ -4851,7 +4842,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
bindRequestCopy.setVersion3( bindRequest.getVersion3() );
bindRequestCopy.addAllControls( bindRequest.getControls().values().toArray( new Control[0] ) );
- writeRequest( new BindRequestDecorator( codec, bindRequestCopy ) );
+ writeRequest( bindRequestCopy );
bindResponse = bindFuture.get( timeout, TimeUnit.MILLISECONDS );
@@ -4889,7 +4880,7 @@ public class LdapNetworkConnection extends AbstractLdapConnection implements Lda
addToFutureMap( newId, bindFuture );
- writeRequest( new BindRequestDecorator( codec, bindRequest ) );
+ writeRequest( bindRequest );
bindResponse = bindFuture.get( timeout, TimeUnit.MILLISECONDS );
diff --git a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/LdapControlTest.java b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/LdapControlTest.java
index 961ad0b..66aaf08 100644
--- a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/LdapControlTest.java
+++ b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/LdapControlTest.java
@@ -32,6 +32,7 @@ import org.apache.directory.api.asn1.DecoderException;
import org.apache.directory.api.asn1.EncoderException;
import org.apache.directory.api.asn1.ber.Asn1Container;
import org.apache.directory.api.asn1.ber.Asn1Decoder;
+import org.apache.directory.api.asn1.util.Asn1Buffer;
import org.apache.directory.api.ldap.codec.api.AbstractMessageDecorator;
import org.apache.directory.api.ldap.codec.api.CodecControl;
import org.apache.directory.api.ldap.codec.api.LdapEncoder;
@@ -171,7 +172,8 @@ public class LdapControlTest extends AbstractCodecServiceTest
internalAbandonRequest.addControl( control );
// Check the encoding
- ByteBuffer bb = LdapEncoder.encodeMessage( codec, new AbandonRequestDecorator( codec, internalAbandonRequest ) );
+ Asn1Buffer buffer = new Asn1Buffer();
+ ByteBuffer bb = LdapEncoder.encodeMessageReverse( buffer, codec, internalAbandonRequest );
// Check the length
assertEquals( 0x9C, bb.limit() );
@@ -229,7 +231,8 @@ public class LdapControlTest extends AbstractCodecServiceTest
assertEquals( 0, controls.size() );
// Check the encoding
- ByteBuffer bb = LdapEncoder.encodeMessage( codec, new AbandonRequestDecorator( codec, internalAbandonRequest ) );
+ Asn1Buffer buffer = new Asn1Buffer();
+ ByteBuffer bb = LdapEncoder.encodeMessageReverse( buffer, codec, internalAbandonRequest );
// Check the length, which should be 2 bytes shorter, as we don't encode teh empty control
assertEquals( 0x08, bb.limit() );
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ExtendedResponseImpl.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ExtendedResponseImpl.java
index 0ee2278..6be87cf 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ExtendedResponseImpl.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/ExtendedResponseImpl.java
@@ -32,9 +32,6 @@ public class ExtendedResponseImpl extends AbstractResultResponse implements Exte
/** Object identifier for the extended response */
protected String responseName;
- /** The ResponseValue part of the extended response */
- //protected byte[] responseValue;
-
/** Extended response message type enumeration value */
private static final MessageTypeEnum TYPE = MessageTypeEnum.EXTENDED_RESPONSE;