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/01/23 23:42:11 UTC
[directory-ldap-api] branch master updated: o Removed the useless
LDAP_ENCODER/LDAP_DECODER variables in LdapProtocolCodecFactory. Same thing
with the MAX_PDU_SIZE o Removed the EncoderException from the
PasswordModifyRequestDecorator/PasswordModifyResponseDecorator o Fixed the
code and tests acordingly o Added some Javadoc o Removed the useless
setResponseValue() method from the StartTlsResponseDecorator class o Added
the startTransaction extended operation
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 58610c7 o Removed the useless LDAP_ENCODER/LDAP_DECODER variables in LdapProtocolCodecFactory. Same thing with the MAX_PDU_SIZE o Removed the EncoderException from the PasswordModifyRequestDecorator/PasswordModifyResponseDecorator o Fixed the code and tests acordingly o Added some Javadoc o Removed the useless setResponseValue() method from the StartTlsResponseDecorator class o Added the startTransaction extended operation
58610c7 is described below
commit 58610c7acc72ba912e745f46f695602fb09fe3e3
Author: Emmanuel Lécharny <el...@symas.com>
AuthorDate: Wed Jan 24 00:41:56 2018 +0100
o Removed the useless LDAP_ENCODER/LDAP_DECODER variables in
LdapProtocolCodecFactory. Same thing with the MAX_PDU_SIZE
o Removed the EncoderException from the
PasswordModifyRequestDecorator/PasswordModifyResponseDecorator
o Fixed the code and tests acordingly
o Added some Javadoc
o Removed the useless setResponseValue() method from the
StartTlsResponseDecorator class
o Added the startTransaction extended operation
---
.../ldap/extras/extended/cancel/CancelRequest.java | 8 +-
.../extras/extended/cancel/CancelResponse.java | 3 +-
.../StartTransactionRequest.java} | 32 ++--
.../StartTransactionRequestImpl.java | 77 +++++++++
.../StartTransactionResponse.java} | 26 ++-
.../StartTransactionResponseImpl.java | 191 +++++++++++++++++++++
.../pwdModify/PasswordModifyRequestDecorator.java | 13 +-
.../pwdModify/PasswordModifyResponseDecorator.java | 13 +-
.../startTls/StartTlsResponseDecorator.java | 9 -
.../startTransaction/StartTransactionFactory.java | 123 +++++++++++++
.../StartTransactionRequestDecorator.java} | 40 ++---
.../StartTransactionResponseDecorator.java} | 21 ++-
.../ads_impl/cancel/CancelRequestTest.java | 2 +-
.../pwdModify/PasswordModifyRequestTest.java | 183 +++++---------------
.../pwdModify/PasswordModifyResponseTest.java | 42 +----
.../protocol/mina/LdapProtocolCodecFactory.java | 9 -
16 files changed, 519 insertions(+), 273 deletions(-)
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequest.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequest.java
index 392f447..9352f0f 100644
--- a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequest.java
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequest.java
@@ -24,7 +24,13 @@ import org.apache.directory.api.ldap.model.message.ExtendedRequest;
/**
- * The CancelRequest interface.
+ * The CancelRequest interface, as described in RFC 3909 :
+ *
+ * <pre>
+ * cancelRequestValue ::= SEQUENCE {
+ * cancelID MessageID
+ * -- MessageID is as defined in [RFC2251]
+ * </pre>
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelResponse.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelResponse.java
index 4b0e4a2..c48311f 100644
--- a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelResponse.java
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelResponse.java
@@ -24,7 +24,8 @@ import org.apache.directory.api.ldap.model.message.ExtendedResponse;
/**
- * The interface for Cancel ExtendedResponses.
+ * The interface for Cancel ExtendedResponse, as defined in RFC 3909. The responseName
+ * and responseValue are absent.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequest.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionRequest.java
similarity index 62%
copy from ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequest.java
copy to ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionRequest.java
index 392f447..51e07b0 100644
--- a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelRequest.java
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionRequest.java
@@ -17,33 +17,27 @@
* under the License.
*
*/
-package org.apache.directory.api.ldap.extras.extended.cancel;
+package org.apache.directory.api.ldap.extras.extended.startTransaction;
import org.apache.directory.api.ldap.model.message.ExtendedRequest;
/**
- * The CancelRequest interface.
+ * The TransactionRequest interface. This is for the RFC 5805 Start Transaction Request,
+ * which grammar is :
+ * <pre>
+ * ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ * requestName [0] LDAPOID,
+ * requestValue [1] OCTET STRING OPTIONAL }
+ * </pre>
+ *
+ * where 'requestName' is 1.3.6.1.1.21.1 and requestValue is absent.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface CancelRequest extends ExtendedRequest
+public interface StartTransactionRequest extends ExtendedRequest
{
- /** The OID for the Cancel extended operation request. */
- String EXTENSION_OID = "1.3.6.1.1.8";
-
-
- /**
- * @return The id of the Message to cancel.
- */
- int getCancelId();
-
-
- /**
- * Sets the message to cancel by id.
- *
- * @param cancelId The id of the message to cancel.
- */
- void setCancelId( int cancelId );
+ /** The OID for the Transaction extended operation request. */
+ String EXTENSION_OID = "1.3.6.1.1.21.1";
}
\ No newline at end of file
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionRequestImpl.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionRequestImpl.java
new file mode 100644
index 0000000..1b2038c
--- /dev/null
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionRequestImpl.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.api.ldap.extras.extended.startTransaction;
+
+
+import org.apache.directory.api.ldap.model.message.AbstractExtendedRequest;
+
+
+/**
+ * Implement the extended Start Transaction Request as described in RFC 5805.
+ *
+ * It's grammar is :
+ *
+ * <pre>
+ * ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
+ * requestName [0] LDAPOID,
+ * requestValue [1] OCTET STRING OPTIONAL }
+ * </pre>
+ *
+ * where 'requestName' is 1.3.6.1.1.21.1 and requestValue is absent.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StartTransactionRequestImpl extends AbstractExtendedRequest implements StartTransactionRequest
+{
+ /**
+ * Creates a new instance of StartTransactionRequestImpl.
+ *
+ * @param messageId the message id
+ */
+ public StartTransactionRequestImpl( int messageId )
+ {
+ super( messageId );
+ setRequestName( EXTENSION_OID );
+ }
+
+
+ /**
+ * Creates a new instance of StartTransactionRequestImpl.
+ */
+ public StartTransactionRequestImpl()
+ {
+ setRequestName( EXTENSION_OID );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StartTransactionResponse getResultResponse()
+ {
+ if ( getResponse() == null )
+ {
+ setResponse( new StartTransactionResponseImpl() );
+ }
+
+ return ( StartTransactionResponse ) getResponse();
+ }
+}
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelResponse.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionResponse.java
similarity index 54%
copy from ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelResponse.java
copy to ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionResponse.java
index 4b0e4a2..0c9fdbe 100644
--- a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/cancel/CancelResponse.java
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionResponse.java
@@ -17,19 +17,35 @@
* under the License.
*
*/
-package org.apache.directory.api.ldap.extras.extended.cancel;
+package org.apache.directory.api.ldap.extras.extended.startTransaction;
import org.apache.directory.api.ldap.model.message.ExtendedResponse;
/**
- * The interface for Cancel ExtendedResponses.
+ * The interface for Start Transaction Extended Response. It's described in RFC 5805 :
+ *
+ * <pre>
+ * ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * responseName [10] LDAPOID OPTIONAL,
+ * responseValue [11] OCTET STRING OPTIONAL }
+ * </pre>
+ *
+ * where the responseName is not present, and the responseValue contain
+ * a transaction identifier when the result is SUCCESS.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface CancelResponse extends ExtendedResponse
+public interface StartTransactionResponse extends ExtendedResponse
{
- /** The OID for the Cancel extended operation request. */
- String EXTENSION_OID = CancelRequest.EXTENSION_OID;
+ /** The OID for the Start Transaction extended operation response. */
+ String EXTENSION_OID = StartTransactionRequest.EXTENSION_OID;
+
+
+ /**
+ * @return The transaction ID if success
+ */
+ byte[] getTransactionId();
}
\ No newline at end of file
diff --git a/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionResponseImpl.java b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionResponseImpl.java
new file mode 100644
index 0000000..61f8f2f
--- /dev/null
+++ b/ldap/extras/codec-api/src/main/java/org/apache/directory/api/ldap/extras/extended/startTransaction/StartTransactionResponseImpl.java
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.api.ldap.extras.extended.startTransaction;
+
+
+import org.apache.directory.api.i18n.I18n;
+import org.apache.directory.api.ldap.model.message.ExtendedResponseImpl;
+import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
+import org.apache.directory.api.util.Strings;
+
+
+/**
+ * The interface for Start Transaction Extended Response. It's described in RFC 5805 :
+ *
+ * <pre>
+ * ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
+ * COMPONENTS OF LDAPResult,
+ * responseName [10] LDAPOID OPTIONAL,
+ * responseValue [11] OCTET STRING OPTIONAL }
+ * </pre>
+ *
+ * where the responseName is not present, and the responseValue contain
+ * a transaction identifier when the result is SUCCESS.
+ *
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StartTransactionResponseImpl extends ExtendedResponseImpl implements StartTransactionResponse
+{
+ /** The transaction ID if the request was successful */
+ private byte[] transactionId;
+
+ /**
+ * Create a new StartTransactionResponseImpl object
+ *
+ * @param messageId The messageId
+ * @param rcode the result code
+ * @param transactionId The transaction ID
+ */
+ public StartTransactionResponseImpl( int messageId, ResultCodeEnum resultCode, byte[] transactionId )
+ {
+ super( messageId );
+
+ switch ( resultCode )
+ {
+ case SUCCESS:
+ this.transactionId = Strings.copy( transactionId );
+ // pass through ...
+ case CANCELED:
+ case CANNOT_CANCEL:
+ case NO_SUCH_OPERATION:
+ case TOO_LATE:
+ break;
+
+ default:
+ throw new IllegalArgumentException( I18n.err( I18n.ERR_04166, ResultCodeEnum.SUCCESS,
+ ResultCodeEnum.OPERATIONS_ERROR, ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
+ }
+
+ super.getLdapResult().setMatchedDn( null );
+ super.getLdapResult().setResultCode( resultCode );
+ }
+
+
+ /**
+ * Create a new StartTransactionResponseImpl instance
+ *
+ * @param messageId The request's messageId
+ * @param transactionId The transaction ID
+ */
+ public StartTransactionResponseImpl( int messageId, byte[] transactionId )
+ {
+ super( messageId );
+ super.getLdapResult().setMatchedDn( null );
+ super.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+ this.transactionId = Strings.copy( transactionId );
+ }
+
+
+ /**
+ * Create a new StartTransactionResponseImpl instance
+ *
+ * @param transactionId The transaction ID
+ */
+ public StartTransactionResponseImpl( byte[] transactionId )
+ {
+ super( StartTransactionRequest.EXTENSION_OID );
+ super.getLdapResult().setMatchedDn( null );
+ super.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+ this.transactionId = Strings.copy( transactionId );
+ }
+
+
+ /**
+ * Create a new StartTransactionResponseImpl instance
+ */
+ public StartTransactionResponseImpl()
+ {
+ super( StartTransactionRequest.EXTENSION_OID );
+ super.getLdapResult().setMatchedDn( null );
+ super.getLdapResult().setResultCode( ResultCodeEnum.UNWILLING_TO_PERFORM );
+ }
+
+
+ /**
+ * Gets the OID uniquely identifying this extended response (a.k.a. its
+ * name). It's a null value for the Cancel response
+ *
+ * @return the OID of the extended response type.
+ */
+ @Override
+ public String getResponseName()
+ {
+ return "";
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode()
+ {
+ int hash = 37;
+ // Seems simple but look at the equals() method ...
+ hash = hash * 17;
+
+ if ( transactionId != null )
+ {
+ for ( byte b : transactionId )
+ {
+ hash += hash * 17 + b;
+ }
+ }
+
+ hash = hash * 17 + getClass().getName().hashCode();
+
+ return hash;
+ }
+
+
+ /**
+ * @see Object#equals(Object)
+ */
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( obj == this )
+ {
+ return true;
+ }
+
+ return obj instanceof StartTransactionResponseImpl;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public byte[] getTransactionId()
+ {
+ return Strings.copy( transactionId );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setTransactionId( byte[] transactionId )
+ {
+ this.transactionId = Strings.copy( transactionId );
+ }
+}
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
index 8ca5c03..ddd4a6c 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
@@ -23,7 +23,6 @@ package org.apache.directory.api.ldap.extras.extended.ads_impl.pwdModify;
import java.nio.ByteBuffer;
import org.apache.directory.api.asn1.DecoderException;
-import org.apache.directory.api.asn1.EncoderException;
import org.apache.directory.api.asn1.ber.tlv.TLV;
import org.apache.directory.api.asn1.ber.tlv.UniversalTag;
import org.apache.directory.api.i18n.I18n;
@@ -102,15 +101,7 @@ public class PasswordModifyRequestDecorator extends ExtendedRequestDecorator<Pas
{
if ( requestValue == null )
{
- try
- {
- requestValue = encodeInternal().array();
- }
- catch ( EncoderException e )
- {
- LOG.error( I18n.err( I18n.ERR_04167 ), e );
- throw new RuntimeException( e );
- }
+ requestValue = encodeInternal().array();
}
return requestValue;
@@ -229,7 +220,7 @@ public class PasswordModifyRequestDecorator extends ExtendedRequestDecorator<Pas
* @return A ByteBuffer that contains the encoded PDU
* @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
*/
- /* No qualifier */ByteBuffer encodeInternal() throws EncoderException
+ /* No qualifier */ByteBuffer encodeInternal()
{
ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
index 0c1b076..19faba6 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
@@ -23,7 +23,6 @@ package org.apache.directory.api.ldap.extras.extended.ads_impl.pwdModify;
import java.nio.ByteBuffer;
import org.apache.directory.api.asn1.DecoderException;
-import org.apache.directory.api.asn1.EncoderException;
import org.apache.directory.api.asn1.ber.tlv.TLV;
import org.apache.directory.api.asn1.ber.tlv.UniversalTag;
import org.apache.directory.api.i18n.I18n;
@@ -103,15 +102,7 @@ public class PasswordModifyResponseDecorator extends ExtendedResponseDecorator<P
{
if ( responseValue == null )
{
- try
- {
- responseValue = encodeInternal().array();
- }
- catch ( EncoderException e )
- {
- LOG.error( I18n.err( I18n.ERR_04167 ), e );
- throw new RuntimeException( e );
- }
+ responseValue = encodeInternal().array();
}
return responseValue;
@@ -176,7 +167,7 @@ public class PasswordModifyResponseDecorator extends ExtendedResponseDecorator<P
* @return A ByteBuffer that contains the encoded PDU
* @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
*/
- /* no qualifier */ByteBuffer encodeInternal() throws EncoderException
+ /* no qualifier */ByteBuffer encodeInternal()
{
// Allocate the bytes buffer.
ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java
index 5edfeed..28a5a72 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java
@@ -49,15 +49,6 @@ public class StartTlsResponseDecorator extends ExtendedResponseDecorator<StartTl
* {@inheritDoc}
*/
@Override
- public void setResponseValue( byte[] responseValue )
- {
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
public byte[] getResponseValue()
{
return Strings.EMPTY_BYTES;
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionFactory.java
new file mode 100644
index 0000000..3328347
--- /dev/null
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionFactory.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.api.ldap.extras.extended.ads_impl.startTransaction;
+
+
+import org.apache.directory.api.asn1.DecoderException;
+import org.apache.directory.api.ldap.codec.api.ExtendedOperationFactory;
+import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.extras.extended.cancel.CancelRequest;
+import org.apache.directory.api.ldap.extras.extended.startTransaction.StartTransactionRequest;
+import org.apache.directory.api.ldap.extras.extended.startTransaction.StartTransactionResponse;
+import org.apache.directory.api.ldap.model.message.ExtendedRequest;
+import org.apache.directory.api.ldap.model.message.ExtendedResponse;
+
+
+/**
+ * An {@link ExtendedOperationFactory} for creating cancel extended request response
+ * pairs.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StartTransactionFactory implements ExtendedOperationFactory
+{
+ private LdapApiService codec;
+
+
+ /**
+ * Creates a new instance of CancelFactory.
+ *
+ * @param codec The codec for this factory.
+ */
+ public StartTransactionFactory( LdapApiService codec )
+ {
+ this.codec = codec;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getOid()
+ {
+ return CancelRequest.EXTENSION_OID;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StartTransactionResponse newResponse( byte[] encodedValue ) throws DecoderException
+ {
+ StartTransactionResponseDecorator response = new StartTransactionResponseDecorator( codec, null );
+ response.setResponseValue( encodedValue );
+
+ return response;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StartTransactionRequest newRequest( byte[] value )
+ {
+ /*
+ StartTransactionRequestDecorator req = new StartTransactionResponseDecorator( codec, new StartTransactionResponseImpl() );
+ req.setRequestValue( value );
+
+ return req;
+ */
+
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StartTransactionRequestDecorator decorate( ExtendedRequest modelRequest )
+ {
+ if ( modelRequest instanceof StartTransactionRequestDecorator )
+ {
+ return ( StartTransactionRequestDecorator ) modelRequest;
+ }
+
+ return new StartTransactionRequestDecorator( codec, null );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StartTransactionResponseDecorator decorate( ExtendedResponse decoratedMessage )
+ {
+ if ( decoratedMessage instanceof StartTransactionResponseDecorator )
+ {
+ return ( StartTransactionResponseDecorator ) decoratedMessage;
+ }
+
+ return new StartTransactionResponseDecorator( codec, null );
+ }
+}
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionRequestDecorator.java
similarity index 51%
copy from ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java
copy to ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionRequestDecorator.java
index 5edfeed..aff0a04 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionRequestDecorator.java
@@ -17,40 +17,38 @@
* under the License.
*
*/
-package org.apache.directory.api.ldap.extras.extended.ads_impl.startTls;
+package org.apache.directory.api.ldap.extras.extended.ads_impl.startTransaction;
-import org.apache.directory.api.ldap.codec.api.ExtendedResponseDecorator;
+import org.apache.directory.api.asn1.Asn1Object;
+import org.apache.directory.api.ldap.codec.api.ExtendedRequestDecorator;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
-import org.apache.directory.api.ldap.extras.extended.startTls.StartTlsResponse;
-import org.apache.directory.api.util.Strings;
+import org.apache.directory.api.ldap.extras.extended.startTransaction.StartTransactionRequest;
+import org.apache.directory.api.ldap.extras.extended.startTransaction.StartTransactionResponse;
/**
- * A Decorator for StartTlsResponse extended request.
+ * A Decorator for startTransaction request.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class StartTlsResponseDecorator extends ExtendedResponseDecorator<StartTlsResponse> implements StartTlsResponse
+public class StartTransactionRequestDecorator extends ExtendedRequestDecorator<StartTransactionRequest> implements
+ StartTransactionRequest, Asn1Object
{
- /**
- * Creates a new instance of StartTlsResponseDecorator.
- *
- * @param codec The LDAP service instance
- * @param decoratedMessage The decorated message
- */
- public StartTlsResponseDecorator( LdapApiService codec, StartTlsResponse decoratedMessage )
- {
- super( codec, decoratedMessage );
- }
+ /** The internal startTransaction request */
+ private StartTransactionRequest startTransactionRequest;
/**
- * {@inheritDoc}
+ * Creates a new instance of StartTransactionRequestDecorator.
+ *
+ * @param codec The LDAP Service to use
+ * @param decoratedMessage The canceled request
*/
- @Override
- public void setResponseValue( byte[] responseValue )
+ public StartTransactionRequestDecorator( LdapApiService codec, StartTransactionRequest decoratedMessage )
{
+ super( codec, decoratedMessage );
+ startTransactionRequest = decoratedMessage;
}
@@ -58,8 +56,8 @@ public class StartTlsResponseDecorator extends ExtendedResponseDecorator<StartTl
* {@inheritDoc}
*/
@Override
- public byte[] getResponseValue()
+ public StartTransactionResponse getResultResponse()
{
- return Strings.EMPTY_BYTES;
+ return ( StartTransactionResponse ) startTransactionRequest.getResultResponse();
}
}
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionResponseDecorator.java
similarity index 66%
copy from ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java
copy to ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionResponseDecorator.java
index 5edfeed..a6aa1c5 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTls/StartTlsResponseDecorator.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/startTransaction/StartTransactionResponseDecorator.java
@@ -17,31 +17,35 @@
* under the License.
*
*/
-package org.apache.directory.api.ldap.extras.extended.ads_impl.startTls;
+package org.apache.directory.api.ldap.extras.extended.ads_impl.startTransaction;
import org.apache.directory.api.ldap.codec.api.ExtendedResponseDecorator;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
-import org.apache.directory.api.ldap.extras.extended.startTls.StartTlsResponse;
+import org.apache.directory.api.ldap.extras.extended.startTransaction.StartTransactionResponse;
import org.apache.directory.api.util.Strings;
/**
- * A Decorator for StartTlsResponse extended request.
+ * A Decorator for CancelResponses.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class StartTlsResponseDecorator extends ExtendedResponseDecorator<StartTlsResponse> implements StartTlsResponse
+public class StartTransactionResponseDecorator extends ExtendedResponseDecorator<StartTransactionResponse> implements StartTransactionResponse
{
+ /** The startTransaction response */
+ private StartTransactionResponse startTransactionResponse;
+
/**
- * Creates a new instance of StartTlsResponseDecorator.
+ * Creates a new instance of CancelResponseDecorator.
*
* @param codec The LDAP service instance
* @param decoratedMessage The decorated message
*/
- public StartTlsResponseDecorator( LdapApiService codec, StartTlsResponse decoratedMessage )
+ public StartTransactionResponseDecorator( LdapApiService codec, StartTransactionResponse decoratedMessage )
{
super( codec, decoratedMessage );
+ startTransactionResponse = decoratedMessage;
}
@@ -51,6 +55,7 @@ public class StartTlsResponseDecorator extends ExtendedResponseDecorator<StartTl
@Override
public void setResponseValue( byte[] responseValue )
{
+ this.responseValue = Strings.copy( responseValue );
}
@@ -58,8 +63,8 @@ public class StartTlsResponseDecorator extends ExtendedResponseDecorator<StartTl
* {@inheritDoc}
*/
@Override
- public byte[] getResponseValue()
+ public byte[] getTransactionId()
{
- return Strings.EMPTY_BYTES;
+ return startTransactionResponse.getTransactionId();
}
}
diff --git a/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java b/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java
index 9083a09..e348c50 100644
--- a/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java
+++ b/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestTest.java
@@ -43,7 +43,7 @@ import com.mycila.junit.concurrent.ConcurrentJunitRunner;
/*
- * TestCase for a Cancel Extended Operation
+ * TestCase for a Cancel Extended Operation request
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
diff --git a/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestTest.java b/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestTest.java
index b2038dd..fb3f0e9 100644
--- a/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestTest.java
+++ b/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestTest.java
@@ -28,7 +28,6 @@ import static org.junit.Assert.fail;
import java.nio.ByteBuffer;
import org.apache.directory.api.asn1.DecoderException;
-import org.apache.directory.api.asn1.EncoderException;
import org.apache.directory.api.asn1.ber.Asn1Decoder;
import org.apache.directory.api.ldap.extras.extended.ads_impl.pwdModify.PasswordModifyRequestContainer;
import org.apache.directory.api.ldap.extras.extended.ads_impl.pwdModify.PasswordModifyRequestDecorator;
@@ -86,19 +85,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x02, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -141,19 +132,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x04, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -200,19 +183,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x08, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -263,19 +238,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x0A, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -330,19 +297,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x0E, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -392,19 +351,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x0A, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -458,19 +409,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x0E, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -528,19 +471,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x10, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -602,19 +537,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x14, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -657,19 +584,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x04, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -716,19 +635,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x08, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -779,19 +690,11 @@ public class PasswordModifyRequestTest
assertEquals( 0x0A, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -846,18 +749,10 @@ public class PasswordModifyRequestTest
assertEquals( 0x0E, ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyRequestDecorator ) pwdModifyRequest ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
}
diff --git a/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseTest.java b/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseTest.java
index 436b76a..3f8767e 100644
--- a/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseTest.java
+++ b/ldap/extras/codec/src/test/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseTest.java
@@ -84,19 +84,11 @@ public class PasswordModifyResponseTest
assertEquals( 0x02, ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -137,19 +129,11 @@ public class PasswordModifyResponseTest
assertEquals( 0x04, ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
@@ -194,18 +178,10 @@ public class PasswordModifyResponseTest
assertEquals( 0x08, ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).computeLengthInternal() );
// Check the encoding
- try
- {
- ByteBuffer bb1 = ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).encodeInternal();
+ ByteBuffer bb1 = ( ( PasswordModifyResponseDecorator ) pwdModifyResponse ).encodeInternal();
- String encodedPdu = Strings.dumpBytes( bb1.array() );
+ String encodedPdu = Strings.dumpBytes( bb1.array() );
- assertEquals( encodedPdu, decodedPdu );
- }
- catch ( EncoderException ee )
- {
- ee.printStackTrace();
- fail( ee.getMessage() );
- }
+ assertEquals( encodedPdu, decodedPdu );
}
}
diff --git a/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java b/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java
index 7428462..f78b2ad 100644
--- a/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java
+++ b/ldap/net/mina/src/main/java/org/apache/directory/api/ldap/codec/protocol/mina/LdapProtocolCodecFactory.java
@@ -35,15 +35,6 @@ import org.apache.mina.filter.codec.ProtocolEncoder;
*/
public class LdapProtocolCodecFactory implements ProtocolCodecFactory
{
- /** The tag stored into the session if we want to set a max PDU size */
- public static final String MAX_PDU_SIZE = "MAX_PDU_SIZE";
-
- /** The LdapDecoder key */
- public static final String LDAP_DECODER = "LDAP_DECODER";
-
- /** The LdapEncoder key */
- public static final String LDAP_ENCODER = "LDAP_ENCODER";
-
/** The statefull LDAP decoder */
private LdapProtocolDecoder ldapDecoder;
--
To stop receiving notification emails like this one, please contact
elecharny@apache.org.