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 2019/01/01 11:17:42 UTC
[directory-server] branch master updated (4e8a2e6 -> d9f4e8d)
This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git.
from 4e8a2e6 Extract certificate exception classification to make it reusable. Cleanup test annotations.
new f28f4aa Fixed the server compilation issues following the changes in the LDA API
new d9f4e8d Merge branch 'master' of https://gitbox.apache.org/repos/asf/directory-server
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../core/api/LdapCoreSessionConnectionTest.java | 14 +--
.../core/operations/search/SortedSearchIT.java | 2 +-
.../server/core/subtree/SubentryServiceIT.java | 9 +-
.../directory/server/core/jndi/ServerContext.java | 110 ++++---------------
.../core/authn/AuthenticationInterceptor.java | 34 +++---
.../server/core/subtree/SubentryInterceptor.java | 6 +-
protocol-ldap/pom.xml | 1 -
.../directory/server/ldap/LdapProtocolHandler.java | 13 +--
.../extended/CertGenerationRequestHandler.java | 6 +
.../handlers/extended/EndTransactionHandler.java | 9 +-
.../handlers/extended/GracefulShutdownHandler.java | 2 +-
.../handlers/extended/StartTransactionHandler.java | 6 +
.../StoredProcedureExtendedOperationHandler.java | 11 +-
.../ldap/handlers/extended/WhoAmIHandler.java | 3 +
.../handlers/request/SearchRequestHandler.java | 24 ++--
.../consumer/ReplicationConsumerImpl.java | 17 ++-
.../provider/SyncReplRequestHandler.java | 18 ++-
.../provider/SyncReplSearchListener.java | 4 +-
.../directory/server/operations/add/AddIT.java | 8 +-
.../server/operations/bind/SaslBindIT.java | 9 +-
.../operations/extended/DitUtilitiesProcedure.java | 2 +-
.../server/operations/extended/PwdModifyIT.java | 20 +---
.../directory/server/operations/ldapsdk/AddIT.java | 1 +
.../server/operations/search/PagedSearchApiIT.java | 3 +-
.../server/operations/search/PagedSearchIT.java | 11 +-
.../operations/search/PersistentSearchApiIT.java | 17 +--
.../operations/search/PersistentSearchIT.java | 17 +--
.../server/operations/search/SearchIT.java | 122 +++++++++++++++++++--
.../server/operations/search/SearchPerfIT.java | 1 +
.../server/operations/search/SortedSearchIT.java | 2 +-
.../directory/server/ppolicy/PasswordPolicyIT.java | 3 +-
.../server/replication/ClientInitialRefreshIT.java | 8 +-
.../server/replication/MockSyncReplConsumer.java | 27 +----
.../server/core/integ/FrameworkRunner.java | 1 +
34 files changed, 268 insertions(+), 273 deletions(-)
[directory-server] 01/02: Fixed the server compilation issues
following the changes in the LDA API
Posted by el...@apache.org.
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-server.git
commit f28f4aa854d1e924f19375d4c5cfdccdd03bd2ec
Author: Emmanuel Lecharny <el...@apache.org>
AuthorDate: Thu Dec 27 17:49:51 2018 +0100
Fixed the server compilation issues following the changes in the LDA API
---
.../core/api/LdapCoreSessionConnectionTest.java | 14 +--
.../server/core/subtree/SubentryServiceIT.java | 9 +-
.../directory/server/core/jndi/ServerContext.java | 110 ++++-----------------
.../core/authn/AuthenticationInterceptor.java | 34 +++----
.../server/core/subtree/SubentryInterceptor.java | 6 +-
protocol-ldap/pom.xml | 1 -
.../directory/server/ldap/LdapProtocolHandler.java | 7 +-
.../extended/CertGenerationRequestHandler.java | 6 ++
.../handlers/extended/EndTransactionHandler.java | 3 +-
.../handlers/extended/GracefulShutdownHandler.java | 2 +-
.../StoredProcedureExtendedOperationHandler.java | 11 ++-
.../ldap/handlers/extended/WhoAmIHandler.java | 5 +-
.../handlers/request/SearchRequestHandler.java | 24 ++---
.../consumer/ReplicationConsumerImpl.java | 13 +--
.../provider/SyncReplRequestHandler.java | 16 ++-
.../provider/SyncReplSearchListener.java | 4 +-
.../server/operations/bind/SaslBindIT.java | 9 +-
.../operations/extended/DitUtilitiesProcedure.java | 2 +-
.../server/operations/extended/PwdModifyIT.java | 19 ++--
.../server/operations/search/PagedSearchApiIT.java | 3 +-
.../server/operations/search/PagedSearchIT.java | 8 +-
.../operations/search/PersistentSearchApiIT.java | 19 ++--
.../operations/search/PersistentSearchIT.java | 17 ++--
.../directory/server/ppolicy/PasswordPolicyIT.java | 3 +-
.../server/replication/MockSyncReplConsumer.java | 14 +--
.../server/core/integ/FrameworkRunner.java | 1 +
26 files changed, 123 insertions(+), 237 deletions(-)
diff --git a/core-integ/src/test/java/org/apache/directory/server/core/api/LdapCoreSessionConnectionTest.java b/core-integ/src/test/java/org/apache/directory/server/core/api/LdapCoreSessionConnectionTest.java
index b22789c..9de0bd4 100755
--- a/core-integ/src/test/java/org/apache/directory/server/core/api/LdapCoreSessionConnectionTest.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/api/LdapCoreSessionConnectionTest.java
@@ -22,13 +22,8 @@ package org.apache.directory.server.core.api;
import static org.junit.Assert.assertNotNull;
-import org.apache.directory.api.ldap.codec.api.LdapApiService;
-import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest;
-import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequestImpl;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseDecorator;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.message.BindRequest;
import org.apache.directory.api.ldap.model.message.BindRequestImpl;
@@ -79,9 +74,8 @@ import org.slf4j.LoggerFactory;
public class LdapCoreSessionConnectionTest extends AbstractLdapTestUnit
{
private static Logger logger = LoggerFactory.getLogger( LdapCoreSessionConnection.class );
- private static final LdapApiService codec = LdapApiServiceFactory.getSingleton();
- private static final PasswordPolicyResponseDecorator passwordPolicyRequestControl =
- new PasswordPolicyResponseDecorator( codec, new PasswordPolicyResponseImpl() );
+ private static final PasswordPolicyResponse passwordPolicyRequestControl =
+ new PasswordPolicyResponseImpl();
@Before
@@ -119,7 +113,7 @@ public class LdapCoreSessionConnectionTest extends AbstractLdapTestUnit
BindResponse bindResponse = connection.bind( bindRequest );
Control responseControl = bindResponse.getControls().get( passwordPolicyRequestControl.getOid() );
assertNotNull( responseControl );
- PasswordPolicyResponse passwordPolicy = ( ( PasswordPolicyResponseDecorator ) responseControl ).getDecorated();
+ PasswordPolicyResponse passwordPolicy = ( PasswordPolicyResponse ) responseControl;
assertNotNull( passwordPolicy );
}
finally
@@ -147,7 +141,7 @@ public class LdapCoreSessionConnectionTest extends AbstractLdapTestUnit
BindResponse bindResponse = connection.bind( bindRequest );
Control responseControl = bindResponse.getControls().get( passwordPolicyRequestControl.getOid() );
assertNotNull( responseControl );
- PasswordPolicyResponse passwordPolicy = ( ( PasswordPolicyResponseDecorator ) responseControl ).getDecorated();
+ PasswordPolicyResponse passwordPolicy = ( PasswordPolicyResponse ) responseControl;
assertNotNull( passwordPolicy );
}
finally
diff --git a/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java b/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
index 69cf53a..2d9eb79 100644
--- a/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceIT.java
@@ -43,7 +43,6 @@ import javax.naming.ldap.LdapContext;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesDecorator;
import org.apache.directory.api.ldap.model.cursor.EntryCursor;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
@@ -56,6 +55,7 @@ import org.apache.directory.api.ldap.model.message.ModifyRequest;
import org.apache.directory.api.ldap.model.message.ModifyRequestImpl;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.message.controls.Subentries;
+import org.apache.directory.api.ldap.model.message.controls.SubentriesImpl;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.util.JndiUtils;
import org.apache.directory.ldap.client.api.LdapConnection;
@@ -1302,10 +1302,8 @@ public class SubentryServiceIT extends AbstractLdapTestUnit
// except subentries disappear
LdapApiService codec = LdapApiServiceFactory.getSingleton();
- SubentriesDecorator decorator = new SubentriesDecorator( codec );
- Subentries ctl = decorator.getDecorated();
+ Subentries ctl = new SubentriesImpl();
ctl.setVisibility( true );
- decorator.getValue();
sysRoot.setRequestControls( JndiUtils.toJndiControls( codec, new Control[]
{ ctl } ) );
list = sysRoot.search( "", "(objectClass=*)", searchControls );
@@ -1419,8 +1417,7 @@ public class SubentryServiceIT extends AbstractLdapTestUnit
connection.add( getTestSubentryWithExclusion( "cn=testsubentry,ou=system" ) );
Entry result = connection.lookup( "cn=testsubentry,ou=system", new Control[]
- {
- new SubentriesDecorator( connection.getCodecService() ) }, "subtreeSpecification" );
+ { new SubentriesImpl() }, "subtreeSpecification" );
assertNotNull( result );
String ss = result.get( "SubtreeSpecification" ).getString();
diff --git a/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java b/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
index bfa8f35..5dea15d 100644
--- a/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
+++ b/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
@@ -47,24 +47,11 @@ import javax.naming.spi.DirStateFactory;
import javax.naming.spi.DirectoryManager;
import org.apache.directory.api.asn1.DecoderException;
-import org.apache.directory.api.ldap.codec.api.CodecControl;
-import org.apache.directory.api.ldap.codec.controls.cascade.CascadeDecorator;
-import org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITDecorator;
-import org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeDecorator;
-import org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
-import org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchDecorator;
-import org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesDecorator;
+import org.apache.directory.api.ldap.codec.api.ControlFactory;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest;
-import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequestImpl;
-import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyRequestDecorator;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseDecorator;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValue;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValue;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValue;
-import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncDoneValueDecorator;
-import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueDecorator;
-import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueDecorator;
import org.apache.directory.api.ldap.extras.intermediate.syncrepl.SyncInfoValue;
import org.apache.directory.api.ldap.model.constants.JndiPropertyConstants;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
@@ -83,10 +70,8 @@ import org.apache.directory.api.ldap.model.filter.PresenceNode;
import org.apache.directory.api.ldap.model.message.AliasDerefMode;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.message.controls.Cascade;
-import org.apache.directory.api.ldap.model.message.controls.CascadeImpl;
import org.apache.directory.api.ldap.model.message.controls.EntryChange;
import org.apache.directory.api.ldap.model.message.controls.ManageDsaIT;
-import org.apache.directory.api.ldap.model.message.controls.ManageDsaITImpl;
import org.apache.directory.api.ldap.model.message.controls.PagedResults;
import org.apache.directory.api.ldap.model.message.controls.PersistentSearch;
import org.apache.directory.api.ldap.model.message.controls.Subentries;
@@ -386,87 +371,30 @@ public abstract class ServerContext implements EventContext
private org.apache.directory.api.ldap.model.message.Control convertControl( boolean isRequest,
Control jndiControl ) throws DecoderException
{
- String controlIDStr = jndiControl.getID();
- CodecControl<? extends org.apache.directory.api.ldap.model.message.Control> control = null;
-
- ControlEnum controlId = ADS_CONTROLS.get( controlIDStr );
-
- switch ( controlId )
+ String controlIdStr = jndiControl.getID();
+
+ ControlFactory<?> controlFactory;
+
+ if ( isRequest )
{
- case CASCADE_CONTROL:
- control = new CascadeDecorator( getDirectoryService().getLdapCodecService(), new CascadeImpl() );
-
- break;
-
- case ENTRY_CHANGE_CONTROL:
- control = new EntryChangeDecorator( getDirectoryService().getLdapCodecService() );
-
- break;
-
- case MANAGE_DSA_IT_CONTROL:
- control = new ManageDsaITDecorator( getDirectoryService().getLdapCodecService(), new ManageDsaITImpl() );
-
- break;
-
- case PAGED_RESULTS_CONTROL:
- control = new PagedResultsDecorator( getDirectoryService().getLdapCodecService() );
-
- break;
-
- case PASSWORD_POLICY_REQUEST_CONTROL:
- if ( isRequest )
- {
- control = new PasswordPolicyRequestDecorator( getDirectoryService().getLdapCodecService(),
- new PasswordPolicyRequestImpl() );
- }
- else
- {
- control = new PasswordPolicyResponseDecorator( getDirectoryService().getLdapCodecService(),
- new PasswordPolicyResponseImpl() );
- }
-
- break;
-
- case PERSISTENT_SEARCH_CONTROL:
- control = new PersistentSearchDecorator( getDirectoryService().getLdapCodecService() );
-
- break;
-
- case SUBENTRIES_CONTROL:
- control = new SubentriesDecorator( getDirectoryService().getLdapCodecService() );
-
- break;
-
- case SYNC_DONE_VALUE_CONTROL:
- control = new SyncDoneValueDecorator( getDirectoryService().getLdapCodecService() );
-
- break;
-
- case SYNC_REQUEST_VALUE_CONTROL:
- control = new SyncRequestValueDecorator( getDirectoryService().getLdapCodecService() );
-
- break;
-
- case SYNC_STATE_VALUE_CONTROL:
- control = new SyncStateValueDecorator( getDirectoryService().getLdapCodecService() );
-
- break;
-
- default:
- throw new IllegalArgumentException( "Unsupported control " + controlIDStr );
+ controlFactory = service.getLdapCodecService().getRequestControlFactories().get( controlIdStr );
+ }
+ else
+ {
+ controlFactory = service.getLdapCodecService().getResponseControlFactories().get( controlIdStr );
}
- control.setCritical( jndiControl.isCritical() );
- control.setValue( jndiControl.getEncodedValue() );
-
- byte[] value = jndiControl.getEncodedValue();
-
- if ( !Strings.isEmpty( value ) )
+ if ( controlFactory == null )
{
- control.decode( value );
+ throw new IllegalArgumentException( "Unsupported control " + controlIdStr );
}
- return control;
+ org.apache.directory.api.ldap.model.message.Control apiControl = controlFactory.newControl();
+
+ apiControl.setCritical( jndiControl.isCritical() );
+ controlFactory.decodeValue( apiControl, jndiControl.getEncodedValue() );
+
+ return apiControl;
}
diff --git a/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java b/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
index bff1122..01f8328 100644
--- a/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
+++ b/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
@@ -48,8 +48,9 @@ import java.util.List;
import java.util.Set;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest;
+import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse;
+import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseDecorator;
import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.api.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
@@ -370,8 +371,7 @@ public class AuthenticationInterceptor extends BaseInterceptor
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
+ PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.get( e.getErrorCode() ) );
addContext.addResponseControl( responseControl );
@@ -561,8 +561,7 @@ public class AuthenticationInterceptor extends BaseInterceptor
PasswordPolicyException ppe = null;
boolean isPPolicyReqCtrlPresent = bindContext.hasRequestControl( PasswordPolicyRequest.OID );
- PasswordPolicyResponseDecorator pwdRespCtrl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
+ PasswordPolicyResponse pwdRespCtrl = new PasswordPolicyResponseImpl();
boolean authenticated = false;
Authenticator authenticator = selectAuthenticator( bindDn, level );
@@ -1018,8 +1017,7 @@ public class AuthenticationInterceptor extends BaseInterceptor
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
+ PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.PASSWORD_TOO_YOUNG );
modifyContext.addResponseControl( responseControl );
@@ -1039,8 +1037,7 @@ public class AuthenticationInterceptor extends BaseInterceptor
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
+ PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.get( e.getErrorCode() ) );
modifyContext.addResponseControl( responseControl );
@@ -1168,8 +1165,7 @@ public class AuthenticationInterceptor extends BaseInterceptor
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
+ PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.PASSWORD_IN_HISTORY );
modifyContext.addResponseControl( responseControl );
@@ -1263,8 +1259,7 @@ public class AuthenticationInterceptor extends BaseInterceptor
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
+ PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
modifyContext.addResponseControl( responseControl );
@@ -1290,8 +1285,7 @@ public class AuthenticationInterceptor extends BaseInterceptor
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
+ PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.MUST_SUPPLY_OLD_PASSWORD );
modifyContext.addResponseControl( responseControl );
@@ -1314,8 +1308,7 @@ public class AuthenticationInterceptor extends BaseInterceptor
{
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator responseControl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
+ PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.PASSWORD_MOD_NOT_ALLOWED );
modifyContext.addResponseControl( responseControl );
@@ -1715,10 +1708,9 @@ public class AuthenticationInterceptor extends BaseInterceptor
if ( isPPolicyReqCtrlPresent )
{
- PasswordPolicyResponseDecorator pwdRespCtrl =
- new PasswordPolicyResponseDecorator( directoryService.getLdapCodecService() );
- pwdRespCtrl.setPasswordPolicyError( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
- opContext.addResponseControl( pwdRespCtrl );
+ PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
+ responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET );
+ opContext.addResponseControl( responseControl );
}
throw new LdapNoPermissionException( "password needs to be reset before performing this operation" );
diff --git a/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java b/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
index 48c5907..7acc649 100644
--- a/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
+++ b/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
@@ -27,7 +27,6 @@ import java.util.Set;
import javax.naming.directory.SearchControls;
-import org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesDecorator;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
@@ -344,9 +343,8 @@ public class SubentryInterceptor extends BaseInterceptor
// found the subentry request control so we return its value
if ( opContext.hasRequestControl( SUBENTRY_CONTROL ) )
{
- SubentriesDecorator subentriesDecorator = ( SubentriesDecorator ) opContext
- .getRequestControl( SUBENTRY_CONTROL );
- return subentriesDecorator.getDecorated().isVisible();
+ Subentries subentries = ( Subentries ) opContext.getRequestControl( SUBENTRY_CONTROL );
+ return subentries.isVisible();
}
return false;
diff --git a/protocol-ldap/pom.xml b/protocol-ldap/pom.xml
index 6369550..050b810 100644
--- a/protocol-ldap/pom.xml
+++ b/protocol-ldap/pom.xml
@@ -217,7 +217,6 @@
org.apache.directory.api.ldap.codec.api;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.codec.controls.manageDsaIT;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.codec.controls.search.pagedSearch;version=${org.apache.directory.api.version},
- org.apache.directory.api.ldap.codec.decorators;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.extras.controls;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.extras.controls.ppolicy;version=${org.apache.directory.api.version},
org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone;version=${org.apache.directory.api.version},
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
index c4d0223..82d98b6 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
@@ -20,9 +20,8 @@
package org.apache.directory.server.ldap;
-import org.apache.directory.api.ldap.codec.api.AbstractMessageDecorator;
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.LdapMessageContainerDirect;
import org.apache.directory.api.ldap.codec.api.SchemaBinaryAttributeDetector;
import org.apache.directory.api.ldap.model.exception.ResponseCarryingMessageException;
import org.apache.directory.api.ldap.model.message.Control;
@@ -87,8 +86,8 @@ class LdapProtocolHandler extends DemuxingIoHandler
session.setAttribute( LdapDecoder.MAX_PDU_SIZE_ATTR, ldapServer.getDirectoryService().getMaxPDUSize() );
// Last, store the message container
- LdapMessageContainer<? extends AbstractMessageDecorator<Message>> ldapMessageContainer =
- new LdapMessageContainer<>(
+ LdapMessageContainerDirect<Message> ldapMessageContainer =
+ new LdapMessageContainerDirect<>(
ldapServer.getDirectoryService().getLdapCodecService(),
new SchemaBinaryAttributeDetector(
ldapServer.getDirectoryService().getSchemaManager() ) );
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
index d1d43fe..6d81110 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
@@ -26,6 +26,7 @@ import java.util.Set;
import org.apache.directory.api.ldap.extras.extended.certGeneration.CertGenerationRequest;
import org.apache.directory.api.ldap.extras.extended.certGeneration.CertGenerationResponse;
+import org.apache.directory.api.ldap.extras.extended.certGeneration.CertGenerationResponseImpl;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
@@ -87,6 +88,11 @@ public class CertGenerationRequestHandler
req.getSubjectDN(),
req.getKeyAlgorithm() );
}
+
+ CertGenerationResponse certGenerationResponse = new CertGenerationResponseImpl( req.getMessageId() );
+
+ // write the response
+ session.getIoSession().write( certGenerationResponse );
}
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
index ab30426..d2580c5 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-import org.apache.directory.api.ldap.extras.extended.ads_impl.endTransaction.EndTransactionRequestDecorator;
import org.apache.directory.api.ldap.extras.extended.endTransaction.EndTransactionRequest;
import org.apache.directory.api.ldap.extras.extended.endTransaction.EndTransactionResponse;
import org.apache.directory.api.ldap.extras.extended.endTransaction.EndTransactionResponseImpl;
@@ -76,7 +75,7 @@ public class EndTransactionHandler implements ExtendedOperationHandler<ExtendedR
// We need to create a new transaction ID for the current session.
// If the current session is already processing a transaction, we will return an error
CoreSession coreSession = session.getCoreSession();
- coreSession.endSessionTransaction( ( ( EndTransactionRequestDecorator ) req ).getCommit() );
+ coreSession.endSessionTransaction( ( ( EndTransactionRequest ) req ).getCommit() );
EndTransactionResponse endTransactionResponse = new EndTransactionResponseImpl( req.getMessageId() );
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
index 4980392..d127cb5 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
@@ -259,7 +259,7 @@ public class GracefulShutdownHandler implements
try
{
future.awaitUninterruptibly( 1000 );
- sessionIt.next().close( true );
+ sessionIt.next().closeNow();
}
catch ( Exception e )
{
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
index ffe92c2..905a867 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
@@ -28,7 +28,8 @@ import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.SerializationUtils;
-import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
+import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.extras.extended.ads_impl.storedProcedure.StoredProcedureFactory;
import org.apache.directory.api.ldap.extras.extended.storedProcedure.StoredProcedureRequest;
import org.apache.directory.api.ldap.extras.extended.storedProcedure.StoredProcedureResponse;
import org.apache.directory.api.ldap.model.entry.Entry;
@@ -94,9 +95,11 @@ public class StoredProcedureExtendedOperationHandler implements
Object[] values = valueList.toArray( EMPTY_CLASS_ARRAY );
Object response = engine.invokeProcedure( session.getCoreSession(), procedure, values );
byte[] serializedResponse = SerializationUtils.serialize( ( Serializable ) response );
- StoredProcedureResponse resp =
- LdapApiServiceFactory.getSingleton().newExtendedResponse( req.getRequestName(), req.getMessageId(),
- serializedResponse );
+ LdapApiService codec = session.getLdapServer().getDirectoryService().getLdapCodecService();
+ StoredProcedureFactory factory = ( StoredProcedureFactory ) codec.getExtendedResponseFactories().get( req.getRequestName() );
+ StoredProcedureResponse resp = ( StoredProcedureResponse ) factory.newResponse( serializedResponse );
+ resp.setMessageId( req.getMessageId() );
+
session.getIoSession().write( resp );
}
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/WhoAmIHandler.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/WhoAmIHandler.java
index 32ecb81..f8982c9 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/WhoAmIHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/WhoAmIHandler.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
+import org.apache.directory.api.ldap.extras.extended.ads_impl.whoAmI.WhoAmIFactory;
import org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIRequest;
import org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponse;
import org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponseImpl;
@@ -74,9 +75,11 @@ public class WhoAmIHandler implements ExtendedOperationHandler<WhoAmIRequest, Wh
LdapPrincipal ldapPrincipal = requestor.getCoreSession().getAuthenticatedPrincipal();
- WhoAmIResponse whoAmIResponse = new WhoAmIResponseImpl( req.getMessageId(), ResultCodeEnum.SUCCESS );
+ WhoAmIResponseImpl whoAmIResponse = new WhoAmIResponseImpl( req.getMessageId(), ResultCodeEnum.SUCCESS );
String authzId = "dn:" + ldapPrincipal.getDn();
+
+ WhoAmIFactory.decode( whoAmIResponse, Strings.getBytesUtf8( authzId ) );
whoAmIResponse.setAuthzId( Strings.getBytesUtf8( authzId ) );
// write the response
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
index e627017..82bb76e 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValue;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.cursor.Cursor;
@@ -62,6 +61,7 @@ import org.apache.directory.api.ldap.model.message.SearchResultReferenceImpl;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.api.ldap.model.message.controls.PagedResults;
+import org.apache.directory.api.ldap.model.message.controls.PagedResultsImpl;
import org.apache.directory.api.ldap.model.message.controls.PersistentSearch;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.schema.AttributeType;
@@ -437,7 +437,7 @@ public class SearchRequestHandler extends LdapRequestHandler<SearchRequest>
private void readPagedResults( LdapSession session, SearchRequest req, LdapResult ldapResult,
Cursor<Entry> cursor, long sizeLimit, int pagedLimit, PagedSearchContext pagedContext,
- PagedResultsDecorator pagedResultsControl ) throws Exception
+ PagedResults pagedResultsControl ) throws Exception
{
req.addAbandonListener( new SearchAbandonListener( ldapServer, cursor ) );
setTimeLimitsOnCursor( req, session, cursor );
@@ -496,8 +496,7 @@ public class SearchRequestHandler extends LdapRequestHandler<SearchRequest>
}
}
- pagedResultsControl = new PagedResultsDecorator( ldapServer.getDirectoryService()
- .getLdapCodecService() );
+ pagedResultsControl = new PagedResultsImpl();
pagedResultsControl.setCritical( true );
pagedResultsControl.setSize( 0 );
req.getResultResponse().addControl( pagedResultsControl );
@@ -591,11 +590,11 @@ public class SearchRequestHandler extends LdapRequestHandler<SearchRequest>
/**
* Handle a Paged Search request.
*/
- private SearchResultDone doPagedSearch( LdapSession session, SearchRequest req, PagedResultsDecorator control )
+ private SearchResultDone doPagedSearch( LdapSession session, SearchRequest req, PagedResults control )
throws Exception
{
- PagedResultsDecorator pagedSearchControl = control;
- PagedResultsDecorator pagedResultsControl = null;
+ PagedResults pagedSearchControl = control;
+ PagedResults pagedResultsControl = null;
// Get the size limits
// Don't bother setting size limits for administrators that don't ask for it
@@ -676,8 +675,7 @@ public class SearchRequestHandler extends LdapRequestHandler<SearchRequest>
session.addPagedSearchContext( pagedContext );
cookie = pagedContext.getCookie();
- pagedResultsControl = new PagedResultsDecorator( ldapServer.getDirectoryService()
- .getLdapCodecService() );
+ pagedResultsControl = new PagedResultsImpl();
pagedResultsControl.setCookie( cookie );
pagedResultsControl.setSize( 0 );
pagedResultsControl.setCritical( true );
@@ -710,8 +708,7 @@ public class SearchRequestHandler extends LdapRequestHandler<SearchRequest>
// get the cookie
cookie = pagedContext.getCookie();
- pagedResultsControl = new PagedResultsDecorator( ldapServer.getDirectoryService()
- .getLdapCodecService() );
+ pagedResultsControl = new PagedResultsImpl();
pagedResultsControl.setCookie( cookie );
pagedResultsControl.setSize( 0 );
pagedResultsControl.setCritical( true );
@@ -734,8 +731,7 @@ public class SearchRequestHandler extends LdapRequestHandler<SearchRequest>
session.addPagedSearchContext( pagedContext );
cookie = pagedContext.getCookie();
- pagedResultsControl = new PagedResultsDecorator( ldapServer.getDirectoryService()
- .getLdapCodecService() );
+ pagedResultsControl = new PagedResultsImpl();
pagedResultsControl.setCookie( cookie );
pagedResultsControl.setSize( 0 );
pagedResultsControl.setCritical( true );
@@ -792,7 +788,7 @@ public class SearchRequestHandler extends LdapRequestHandler<SearchRequest>
if ( control != null )
{
// Let's deal with the pagedControl
- return doPagedSearch( session, req, ( PagedResultsDecorator ) control );
+ return doPagedSearch( session, req, ( PagedResults ) control );
}
// A normal search
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
index 0a1983d..37759c5 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
@@ -27,15 +27,14 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.map.LRUMap;
-import org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITDecorator;
import org.apache.directory.api.ldap.extras.controls.SynchronizationModeEnum;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValue;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValue;
+import org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValueImpl;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateTypeEnum;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValue;
-import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueDecorator;
import org.apache.directory.api.ldap.extras.intermediate.syncrepl.SyncInfoValue;
-import org.apache.directory.api.ldap.extras.intermediate.syncrepl_impl.SyncInfoValueDecorator;
+import org.apache.directory.api.ldap.extras.intermediate.syncrepl.SyncInfoValueImpl;
import org.apache.directory.api.ldap.model.constants.Loggers;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.csn.Csn;
@@ -296,8 +295,7 @@ public class ReplicationConsumerImpl implements ConnectionClosedEventListener, R
if ( !config.isChaseReferrals() )
{
- searchRequest.addControl( new ManageDsaITDecorator( directoryService.getLdapCodecService(),
- new ManageDsaITImpl() ) );
+ searchRequest.addControl( new ManageDsaITImpl() );
}
if ( CONSUMER_LOG.isDebugEnabled() )
@@ -488,8 +486,7 @@ public class ReplicationConsumerImpl implements ConnectionClosedEventListener, R
return;
}
- SyncInfoValueDecorator decorator = new SyncInfoValueDecorator( directoryService.getLdapCodecService() );
- SyncInfoValue syncInfoValue = ( SyncInfoValue ) decorator.decode( syncInfoBytes );
+ SyncInfoValue syncInfoValue = new SyncInfoValueImpl();
byte[] cookie = syncInfoValue.getCookie();
@@ -751,7 +748,7 @@ public class ReplicationConsumerImpl implements ConnectionClosedEventListener, R
{
CONSUMER_LOG.debug( "Starting synchronization mode {}, reloadHint {}", syncType, reloadHint );
// Prepare the Syncrepl Request
- SyncRequestValue syncReq = new SyncRequestValueDecorator( directoryService.getLdapCodecService() );
+ SyncRequestValue syncReq = new SyncRequestValueImpl();
syncReq.setMode( syncType );
syncReq.setReloadHint( reloadHint );
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
index 0edac1f..154ab4c 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
@@ -40,11 +40,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.directory.api.ldap.extras.controls.SynchronizationModeEnum;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValue;
+import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValueImpl;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValue;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateTypeEnum;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValue;
-import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncDoneValueDecorator;
-import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueDecorator;
+import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValueImpl;
import org.apache.directory.api.ldap.extras.intermediate.syncrepl.SyncInfoValue;
import org.apache.directory.api.ldap.extras.intermediate.syncrepl.SyncInfoValueImpl;
import org.apache.directory.api.ldap.extras.intermediate.syncrepl.SynchronizationInfoEnum;
@@ -464,8 +464,7 @@ public class SyncReplRequestHandler implements ReplicationRequestHandler
{
SearchResultDone searchDoneResp = ( SearchResultDone ) req.getResultResponse();
searchDoneResp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
- SyncDoneValue syncDone = new SyncDoneValueDecorator(
- ldapServer.getDirectoryService().getLdapCodecService() );
+ SyncDoneValue syncDone = new SyncDoneValueImpl();
syncDone.setCookie( cookie );
searchDoneResp.addControl( syncDone );
@@ -608,8 +607,7 @@ public class SyncReplRequestHandler implements ReplicationRequestHandler
byte[] cookie = LdapProtocolUtils.createCookie( replicaLog.getId(), contextCsn );
// no need to send from the log, that will be done in the next refreshOnly session
- SyncDoneValue syncDone = new SyncDoneValueDecorator(
- ldapServer.getDirectoryService().getLdapCodecService() );
+ SyncDoneValue syncDone = new SyncDoneValueImpl();
syncDone.setCookie( cookie );
searchDoneResp.addControl( syncDone );
PROVIDER_LOG.info( "Sending the searchResultDone response to consumer {}, {}", replicaLog,
@@ -763,8 +761,7 @@ public class SyncReplRequestHandler implements ReplicationRequestHandler
Attribute uuid = entry.get( SchemaConstants.ENTRY_UUID_AT );
// Create the SyncState control
- SyncStateValue syncStateControl = new SyncStateValueDecorator(
- ldapServer.getDirectoryService().getLdapCodecService() );
+ SyncStateValue syncStateControl = new SyncStateValueImpl();
syncStateControl.setSyncStateType( syncStateType );
syncStateControl.setEntryUUID( Strings.uuidToBytes( uuid.getString() ) );
@@ -1157,8 +1154,7 @@ public class SyncReplRequestHandler implements ReplicationRequestHandler
{
SearchResultDone searchDoneResp = ( SearchResultDone ) req.getResultResponse();
searchDoneResp.getLdapResult().setResultCode( ResultCodeEnum.E_SYNC_REFRESH_REQUIRED );
- SyncDoneValue syncDone = new SyncDoneValueDecorator(
- ldapServer.getDirectoryService().getLdapCodecService() );
+ SyncDoneValue syncDone = new SyncDoneValueImpl();
searchDoneResp.addControl( syncDone );
session.getIoSession().write( searchDoneResp );
diff --git a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java
index 4f6ebe8..8cef693 100644
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java
@@ -22,7 +22,7 @@ package org.apache.directory.server.ldap.replication.provider;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateTypeEnum;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValue;
-import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncStateValueDecorator;
+import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValueImpl;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
@@ -175,7 +175,7 @@ public class SyncReplSearchListener implements DirectoryListener, AbandonListene
private SyncStateValue createControl( DirectoryService directoryService, SyncStateTypeEnum operation, Entry entry )
throws LdapInvalidAttributeValueException
{
- SyncStateValue syncStateValue = new SyncStateValueDecorator( directoryService.getLdapCodecService() );
+ SyncStateValue syncStateValue = new SyncStateValueImpl();
syncStateValue.setSyncStateType( operation );
String uuidStr = entry.get( SchemaConstants.ENTRY_UUID_AT ).getString();
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java b/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
index 1f46b07..3aa3a9a 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
@@ -36,10 +36,9 @@ import javax.naming.directory.InitialDirContext;
import org.apache.commons.net.SocketClient;
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.LdapDecoder;
import org.apache.directory.api.ldap.codec.api.LdapEncoder;
-import org.apache.directory.api.ldap.codec.api.LdapMessageContainer;
+import org.apache.directory.api.ldap.codec.api.LdapMessageContainerDirect;
import org.apache.directory.api.ldap.model.constants.SaslQoP;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.constants.SupportedSaslMechanisms;
@@ -728,8 +727,9 @@ public class SaslBindIT extends AbstractLdapTestUnit
}
// Retrieve the response back from server to my last request.
- LdapMessageContainer<AbstractMessageDecorator<? extends Message>> container = new LdapMessageContainer(
+ LdapMessageContainerDirect<? extends Message> container = new LdapMessageContainerDirect(
ldapServer.getDirectoryService().getLdapCodecService() );
+
return ( BindResponse ) decoder.decode( _input_, container );
}
@@ -767,8 +767,9 @@ public class SaslBindIT extends AbstractLdapTestUnit
}
// Retrieve the response back from server to my last request.
- LdapMessageContainer<AbstractMessageDecorator<? extends Message>> container = new LdapMessageContainer(
+ LdapMessageContainerDirect<? extends Message> container = new LdapMessageContainerDirect(
ldapServer.getDirectoryService().getLdapCodecService() );
+
return ( BindResponse ) decoder.decode( _input_, container );
}
}
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/extended/DitUtilitiesProcedure.java b/server-integ/src/test/java/org/apache/directory/server/operations/extended/DitUtilitiesProcedure.java
index bdf56eb..8b91285 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/extended/DitUtilitiesProcedure.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/extended/DitUtilitiesProcedure.java
@@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory;
public class DitUtilitiesProcedure
{
- private static final Logger log = LoggerFactory.getLogger( DitUtilitiesProcedure.class );
+ private static final Logger LOG = LoggerFactory.getLogger( DitUtilitiesProcedure.class );
/**
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java b/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
index 71df9b4..7dd5397 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
@@ -28,14 +28,10 @@ import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import org.apache.directory.api.ldap.codec.api.LdapApiService;
import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum;
-import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequestImpl;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseDecorator;
import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequest;
import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequestImpl;
import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyResponse;
@@ -90,10 +86,7 @@ import org.junit.runner.RunWith;
{ Sha512PasswordHashingInterceptor.class })
public class PwdModifyIT extends AbstractLdapTestUnit
{
- private static final LdapApiService codec = LdapApiServiceFactory.getSingleton();
-
- private static final PasswordPolicyResponseDecorator PP_REQ_CTRL =
- new PasswordPolicyResponseDecorator( codec, new PasswordPolicyResponseImpl() );
+ private static final PasswordPolicyResponse PP_REQ_CTRL = new PasswordPolicyResponseImpl();
/** The passwordPolicy configuration */
private PasswordPolicyConfiguration policyConfig;
@@ -111,7 +104,7 @@ public class PwdModifyIT extends AbstractLdapTestUnit
return null;
}
- return ( ( PasswordPolicyResponseDecorator ) control ).getDecorated();
+ return ( PasswordPolicyResponse ) control;
}
@@ -517,8 +510,8 @@ public class PwdModifyIT extends AbstractLdapTestUnit
Dn userDn = new Dn( "cn=UserXY,ou=system" );
userConnection = getNetworkConnectionAs( ldapServer, userDn.toString(), "secret3" );
- PasswordPolicyResponseDecorator passwordPolicyRequestControl =
- new PasswordPolicyResponseDecorator( LdapApiServiceFactory.getSingleton(), new PasswordPolicyResponseImpl() );
+ PasswordPolicyResponse passwordPolicyRequestControl =
+ new PasswordPolicyResponseImpl();
PasswordModifyRequest selfPwdModifyRequest = new PasswordModifyRequestImpl();
selfPwdModifyRequest.setUserIdentity( Strings.getBytesUtf8( userDn.getNormName() ) );
selfPwdModifyRequest.setOldPassword( Strings.getBytesUtf8( "secret3" ) );
@@ -533,8 +526,8 @@ public class PwdModifyIT extends AbstractLdapTestUnit
.getControl( passwordPolicyRequestControl.getOid() );
assertNotNull( passwordPolicyResponseControl );
assertEquals( PasswordPolicyErrorEnum.PASSWORD_TOO_YOUNG,
- ( ( PasswordPolicyResponseDecorator ) passwordPolicyResponseControl )
- .getDecorated().getPasswordPolicyError() );
+ ( ( PasswordPolicyResponse ) passwordPolicyResponseControl )
+ .getPasswordPolicyError() );
addUser( adminConnection, "UserZZ", "secret4" );
Dn otherUserDn = new Dn( "cn=UserZZ,ou=system" );
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchApiIT.java b/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchApiIT.java
index 09ebd90..8bd4b3a 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchApiIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchApiIT.java
@@ -33,7 +33,6 @@ import java.util.Set;
import org.apache.directory.api.asn1.EncoderException;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
import org.apache.directory.api.ldap.model.cursor.CursorException;
import org.apache.directory.api.ldap.model.cursor.EntryCursor;
import org.apache.directory.api.ldap.model.cursor.SearchCursor;
@@ -1036,7 +1035,7 @@ public class PagedSearchApiIT extends AbstractLdapTestUnit
{
connection.bind( "uid=admin,ou=system", "secret" );
- PagedResults pagedSearchControl = new PagedResultsDecorator( codec );
+ PagedResults pagedSearchControl = new PagedResultsImpl();
pagedSearchControl.setSize( 3 );
SearchRequest searchRequest = new SearchRequestImpl();
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java b/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
index c28ea18..d3e174f 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
@@ -41,7 +41,6 @@ import javax.naming.ldap.PagedResultsResponseControl;
import org.apache.directory.api.asn1.EncoderException;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.api.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
import org.apache.directory.api.ldap.model.cursor.EntryCursor;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.message.Control;
@@ -51,6 +50,7 @@ import org.apache.directory.api.ldap.model.message.SearchRequestImpl;
import org.apache.directory.api.ldap.model.message.SearchResultDone;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.message.controls.PagedResults;
+import org.apache.directory.api.ldap.model.message.controls.PagedResultsImpl;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.util.JndiUtils;
import org.apache.directory.api.util.Network;
@@ -220,7 +220,7 @@ public class PagedSearchIT extends AbstractLdapTestUnit
SearchControls controls = new SearchControls();
controls.setCountLimit( sizeLimit );
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- PagedResultsDecorator pagedSearchControl = new PagedResultsDecorator( codec );
+ PagedResults pagedSearchControl = new PagedResultsImpl();
pagedSearchControl.setSize( pagedSize );
( ( LdapContext ) ctx ).setRequestControls( JndiUtils.toJndiControls( codec, new Control[]
@@ -237,7 +237,7 @@ public class PagedSearchIT extends AbstractLdapTestUnit
private void createNextSearchControls( DirContext ctx, byte[] cookie, int pagedSize )
throws NamingException, EncoderException
{
- PagedResultsDecorator pagedSearchControl = new PagedResultsDecorator( codec );
+ PagedResults pagedSearchControl = new PagedResultsImpl();
pagedSearchControl.setCookie( cookie );
pagedSearchControl.setSize( pagedSize );
( ( LdapContext ) ctx ).setRequestControls( JndiUtils.toJndiControls( codec, new Control[]
@@ -1040,7 +1040,7 @@ public class PagedSearchIT extends AbstractLdapTestUnit
SearchControls controls = new SearchControls();
controls.setCountLimit( ( int ) LdapServer.NO_SIZE_LIMIT );
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- PagedResults pagedSearchControl = new PagedResultsDecorator( codec );
+ PagedResults pagedSearchControl = new PagedResultsImpl();
pagedSearchControl.setSize( 3 );
// Loop over all the elements
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java b/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
index 52035d5..7811358 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
@@ -44,10 +44,8 @@ import javax.naming.event.ObjectChangeListener;
import javax.naming.ldap.HasControls;
import javax.naming.ldap.LdapContext;
-import org.apache.directory.api.ldap.codec.api.CodecControl;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
-import org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeDecorator;
-import org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchDecorator;
+import org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory;
import org.apache.directory.api.ldap.model.cursor.SearchCursor;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
@@ -605,23 +603,22 @@ public class PersistentSearchApiIT extends AbstractLdapTestUnit
{
boolean isReady = false;
PSearchNotification result;
- final PersistentSearchDecorator persistentSearch;
+ final PersistentSearch persistentSearch;
LdapContext ctx;
NamingEnumeration<SearchResult> list;
PSearchListener()
{
- persistentSearch = new PersistentSearchDecorator( getLdapServer().getDirectoryService()
- .getLdapCodecService() );
+ persistentSearch = new PersistentSearchImpl();
}
PSearchListener( PersistentSearch persistentSearch )
{
- CodecControl<? extends Control> wrapped =
- getLdapServer().getDirectoryService().getLdapCodecService().newRequestControl( persistentSearch );
- this.persistentSearch = ( PersistentSearchDecorator ) wrapped;
+ LdapApiService codec = getLdapServer().getDirectoryService().getLdapCodecService();
+
+ this.persistentSearch = ( PersistentSearch ) codec.getRequestControlFactories().get( PersistentSearch.OID ).newControl();
}
@@ -660,8 +657,8 @@ public class PersistentSearchApiIT extends AbstractLdapTestUnit
{
LOG.debug( "PSearchListener.run() called." );
LdapApiService codec = getLdapServer().getDirectoryService().getLdapCodecService();
+ EntryChangeFactory factory = ( EntryChangeFactory ) codec.getResponseControlFactories().get( EntryChange.OID );
persistentSearch.setCritical( true );
- persistentSearch.setValue( persistentSearch.getValue() );
Control[] ctxCtls = new Control[]
{ persistentSearch };
@@ -694,7 +691,7 @@ public class PersistentSearchApiIT extends AbstractLdapTestUnit
EntryChange.OID ) )
{
ecControl = ( EntryChange ) JndiUtils.fromJndiResponseControl( codec, jndiControl );
- ( ( EntryChangeDecorator ) ecControl ).decode( jndiControl.getEncodedValue() );
+ factory.decodeValue( ecControl, jndiControl.getEncodedValue() );
}
}
}
diff --git a/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java b/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
index 866446f..467bfbd 100644
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchIT.java
@@ -44,10 +44,8 @@ import javax.naming.event.ObjectChangeListener;
import javax.naming.ldap.HasControls;
import javax.naming.ldap.LdapContext;
-import org.apache.directory.api.ldap.codec.api.CodecControl;
import org.apache.directory.api.ldap.codec.api.LdapApiService;
-import org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeDecorator;
-import org.apache.directory.api.ldap.codec.controls.search.persistentSearch.PersistentSearchDecorator;
+import org.apache.directory.api.ldap.codec.controls.search.entryChange.EntryChangeFactory;
import org.apache.directory.api.ldap.model.cursor.SearchCursor;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
@@ -605,23 +603,20 @@ public class PersistentSearchIT extends AbstractLdapTestUnit
{
boolean isReady = false;
PSearchNotification result;
- final PersistentSearchDecorator persistentSearch;
+ final PersistentSearch persistentSearch;
LdapContext ctx;
NamingEnumeration<SearchResult> list;
PSearchListener()
{
- persistentSearch = new PersistentSearchDecorator( getLdapServer().getDirectoryService()
- .getLdapCodecService() );
+ persistentSearch = new PersistentSearchImpl();
}
PSearchListener( PersistentSearch persistentSearch )
{
- CodecControl<? extends Control> wrapped =
- getLdapServer().getDirectoryService().getLdapCodecService().newRequestControl( persistentSearch );
- this.persistentSearch = ( PersistentSearchDecorator ) wrapped;
+ this.persistentSearch = persistentSearch;
}
@@ -660,8 +655,8 @@ public class PersistentSearchIT extends AbstractLdapTestUnit
{
LOG.debug( "PSearchListener.run() called." );
LdapApiService codec = getLdapServer().getDirectoryService().getLdapCodecService();
+ EntryChangeFactory factory = ( EntryChangeFactory ) codec.getResponseControlFactories().get( EntryChange.OID );
persistentSearch.setCritical( true );
- persistentSearch.setValue( persistentSearch.getValue() );
Control[] ctxCtls = new Control[]
{ persistentSearch };
@@ -694,7 +689,7 @@ public class PersistentSearchIT extends AbstractLdapTestUnit
EntryChange.OID ) )
{
ecControl = ( EntryChange ) JndiUtils.fromJndiResponseControl( codec, jndiControl );
- ( ( EntryChangeDecorator ) ecControl ).decode( jndiControl.getEncodedValue() );
+ factory.decodeValue( ecControl, jndiControl.getEncodedValue() );
}
}
}
diff --git a/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java b/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java
index 2f0c14f..6d61ea5 100644
--- a/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/ppolicy/PasswordPolicyIT.java
@@ -45,7 +45,6 @@ import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyReque
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequestImpl;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseDecorator;
import org.apache.directory.api.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.api.ldap.model.constants.PasswordPolicySchemaConstants;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
@@ -167,7 +166,7 @@ public class PasswordPolicyIT extends AbstractLdapTestUnit
return null;
}
- return ( ( PasswordPolicyResponseDecorator ) control ).getDecorated();
+ return ( PasswordPolicyResponse) control;
}
diff --git a/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java b/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
index 5e43043..a4717bd 100644
--- a/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
+++ b/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
@@ -32,17 +32,15 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.directory.api.ldap.codec.api.LdapApiService;
-import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
import org.apache.directory.api.ldap.extras.controls.SyncModifyDnType;
import org.apache.directory.api.ldap.extras.controls.SynchronizationModeEnum;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValue;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValue;
+import org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValueImpl;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateTypeEnum;
import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValue;
-import org.apache.directory.api.ldap.extras.controls.syncrepl_impl.SyncRequestValueDecorator;
import org.apache.directory.api.ldap.extras.intermediate.syncrepl.SyncInfoValue;
-import org.apache.directory.api.ldap.extras.intermediate.syncrepl_impl.SyncInfoValueDecorator;
+import org.apache.directory.api.ldap.extras.intermediate.syncrepl_impl.SyncInfoValueFactory;
import org.apache.directory.api.ldap.model.constants.Loggers;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.cursor.EntryCursor;
@@ -103,9 +101,6 @@ public class MockSyncReplConsumer implements ConnectionClosedEventListener, Repl
/** A dedicated logger for the consumer */
private static final Logger CONSUMER_LOG = LoggerFactory.getLogger( Loggers.CONSUMER_LOG.getName() );
- /** The codec */
- private LdapApiService ldapCodecService = LdapApiServiceFactory.getSingleton();
-
/** the syncrepl configuration */
private SyncReplConfiguration config;
@@ -414,8 +409,7 @@ public class MockSyncReplConsumer implements ConnectionClosedEventListener, Repl
return;
}
- SyncInfoValueDecorator decorator = new SyncInfoValueDecorator( ldapCodecService );
- SyncInfoValue syncInfoValue = ( SyncInfoValue ) decorator.decode( syncInfoBytes );
+ SyncInfoValue syncInfoValue = new SyncInfoValueFactory().newResponse( syncInfoBytes );
byte[] cookie = syncInfoValue.getCookie();
@@ -667,7 +661,7 @@ public class MockSyncReplConsumer implements ConnectionClosedEventListener, Repl
*/
private ReplicationStatusEnum doSyncSearch( SynchronizationModeEnum syncType, boolean reloadHint ) throws Exception
{
- SyncRequestValue syncReq = new SyncRequestValueDecorator( ldapCodecService );
+ SyncRequestValue syncReq = new SyncRequestValueImpl();
syncReq.setMode( syncType );
syncReq.setReloadHint( reloadHint );
diff --git a/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java b/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
index 52d73e4..fa73e97 100644
--- a/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
+++ b/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
@@ -192,6 +192,7 @@ public class FrameworkRunner extends BlockJUnit4ClassRunner
}
catch ( Exception e )
{
+ e.printStackTrace();
LOG.error( I18n.err( I18n.ERR_181, getTestClass().getName() ) );
LOG.error( e.getLocalizedMessage() );
notifier.fireTestFailure( new Failure( getDescription(), e ) );
[directory-server] 02/02: Merge branch 'master' of
https://gitbox.apache.org/repos/asf/directory-server
Posted by el...@apache.org.
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-server.git
commit d9f4e8d2c63594055114d266a3f73f444d224261
Merge: f28f4aa 4e8a2e6
Author: Emmanuel Lecharny <el...@apache.org>
AuthorDate: Tue Jan 1 12:16:27 2019 +0100
Merge branch 'master' of
https://gitbox.apache.org/repos/asf/directory-server
# Conflicts:
# server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
o Fixed some issues in the transaction handler
o Don't close the connection in the exceptionCaught method, it's done
later. That allow the NoD message to be sent to the client
o Fixed the replication test failures
.../core/api/LdapCoreSessionConnectionTest.java | 1 -
.../core/operations/search/SortedSearchIT.java | 2 +-
core/src/checkstyle/suppressions.xml | 1 +
.../server/core/security/TlsKeyGenerator.java | 101 +----
.../kerberos/client/KdcConnectionTest.java | 6 +-
.../src/test/resources/log4j.properties | 2 +-
.../shared/client/api/LdapApiIntegrationUtils.java | 1 -
.../template/LdapConnectionTemplateTest.java | 1 -
.../client/api/CertificateValidationTest.java | 442 +++++++++++++++++++++
.../shared/client/api/LdapConnectionPoolTest.java | 42 +-
.../shared/client/api/LdapConnectionTest.java | 39 +-
.../api/LightweightLdapConnectionPoolTest.java | 4 -
.../shared/client/api/ServerSchemaLoaderTest.java | 1 -
.../api/operations/ClientAddRequestTest.java | 2 -
.../api/operations/bind/SimpleBindRequestTest.java | 1 -
.../search/AnonymousClientSearchRequestTest.java | 1 -
.../operations/search/OperationWithIndexTest.java | 1 -
.../directory/server/ldap/LdapProtocolHandler.java | 6 +-
.../handlers/extended/EndTransactionHandler.java | 6 +
.../handlers/extended/StartTransactionHandler.java | 6 +
.../ldap/replication/SyncReplConfiguration.java | 2 +-
.../consumer/ReplicationConsumerImpl.java | 5 +-
.../provider/SyncReplRequestHandler.java | 2 +-
.../src/test/java/MultiThreadedReadWriteTest.java | 1 -
.../server/operations/add/AddAliasIT.java | 3 -
.../directory/server/operations/add/AddIT.java | 10 +-
.../AddingEntriesWithSpecialCharactersInRDNIT.java | 1 -
.../server/operations/bind/DelegatedAuthIT.java | 2 -
.../operations/bind/DelegatedAuthOverSslIT.java | 1 -
.../operations/bind/DelegatedAuthOverTlsIT.java | 1 -
.../server/operations/bind/SaslBindIT.java | 3 -
.../server/operations/bind/SimpleBindIT.java | 1 -
.../server/operations/extended/PwdModifyIT.java | 6 -
.../server/operations/extended/WhoAmIIT.java | 2 -
.../directory/server/operations/ldapsdk/AddIT.java | 1 +
.../server/operations/lookup/LookupIT.java | 2 -
.../server/operations/modify/ModifyAddIT.java | 2 -
.../server/operations/modifydn/ModifyRdnIT.java | 2 -
.../server/operations/search/PagedSearchIT.java | 3 +
.../operations/search/PersistentSearchApiIT.java | 4 +-
.../server/operations/search/SearchIT.java | 122 +++++-
.../server/operations/search/SearchPerfIT.java | 3 +-
.../server/operations/search/SortedSearchIT.java | 3 +-
.../directory/server/ppolicy/PasswordPolicyIT.java | 18 -
.../server/replication/ClientInitialRefreshIT.java | 91 ++---
.../replication/ClientServerReplicationIT.java | 10 +
.../server/replication/MockSyncReplConsumer.java | 27 +-
.../replication/StaleEventLogDetectionIT.java | 15 +
.../apache/directory/server/ssl/KeyStoreIT.java | 9 +-
49 files changed, 741 insertions(+), 277 deletions(-)
diff --cc core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
index 4b74cdb,4b74cdb..66f4ab7
--- a/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
+++ b/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SortedSearchIT.java
@@@ -365,7 -365,7 +365,7 @@@ public class SortedSearchIT extends Abs
public void testSortByDn() throws Exception
{
sk.setAttributeTypeDesc( "entryDn" );
-- sk.setMatchingRuleId( "2.5.13.1" );
++ sk.setMatchingRuleId( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID );
SearchCursor cursor = connection.search( req );
List<Entry> actualOrder = new ArrayList<Entry>();
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
index 82d98b6,c4d0223..7bc588e
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
@@@ -245,8 -246,8 +245,8 @@@ class LdapProtocolHandler extends Demux
LOG.warn( "Unexpected exception forcing session to close: sending disconnect notice to client.", cause );
session.write( NoticeOfDisconnect.PROTOCOLERROR );
-- LdapSession ldapSession = this.ldapServer.getLdapSessionManager().removeLdapSession( session );
-- cleanUpSession( ldapSession );
-- session.closeNow();
++ session.closeOnFlush();
++ //LdapSession ldapSession = this.ldapServer.getLdapSessionManager().removeLdapSession( session );
++ //cleanUpSession( ldapSession );
}
}
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
index d2580c5,ab30426..619f96b
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/EndTransactionHandler.java
@@@ -79,6 -80,6 +79,12 @@@ public class EndTransactionHandler impl
EndTransactionResponse endTransactionResponse = new EndTransactionResponseImpl( req.getMessageId() );
++ // Store the StartTransaction request name in the response, to be able to
++ // encode the response properly.
++ // Kurt Zeilenga should have set a responseName to make it easier to
++ // implement in RFC 5805 :/
++ endTransactionResponse.setResponseName( EndTransactionRequest.EXTENSION_OID );
++
// write the response
session.getIoSession().write( endTransactionResponse );
}
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTransactionHandler.java
index b64f5b2,b64f5b2..a630004
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTransactionHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTransactionHandler.java
@@@ -80,6 -80,6 +80,12 @@@ public class StartTransactionHandler im
StartTransactionResponse startTransactionResponse = new StartTransactionResponseImpl(
req.getMessageId(), Conversion.convertToByteArray( transactionId ) );
++
++ // Store the StartTransaction request name in the response, to be able to
++ // encode the response properly.
++ // Kurt Zeilenga should have set a responseName to make it easier to
++ // implement in RFC 5805 :/
++ startTransactionResponse.setResponseName( StartTransactionRequest.EXTENSION_OID );
// write the response
session.getIoSession().write( startTransactionResponse );
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
index 37759c5,4bb1954..0ba592b
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
@@@ -1358,7 -1360,7 +1357,7 @@@ public class ReplicationConsumerImpl im
// the ENTRY_DN_AT must be in the attribute list, otherwise sorting fails
req.addAttributes( SchemaConstants.ENTRY_DN_AT );
-- SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, "2.5.13.1" );
++ SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID );
SortRequest ctrl = new SortRequestImpl();
ctrl.addSortKey( sk );
req.addControl( ctrl );
@@@ -1427,7 -1429,7 +1426,7 @@@
// the ENTRY_DN_AT must be in the attribute list, otherwise sorting fails
req.addAttributes( SchemaConstants.ENTRY_DN_AT );
-- SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, "2.5.13.1" );
++ SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT, SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID );
SortRequest ctrl = new SortRequestImpl();
ctrl.addSortKey( sk );
diff --cc protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
index 154ab4c,0edac1f..9c63f1a
--- a/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
+++ b/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplRequestHandler.java
@@@ -497,7 -498,7 +497,7 @@@ public class SyncReplRequestHandler imp
.debug( "Adding sort control to sort the entries by entryDn attribute to preserve order of insertion" );
SortKey sk = new SortKey( SchemaConstants.ENTRY_DN_AT );
// matchingrule for "entryDn"
-- sk.setMatchingRuleId( "2.5.13.1" );
++ sk.setMatchingRuleId( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID );
sk.setReverseOrder( true );
ctrl = new SortRequestImpl();
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
index 35aeebe,8aedb55..ab3236f
--- a/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/add/AddIT.java
@@@ -1183,9 -1183,9 +1183,11 @@@ public class AddIT extends AbstractLdap
if ( connection.isConnected() )
{
// Race condition:
-- // Upon NoticeOfDisconnection the API sends an abandon request but does not immediately close the connection.
-- // So at this point it is not guaranteed that the connnection is already closed.
-- // TODO: This is just a workaround, better check the connection for any outstanding abandon requests
++ // Upon NoticeOfDisconnection the API sends an abandon request but does not
++ // immediately close the connection.
++ // So at this point it is not guaranteed that the connection is already closed.
++ // TODO: This is just a workaround, better check the connection for any
++ // outstanding abandon requests
Thread.sleep( 1000 );
}
assertFalse( connection.isConnected() );
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
index 7dd5397,dfe769e..3023496
--- a/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
@@@ -28,10 -28,14 +28,9 @@@ import static org.junit.Assert.assertNo
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import org.apache.directory.api.ldap.codec.api.LdapApiService;
--import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum;
-import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequestImpl;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse;
import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseDecorator;
import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequest;
import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyRequestImpl;
import org.apache.directory.api.ldap.extras.extended.pwdModify.PasswordModifyResponse;
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java
index d068660,d068660..cc3490e
--- a/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/AddIT.java
@@@ -1200,6 -1200,6 +1200,7 @@@ public class AddIT extends AbstractLdap
}
assertFalse( connection.isConnected() );
}
++ connection.close();
}
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
index d3e174f,c28ea18..c13c835
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
@@@ -1174,5 -1174,5 +1174,8 @@@ public class PagedSearchIT extends Abst
assertEquals( 4, loop );
checkResults( results, 10 );
++
++ // And close the connection
++ closeConnection( ctx );
}
}
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
index 7811358,52035d5..514a0e1
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/PersistentSearchApiIT.java
@@@ -616,9 -619,9 +616,7 @@@ public class PersistentSearchApiIT exte
PSearchListener( PersistentSearch persistentSearch )
{
- LdapApiService codec = getLdapServer().getDirectoryService().getLdapCodecService();
-
- this.persistentSearch = ( PersistentSearch ) codec.getRequestControlFactories().get( PersistentSearch.OID ).newControl();
- CodecControl<? extends Control> wrapped =
- getLdapServer().getDirectoryService().getLdapCodecService().newRequestControl( persistentSearch );
- this.persistentSearch = ( PersistentSearchDecorator ) wrapped;
++ this.persistentSearch = persistentSearch;
}
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
index dfa5a1f,dfa5a1f..49797db
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
@@@ -205,9 -205,9 +205,6 @@@ import org.junit.runner.RunWith
public class SearchIT extends AbstractLdapTestUnit
{
private static final String BASE = "ou=system";
--
-- //public static LdapServer getLdapServer();
--
private static final String RDN = "cn=Tori Amos";
private static final String RDN2 = "cn=Rolling-Stones";
private static final String HEATHER_RDN = "cn=Heather Nova";
@@@ -237,7 -237,7 +234,6 @@@
0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00, ( byte ) 0x8a, 0x00, ( byte ) 0xb5, ( byte ) 0xe3,
( byte ) 0xff, ( byte ) 0xd9, };
--
/**
* Creation of required attributes of a person entry.
*/
@@@ -287,6 -287,6 +283,7 @@@
assertNotNull( sr );
assertFalse( enm.hasMore() );
assertEquals( "cn=Kate Bush", sr.getName() );
++ enm.close();
enm = ctx.search( "", "(&(cn=Kate Bush)(userCertificate={0}))", new Object[]
{ certData }, controls );
@@@ -295,6 -295,6 +292,7 @@@
assertNotNull( sr );
assertFalse( enm.hasMore() );
assertEquals( "cn=Kate Bush", sr.getName() );
++ enm.close();
enm = ctx.search( "", "(userCertificate=\\34\\56\\4E\\5F)", controls );
assertTrue( enm.hasMore() );
@@@ -318,6 -318,6 +316,9 @@@
assertEquals( 4, count );
assertFalse( enm.hasMore() );
assertEquals( 0, expected.size() );
++
++ enm.close();
++ ctx.close();
}
@@@ -357,6 -357,6 +358,9 @@@
NamingEnumeration<SearchResult> result = ctx.search( "ou=system", "(objectClass=*)", controls );
assertTrue( result.hasMore() );
++
++ result.close();
++ ctx.close();
}
catch ( InvalidNameException ine )
{
@@@ -395,6 -395,6 +399,8 @@@
assertEquals( "cn=Janis Joplin,ou=system", entry.getName() );
assertFalse( result.hasMore() );
++ result.close();
++ ctx.close();
}
catch ( InvalidNameException ine )
{
@@@ -418,15 -418,15 +424,18 @@@
LdapContext ctx = ( LdapContext ) getWiredContext( getLdapServer() ).lookup( BASE );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
-- NamingEnumeration<SearchResult> ii = ctx.search( "", filter, controls );
++ NamingEnumeration<SearchResult> searchResults = ctx.search( "", filter, controls );
// collect all results
HashSet<String> results = new HashSet<String>();
-- while ( ii.hasMore() )
++ while ( searchResults.hasMore() )
{
-- SearchResult result = ii.next();
++ SearchResult result = searchResults.next();
results.add( result.getName() );
}
++
++ searchResults.close();
++ ctx.close();
return results;
}
@@@ -494,6 -494,6 +503,9 @@@
assertNotNull( sn );
assertTrue( sn.contains( "Ferry" ) );
}
++
++ enm.close();
++ ctx.close();
}
catch ( Exception e )
{
@@@ -524,72 -524,72 +536,93 @@@
results = ctx.search( RDN2, "(cn=*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
// Search for all entries ending by Amos
results = ctx.search( RDN, "(cn=*Amos)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=*Amos)", ctls );
assertFalse( results.hasMore() );
++ results.close();
// Search for all entries ending by amos
results = ctx.search( RDN, "(cn=*amos)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=*amos)", ctls );
assertFalse( results.hasMore() );
++ results.close();
// Search for all entries starting by Tori
results = ctx.search( RDN, "(cn=Tori*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=Tori*)", ctls );
assertFalse( results.hasMore() );
++ results.close();
// Search for all entries starting by tori
results = ctx.search( RDN, "(cn=tori*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=tori*)", ctls );
assertFalse( results.hasMore() );
++ results.close();
// Search for all entries containing ori
results = ctx.search( RDN, "(cn=*ori*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=*ori*)", ctls );
assertFalse( results.hasMore() );
++ results.close();
// Search for all entries containing o and i
results = ctx.search( RDN, "(cn=*o*i*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=*o*i*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
// Search for all entries containing o, space and o
results = ctx.search( RDN, "(cn=*o* *o*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=*o* *o*)", ctls );
assertFalse( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=*o*-*o*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
// Search for all entries starting by To and containing A
results = ctx.search( RDN, "(cn=To*A*)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=To*A*)", ctls );
assertFalse( results.hasMore() );
++ results.close();
// Search for all entries ending by os and containing ri
results = ctx.search( RDN, "(cn=*ri*os)", ctls );
assertTrue( results.hasMore() );
++ results.close();
results = ctx.search( RDN2, "(cn=*ri*os)", ctls );
assertFalse( results.hasMore() );
++ results.close();
++ ctx.close();
}
@@@ -658,6 -658,6 +691,7 @@@
SearchResult result = results.next();
assertNotNull( result );
assertFalse( results.hasMore() );
++ results.close();
NamingEnumeration<? extends Attribute> attrs = result.getAttributes().getAll();
@@@ -670,6 -670,6 +704,8 @@@
assertNotNull( result.getAttributes().get( "objectClasses" ) );
assertEquals( 1, result.getAttributes().size() );
++ attrs.close();
++ ctx.close();
}
@@@ -743,7 -743,7 +779,9 @@@
fail( "entry " + rdn + " not found" );
}
++ result.close();
ctx.destroySubcontext( rdn );
++ ctx.close();
}
@@@ -779,8 -779,8 +817,10 @@@
{
fail( "entry " + rdn + " not found" );
}
--
++
++ result.close();
ctx.destroySubcontext( rdn );
++ ctx.close();
}
@@@ -818,6 -818,6 +858,8 @@@
assertEquals( "expected results size of", 1, results.size() );
assertTrue( results.contains( "cn=anyBodyAdd" ) );
++ enm.close();
++ ctx.close();
}
@@@ -852,7 -852,7 +894,9 @@@
assertTrue( sn.contains( "Bush" ) );
}
++ enm.close();
ctx.destroySubcontext( rdn );
++ ctx.close();
}
@@@ -906,7 -906,7 +950,9 @@@
fail( "Entry not found:" + nameInNamespace );
}
++ enm.close();
ctx.destroySubcontext( rdn );
++ ctx.close();
}
@@@ -940,6 -940,6 +986,9 @@@
}
}
}
++
++ res.close();
++ ctx.close();
}
@@@ -967,6 -967,6 +1016,9 @@@
// ensure that no other value was found
assertFalse( res.hasMore() );
++
++ res.close();
++ ctx.close();
}
@@@ -996,6 -996,6 +1048,8 @@@
assertNotNull( attrs.get( "cn" ) );
assertEquals( 1, attrs.get( "cn" ).size() );
assertEquals( "Tori Amos", attrs.get( "cn" ).get() );
++ res.close();
++ ctx.close();
}
@@@ -1028,6 -1028,6 +1082,8 @@@
assertNotNull( attrs.get( "sn" ) );
assertEquals( 1, attrs.get( "sn" ).size() );
assertEquals( "Amos", attrs.get( "sn" ).get() );
++ res.close();
++ ctx.close();
}
@@@ -1062,6 -1062,6 +1118,8 @@@
assertNotNull( attrs.get( "cn" ) );
assertEquals( 1, attrs.get( "cn" ).size() );
assertEquals( "Tori Amos", attrs.get( "cn" ).get() );
++ res.close();
++ ctx.close();
}
@@@ -1096,6 -1096,6 +1154,8 @@@
assertNotNull( attrs.get( "cn" ) );
assertEquals( 1, attrs.get( "cn" ).size() );
assertEquals( "Tori Amos", attrs.get( "cn" ).get() );
++ res.close();
++ ctx.close();
}
@@@ -1153,6 -1153,6 +1213,9 @@@
assertNotNull( attrs.get( "c-l" ) );
assertEquals( 1, attrs.get( "c-l" ).size() );
assertEquals( "Munich", attrs.get( "c-l" ).get() );
++
++ res.close();
++ ctx.close();
}
@@@ -1187,6 -1187,6 +1250,8 @@@
assertNotNull( attrs.get( "userCertificate" ) );
assertNull( attrs.get( "createtimestamp" ) );
assertNull( attrs.get( "creatorsname" ) );
++ res.close();
++ ctx.close();
}
@@@ -1227,6 -1227,6 +1292,9 @@@
assertNotNull( attrs.get( "subschemaSubentry" ) );
assertNotNull( attrs.get( "nbChildren" ) );
assertNotNull( attrs.get( "nbSubordinates" ) );
++
++ res.close();
++ ctx.close();
}
@@@ -1256,6 -1256,6 +1324,9 @@@
assertEquals( 1, attrs.size() );
assertNotNull( attrs.get( "nbChildren" ) );
assertNull( attrs.get( "nbSubordinates" ) );
++
++ res.close();
++ ctx.close();
}
@@@ -1285,6 -1285,6 +1356,9 @@@
assertEquals( 1, attrs.size() );
assertNotNull( attrs.get( "nbSubordinates" ) );
assertNull( attrs.get( "nbChildren" ) );
++
++ res.close();
++ ctx.close();
}
@@@ -1338,6 -1338,6 +1412,7 @@@
long t001 = System.currentTimeMillis();
System.out.println( "Delta without children(2) = " + ( t001 - t000 ) );
++ ctx.close();
}
@@@ -1378,6 -1378,6 +1453,8 @@@
assertNotNull( attrs.get( "subschemaSubentry" ) );
assertNotNull( attrs.get( "nbChildren" ) );
assertNotNull( attrs.get( "nbSubordinates" ) );
++ res.close();
++ ctx.close();
}
@@@ -1396,6 -1396,6 +1473,8 @@@
{
assertTrue( true );
}
++
++ ctx.close();
}
@@@ -1416,6 -1416,6 +1495,8 @@@
{
assertTrue( true );
}
++
++ ctx.close();
}
@@@ -1449,6 -1449,6 +1530,7 @@@
}
result.close();
++ ctx.close();
}
@@@ -1482,6 -1482,6 +1564,7 @@@
}
result.close();
++ ctx.close();
}
@@@ -1500,6 -1500,6 +1583,7 @@@
NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER, ctls );
result.close();
++ ctx.close();
}
@@@ -1518,6 -1518,6 +1602,7 @@@
NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER, ctls );
result.close();
++ ctx.close();
}
@@@ -1535,6 -1535,6 +1620,7 @@@
NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER, ctls );
result.close();
++ ctx.close();
}
@@@ -1597,6 -1597,6 +1683,7 @@@
}
result.close();
++ ctx.close();
}
@@@ -1633,7 -1633,7 +1720,10 @@@
assertEquals( 1, attrs.get( "cn" ).size() );
assertEquals( "jimbean", attrs.get( "cn" ).get() );
assertFalse( res.hasMore() );
++ res.close();
}
++
++ ctx.close();
}
@@@ -1665,6 -1665,6 +1755,8 @@@
{
assertTrue( true );
}
++
++ ctx.close();
}
@@@ -1698,6 -1698,6 +1790,8 @@@
assertTrue( res.hasMore() );
assertEquals( "x*y*z*", res.next().getAttributes().get( "cn" ).get() );
assertFalse( res.hasMore() );
++ res.close();
++ ctx.close();
}
@@@ -1741,24 -1741,24 +1835,29 @@@
assertTrue( res.hasMore() );
assertEquals( "groupOfNames", res.next().getAttributes().get( "cn" ).get() );
assertFalse( res.hasMore() );
++ res.close();
// search with escaped filter value
res = ctx.search( "", "(member=uid=r\\c3\\a9dacteur1,ou=system)", controls );
assertTrue( res.hasMore() );
assertEquals( "groupOfNames", res.next().getAttributes().get( "cn" ).get() );
assertFalse( res.hasMore() );
++ res.close();
// search with unicode filter value
res = ctx.search( "", "(uniqueMember=uid=r\u00e9dacteur1,ou=system)", controls );
assertTrue( res.hasMore() );
assertEquals( "groupOfUniqueNames", res.next().getAttributes().get( "cn" ).get() );
assertFalse( res.hasMore() );
++ res.close();
// search with escaped filter value
res = ctx.search( "", "(uniqueMember=uid=r\\c3\\a9dacteur1,ou=system)", controls );
assertTrue( res.hasMore() );
assertEquals( "groupOfUniqueNames", res.next().getAttributes().get( "cn" ).get() );
assertFalse( res.hasMore() );
++ res.close();
++ ctx.close();
}
@@@ -1788,6 -1788,6 +1887,7 @@@
}
result.close();
++ ctx.close();
}
@@@ -1867,6 -1867,6 +1967,8 @@@
SearchResult entry = result.next();
assertEquals( "Kim Wilde", entry.getAttributes().get( "cn" ).get() );
++ result.close();
++ ctx.close();
}
@@@ -1927,6 -1927,6 +2029,7 @@@
}
assertTrue( newCount < count );
++ cursor.close();
connection.close();
}
@@@ -1946,6 -1946,6 +2049,7 @@@
SearchResult sr = result.next();
assertNotNull( sr );
assertEquals( "Kim Wilde", sr.getAttributes().get( "cn" ).get() );
++ result.close();
// Now check with another version of the filter
result = ctx.search( "cn=Kim Wilde,ou=system",
@@@ -1955,6 -1955,6 +2059,8 @@@
sr = result.next();
assertNotNull( sr );
assertEquals( "Kim Wilde", sr.getAttributes().get( "cn" ).get() );
++ result.close();
++ ctx.close();
}
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
index 1ffe180,a76fefa..aa4d884
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
@@@ -575,5 -573,5 +573,6 @@@ public class SearchPerfIT extends Abstr
Long deltaWarmed = ( t1 - t00 );
System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 50000 ) * 1000 ) / deltaWarmed )
+ " per s ) /" + ( t1 - t0 ) + ", count : " + count );
++ connection.close();
}
}
diff --cc server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java
index c52ef5a,5f43084..a117a1f
--- a/server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/operations/search/SortedSearchIT.java
@@@ -368,7 -367,7 +367,7 @@@ public class SortedSearchIT extends Abs
public void testSortByDn() throws Exception
{
sk.setAttributeTypeDesc( "entryDn" );
-- sk.setMatchingRuleId( "2.5.13.1" );
++ sk.setMatchingRuleId( SchemaConstants.DISTINGUISHED_NAME_MATCH_MR_OID );
SearchCursor cursor = con.search( req );
List<Entry> actualOrder = new ArrayList<Entry>();
diff --cc server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
index 275c5a5,a526127..bb811f9
--- a/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
+++ b/server-integ/src/test/java/org/apache/directory/server/replication/ClientInitialRefreshIT.java
@@@ -61,6 -62,7 +62,8 @@@ import org.junit.After
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
++import org.junit.Ignore;
+ import org.junit.Rule;
import org.junit.Test;
@@@ -69,8 -71,11 +72,12 @@@
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
++//@Ignore
public class ClientInitialRefreshIT
{
+ @Rule
+ public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE );
+
private static LdapServer providerServer;
private static SchemaManager schemaManager;
@@@ -162,12 -167,12 +169,6 @@@
{
DirectoryService provDirService = DSAnnotationProcessor.getDirectoryService();
-- // Load the replication controls
-- LdapApiService codec = provDirService.getLdapCodecService();
-- codec.registerRequestControl( new SyncRequestValueFactory( codec ) );
-- codec.registerResponseControl( new SyncDoneValueFactory( codec ) );
-- codec.registerResponseControl( new SyncStateValueFactory( codec ) );
--
providerServer = ServerAnnotationProcessor.getLdapServer( provDirService );
providerServer.setReplicationReqHandler( new SyncReplRequestHandler() );
diff --cc server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
index a4717bd,a462207..cc8d791
--- a/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
+++ b/server-integ/src/test/java/org/apache/directory/server/replication/MockSyncReplConsumer.java
@@@ -217,7 -222,6 +217,7 @@@ public class MockSyncReplConsumer imple
if ( connection == null )
{
connection = new LdapNetworkConnection( providerHost, port );
- connection.setTimeOut( -1L );
++ connection.setTimeOut( 10000L );
if ( config.isUseTls() )
{
@@@ -396,20 -400,24 +396,13 @@@
/**
* {@inheritDoc}
*/
-- public void handleSyncInfo( IntermediateResponse syncInfoResp )
++ public void handleSyncInfo( SyncInfoValue syncInfoValue )
{
try
{
LOG.debug( "............... inside handleSyncInfo ..............." );
-- byte[] syncInfoBytes = syncInfoResp.getResponseValue();
- LOG.debug( "received intermediate response: " + syncInfoResp );
--
-- if ( syncInfoBytes == null )
-- {
- LOG.debug( "received null sync info");
-- return;
-- }
--
- SyncInfoValue syncInfoValue = new SyncInfoValueFactory().newResponse( syncInfoBytes );
- SyncInfoValueDecorator decorator = new SyncInfoValueDecorator( ldapCodecService );
- SyncInfoValue syncInfoValue = ( SyncInfoValue ) decorator.decode( syncInfoBytes );
+ LOG.debug( "received sync info: " + syncInfoValue );
byte[] cookie = syncInfoValue.getCookie();
@@@ -691,7 -699,7 +684,7 @@@
}
else if ( resp instanceof IntermediateResponse )
{
-- handleSyncInfo( ( IntermediateResponse ) resp );
++ handleSyncInfo( ( SyncInfoValue ) resp );
}
resp = sf.get();