From 2f4e0befa53d70a4323b984bbc5563e821907178 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 26 Jun 2013 11:52:22 +0000
Subject: [PATCH] Operation.java: Removed unused methods getCommonLogElements(), getRequestLogElements() and getResponseLogElements().
---
opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java | 56 -
opends/tests/unit-tests-testng/src/server/org/opends/server/core/OperationTestCase.java | 56 -
opends/src/server/org/opends/server/core/AddOperationBasis.java | 164 +---
opends/src/server/org/opends/server/core/CompareOperationBasis.java | 141 ---
opends/src/server/org/opends/server/core/BindOperationBasis.java | 152 ---
opends/src/server/org/opends/server/types/AbstractOperation.java | 32
opends/src/server/org/opends/server/core/DeleteOperationBasis.java | 128 ---
opends/src/server/org/opends/server/core/UnbindOperationBasis.java | 41 -
opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java | 182 +---
opends/src/server/org/opends/server/core/ModifyOperationBasis.java | 142 +---
opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java | 76 -
opends/src/server/org/opends/server/core/SearchOperationBasis.java | 134 ---
opends/tests/unit-tests-testng/src/server/org/opends/server/core/UnbindOperationTestCase.java | 16
opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java | 32
opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java | 4
opends/src/server/org/opends/server/core/OperationWrapper.java | 34 -
opends/src/server/org/opends/server/core/ExtendedOperationBasis.java | 130 ---
opends/src/server/org/opends/server/types/Operation.java | 39 -
opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java | 189 ----
opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java | 51 -
opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java | 27
opends/src/server/org/opends/server/core/AbandonOperationBasis.java | 74 --
opends/tests/unit-tests-testng/src/server/org/opends/server/core/AbandonOperationTestCase.java | 48 -
23 files changed, 386 insertions(+), 1,562 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/AbandonOperationBasis.java b/opends/src/server/org/opends/server/core/AbandonOperationBasis.java
index 74e0ee6..2aa9f6e 100644
--- a/opends/src/server/org/opends/server/core/AbandonOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/AbandonOperationBasis.java
@@ -23,39 +23,33 @@
*
*
* Copyright 2007-2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS
*/
package org.opends.server.core;
-import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ID_TO_ABANDON;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE;
-import static org.opends.server.loggers.AccessLogger.logAbandonRequest;
-import static org.opends.server.loggers.AccessLogger.logAbandonResult;
import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
+
import java.util.List;
+import org.opends.messages.Message;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.types.*;
import org.opends.server.types.operation.PostOperationAbandonOperation;
import org.opends.server.types.operation.PreParseAbandonOperation;
-
/**
* This class defines an operation that may be used to abandon an operation
* that may already be in progress in the Directory Server.
*/
public class AbandonOperationBasis extends AbstractOperation
- implements Runnable,
- AbandonOperation,
+ implements AbandonOperation,
PreParseAbandonOperation,
PostOperationAbandonOperation
{
- // The message ID of the operation that should be abandoned.
+ /** The message ID of the operation that should be abandoned. */
private final int idToAbandon;
@@ -93,6 +87,7 @@
*
* @return The message ID of the operation that should be abandoned.
*/
+ @Override
public final int getIDToAbandon()
{
return idToAbandon;
@@ -118,60 +113,6 @@
* {@inheritDoc}
*/
@Override()
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_ID_TO_ABANDON, String.valueOf(idToAbandon) }
- };
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- // There is no response for an abandon. However, we will still want to log
- // information about whether it was successful.
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String processingTime =
- String.valueOf(getProcessingTime());
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
public final List<Control> getResponseControls()
{
// An abandon operation can never have a response, so just return an empty
@@ -210,6 +151,7 @@
* managing synchronization, and any other work that might need to
* be done in the course of processing.
*/
+ @Override
public final void run()
{
setResultCode(ResultCode.UNDEFINED);
diff --git a/opends/src/server/org/opends/server/core/AddOperationBasis.java b/opends/src/server/org/opends/server/core/AddOperationBasis.java
index 39bc471..9d6af1b 100644
--- a/opends/src/server/org/opends/server/core/AddOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/AddOperationBasis.java
@@ -23,27 +23,18 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS
*/
package org.opends.server.core;
-import org.opends.messages.MessageBuilder;
-
-import static org.opends.server.config.ConfigConstants.ATTR_OBJECTCLASS;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ENTRY_DN;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_MATCHED_DN;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_REFERRAL_URLS;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE;
-import static org.opends.server.loggers.AccessLogger.logAddRequest;
-import static org.opends.server.loggers.AccessLogger.logAddResponse;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.messages.CoreMessages.*;
-import static org.opends.server.util.StaticUtils.toLowerCase;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.util.StaticUtils.*;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -53,13 +44,11 @@
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.ldap.LDAPAttribute;
+import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.*;
import org.opends.server.types.operation.PostResponseAddOperation;
import org.opends.server.types.operation.PreParseAddOperation;
import org.opends.server.workflowelement.localbackend.LocalBackendAddOperation;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-
-
/**
* This class defines an operation that may be used to add a new entry to the
@@ -67,8 +56,7 @@
*/
public class AddOperationBasis
extends AbstractOperation
- implements PreParseAddOperation, AddOperation, Runnable,
- PostResponseAddOperation
+ implements PreParseAddOperation, AddOperation, PostResponseAddOperation
{
/**
@@ -76,38 +64,43 @@
*/
private static final DebugTracer TRACER = DebugLogger.getTracer();
- // The set of response controls to send to the client.
+ /** The set of response controls to send to the client. */
private ArrayList<Control> responseControls;
- // The raw, unprocessed entry DN as provided in the request. This may or may
- // not be a valid DN.
+ /**
+ * The raw, unprocessed entry DN as provided in the request. This may or may
+ * not be a valid DN.
+ */
private ByteString rawEntryDN;
- // The processed DN of the entry to add.
+ /** The processed DN of the entry to add. */
private DN entryDN;
- // The proxied authorization target DN for this operation.
+ /** The proxied authorization target DN for this operation. */
private DN proxiedAuthorizationDN;
- // The set of attributes (including the objectclass attribute) in a raw,
- // unprocessed form as provided in the request. One or more of these
- // attributes may be invalid.
+ /**
+ * The set of attributes (including the objectclass attribute) in a raw,
+ * unprocessed form as provided in the request. One or more of these
+ * attributes may be invalid.
+ */
private List<RawAttribute> rawAttributes;
- // The set of operational attributes for the entry to add.
+ /** The set of operational attributes for the entry to add. */
private Map<AttributeType,List<Attribute>> operationalAttributes;
- // The set of user attributes for the entry to add.
+ /** The set of user attributes for the entry to add. */
private Map<AttributeType,List<Attribute>> userAttributes;
- // The set of objectclasses for the entry to add.
+ /** The set of objectclasses for the entry to add. */
private Map<ObjectClass,String> objectClasses;
- // The change number that has been assigned to this operation.
+ /** The change number that has been assigned to this operation. */
private long changeNumber;
- // The flag indicates if an LDAP error was reported.
+ /** The flag indicates if an LDAP error was reported. */
private boolean ldapError;
+
/**
* Creates a new add operation with the provided information.
*
@@ -213,6 +206,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getRawEntryDN()
{
return rawEntryDN;
@@ -221,6 +215,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawEntryDN(ByteString rawEntryDN)
{
this.rawEntryDN = rawEntryDN;
@@ -232,6 +227,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final DN getEntryDN()
{
try
@@ -260,6 +256,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final List<RawAttribute> getRawAttributes()
{
return rawAttributes;
@@ -269,6 +266,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void addRawAttribute(RawAttribute rawAttribute)
{
rawAttributes.add(rawAttribute);
@@ -282,6 +280,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawAttributes(List<RawAttribute> rawAttributes)
{
this.rawAttributes = rawAttributes;
@@ -296,6 +295,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final Map<ObjectClass,String> getObjectClasses()
{
if (objectClasses == null){
@@ -309,6 +309,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void addObjectClass(ObjectClass objectClass, String name)
{
objectClasses.put(objectClass, name);
@@ -319,6 +320,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void removeObjectClass(ObjectClass objectClass)
{
objectClasses.remove(objectClass);
@@ -329,6 +331,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final Map<AttributeType,List<Attribute>> getUserAttributes()
{
if (userAttributes == null){
@@ -341,6 +344,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final Map<AttributeType,List<Attribute>> getOperationalAttributes()
{
if (operationalAttributes == null){
@@ -486,6 +490,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setAttribute(AttributeType attributeType,
List<Attribute> attributeList)
{
@@ -517,6 +522,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void removeAttribute(AttributeType attributeType)
{
if (attributeType.isOperational())
@@ -532,6 +538,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final long getChangeNumber()
{
return changeNumber;
@@ -541,6 +548,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setChangeNumber(long changeNumber)
{
this.changeNumber = changeNumber;
@@ -550,6 +558,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final OperationType getOperationType()
{
// Note that no debugging will be done in this method because it is a likely
@@ -562,88 +571,7 @@
/**
* {@inheritDoc}
*/
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) }
- };
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String matchedDNStr;
- DN matchedDN = getMatchedDN();
- if (matchedDN == null)
- {
- matchedDNStr = null;
- }
- else
- {
- matchedDNStr = matchedDN.toString();
- }
-
- String referrals;
- List<String> referralURLs = getReferralURLs();
- if ((referralURLs == null) || referralURLs.isEmpty())
- {
- referrals = null;
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
- Iterator<String> iterator = referralURLs.iterator();
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(", ");
- buffer.append(iterator.next());
- }
-
- referrals = buffer.toString();
- }
-
- String processingTime =
- String.valueOf(getProcessingTime());
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr },
- new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
- /**
- * {@inheritDoc}
- */
+ @Override
public DN getProxiedAuthorizationDN()
{
return proxiedAuthorizationDN;
@@ -652,6 +580,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ArrayList<Control> getResponseControls()
{
return responseControls;
@@ -662,6 +591,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void addResponseControl(Control control)
{
responseControls.add(control);
@@ -672,6 +602,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void removeResponseControl(Control control)
{
responseControls.remove(control);
@@ -682,6 +613,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void toString(StringBuilder buffer)
{
buffer.append("AddOperation(connID=");
@@ -696,6 +628,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN)
{
this.proxiedAuthorizationDN = proxiedAuthorizationDN;
@@ -704,6 +637,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void run()
{
setResultCode(ResultCode.UNDEFINED);
@@ -898,10 +832,10 @@
*
* This method always returns null.
*/
+ @Override
public Entry getEntryToAdd()
{
return null;
}
}
-
diff --git a/opends/src/server/org/opends/server/core/BindOperationBasis.java b/opends/src/server/org/opends/server/core/BindOperationBasis.java
index 1d29a06..5fac1a3 100644
--- a/opends/src/server/org/opends/server/core/BindOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/BindOperationBasis.java
@@ -26,28 +26,16 @@
* Portions Copyright 2013 ForgeRock AS
*/
package org.opends.server.core;
-import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
-
-import static org.opends.server.config.ConfigConstants.DN_CONFIG_ROOT;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_AUTH_TYPE;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_BIND_DN;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_MATCHED_DN;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_REFERRAL_URLS;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_SASL_MECHANISM;
-import static org.opends.server.loggers.AccessLogger.logBindRequest;
-import static org.opends.server.loggers.AccessLogger.logBindResponse;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
+import org.opends.messages.Message;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.core.networkgroups.NetworkGroup;
@@ -55,8 +43,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.*;
import org.opends.server.types.operation.PreParseBindOperation;
-import org.opends.server.workflowelement.localbackend.*;
-
+import org.opends.server.workflowelement.localbackend.LocalBackendBindOperation;
/**
* This class defines an operation that may be used to authenticate a user to
@@ -77,45 +64,49 @@
*/
private static final DebugTracer TRACER = DebugLogger.getTracer();
- // The credentials used for SASL authentication.
+ /** The credentials used for SASL authentication. */
private ByteString saslCredentials;
- // The server SASL credentials provided to the client in the response.
+ /** The server SASL credentials provided to the client in the response. */
private ByteString serverSASLCredentials;
- // The authentication info for this bind operation.
+ /** The authentication info for this bind operation. */
private AuthenticationInfo authInfo = null;
- // The authentication type used for this bind operation.
+ /** The authentication type used for this bind operation. */
private AuthenticationType authType;
- // The raw, unprocessed bind DN as contained in the client request.
+ /** The raw, unprocessed bind DN as contained in the client request. */
private ByteString rawBindDN;
- // The password used for simple authentication.
+ /** The password used for simple authentication. */
private ByteString simplePassword;
- // The bind DN used for this bind operation.
+ /** The bind DN used for this bind operation. */
private DN bindDN;
- // The DN of the user entry that is attempting to authenticate.
+ /** The DN of the user entry that is attempting to authenticate. */
private DN userEntryDN;
- // The DN of the user as whom a SASL authentication was attempted (regardless
- // of whether the authentication was successful) for the purpose of updating
- // password policy state information.
+ /**
+ * The DN of the user as whom a SASL authentication was attempted (regardless
+ * of whether the authentication was successful) for the purpose of updating
+ * password policy state information.
+ */
private Entry saslAuthUserEntry;
- // The set of response controls for this bind operation.
+ /** The set of response controls for this bind operation. */
private List<Control> responseControls;
- // A message explaining the reason for the authentication failure.
+ /** A message explaining the reason for the authentication failure. */
private Message authFailureReason;
- // The SASL mechanism used for SASL authentication.
+ /** The SASL mechanism used for SASL authentication. */
private String saslMechanism;
- // A string representation of the protocol version for this bind operation.
+ /**
+ * A string representation of the protocol version for this bind operation.
+ */
private String protocolVersion;
/**
@@ -567,101 +558,6 @@
* {@inheritDoc}
*/
@Override()
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- if (authType == AuthenticationType.SASL)
- {
- return new String[][]
- {
- new String[] { LOG_ELEMENT_BIND_DN, String.valueOf(rawBindDN) },
- new String[] { LOG_ELEMENT_AUTH_TYPE, authType.toString() },
- new String[] { LOG_ELEMENT_SASL_MECHANISM, saslMechanism }
- };
- }
- else
- {
- return new String[][]
- {
- new String[] { LOG_ELEMENT_BIND_DN, String.valueOf(rawBindDN) },
- new String[] { LOG_ELEMENT_AUTH_TYPE, authType.toString() }
- };
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String matchedDNStr;
- DN matchedDN = getMatchedDN();
- if (matchedDN == null)
- {
- matchedDNStr = null;
- }
- else
- {
- matchedDNStr = matchedDN.toString();
- }
-
- String referrals;
- List<String> referralURLs = getReferralURLs();
- if ((referralURLs == null) || referralURLs.isEmpty())
- {
- referrals = null;
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
- Iterator<String> iterator = referralURLs.iterator();
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(", ");
- buffer.append(iterator.next());
- }
-
- referrals = buffer.toString();
- }
-
- String processingTime =
- String.valueOf(getProcessingTime());
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr },
- new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
- /**
- * {@inheritDoc}
- */
- @Override()
public final List<Control> getResponseControls()
{
return responseControls;
diff --git a/opends/src/server/org/opends/server/core/CompareOperationBasis.java b/opends/src/server/org/opends/server/core/CompareOperationBasis.java
index 37625eb..e2ea770 100644
--- a/opends/src/server/org/opends/server/core/CompareOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/CompareOperationBasis.java
@@ -23,19 +23,17 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS
*/
package org.opends.server.core;
-import org.opends.messages.MessageBuilder;
-import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.AccessLogger.logCompareRequest;
-import static org.opends.server.loggers.AccessLogger.logCompareResponse;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.StaticUtils.*;
+
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -47,9 +45,7 @@
import org.opends.server.types.*;
import org.opends.server.types.operation.PostResponseCompareOperation;
import org.opends.server.types.operation.PreParseCompareOperation;
-import org.opends.server.workflowelement.localbackend.
- LocalBackendCompareOperation;
-
+import org.opends.server.workflowelement.localbackend.*;
/**
* This class defines an operation that may be used to determine whether a
@@ -59,35 +55,35 @@
public class CompareOperationBasis
extends AbstractOperation
implements PreParseCompareOperation, CompareOperation,
- Runnable, PostResponseCompareOperation
+ PostResponseCompareOperation
{
/**
* The tracer object for the debug logger.
*/
private static final DebugTracer TRACER = DebugLogger.getTracer();
- // The attribute type for this compare operation.
+ /** The attribute type for this compare operation. */
private AttributeType attributeType;
- // The assertion value for the compare operation.
+ /** The assertion value for the compare operation. */
private ByteString assertionValue;
- // The set of attribute options
+ /** The set of attribute options. */
private Set<String> attributeOptions;
- // The raw, unprocessed entry DN as included in the client request.
+ /** The raw, unprocessed entry DN as included in the client request. */
private ByteString rawEntryDN;
- // The DN of the entry for the compare operation.
+ /** The DN of the entry for the compare operation. */
private DN entryDN;
- // The proxied authorization target DN for this operation.
+ /** The proxied authorization target DN for this operation. */
private DN proxiedAuthorizationDN;
- // The set of response controls for this compare operation.
+ /** The set of response controls for this compare operation. */
private List<Control> responseControls;
- // The attribute type for the compare operation.
+ /** The attribute type for the compare operation. */
private String rawAttributeType;
@@ -169,6 +165,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getRawEntryDN()
{
return rawEntryDN;
@@ -179,6 +176,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawEntryDN(ByteString rawEntryDN)
{
this.rawEntryDN = rawEntryDN;
@@ -191,6 +189,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final DN getEntryDN()
{
if (entryDN == null) {
@@ -217,6 +216,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final String getRawAttributeType()
{
return rawAttributeType;
@@ -227,6 +227,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawAttributeType(String rawAttributeType)
{
this.rawAttributeType = rawAttributeType;
@@ -266,6 +267,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final AttributeType getAttributeType()
{
if (attributeType == null) {
@@ -279,6 +281,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setAttributeType(AttributeType attributeType)
{
this.attributeType = attributeType;
@@ -289,6 +292,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public Set<String> getAttributeOptions()
{
if (attributeOptions == null) {
@@ -302,6 +306,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setAttributeOptions(Set<String> attributeOptions)
{
this.attributeOptions = attributeOptions;
@@ -310,6 +315,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getAssertionValue()
{
return assertionValue;
@@ -320,6 +326,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setAssertionValue(ByteString assertionValue)
{
this.assertionValue = assertionValue;
@@ -335,100 +342,12 @@
{
// Note that no debugging will be done in this method because it is a likely
// candidate for being called by the logging subsystem.
-
return OperationType.COMPARE;
}
/**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) },
- new String[] { LOG_ELEMENT_COMPARE_ATTR, rawAttributeType }
- };
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String matchedDNStr;
- DN matchedDN = getMatchedDN();
- if (matchedDN == null)
- {
- matchedDNStr = null;
- }
- else
- {
- matchedDNStr = matchedDN.toString();
- }
-
- String referrals;
- List<String> referralURLs = getReferralURLs();
- if ((referralURLs == null) || referralURLs.isEmpty())
- {
- referrals = null;
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
- Iterator<String> iterator = referralURLs.iterator();
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(", ");
- buffer.append(iterator.next());
- }
-
- referrals = buffer.toString();
- }
-
- String processingTime =
- String.valueOf(getProcessingTime());
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr },
- new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
-
-
- /**
* Retrieves the proxied authorization DN for this operation if proxied
* authorization has been requested.
*
@@ -436,6 +355,7 @@
* authorization has been requested, or {@code null} if proxied
* authorization has not been requested.
*/
+ @Override
public DN getProxiedAuthorizationDN()
{
return proxiedAuthorizationDN;
@@ -446,6 +366,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN)
{
this.proxiedAuthorizationDN = proxiedAuthorizationDN;
@@ -493,6 +414,7 @@
* managing synchronization, and any other work that might need to
* be done in the course of processing.
*/
+ @Override
public final void run()
{
setResultCode(ResultCode.UNDEFINED);
@@ -630,15 +552,13 @@
{
// Invoke the post response plugins that have been registered by
// the workflow elements
- List localOperations =
+ List<LocalBackendCompareOperation> localOperations =
(List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
if (localOperations != null)
{
- for (Object localOp : localOperations)
+ for (LocalBackendCompareOperation localOperation : localOperations)
{
- LocalBackendCompareOperation localOperation =
- (LocalBackendCompareOperation)localOp;
pluginConfigManager.invokePostResponseComparePlugins(localOperation);
}
}
@@ -690,6 +610,7 @@
*
* This method always returns null.
*/
+ @Override
public Entry getEntryToCompare()
{
return null;
diff --git a/opends/src/server/org/opends/server/core/DeleteOperationBasis.java b/opends/src/server/org/opends/server/core/DeleteOperationBasis.java
index 20e8d2b..aadcb0d 100644
--- a/opends/src/server/org/opends/server/core/DeleteOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/DeleteOperationBasis.java
@@ -23,23 +23,15 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS
*/
package org.opends.server.core;
-import org.opends.messages.MessageBuilder;
-
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ENTRY_DN;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_MATCHED_DN;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_REFERRAL_URLS;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE;
-import static org.opends.server.loggers.AccessLogger.logDeleteRequest;
-import static org.opends.server.loggers.AccessLogger.logDeleteResponse;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.opends.server.api.ClientConnection;
@@ -52,8 +44,6 @@
import org.opends.server.types.operation.PreParseDeleteOperation;
import org.opends.server.workflowelement.localbackend.*;
-
-
/**
* This class defines an operation that may be used to remove an entry from the
* Directory Server.
@@ -69,19 +59,19 @@
*/
private static final DebugTracer TRACER = DebugLogger.getTracer();
- // The raw, unprocessed entry DN as included in the client request.
+ /** The raw, unprocessed entry DN as included in the client request. */
private ByteString rawEntryDN;
- // The DN of the entry for the delete operation.
+ /** The DN of the entry for the delete operation. */
private DN entryDN;
- // The proxied authorization target DN for this operation.
+ /** The proxied authorization target DN for this operation. */
private DN proxiedAuthorizationDN;
- // The set of response controls for this delete operation.
+ /** The set of response controls for this delete operation. */
private List<Control> responseControls;
- // The change number that has been assigned to this operation.
+ /** The change number that has been assigned to this operation. */
private long changeNumber;
@@ -145,6 +135,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getRawEntryDN()
{
return rawEntryDN;
@@ -153,6 +144,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawEntryDN(ByteString rawEntryDN)
{
this.rawEntryDN = rawEntryDN;
@@ -163,6 +155,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final DN getEntryDN()
{
try
@@ -191,6 +184,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final long getChangeNumber()
{
return changeNumber;
@@ -199,6 +193,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setChangeNumber(long changeNumber)
{
this.changeNumber = changeNumber;
@@ -212,96 +207,13 @@
{
// Note that no debugging will be done in this method because it is a likely
// candidate for being called by the logging subsystem.
-
return OperationType.DELETE;
}
-
/**
* {@inheritDoc}
*/
- @Override()
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) }
- };
- }
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String matchedDNStr;
- DN matchedDN = getMatchedDN();
- if (matchedDN == null)
- {
- matchedDNStr = null;
- }
- else
- {
- matchedDNStr = matchedDN.toString();
- }
-
- String referrals;
- List<String> referralURLs = getReferralURLs();
- if ((referralURLs == null) || referralURLs.isEmpty())
- {
- referrals = null;
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
- Iterator<String> iterator = referralURLs.iterator();
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(", ");
- buffer.append(iterator.next());
- }
-
- referrals = buffer.toString();
- }
-
- String processingTime =
- String.valueOf(getProcessingTime());
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr },
- new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
- /**
- * {@inheritDoc}
- */
+ @Override
public DN getProxiedAuthorizationDN()
{
return proxiedAuthorizationDN;
@@ -351,6 +263,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN)
{
this.proxiedAuthorizationDN = proxiedAuthorizationDN;
@@ -359,6 +272,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void run()
{
setResultCode(ResultCode.UNDEFINED);
@@ -484,15 +398,13 @@
{
// Invoke the post response plugins that have been registered by
// the workflow elements
- List localOperations =
+ List<LocalBackendDeleteOperation> localOperations =
(List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
if (localOperations != null)
{
- for (Object localOp : localOperations)
+ for (LocalBackendDeleteOperation localOperation : localOperations)
{
- LocalBackendDeleteOperation localOperation =
- (LocalBackendDeleteOperation)localOp;
pluginConfigManager.invokePostResponseDeletePlugins(localOperation);
}
}
@@ -525,8 +437,8 @@
*
* This method always returns null.
*/
+ @Override
public Entry getEntryToDelete() {
- // TODO Auto-generated method stub
return null;
}
diff --git a/opends/src/server/org/opends/server/core/ExtendedOperationBasis.java b/opends/src/server/org/opends/server/core/ExtendedOperationBasis.java
index d0d0c50..7b09c0f 100644
--- a/opends/src/server/org/opends/server/core/ExtendedOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/ExtendedOperationBasis.java
@@ -23,37 +23,29 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011-2012 ForgeRock AS.
+ * Portions copyright 2011-2013 ForgeRock AS.
*/
package org.opends.server.core;
-import org.opends.messages.MessageBuilder;
+import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.util.ServerConstants.*;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.ExtendedOperationHandler;
import org.opends.server.api.plugin.PluginResult;
+import org.opends.server.loggers.debug.DebugLogger;
+import org.opends.server.loggers.debug.DebugTracer;
+import org.opends.server.types.*;
import org.opends.server.types.operation.PostOperationExtendedOperation;
import org.opends.server.types.operation.PostResponseExtendedOperation;
import org.opends.server.types.operation.PreOperationExtendedOperation;
import org.opends.server.types.operation.PreParseExtendedOperation;
-import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.AccessLogger.*;
-import static org.opends.server.loggers.debug.DebugLogger.*;
-
-import org.opends.server.loggers.debug.DebugLogger;
-import org.opends.server.loggers.debug.DebugTracer;
-import org.opends.server.types.*;
-
-import static org.opends.messages.CoreMessages.*;
-import static org.opends.server.util.ServerConstants.*;
-
-
-
/**
* This class defines an extended operation, which can perform virtually any
* kind of task.
@@ -71,19 +63,19 @@
*/
private static final DebugTracer TRACER = DebugLogger.getTracer();
- // The value for the request associated with this extended operation.
+ /** The value for the request associated with this extended operation. */
private ByteString requestValue;
- // The value for the response associated with this extended operation.
+ /** The value for the response associated with this extended operation. */
private ByteString responseValue;
- // The set of response controls for this extended operation.
+ /** The set of response controls for this extended operation. */
private List<Control> responseControls;
- // The OID for the request associated with this extended operation.
+ /** The OID for the request associated with this extended operation. */
private String requestOID;
- // The OID for the response associated with this extended operation.
+ /** The OID for the response associated with this extended operation. */
private String responseOID;
@@ -135,6 +127,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final String getRequestOID()
{
return requestOID;
@@ -149,6 +142,7 @@
* @param requestOID The OID for the request associated with this extended
* operation.
*/
+ @Override
public final void setRequestOID(String requestOID)
{
this.requestOID = requestOID;
@@ -159,6 +153,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getRequestValue()
{
return requestValue;
@@ -173,6 +168,7 @@
* @param requestValue The value for the request associated with this
* extended operation.
*/
+ @Override
public final void setRequestValue(ByteString requestValue)
{
this.requestValue = requestValue;
@@ -183,6 +179,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final String getResponseOID()
{
return responseOID;
@@ -193,6 +190,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setResponseOID(String responseOID)
{
this.responseOID = responseOID;
@@ -203,6 +201,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getResponseValue()
{
return responseValue;
@@ -213,6 +212,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setResponseValue(ByteString responseValue)
{
this.responseValue = responseValue;
@@ -227,7 +227,6 @@
{
// Note that no debugging will be done in this method because it is a likely
// candidate for being called by the logging subsystem.
-
return OperationType.EXTENDED;
}
@@ -237,93 +236,6 @@
* {@inheritDoc}
*/
@Override()
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_EXTENDED_REQUEST_OID, requestOID }
- };
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String matchedDNStr;
- DN matchedDN = getMatchedDN();
- if (matchedDN == null)
- {
- matchedDNStr = null;
- }
- else
- {
- matchedDNStr = matchedDN.toString();
- }
-
- String referrals;
- List<String> referralURLs = getReferralURLs();
- if ((referralURLs == null) || referralURLs.isEmpty())
- {
- referrals = null;
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
- Iterator<String> iterator = referralURLs.iterator();
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(", ");
- buffer.append(iterator.next());
- }
-
- referrals = buffer.toString();
- }
-
- String processingTime =
- String.valueOf(getProcessingTime());
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr },
- new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals },
- new String[] { LOG_ELEMENT_EXTENDED_RESPONSE_OID, responseOID },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
public final List<Control> getResponseControls()
{
return responseControls;
diff --git a/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java b/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java
index 6ad2c43..3c70d65 100644
--- a/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java
@@ -23,31 +23,26 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS.
+ * Portions copyright 2011-2013 ForgeRock AS.
*/
package org.opends.server.core;
-import org.opends.messages.MessageBuilder;
+
+import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
+
import org.opends.server.api.ClientConnection;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.core.networkgroups.NetworkGroup;
-import org.opends.server.types.operation.PostResponseModifyDNOperation;
-import org.opends.server.types.operation.PreParseModifyDNOperation;
-import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.AccessLogger.*;
-
-import org.opends.server.types.*;
-import org.opends.server.workflowelement.localbackend.*;
-
-import static org.opends.server.loggers.debug.DebugLogger.*;
-
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.loggers.debug.DebugTracer;
-import static org.opends.messages.CoreMessages.*;
-
+import org.opends.server.types.*;
+import org.opends.server.types.operation.PostResponseModifyDNOperation;
+import org.opends.server.types.operation.PreParseModifyDNOperation;
+import org.opends.server.workflowelement.localbackend.*;
/**
* This class defines an operation that may be used to alter the DN of an entry
@@ -58,49 +53,56 @@
implements ModifyDNOperation,
PreParseModifyDNOperation,
PostResponseModifyDNOperation
- {
+{
+
/**
* The tracer object for the debug logger.
*/
private static final DebugTracer TRACER = DebugLogger.getTracer();
- // Indicates whether to delete the old RDN value from the entry.
+ /** Indicates whether to delete the old RDN value from the entry. */
private boolean deleteOldRDN;
- // The raw, unprocessed current DN of the entry as included in the request
- // from the client.
+ /**
+ * The raw, unprocessed current DN of the entry as included in the request
+ * from the client.
+ */
private ByteString rawEntryDN;
- // The raw, unprocessed newRDN as included in the request from the client.
+ /** The raw, unprocessed newRDN as included in the request from the client. */
private ByteString rawNewRDN;
- // The raw, unprocessed newSuperior as included in the request from the
- // client.
+ /**
+ * The raw, unprocessed newSuperior as included in the request from the
+ * client.
+ */
private ByteString rawNewSuperior;
- // The current DN of the entry.
+ /** The current DN of the entry. */
private DN entryDN;
- // The new parent for the entry.
+ /** The new parent for the entry. */
private DN newSuperior;
- // The proxied authorization target DN for this operation.
+ /** The proxied authorization target DN for this operation. */
private DN proxiedAuthorizationDN;
- // The set of response controls for this modify DN operation.
+ /** The set of response controls for this modify DN operation. */
private List<Control> responseControls;
- // The set of modifications applied to attributes in the entry in the course
- // of processing the modify DN.
+ /**
+ * The set of modifications applied to attributes in the entry in the course
+ * of processing the modify DN.
+ */
private List<Modification> modifications;
- // The change number that has been assigned to this operation.
+ /** The change number that has been assigned to this operation. */
private long changeNumber;
- // The new RDN for the entry.
+ /** The new RDN for the entry. */
private RDN newRDN;
- // The new entry DN
+ /** The new entry DN. */
private DN newDN = null;
/**
@@ -199,6 +201,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getRawEntryDN()
{
return rawEntryDN;
@@ -209,6 +212,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawEntryDN(ByteString rawEntryDN)
{
this.rawEntryDN = rawEntryDN;
@@ -221,6 +225,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final DN getEntryDN()
{
try
@@ -245,6 +250,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getRawNewRDN()
{
return rawNewRDN;
@@ -253,6 +259,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawNewRDN(ByteString rawNewRDN)
{
this.rawNewRDN = rawNewRDN;
@@ -264,6 +271,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final RDN getNewRDN()
{
try
@@ -290,6 +298,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final boolean deleteOldRDN()
{
return deleteOldRDN;
@@ -298,6 +307,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setDeleteOldRDN(boolean deleteOldRDN)
{
this.deleteOldRDN = deleteOldRDN;
@@ -306,6 +316,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getRawNewSuperior()
{
return rawNewSuperior;
@@ -314,6 +325,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawNewSuperior(ByteString rawNewSuperior)
{
this.rawNewSuperior = rawNewSuperior;
@@ -325,6 +337,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final DN getNewSuperior()
{
if (rawNewSuperior == null)
@@ -358,6 +371,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final List<Modification> getModifications()
{
return modifications;
@@ -367,6 +381,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void addModification(Modification modification)
{
if (modifications == null)
@@ -383,6 +398,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final Entry getOriginalEntry()
{
return null;
@@ -392,6 +408,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final Entry getUpdatedEntry()
{
return null;
@@ -400,6 +417,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final long getChangeNumber()
{
return changeNumber;
@@ -409,6 +427,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setChangeNumber(long changeNumber)
{
this.changeNumber = changeNumber;
@@ -431,104 +450,7 @@
/**
* {@inheritDoc}
*/
- @Override()
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String newSuperiorStr;
- if (rawNewSuperior == null)
- {
- newSuperiorStr = null;
- }
- else
- {
- newSuperiorStr = rawNewSuperior.toString();
- }
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) },
- new String[] { LOG_ELEMENT_NEW_RDN, String.valueOf(newRDN) },
- new String[] { LOG_ELEMENT_DELETE_OLD_RDN,
- String.valueOf(deleteOldRDN) },
- new String[] { LOG_ELEMENT_NEW_SUPERIOR, newSuperiorStr }
- };
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String matchedDNStr;
- DN matchedDN = getMatchedDN();
- if (matchedDN == null)
- {
- matchedDNStr = null;
- }
- else
- {
- matchedDNStr = matchedDN.toString();
- }
-
- String referrals;
- List<String> referralURLs = getReferralURLs();
- if ((referralURLs == null) || referralURLs.isEmpty())
- {
- referrals = null;
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
- Iterator<String> iterator = referralURLs.iterator();
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(", ");
- buffer.append(iterator.next());
- }
-
- referrals = buffer.toString();
- }
-
- String processingTime =
- String.valueOf(getProcessingTime());
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr },
- new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
-
- /**
- * {@inheritDoc}
- */
+ @Override
public DN getProxiedAuthorizationDN()
{
return proxiedAuthorizationDN;
@@ -765,6 +687,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setProxiedAuthorizationDN(DN dn)
{
proxiedAuthorizationDN = dn;
@@ -774,6 +697,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public DN getNewDN()
{
if (newDN == null)
diff --git a/opends/src/server/org/opends/server/core/ModifyOperationBasis.java b/opends/src/server/org/opends/server/core/ModifyOperationBasis.java
index a60183a..60b7574 100644
--- a/opends/src/server/org/opends/server/core/ModifyOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/ModifyOperationBasis.java
@@ -23,23 +23,15 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2013 ForgeRock AS.
*/
package org.opends.server.core;
-import org.opends.messages.MessageBuilder;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ENTRY_DN;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_ERROR_MESSAGE;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_MATCHED_DN;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_PROCESSING_TIME;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_REFERRAL_URLS;
-import static org.opends.server.core.CoreConstants.LOG_ELEMENT_RESULT_CODE;
-import static org.opends.server.loggers.AccessLogger.logModifyRequest;
-import static org.opends.server.loggers.AccessLogger.logModifyResponse;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.opends.server.api.ClientConnection;
@@ -49,12 +41,11 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.ldap.LDAPAttribute;
import org.opends.server.protocols.ldap.LDAPModification;
+import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.*;
import org.opends.server.types.operation.PostResponseModifyOperation;
import org.opends.server.types.operation.PreParseModifyOperation;
import org.opends.server.workflowelement.localbackend.*;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-
/**
* This class defines an operation that may be used to modify an entry in the
@@ -64,33 +55,35 @@
extends AbstractOperation implements ModifyOperation,
PreParseModifyOperation,
PostResponseModifyOperation
- {
+{
/**
* The tracer object for the debug logger.
*/
private static final DebugTracer TRACER = DebugLogger.getTracer();
- // The raw, unprocessed entry DN as included by the client request.
+ /** The raw, unprocessed entry DN as included by the client request. */
private ByteString rawEntryDN;
- // The DN of the entry for the modify operation.
+ /** The DN of the entry for the modify operation. */
private DN entryDN;
- // The proxied authorization target DN for this operation.
+ /** The proxied authorization target DN for this operation. */
private DN proxiedAuthorizationDN;
- // The set of response controls for this modify operation.
+ /** The set of response controls for this modify operation. */
private List<Control> responseControls;
- // The raw, unprocessed set of modifications as included in the client
- // request.
+ /**
+ * The raw, unprocessed set of modifications as included in the client
+ * request.
+ */
private List<RawModification> rawModifications;
- // The set of modifications for this modify operation.
+ /** The set of modifications for this modify operation. */
private List<Modification> modifications;
- // The change number that has been assigned to this operation.
+ /** The change number that has been assigned to this operation. */
private long changeNumber;
/**
@@ -166,6 +159,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final ByteString getRawEntryDN()
{
return rawEntryDN;
@@ -174,6 +168,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawEntryDN(ByteString rawEntryDN)
{
this.rawEntryDN = rawEntryDN;
@@ -184,6 +179,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final DN getEntryDN()
{
if (entryDN == null){
@@ -206,6 +202,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final List<RawModification> getRawModifications()
{
return rawModifications;
@@ -214,6 +211,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void addRawModification(RawModification rawModification)
{
rawModifications.add(rawModification);
@@ -224,6 +222,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void setRawModifications(List<RawModification> rawModifications)
{
this.rawModifications = rawModifications;
@@ -234,6 +233,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final List<Modification> getModifications()
{
if (modifications == null)
@@ -289,6 +289,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void addModification(Modification modification)
throws DirectoryException
{
@@ -298,6 +299,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final OperationType getOperationType()
{
// Note that no debugging will be done in this method because it is a likely
@@ -309,86 +311,7 @@
/**
* {@inheritDoc}
*/
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_ENTRY_DN, String.valueOf(rawEntryDN) }
- };
- }
-
- /**
- * {@inheritDoc}
- */
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String matchedDNStr;
- DN matchedDN = getMatchedDN();
- if (matchedDN == null)
- {
- matchedDNStr = null;
- }
- else
- {
- matchedDNStr = matchedDN.toString();
- }
-
- String referrals;
- List<String> referralURLs = getReferralURLs();
- if ((referralURLs == null) || referralURLs.isEmpty())
- {
- referrals = null;
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
- Iterator<String> iterator = referralURLs.iterator();
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(", ");
- buffer.append(iterator.next());
- }
-
- referrals = buffer.toString();
- }
-
- String processingTime =
- String.valueOf(getProcessingTime());
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr },
- new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
- /**
- * {@inheritDoc}
- */
+ @Override
public DN getProxiedAuthorizationDN()
{
return proxiedAuthorizationDN;
@@ -397,6 +320,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final List<Control> getResponseControls()
{
return responseControls;
@@ -405,6 +329,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void addResponseControl(Control control)
{
responseControls.add(control);
@@ -413,6 +338,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void removeResponseControl(Control control)
{
responseControls.remove(control);
@@ -421,6 +347,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void toString(StringBuilder buffer)
{
buffer.append("ModifyOperation(connID=");
@@ -435,6 +362,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final long getChangeNumber(){
return changeNumber;
}
@@ -442,6 +370,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setChangeNumber(long changeNumber)
{
this.changeNumber = changeNumber;
@@ -450,6 +379,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN)
{
this.proxiedAuthorizationDN = proxiedAuthorizationDN;
@@ -458,6 +388,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public final void run()
{
setResultCode(ResultCode.UNDEFINED);
@@ -627,8 +558,8 @@
*
* This method always returns null.
*/
+ @Override
public Entry getCurrentEntry() {
- // TODO Auto-generated method stub
return null;
}
@@ -637,6 +568,7 @@
*
* This method always returns null.
*/
+ @Override
public List<AttributeValue> getCurrentPasswords()
{
return null;
@@ -647,6 +579,7 @@
*
* This method always returns null.
*/
+ @Override
public Entry getModifiedEntry()
{
return null;
@@ -657,6 +590,7 @@
*
* This method always returns null.
*/
+ @Override
public List<AttributeValue> getNewPasswords()
{
return null;
diff --git a/opends/src/server/org/opends/server/core/OperationWrapper.java b/opends/src/server/org/opends/server/core/OperationWrapper.java
index 0e21cff..0f29a37 100644
--- a/opends/src/server/org/opends/server/core/OperationWrapper.java
+++ b/opends/src/server/org/opends/server/core/OperationWrapper.java
@@ -36,7 +36,6 @@
import org.opends.server.controls.ControlDecoder;
import org.opends.server.types.*;
-
/**
* This abstract class is a generic operation wrapper intended to be subclassed
* by a specific operation wrapper.
@@ -195,15 +194,6 @@
* {@inheritDoc}
*/
@Override
- public String[][] getCommonLogElements()
- {
- return operation.getCommonLogElements();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public long getConnectionID()
{
return operation.getConnectionID();
@@ -332,15 +322,6 @@
* {@inheritDoc}
*/
@Override
- public String[][] getRequestLogElements()
- {
- return operation.getRequestLogElements();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public List<Control> getResponseControls()
{
return operation.getResponseControls();
@@ -350,15 +331,6 @@
* {@inheritDoc}
*/
@Override
- public String[][] getResponseLogElements()
- {
- return operation.getResponseLogElements();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public ResultCode getResultCode()
{
return operation.getResultCode();
@@ -535,8 +507,6 @@
operation.setSynchronizationOperation(isSynchronizationOperation);
}
-
-
/**
* {@inheritDoc}
*/
@@ -546,8 +516,6 @@
return getClientConnection().hashCode() * (int) getOperationID();
}
-
-
/**
* {@inheritDoc}
*/
@@ -571,8 +539,6 @@
return false;
}
-
-
/**
* {@inheritDoc}
*/
diff --git a/opends/src/server/org/opends/server/core/SearchOperationBasis.java b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
index 2b42632..822cbf3 100644
--- a/opends/src/server/org/opends/server/core/SearchOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
@@ -27,16 +27,16 @@
*/
package org.opends.server.core;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.opends.server.util.StaticUtils.*;
+
+import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import org.opends.messages.Message;
-import org.opends.messages.MessageBuilder;
import org.opends.server.api.AuthenticationPolicyState;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.plugin.PluginResult;
@@ -53,13 +53,6 @@
import org.opends.server.types.operation.SearchReferenceSearchOperation;
import org.opends.server.util.TimeThread;
-import static org.opends.messages.CoreMessages.*;
-import static org.opends.server.core.CoreConstants.*;
-import static org.opends.server.loggers.AccessLogger.*;
-import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
* This class defines an operation that may be used to locate entries in the
* Directory Server based on a given set of criteria.
@@ -1007,123 +1000,12 @@
{
// Note that no debugging will be done in this method because it is a likely
// candidate for being called by the logging subsystem.
-
return OperationType.SEARCH;
}
/**
* {@inheritDoc}
*/
- @Override()
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String attrs;
- if ((attributes == null) || attributes.isEmpty())
- {
- attrs = null;
- }
- else
- {
- StringBuilder attrBuffer = new StringBuilder();
- Iterator<String> iterator = attributes.iterator();
- attrBuffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- attrBuffer.append(", ");
- attrBuffer.append(iterator.next());
- }
-
- attrs = attrBuffer.toString();
- }
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_BASE_DN, String.valueOf(rawBaseDN) },
- new String[] { LOG_ELEMENT_SCOPE, String.valueOf(scope) },
- new String[] { LOG_ELEMENT_SIZE_LIMIT, String.valueOf(sizeLimit) },
- new String[] { LOG_ELEMENT_TIME_LIMIT, String.valueOf(timeLimit) },
- new String[] { LOG_ELEMENT_FILTER, String.valueOf(rawFilter) },
- new String[] { LOG_ELEMENT_REQUESTED_ATTRIBUTES, attrs }
- };
- }
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- String resultCode = String.valueOf(getResultCode().getIntValue());
-
- String errorMessage;
- MessageBuilder errorMessageBuffer = getErrorMessage();
- if (errorMessageBuffer == null)
- {
- errorMessage = null;
- }
- else
- {
- errorMessage = errorMessageBuffer.toString();
- }
-
- String matchedDNStr;
- DN matchedDN = getMatchedDN();
- if (matchedDN == null)
- {
- matchedDNStr = null;
- }
- else
- {
- matchedDNStr = matchedDN.toString();
- }
-
- String referrals;
- List<String> referralURLs = getReferralURLs();
- if ((referralURLs == null) || referralURLs.isEmpty())
- {
- referrals = null;
- }
- else
- {
- StringBuilder buffer = new StringBuilder();
- Iterator<String> iterator = referralURLs.iterator();
- buffer.append(iterator.next());
-
- while (iterator.hasNext())
- {
- buffer.append(", ");
- buffer.append(iterator.next());
- }
-
- referrals = buffer.toString();
- }
-
- String processingTime =
- String.valueOf(processingStopTime - processingStartTime);
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_RESULT_CODE, resultCode },
- new String[] { LOG_ELEMENT_ERROR_MESSAGE, errorMessage },
- new String[] { LOG_ELEMENT_MATCHED_DN, matchedDNStr },
- new String[] { LOG_ELEMENT_REFERRAL_URLS, referrals },
- new String[] { LOG_ELEMENT_ENTRIES_SENT, String.valueOf(entriesSent) },
- new String[] { LOG_ELEMENT_REFERENCES_SENT,
- String.valueOf(referencesSent ) },
- new String[] { LOG_ELEMENT_PROCESSING_TIME, processingTime }
- };
- }
-
- /**
- * {@inheritDoc}
- */
@Override
public DN getProxiedAuthorizationDN()
{
@@ -1574,7 +1456,7 @@
if (filter.getAttributeType().isObjectClassType())
{
AttributeValue v = filter.getAssertionValue();
- // FIXME : technically this is not correct since the presense
+ // FIXME : technically this is not correct since the presence
// of draft oc would trigger rfc oc visibility and visa versa.
String stringValueLC = toLowerCase(v.getValue().toString());
if (stringValueLC.equals(OC_LDAP_SUBENTRY_LC) ||
diff --git a/opends/src/server/org/opends/server/core/UnbindOperationBasis.java b/opends/src/server/org/opends/server/core/UnbindOperationBasis.java
index 60a1d9d..823232d 100644
--- a/opends/src/server/org/opends/server/core/UnbindOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/UnbindOperationBasis.java
@@ -23,9 +23,13 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS
*/
package org.opends.server.core;
+import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
+
import java.util.List;
import org.opends.server.api.ClientConnection;
@@ -35,8 +39,6 @@
import org.opends.server.types.operation.PostOperationUnbindOperation;
import org.opends.server.types.operation.PreParseUnbindOperation;
-import static org.opends.server.loggers.AccessLogger.*;
-import static org.opends.messages.CoreMessages.*;
/**
* This class defines an operation that may be used to close the connection
* between the client and the Directory Server.
@@ -83,44 +85,10 @@
{
// Note that no debugging will be done in this method because it is a likely
// candidate for being called by the logging subsystem.
-
return OperationType.UNBIND;
}
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getRequestLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- // There are no special elements that should be logged for an unbind
- // request.
- return new String[0][];
- }
-
-
-
- /**
- * {@inheritDoc}
- */
- @Override()
- public final String[][] getResponseLogElements()
- {
- // Note that no debugging will be done in this method because it is a likely
- // candidate for being called by the logging subsystem.
-
- // There is no unbind response, nor are there any special elements that
- // should be logged when an unbind occurs.
- return new String[0][];
- }
-
-
-
/**
* {@inheritDoc}
*/
@@ -161,6 +129,7 @@
* managing synchronization, and any other work that might need to
* be done in the course of processing.
*/
+ @Override
public final void run()
{
// Get the plugin config manager that will be used for invoking plugins.
diff --git a/opends/src/server/org/opends/server/types/AbstractOperation.java b/opends/src/server/org/opends/server/types/AbstractOperation.java
index d2f150f..00765b0 100644
--- a/opends/src/server/org/opends/server/types/AbstractOperation.java
+++ b/opends/src/server/org/opends/server/types/AbstractOperation.java
@@ -27,7 +27,6 @@
*/
package org.opends.server.types;
-import static org.opends.server.core.CoreConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import java.util.*;
@@ -252,37 +251,6 @@
/**
- * Retrieves a set of standard elements that should be logged in all
- * requests and responses for all types of operations. Each element
- * in the array will itself be a two-element array in which the
- * first element is the name of the field and the second is a string
- * representation of the value, or {@code null} if there is no value
- * for that field.
- *
- * @return A standard set of elements that should be logged in
- * requests and responses for all types of operations.
- */
- @Override
- public final String[][] getCommonLogElements()
- {
- // Note that no debugging will be done in this method because
- // it is a likely candidate for being called by the logging
- // subsystem.
-
- return new String[][]
- {
- new String[] { LOG_ELEMENT_CONNECTION_ID,
- String.valueOf(getConnectionID()) },
- new String[] { LOG_ELEMENT_OPERATION_ID,
- String.valueOf(operationID) },
- new String[] { LOG_ELEMENT_MESSAGE_ID,
- String.valueOf(messageID) }
- };
- }
-
-
-
- /**
* Retrieves the client connection with which this operation is
* associated.
*
diff --git a/opends/src/server/org/opends/server/types/Operation.java b/opends/src/server/org/opends/server/types/Operation.java
index d7b797f..11772ca 100644
--- a/opends/src/server/org/opends/server/types/Operation.java
+++ b/opends/src/server/org/opends/server/types/Operation.java
@@ -89,45 +89,6 @@
);
/**
- * Retrieves a set of standard elements that should be logged in all
- * requests and responses for all types of operations. Each element
- * in the array will itself be a two-element array in which the
- * first element is the name of the field and the second is a string
- * representation of the value, or {@code null} if there is no value
- * for that field.
- *
- * @return A standard set of elements that should be logged in
- * requests and responses for all types of operations.
- */
- public abstract String[][] getCommonLogElements();
-
- /**
- * Retrieves a standard set of elements that should be logged in
- * requests for this type of operation. Each element in the array
- * will itself be a two-element array in which the first element is
- * the name of the field and the second is a string representation
- * of the value, or {@code null} if there is no value for that
- * field.
- *
- * @return A standard set of elements that should be logged in
- * requests for this type of operation.
- */
- public abstract String[][] getRequestLogElements();
-
- /**
- * Retrieves a standard set of elements that should be logged in
- * responses for this type of operation. Each element in the array
- * will itself be a two-element array in which the first element is
- * the name of the field and the second is a string representation
- * of the value, or {@code null} if there is no value for that
- * field.
- *
- * @return A standard set of elements that should be logged in
- * responses for this type of operation.
- */
- public abstract String[][] getResponseLogElements();
-
- /**
* Retrieves the client connection with which this operation is
* associated.
*
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AbandonOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AbandonOperationTestCase.java
index 2f25186..1a8a72a 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AbandonOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AbandonOperationTestCase.java
@@ -23,54 +23,31 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS.
+ * Portions copyright 2011-2013 ForgeRock AS.
*/
package org.opends.server.core;
-import static org.opends.server.util.ServerConstants.OID_WHO_AM_I_REQUEST;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
+import static org.opends.server.util.ServerConstants.*;
+import static org.testng.Assert.*;
import java.net.Socket;
import java.util.ArrayList;
import java.util.LinkedHashSet;
-import org.opends.server.TestCaseUtils;
-import org.opends.server.tools.LDAPWriter;
-import org.opends.server.tools.LDAPReader;
import org.opends.messages.Message;
+import org.opends.server.TestCaseUtils;
import org.opends.server.plugins.DelayPreOpPlugin;
import org.opends.server.plugins.DisconnectClientPlugin;
import org.opends.server.protocols.internal.InternalClientConnection;
-import org.opends.server.protocols.ldap.AbandonRequestProtocolOp;
-import org.opends.server.protocols.ldap.AddRequestProtocolOp;
-import org.opends.server.protocols.ldap.AddResponseProtocolOp;
-import org.opends.server.protocols.ldap.BindRequestProtocolOp;
-import org.opends.server.protocols.ldap.BindResponseProtocolOp;
-import org.opends.server.protocols.ldap.CompareRequestProtocolOp;
-import org.opends.server.protocols.ldap.CompareResponseProtocolOp;
-import org.opends.server.protocols.ldap.DeleteRequestProtocolOp;
-import org.opends.server.protocols.ldap.DeleteResponseProtocolOp;
-import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp;
-import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp;
-import org.opends.server.protocols.ldap.LDAPAttribute;
-import org.opends.server.protocols.ldap.LDAPFilter;
-import org.opends.server.protocols.ldap.LDAPMessage;
-import org.opends.server.protocols.ldap.LDAPModification;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.protocols.ldap.ModifyDNRequestProtocolOp;
-import org.opends.server.protocols.ldap.ModifyDNResponseProtocolOp;
-import org.opends.server.protocols.ldap.ModifyRequestProtocolOp;
-import org.opends.server.protocols.ldap.ModifyResponseProtocolOp;
-import org.opends.server.protocols.ldap.SearchRequestProtocolOp;
-import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp;
+import org.opends.server.protocols.ldap.*;
+import org.opends.server.tools.LDAPReader;
+import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.*;
-import org.testng.annotations.Test;
+import org.opends.server.util.StaticUtils;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
/**
@@ -101,6 +78,7 @@
/**
* For some reason, the @BeforeClass method in the super class is not called.
*/
+ @Override
@BeforeClass()
public void startServer() throws Exception {
super.startServer();
@@ -174,7 +152,6 @@
assertTrue(abandonOperation.getProcessingStartTime() > 0);
assertTrue(abandonOperation.getProcessingStopTime() > 0);
assertTrue(abandonOperation.getProcessingTime() >= 0);
- assertNotNull(abandonOperation.getResponseLogElements());
}
@@ -225,10 +202,7 @@
Thread.sleep(3000);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
// NOTE: We can't check to see if pre-parse plugins were called yet
// because there's no plugin ordering. It's possible that the
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java
index 8d73331..ce2cd45 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java
@@ -27,8 +27,6 @@
*/
package org.opends.server.core;
-
-
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.testng.Assert.*;
@@ -45,22 +43,16 @@
import org.opends.server.plugins.ShortCircuitPlugin;
import org.opends.server.plugins.UpdatePreOpPlugin;
import org.opends.server.protocols.internal.InternalClientConnection;
-import org.opends.server.protocols.ldap.AddRequestProtocolOp;
-import org.opends.server.protocols.ldap.AddResponseProtocolOp;
-import org.opends.server.protocols.ldap.BindRequestProtocolOp;
-import org.opends.server.protocols.ldap.BindResponseProtocolOp;
-import org.opends.server.protocols.ldap.LDAPAttribute;
-import org.opends.server.protocols.ldap.LDAPMessage;
+import org.opends.server.protocols.ldap.*;
import org.opends.server.tools.LDAPModify;
import org.opends.server.tools.LDAPReader;
import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.*;
+import org.opends.server.util.StaticUtils;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-
-
/**
* A set of test cases for add operations
*/
@@ -68,7 +60,7 @@
extends OperationTestCase
{
- // Some of the tests disable the backends, so we reenable them here.
+ /** Some of the tests disable the backends, so we reenable them here. */
@AfterMethod(alwaysRun=true)
public void reenableBackend() throws DirectoryException {
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -565,7 +557,6 @@
assertTrue(addOperation.getProcessingStopTime() >=
addOperation.getProcessingStartTime());
assertTrue(addOperation.getProcessingTime() >= 0);
- assertNotNull(addOperation.getResponseLogElements());
long changeNumber = addOperation.getChangeNumber();
addOperation.setChangeNumber(changeNumber);
@@ -868,10 +859,7 @@
assertEquals(ldapStatistics.getAddRequests(), addRequests+1);
waitForAddResponsesStat(addResponses+1);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1706,10 +1694,7 @@
assertEquals(ldapStatistics.getAddRequests(), addRequests+1);
waitForAddResponsesStat(addResponses+1);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED);
}
@@ -1858,10 +1843,7 @@
assertEquals(ldapStatistics.getAddRequests(), addRequests+1);
waitForAddResponsesStat(addResponses+1);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
b.setWritabilityMode(WritabilityMode.ENABLED);
}
@@ -2108,10 +2090,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -2171,10 +2150,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -2234,10 +2210,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -2310,10 +2283,8 @@
break responseLoop;
default:
// This is a problem. It's an unexpected response.
- try
- {
- s.close();
- } catch (Exception e) {}
+
+ StaticUtils.close(s);
throw new Exception("Unexpected response message " + message +
" encountered in " +
@@ -2321,10 +2292,7 @@
}
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java
index ed631ee..ea1891d 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java
@@ -23,37 +23,31 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS.
+ * Portions copyright 2011-2013 ForgeRock AS.
*/
package org.opends.server.core;
-
+import static org.opends.server.protocols.ldap.LDAPConstants.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.testng.Assert.*;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
+import org.opends.messages.Message;
import org.opends.server.TestCaseUtils;
import org.opends.server.plugins.DisconnectClientPlugin;
import org.opends.server.plugins.InvocationCounterPlugin;
import org.opends.server.plugins.ShortCircuitPlugin;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.ldap.*;
-import org.opends.server.tools.LDAPSearch;
+import org.opends.server.tools.*;
import org.opends.server.tools.LDAPReader;
-import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.*;
-import org.opends.messages.Message;
-import org.opends.server.tools.LDAPDelete;
-import org.opends.server.tools.LDAPModify;
-
-import static org.testng.Assert.*;
-import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.protocols.ldap.LDAPConstants.*;
-
+import org.opends.server.util.StaticUtils;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
/**
* A set of test cases for bind operations
@@ -220,14 +214,14 @@
Operation[] bindOps = new Operation[simpleBinds.length + saslBinds.length];
int pos = 0;
- for (int i=0; i < simpleBinds.length; i++)
+ for (Object[] simpleBind : simpleBinds)
{
- bindOps[pos++] = (BindOperation) simpleBinds[i][0];
+ bindOps[pos++] = (BindOperation) simpleBind[0];
}
- for (int i=0; i < saslBinds.length; i++)
+ for (Object[] saslBind : saslBinds)
{
- bindOps[pos++] = (BindOperation) saslBinds[i][0];
+ bindOps[pos++] = (BindOperation) saslBind[0];
}
return bindOps;
@@ -778,73 +772,6 @@
/**
- * Tests the <CODE>getResponseLogElements</CODE> method for a completed
- * successful bind operation using simple authentication.
- */
- @Test()
- public void testGetResponseLogElementsSimple()
- {
- InternalClientConnection conn =
- new InternalClientConnection(new AuthenticationInfo());
-
- BindOperation bindOperation =
- conn.processSimpleBind(ByteString.valueOf("cn=Directory Manager"),
- ByteString.valueOf("password"));
- assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
- assertNotNull(bindOperation.getResponseLogElements());
- assertTrue(bindOperation.getResponseLogElements().length > 0);
- }
-
-
-
- /**
- * Tests the <CODE>getResponseLogElements</CODE> method for a completed bind
- * operation using SASL authentication.
- */
- @Test()
- public void testGetResponseLogElementsSASL()
- {
- InternalClientConnection conn =
- new InternalClientConnection(new AuthenticationInfo());
-
- ByteString saslCreds =
- ByteString.valueOf("\u0000dn:cn=Directory Manager\u0000password");
-
- BindOperation bindOperation =
- conn.processSASLBind(DN.nullDN(), "PLAIN", saslCreds);
- assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS);
- assertNotNull(bindOperation.getResponseLogElements());
- assertTrue(bindOperation.getResponseLogElements().length > 0);
- }
-
-
-
- /**
- * Tests the <CODE>getResponseLogElements</CODE> method for a failed simple
- * bind attempt in which the target user didn't exist.
- *
- * @throws Exception If an unexpected problem occurs.
- */
- @Test()
- public void testGetResponseLogElementsSimpleNoSuchUser()
- throws Exception
- {
- TestCaseUtils.initializeTestBackend(true);
-
- InternalClientConnection conn =
- new InternalClientConnection(new AuthenticationInfo());
-
- BindOperation bindOperation =
- conn.processSimpleBind(ByteString.valueOf("uid=test,o=test"),
- ByteString.valueOf("password"));
- assertEquals(bindOperation.getResultCode(), ResultCode.INVALID_CREDENTIALS);
- assertNotNull(bindOperation.getResponseLogElements());
- assertTrue(bindOperation.getResponseLogElements().length > 0);
- }
-
-
-
- /**
* Tests a simple bind operation to ensure that all plugin types are invoked
* as expected.
*/
@@ -928,10 +855,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -968,10 +892,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1008,10 +929,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1048,10 +966,7 @@
message = r.readMessage();
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1086,10 +1001,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1126,10 +1038,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1166,10 +1075,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1206,10 +1112,7 @@
message = r.readMessage();
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1246,10 +1149,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1287,10 +1187,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1328,10 +1225,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1369,10 +1263,7 @@
message = r.readMessage();
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1404,10 +1295,7 @@
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), 80);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1440,10 +1328,7 @@
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), 80);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1475,10 +1360,7 @@
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), 80);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1511,10 +1393,7 @@
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), 80);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1547,10 +1426,7 @@
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), 80);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1584,10 +1460,7 @@
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), 80);
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java
index 1cd92df..aa3ef8b 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java
@@ -28,25 +28,27 @@
package org.opends.server.core;
-import org.opends.server.protocols.internal.InternalClientConnection;
-import org.opends.server.protocols.ldap.*;
-import org.opends.server.types.*;
+import static org.testng.Assert.*;
+
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.locks.Lock;
+
import org.opends.server.TestCaseUtils;
-import org.opends.server.tools.LDAPWriter;
-import org.opends.server.util.ServerConstants;
import org.opends.server.controls.LDAPAssertionRequestControl;
import org.opends.server.controls.ProxiedAuthV1Control;
import org.opends.server.controls.ProxiedAuthV2Control;
import org.opends.server.plugins.InvocationCounterPlugin;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.protocols.ldap.*;
+import org.opends.server.tools.LDAPWriter;
+import org.opends.server.types.*;
+import org.opends.server.util.ServerConstants;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import static org.testng.Assert.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.locks.Lock;
-import java.net.Socket;
-
+@SuppressWarnings("javadoc")
public class CompareOperationTestCase extends OperationTestCase
{
private Entry entry;
@@ -149,7 +151,6 @@
assertTrue(compareOperation.getProcessingStartTime() > 0);
assertTrue(compareOperation.getProcessingStopTime() > 0);
assertTrue(compareOperation.getProcessingTime() >= 0);
- assertNotNull(compareOperation.getResponseLogElements());
// assertEquals(InvocationCounterPlugin.getPreParseCount(), 1);
// assertEquals(InvocationCounterPlugin.getPreOperationCount(), 1);
@@ -169,7 +170,6 @@
assertTrue(compareOperation.getProcessingStartTime() > 0);
assertTrue(compareOperation.getProcessingStopTime() > 0);
assertTrue(compareOperation.getProcessingTime() >= 0);
- assertNotNull(compareOperation.getResponseLogElements());
assertTrue(compareOperation.getErrorMessage().length() > 0);
// assertEquals(InvocationCounterPlugin.getPreParseCount(), 1);
@@ -190,7 +190,6 @@
assertTrue(compareOperation.getProcessingStartTime() > 0);
assertTrue(compareOperation.getProcessingStopTime() > 0);
assertTrue(compareOperation.getProcessingTime() >= 0);
- assertNotNull(compareOperation.getResponseLogElements());
assertTrue(compareOperation.getErrorMessage().length() > 0);
// assertEquals(InvocationCounterPlugin.getPreParseCount(), 1);
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java
index 2e83b5a..789695a 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java
@@ -27,18 +27,16 @@
*/
package org.opends.server.core;
-
+import static org.opends.server.protocols.ldap.LDAPConstants.*;
+import static org.testng.Assert.*;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
-import org.testng.annotations.Test;
-import org.testng.annotations.AfterMethod;
-
-import org.opends.server.TestCaseUtils;
import org.opends.messages.Message;
+import org.opends.server.TestCaseUtils;
import org.opends.server.api.Backend;
import org.opends.server.plugins.DisconnectClientPlugin;
import org.opends.server.plugins.ShortCircuitPlugin;
@@ -50,12 +48,10 @@
import org.opends.server.tools.LDAPDelete;
import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.*;
+import org.opends.server.util.StaticUtils;
import org.opends.server.workflowelement.localbackend.LocalBackendDeleteOperation;
-
-import static org.testng.Assert.*;
-import static org.opends.server.protocols.ldap.LDAPConstants.*;
-
-
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
/**
* A set of test cases for delete operations
@@ -63,7 +59,7 @@
public class DeleteOperationTestCase
extends OperationTestCase
{
- // Some of the tests disable the backends, so we reenable them here.
+ /** Some of the tests disable the backends, so we reenable them here. */
@AfterMethod(alwaysRun=true)
public void reenableBackend() throws DirectoryException {
Backend b = DirectoryServer.getBackend(DN.decode("o=test"));
@@ -203,7 +199,6 @@
assertTrue(deleteOperation.getProcessingStopTime() >=
deleteOperation.getProcessingStartTime());
assertTrue(deleteOperation.getProcessingTime() >= 0);
- assertNotNull(deleteOperation.getResponseLogElements());
long changeNumber = deleteOperation.getChangeNumber();
@@ -231,11 +226,11 @@
conn.processDelete(ByteString.valueOf("o=test"));
assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS);
retrieveCompletedOperationElements(deleteOperation);
- List localOps =
+ List<LocalBackendDeleteOperation> localOps =
(List) (deleteOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS));
assertNotNull(localOps);
- for (Object localOp : localOps){
- LocalBackendDeleteOperation curOp = (LocalBackendDeleteOperation) localOp;
+ for (LocalBackendDeleteOperation curOp : localOps)
+ {
assertNotNull(curOp.getEntryToDelete());
}
}
@@ -260,11 +255,11 @@
DeleteOperation deleteOperation =
conn.processDelete(ByteString.valueOf("ou=People,o=test"));
assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS);
- List localOps =
+ List<LocalBackendDeleteOperation> localOps =
(List) (deleteOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS));
assertNotNull(localOps);
- for (Object localOp : localOps){
- LocalBackendDeleteOperation curOp = (LocalBackendDeleteOperation) localOp;
+ for (LocalBackendDeleteOperation curOp : localOps)
+ {
assertNull(curOp.getEntryToDelete());
}
}
@@ -910,10 +905,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -962,10 +954,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1014,10 +1003,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -1090,10 +1076,7 @@
}
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java
index 0f1c1cd..ba058a8 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java
@@ -27,54 +27,37 @@
*/
package org.opends.server.core;
-
+import static org.opends.server.TestCaseUtils.*;
+import static org.opends.server.protocols.ldap.LDAPConstants.*;
+import static org.testng.Assert.*;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-
-import org.opends.server.TestCaseUtils;
import org.opends.messages.Message;
+import org.opends.server.TestCaseUtils;
import org.opends.server.api.Backend;
import org.opends.server.plugins.DisconnectClientPlugin;
import org.opends.server.plugins.ShortCircuitPlugin;
import org.opends.server.plugins.UpdatePreOpPlugin;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
-import org.opends.server.protocols.ldap.BindRequestProtocolOp;
-import org.opends.server.protocols.ldap.BindResponseProtocolOp;
-import org.opends.server.protocols.ldap.ModifyRequestProtocolOp;
-import org.opends.server.protocols.ldap.ModifyResponseProtocolOp;
-import org.opends.server.protocols.ldap.LDAPAttribute;
-import org.opends.server.protocols.ldap.LDAPMessage;
-import org.opends.server.protocols.ldap.LDAPModification;
-import org.opends.server.protocols.ldap.LDAPFilter;
-import org.opends.server.protocols.ldap.LDAPControl;
+import org.opends.server.protocols.ldap.*;
import org.opends.server.tools.LDAPModify;
import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.*;
import org.opends.server.util.Base64;
import org.opends.server.util.ServerConstants;
+import org.opends.server.util.StaticUtils;
import org.opends.server.workflowelement.localbackend.LocalBackendModifyOperation;
-
-import static org.testng.Assert.*;
-
-import static org.opends.server.TestCaseUtils.TEST_BACKEND_ID;
-import static org.opends.server.TestCaseUtils.applyModifications;
-import static org.opends.server.protocols.ldap.LDAPConstants.*;
-
-
+import org.testng.annotations.*;
/**
* A set of test cases for modify operations
*/
+@SuppressWarnings("javadoc")
public class ModifyOperationTestCase
extends OperationTestCase
{
@@ -88,8 +71,9 @@
@AfterMethod(alwaysRun=true)
public void reenableBackend() throws DirectoryException {
Object[][] backendBaseDNs = getBaseDNs();
- for (int i = 0; i < backendBaseDNs.length; i++) {
- String backendBaseDN = backendBaseDNs[i][0].toString();
+ for (Object[] backendBaseDN2 : backendBaseDNs)
+ {
+ String backendBaseDN = backendBaseDN2[0].toString();
Backend b = DirectoryServer.getBackend(DN.decode(backendBaseDN));
b.setWritabilityMode(WritabilityMode.ENABLED);
}
@@ -482,13 +466,12 @@
assertTrue(modifyOperation.getProcessingStopTime() >=
modifyOperation.getProcessingStartTime());
assertTrue(modifyOperation.getProcessingTime() >= 0);
- assertNotNull(modifyOperation.getResponseLogElements());
- List localOps =
+ List<LocalBackendModifyOperation> localOps =
(List) (modifyOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS));
assertNotNull(localOps);
- for (Object localOp : localOps){
- LocalBackendModifyOperation curOp = (LocalBackendModifyOperation) localOp;
+ for (LocalBackendModifyOperation curOp : localOps)
+ {
curOp.getNewPasswords();
curOp.getCurrentPasswords();
assertNotNull(curOp.getCurrentEntry());
@@ -515,7 +498,6 @@
assertTrue(modifyOperation.getProcessingStopTime() >=
modifyOperation.getProcessingStartTime());
assertTrue(modifyOperation.getProcessingTime() >= 0);
- assertNotNull(modifyOperation.getResponseLogElements());
long changeNumber = modifyOperation.getChangeNumber();
modifyOperation.setChangeNumber(changeNumber);
@@ -4096,10 +4078,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -4154,10 +4133,7 @@
assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -4228,10 +4204,7 @@
break responseLoop;
default:
// This is a problem. It's an unexpected response.
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
throw new Exception("Unexpected response message " + message +
" encountered in " +
@@ -4239,10 +4212,7 @@
}
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
@@ -4309,10 +4279,7 @@
break responseLoop;
default:
// This is a problem. It's an unexpected response.
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
throw new Exception("Unexpected response message " + message +
" encountered in " +
@@ -4320,10 +4287,7 @@
}
}
- try
- {
- s.close();
- } catch (Exception e) {}
+ StaticUtils.close(s);
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/OperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/OperationTestCase.java
index 2f6a6ee..e521075 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/OperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/OperationTestCase.java
@@ -23,27 +23,23 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS
*/
package org.opends.server.core;
-
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
+import static org.testng.Assert.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.ConnectionHandler;
import org.opends.server.protocols.ldap.LDAPConnectionHandler;
-import org.opends.server.protocols.ldap.LDAPStatistics;
import org.opends.server.protocols.ldap.LDAPControl;
+import org.opends.server.protocols.ldap.LDAPStatistics;
import org.opends.server.types.Control;
import org.opends.server.types.Operation;
-
-import static org.testng.Assert.*;
-
-
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
/**
* A set of generic test cases for operations
@@ -51,10 +47,10 @@
public abstract class OperationTestCase
extends CoreTestCase
{
- // The LDAPStatistics object associated with the LDAP connection handler.
+ /** The LDAPStatistics object associated with the LDAP connection handler. */
protected LDAPStatistics ldapStatistics;
- // The LDAPStatistics object associated with the LDAPS connection handler.
+ /** The LDAPStatistics object associated with the LDAPS connection handler. */
protected LDAPStatistics ldapsStatistics;
@BeforeMethod
@@ -63,8 +59,10 @@
TestCaseUtils.quiesceServer();
}
- // When this was part of an @BeforeClass method, it was not called reliably
- // for each subclass.
+ /**
+ * When this was part of an @BeforeClass method, it was not called reliably
+ * for each subclass.
+ */
@BeforeMethod
public void initializeLDAPStatistics()
{
@@ -172,34 +170,6 @@
/**
- * Tests the <CODE>getCommonLogElements</CODE> method for the provided
- * operation.
- *
- * @param operation The operation to test.
- */
- @Test(dataProvider = "testOperations")
- public void testGetCommonLogElements(Operation operation)
- {
- assertNotNull(operation.getCommonLogElements());
- }
-
-
-
- /**
- * Tests the <CODE>getRequestLogElements</CODE> method for the provided
- * operation.
- *
- * @param operation The operation to test.
- */
- @Test(dataProvider = "testOperations")
- public void testGetRequestLogElements(Operation operation)
- {
- assertNotNull(operation.getRequestLogElements());
- }
-
-
-
- /**
* Tests the <CODE>getClientConnection</CODE> method for the provided
* operation.
*
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
index 87f1e64..3df8e7d 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
@@ -23,12 +23,11 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2011-2012 ForgeRock AS
+ * Portions copyright 2011-2013 ForgeRock AS
*/
-
package org.opends.server.core;
-import static org.opends.server.util.ServerConstants.OID_LDUP_SUBENTRIES;
+import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
import java.io.IOException;
@@ -43,37 +42,17 @@
import org.opends.server.protocols.asn1.ASN1Exception;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
-import org.opends.server.protocols.ldap.BindRequestProtocolOp;
-import org.opends.server.protocols.ldap.BindResponseProtocolOp;
-import org.opends.server.protocols.ldap.LDAPAttribute;
-import org.opends.server.protocols.ldap.LDAPConstants;
-import org.opends.server.protocols.ldap.LDAPControl;
-import org.opends.server.protocols.ldap.LDAPFilter;
-import org.opends.server.protocols.ldap.LDAPMessage;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.protocols.ldap.SearchRequestProtocolOp;
-import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp;
-import org.opends.server.protocols.ldap.SearchResultEntryProtocolOp;
+import org.opends.server.protocols.ldap.*;
import org.opends.server.tools.LDAPModify;
import org.opends.server.tools.LDAPWriter;
-import org.opends.server.types.Attribute;
-import org.opends.server.types.ByteString;
-import org.opends.server.types.Control;
-import org.opends.server.types.DN;
-import org.opends.server.types.DereferencePolicy;
-import org.opends.server.types.Entry;
-import org.opends.server.types.LDAPException;
-import org.opends.server.types.Operation;
-import org.opends.server.types.ResultCode;
-import org.opends.server.types.SearchResultEntry;
-import org.opends.server.types.SearchResultReference;
-import org.opends.server.types.SearchScope;
+import org.opends.server.types.*;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+@SuppressWarnings("javadoc")
public class SearchOperationTestCase extends OperationTestCase
{
private static final String SUFFIX = "dc=example,dc=com";
@@ -271,7 +250,6 @@
assertTrue(searchOperation.getProcessingStartTime() > 0);
assertTrue(searchOperation.getProcessingStopTime() > 0);
assertTrue(searchOperation.getProcessingTime() >= 0);
- assertNotNull(searchOperation.getResponseLogElements());
// assertEquals(InvocationCounterPlugin.getPreParseCount(), 1);
// assertEquals(InvocationCounterPlugin.getPreOperationCount(), 1);
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
index cacf400..6339981 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
@@ -178,7 +178,6 @@
assertTrue(modifyDNOperation.getProcessingStartTime() > 0);
assertTrue(modifyDNOperation.getProcessingStopTime() > 0);
assertTrue(modifyDNOperation.getProcessingTime() >= 0);
- assertNotNull(modifyDNOperation.getResponseLogElements());
// assertEquals(InvocationCounterPlugin.getPreParseCount(), 1);
// assertEquals(InvocationCounterPlugin.getPreOperationCount(), 1);
@@ -201,7 +200,6 @@
assertTrue(modifyDNOperation.getProcessingStartTime() > 0);
assertTrue(modifyDNOperation.getProcessingStopTime() > 0);
assertTrue(modifyDNOperation.getProcessingTime() >= 0);
- assertNotNull(modifyDNOperation.getResponseLogElements());
// assertEquals(InvocationCounterPlugin.getPreParseCount(), 2);
// assertEquals(InvocationCounterPlugin.getPreOperationCount(), 1);
@@ -225,7 +223,6 @@
assertTrue(modifyDNOperation.getProcessingStartTime() > 0);
assertTrue(modifyDNOperation.getProcessingStopTime() > 0);
assertTrue(modifyDNOperation.getProcessingTime() >= 0);
- assertNotNull(modifyDNOperation.getResponseLogElements());
assertTrue(modifyDNOperation.getErrorMessage().length() > 0);
// assertEquals(InvocationCounterPlugin.getPreParseCount(), 1);
@@ -250,7 +247,6 @@
assertTrue(modifyDNOperation.getProcessingStartTime() > 0);
assertTrue(modifyDNOperation.getProcessingStopTime() > 0);
assertTrue(modifyDNOperation.getProcessingTime() >= 0);
- assertNotNull(modifyDNOperation.getResponseLogElements());
assertTrue(modifyDNOperation.getErrorMessage().length() > 0);
// assertEquals(InvocationCounterPlugin.getPreParseCount(), 1);
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/UnbindOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/UnbindOperationTestCase.java
index 19e4565..8d642c7 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/UnbindOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/UnbindOperationTestCase.java
@@ -23,23 +23,22 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions copyright 2013 ForgeRock AS
*/
package org.opends.server.core;
-
+import static org.testng.Assert.*;
import java.util.ArrayList;
-import org.testng.annotations.Test;
-
import org.opends.messages.Message;
import org.opends.server.plugins.InvocationCounterPlugin;
import org.opends.server.protocols.internal.InternalClientConnection;
-import org.opends.server.types.*;
-
-import static org.testng.Assert.*;
-
-
+import org.opends.server.types.CancelRequest;
+import org.opends.server.types.Control;
+import org.opends.server.types.Operation;
+import org.opends.server.types.ResultCode;
+import org.testng.annotations.Test;
/**
* A set of test cases for unbind operations
@@ -79,7 +78,6 @@
assertTrue(unbindOperation.getProcessingStartTime() > 0);
assertTrue(unbindOperation.getProcessingStopTime() > 0);
assertTrue(unbindOperation.getProcessingTime() >= 0);
- assertNotNull(unbindOperation.getResponseLogElements());
}
--
Gitblit v1.10.0