mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
26.57.2013 693421b38b25cf570415fbb205a78948c32afeb9
OPENDJ-832 Leverage the work queue for processing requests received on the HTTP connection handler 

Code cleanup: More AbstractOperation => Operation.
Converted java comments to javadocs.
Added @Override annotations.
15 files modified
265 ■■■■■ changed files
opends/src/server/org/opends/server/core/QueueingStrategy.java 7 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/SynchronousStrategy.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/WorkQueueStrategy.java 7 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/extensions/ParallelWorkQueue.java 3 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java 15 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/jmx/JmxClientConnection.java 16 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java 23 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/DeleteMsg.java 12 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/LDAPUpdateMsg.java 20 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java 28 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java 15 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java 34 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java 38 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalTest.java 37 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/QueueingStrategy.java
@@ -23,12 +23,12 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2013 ForgeRock AS
 */
package org.opends.server.core;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Operation;
/**
 * This interface defines request handling strategies.
@@ -42,7 +42,6 @@
   * @throws org.opends.server.types.DirectoryException
   *          If a problem occurs in the Directory Server.
   */
  public void enqueueRequest(AbstractOperation operation)
    throws DirectoryException;
  public void enqueueRequest(Operation operation) throws DirectoryException;
}
opends/src/server/org/opends/server/core/SynchronousStrategy.java
@@ -23,12 +23,12 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.core;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Operation;
/**
 *
@@ -44,8 +44,8 @@
   * @throws org.opends.server.types.DirectoryException
   *          If a problem occurs in the Directory Server.
   */
  public void enqueueRequest(AbstractOperation operation)
    throws DirectoryException {
  @Override
  public void enqueueRequest(Operation operation) throws DirectoryException {
    operation.run();
    operation.operationCompleted();
  }
opends/src/server/org/opends/server/core/WorkQueueStrategy.java
@@ -23,11 +23,12 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2013 ForgeRock AS
 */
package org.opends.server.core;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Operation;
/**
 *
@@ -42,8 +43,8 @@
   * @throws org.opends.server.types.DirectoryException
   *          If a problem occurs in the Directory Server.
   */
  public void enqueueRequest(AbstractOperation operation)
    throws DirectoryException {
  @Override
  public void enqueueRequest(Operation operation) throws DirectoryException {
    DirectoryServer.enqueueRequest(operation);
  }
}
opends/src/server/org/opends/server/extensions/ParallelWorkQueue.java
@@ -44,7 +44,6 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.monitors.ParallelWorkQueueMonitor;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.CancelRequest;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.DebugLogLevel;
@@ -456,7 +455,7 @@
   * @return  <CODE>true</CODE> if the provided request was present in the queue
   *          and was removed successfully, or <CODE>false</CODE> it not.
   */
  public boolean removeOperation(AbstractOperation operation)
  public boolean removeOperation(Operation operation)
  {
    return opQueue.remove(operation);
  }
opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -55,7 +55,7 @@
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -88,20 +88,19 @@
  // The message ID counter to use for internal connections.
  /** The message ID counter to use for internal connections. */
  private static AtomicInteger nextMessageID;
  // The connection ID counter to use for internal connections.
  /** The connection ID counter to use for internal connections. */
  private static AtomicLong nextConnectionID;
  // The operation ID counter to use for operations on this
  // connection.
  /** The operation ID counter to use for operations on this connection. */
  private static AtomicLong nextOperationID;
  // The static connection for root-based connections.
  /** The static connection for root-based connections. */
  private static InternalClientConnection rootConnection;
  // The connection ID for this client connection.
  /** The connection ID for this client connection. */
  private final long connectionID;
@@ -2648,7 +2647,7 @@
       mayExtend=false,
       mayInvoke=false)
  @Override()
  public AbstractOperation getOperationInProgress(int messageID)
  public Operation getOperationInProgress(int messageID)
  {
    // Internal operations will not be tracked.
    return null;
opends/src/server/org/opends/server/protocols/jmx/JmxClientConnection.java
@@ -41,13 +41,13 @@
import org.opends.server.core.*;
import org.opends.server.core.networkgroups.NetworkGroup;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.ldap.*;
import org.opends.server.protocols.internal.InternalSearchOperation ;
import org.opends.server.protocols.internal.InternalSearchListener;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.ldap.LDAPFilter;
import org.opends.server.types.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
/**
@@ -63,16 +63,16 @@
   */
  private static final DebugTracer TRACER = getTracer();
  // The message ID counter to use for jmx connections.
  /** The message ID counter to use for jmx connections. */
  private AtomicInteger nextMessageID;
  // The operation ID counter to use for operations on this connection.
  /** The operation ID counter to use for operations on this connection. */
  private AtomicLong nextOperationID;
  // The empty operation list for this connection.
  /** The empty operation list for this connection. */
  private LinkedList<Operation> operationList;
  // The connection ID for this client connection.
  /** The connection ID for this client connection. */
  private long connectionID;
  /**
@@ -1028,7 +1028,7 @@
   *          <CODE>null</CODE> if no such operation could be found.
   */
  @Override
  public AbstractOperation getOperationInProgress(int messageID)
  public Operation getOperationInProgress(int messageID)
  {
    // Jmx operations will not be tracked.
    return null;
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -1210,7 +1210,7 @@
   *           client already has reached the maximum allowed concurrent
   *           requests).
   */
  private void addOperationInProgress(AbstractOperation operation)
  private void addOperationInProgress(Operation operation)
      throws DirectoryException
  {
    int messageID = operation.getMessageID();
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -23,23 +23,19 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.replication.plugin;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.replication.plugin.EntryHistorical.*;
import static org.opends.server.replication.protocol.OperationContext.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.createEntry;
import static org.opends.server.util.StaticUtils.getFileForPath;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import static org.opends.server.util.StaticUtils.toLowerCase;
import static org.opends.server.util.StaticUtils.*;
import java.io.File;
import java.io.InputStream;
@@ -51,9 +47,7 @@
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.DataFormatException;
import java.util.Date;
import org.opends.server.util.TimeThread;
import org.opends.messages.Category;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
@@ -108,6 +102,7 @@
import org.opends.server.replication.service.ReplicationBroker;
import org.opends.server.replication.service.ReplicationDomain;
import org.opends.server.replication.service.ReplicationMonitor;
import org.opends.server.tasks.PurgeConflictsHistoricalTask;
import org.opends.server.tasks.TaskUtils;
import org.opends.server.types.*;
import org.opends.server.types.operation.PluginOperation;
@@ -122,9 +117,9 @@
import org.opends.server.types.operation.PreOperationModifyOperation;
import org.opends.server.types.operation.PreOperationOperation;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.TimeThread;
import org.opends.server.workflowelement.externalchangelog.ECLWorkflowElement;
import org.opends.server.workflowelement.localbackend.*;
import org.opends.server.tasks.PurgeConflictsHistoricalTask;
/**
 *  This class implements the bulk part of the Directory Server side
@@ -2644,7 +2639,7 @@
          op.addRequestControl(new LDAPControl(OID_MANAGE_DSAIT_CONTROL));
          changeNumber = OperationContext.getChangeNumber(op);
          ((AbstractOperation) op).run();
          op.run();
          ResultCode result = op.getResultCode();
@@ -3998,8 +3993,8 @@
    if (checksumOutput)
    {
      os = (OutputStream)new ReplLDIFOutputStream(entryCount);
      ros = (ReplLDIFOutputStream)os;
      ros = new ReplLDIFOutputStream(entryCount);
      os = ros;
      try
      {
        os.write((Long.toString(numberOfEntries)).
opends/src/server/org/opends/server/replication/protocol/DeleteMsg.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.replication.protocol;
@@ -36,8 +36,8 @@
import org.opends.server.core.DeleteOperationBasis;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.replication.common.ChangeNumber;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.ByteString;
import org.opends.server.types.Operation;
import org.opends.server.types.operation.PostOperationDeleteOperation;
/**
@@ -47,7 +47,7 @@
{
  private String initiatorsName;
  // whether the DEL operation is a subtree DEL
  /** whether the DEL operation is a subtree DEL. */
  private boolean isSubtreeDelete = false;
  /**
@@ -66,7 +66,6 @@
    }
    catch(Exception e)
    {}
  }
  /**
@@ -113,8 +112,8 @@
   * {@inheritDoc}
   */
  @Override
  public AbstractOperation createOperation(
         InternalClientConnection connection, String newDn)
  public Operation createOperation(InternalClientConnection connection,
      String newDn)
  {
    DeleteOperationBasis del =  new DeleteOperationBasis(connection,
        InternalClientConnection.nextOperationID(),
@@ -136,6 +135,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public byte[] getBytes_V1() throws UnsupportedEncodingException
  {
    return encodeHeader_V1(MSG_TYPE_DELETE_V1, 0);
opends/src/server/org/opends/server/replication/protocol/LDAPUpdateMsg.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.replication.protocol;
@@ -40,12 +40,12 @@
import org.opends.server.protocols.ldap.LDAPAttribute;
import org.opends.server.replication.common.AssuredMode;
import org.opends.server.replication.common.ChangeNumber;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.Attribute;
import org.opends.server.types.ByteSequenceReader;
import org.opends.server.types.ByteString;
import org.opends.server.types.ByteStringBuilder;
import org.opends.server.types.LDAPException;
import org.opends.server.types.Operation;
import org.opends.server.types.RawAttribute;
import org.opends.server.types.operation.PostOperationAddOperation;
import org.opends.server.types.operation.PostOperationDeleteOperation;
@@ -189,8 +189,8 @@
   * @throws  ASN1Exception In case of ASN1 decoding exception.
   * @throws DataFormatException In case of bad msg format.
   */
  public AbstractOperation createOperation(InternalClientConnection conn)
         throws LDAPException, ASN1Exception, DataFormatException
  public Operation createOperation(InternalClientConnection conn)
      throws LDAPException, ASN1Exception, DataFormatException
  {
    return createOperation(conn, dn);
  }
@@ -206,9 +206,8 @@
   * @throws  ASN1Exception In case of ASN1 decoding exception.
   * @throws DataFormatException In case of bad msg format.
   */
  public abstract AbstractOperation createOperation(
         InternalClientConnection conn, String newDn)
         throws LDAPException, ASN1Exception, DataFormatException;
  public abstract Operation createOperation(InternalClientConnection conn,
      String newDn) throws LDAPException, ASN1Exception, DataFormatException;
  // ============
@@ -460,9 +459,9 @@
   {
     /* first byte is the type */
     boolean foundMatchingType = false;
     for (int i = 0; i < types.length; i++)
     for (byte type : types)
     {
       if (types[i] == encodedMsg[0])
       if (type == encodedMsg[0])
       {
         foundMatchingType = true;
         break;
@@ -485,7 +484,7 @@
     }
     /* read the protocol version */
     protocolVersion = (short)encodedMsg[1];
     protocolVersion = encodedMsg[1];
     try
     {
@@ -589,6 +588,7 @@
   *
   * @return The number of bytes used by this message.
   */
  @Override
  public abstract int size();
  /**
opends/src/server/org/opends/server/replication/protocol/ModifyDNMsg.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.replication.protocol;
@@ -37,12 +37,12 @@
import org.opends.server.protocols.asn1.ASN1Exception;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.replication.common.ChangeNumber;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.ByteString;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.LDAPException;
import org.opends.server.types.Modification;
import org.opends.server.types.Operation;
import org.opends.server.types.RDN;
import org.opends.server.types.operation.PostOperationModifyDNOperation;
@@ -165,9 +165,8 @@
   * {@inheritDoc}
   */
  @Override
  public AbstractOperation createOperation(
      InternalClientConnection connection, String newDn)
  throws LDAPException, ASN1Exception
  public Operation createOperation(InternalClientConnection connection,
      String newDn) throws LDAPException, ASN1Exception
  {
    ModifyDNOperationBasis moddn =  new ModifyDNOperationBasis(connection,
        InternalClientConnection.nextOperationID(),
@@ -328,6 +327,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public byte[] getBytes_V45(short reqProtocolVersion)
      throws UnsupportedEncodingException
  {
@@ -707,11 +707,7 @@
    try
    {
      DN newDN = computeNewDN();
      if (newDN.isAncestorOf(targetDn))
        return true;
      else
        return false;
      return newDN.isAncestorOf(targetDn);
    } catch (DirectoryException e)
    {
      // The DN was not a correct DN, and therefore does not a parent of the
@@ -734,11 +730,7 @@
    try
    {
      DN newDN = computeNewDN();
      if (newDN.equals(targetDN))
        return true;
      else
        return false;
      return newDN.equals(targetDN);
    } catch (DirectoryException e)
    {
      // The DN was not a correct DN, and therefore does not match the
@@ -761,11 +753,7 @@
    try
    {
      DN newSuperiorDN = DN.decode(newSuperior);
      if (newSuperiorDN.equals(targetDN))
        return true;
      else
        return false;
      return newSuperiorDN.equals(targetDN);
    } catch (DirectoryException e)
    {
      // The newsuperior was not a correct DN, and therefore does not match the
opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java
@@ -23,7 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.replication.protocol;
@@ -38,11 +38,11 @@
import org.opends.server.protocols.asn1.ASN1Exception;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.replication.common.ChangeNumber;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.ByteString;
import org.opends.server.types.DN;
import org.opends.server.types.LDAPException;
import org.opends.server.types.Modification;
import org.opends.server.types.Operation;
import org.opends.server.types.RawModification;
import org.opends.server.types.operation.PostOperationModifyOperation;
@@ -133,9 +133,8 @@
   * {@inheritDoc}
   */
  @Override
  public AbstractOperation createOperation(InternalClientConnection connection,
      String newDn)
  throws LDAPException, ASN1Exception, DataFormatException
  public Operation createOperation(InternalClientConnection connection,
      String newDn) throws LDAPException, ASN1Exception, DataFormatException
  {
    if (newDn == null)
      newDn = getDn();
@@ -149,7 +148,6 @@
    ModifyContext ctx = new ModifyContext(getChangeNumber(), getEntryUUID());
    mod.setAttachment(SYNCHROCONTEXT, ctx);
    return mod;
  }
@@ -181,10 +179,8 @@
        }
      } catch (LDAPException e)
      {
      } catch (ASN1Exception e)
      {
      }
      return "ModifyMsg content: " +
@@ -222,6 +218,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public byte[] getBytes_V1() throws UnsupportedEncodingException
  {
    /* encode the header in a byte[] large enough to also contain the mods */
@@ -238,6 +235,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public byte[] getBytes_V23() throws UnsupportedEncodingException
  {
    // Encoding V2 / V3
@@ -256,6 +254,7 @@
  /**
   * {@inheritDoc}
   */
  @Override
  public byte[] getBytes_V45(short reqProtocolVersion)
      throws UnsupportedEncodingException
  {
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
@@ -28,16 +28,11 @@
package org.opends.server.replication;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.TestCaseUtils.TEST_ROOT_DN_STRING;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import static org.opends.server.replication.protocol.OperationContext.SYNCHROCONTEXT;
import static org.opends.server.util.StaticUtils.createEntry;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.replication.protocol.OperationContext.*;
import static org.opends.server.util.StaticUtils.*;
import static org.testng.Assert.*;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
@@ -103,7 +98,6 @@
import org.opends.server.replication.service.ReplicationBroker;
import org.opends.server.tools.LDAPSearch;
import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.opends.server.types.AttributeValue;
@@ -119,6 +113,7 @@
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.Modification;
import org.opends.server.types.ModificationType;
import org.opends.server.types.Operation;
import org.opends.server.types.RDN;
import org.opends.server.types.ResultCode;
import org.opends.server.types.SearchFilter;
@@ -2755,8 +2750,8 @@
   *
   * @throws Exception If the environment could not be set up.
   */
  @Override
  @AfterClass
  public void classCleanUp() throws Exception
  {
    callParanoiaCheck = false;
@@ -3345,10 +3340,8 @@
      assertEquals(searchOp.getSearchEntries().size(), 1);
      if (entries != null)
      {
        int i=0;
        for (SearchResultEntry resultEntry : entries)
        {
          i++;
          debugInfo(tn, "Result entry returned:" + resultEntry.toLDIFString());
          ldifWriter.writeEntry(resultEntry);
          // check the entry has the right content
@@ -3413,10 +3406,8 @@
      assertEquals(searchOp.getSearchEntries().size(), 1);
      if (entries != null)
      {
        int i=0;
        for (SearchResultEntry resultEntry : entries)
        {
          i++;
          // Just verify that no entry contains the ChangeLogCookie control
          List<Control> controls = resultEntry.getControls();
          assertTrue(controls.isEmpty());
@@ -3475,10 +3466,8 @@
          lastDraftChangeNumber-firstDraftChangeNumber+1);
      if (searchOp.getSearchEntries() != null)
      {
        int i=0;
        for (SearchResultEntry resultEntry : searchOp.getSearchEntries())
        {
          i++;
          debugInfo(tn, "Result entry returned:" + resultEntry.toLDIFString());
        }
      }
@@ -3569,10 +3558,8 @@
      assertEquals(searchOp.getSearchEntries().size(), 1);
      if (entries != null)
      {
        int i=0;
        for (SearchResultEntry resultEntry : entries)
        {
          i++;
          debugInfo(tn, "Result entry returned:" + resultEntry.toLDIFString());
          ldifWriter.writeEntry(resultEntry);
          // check the DEL entry has the right content
@@ -3815,10 +3802,8 @@
      assertEquals(searchOp.getSearchEntries().size(), 1);
      if (entries != null)
      {
        int i=0;
        for (SearchResultEntry resultEntry : entries)
        {
          i++;
          debugInfo(tn, "Result entry returned:" + resultEntry.toLDIFString());
          ldifWriter.writeEntry(resultEntry);
          if (eclEnabled)
@@ -4087,10 +4072,8 @@
        debugInfo(tn, "Perfs - last 3 changes searched in (ms):" + (t5 - t4));
        if (searchOp.getSearchEntries() != null)
        {
          int i=0;
          for (SearchResultEntry resultEntry : searchOp.getSearchEntries())
          {
            i++;
            debugInfo(tn, "Result entry returned:" + resultEntry.toLDIFString());
          }
        }
@@ -4422,8 +4405,7 @@
    return targetEntry;
  }
  private void waitOpResult(AbstractOperation operation,
      ResultCode expectedResult)
  private void waitOpResult(Operation operation, ResultCode expectedResult)
  {
    int ii=0;
    while((operation.getResultCode()==ResultCode.UNDEFINED) ||
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
@@ -39,6 +39,7 @@
import java.util.Map;
import java.util.StringTokenizer;
import java.util.UUID;
import org.opends.messages.Category;
import org.opends.messages.Message;
import org.opends.messages.Severity;
@@ -46,51 +47,46 @@
import org.opends.server.core.AddOperationBasis;
import org.opends.server.core.DeleteOperationBasis;
import org.opends.server.core.DirectoryServer;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.ldap.LDAPFilter;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.AssuredMode;
import org.opends.server.replication.common.ChangeNumberGenerator;
import org.opends.server.replication.common.DSInfo;
import org.opends.server.replication.common.RSInfo;
import org.opends.server.replication.common.ServerState;
import org.opends.server.replication.common.ServerStatus;
import org.opends.server.replication.protocol.AckMsg;
import org.opends.server.replication.protocol.AddMsg;
import org.opends.server.replication.protocol.ProtocolSession;
import org.opends.server.replication.protocol.ProtocolVersion;
import org.opends.server.replication.protocol.ReplServerStartMsg;
import org.opends.server.replication.protocol.ReplSessionSecurity;
import org.opends.server.replication.protocol.ReplicationMsg;
import org.opends.server.replication.protocol.ServerStartMsg;
import org.opends.server.replication.protocol.StartSessionMsg;
import org.opends.server.replication.protocol.StopMsg;
import org.opends.server.replication.protocol.TopologyMsg;
import org.opends.server.replication.protocol.UpdateMsg;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.ldap.LDAPFilter;
import org.opends.server.replication.common.ChangeNumberGenerator;
import org.opends.server.replication.protocol.AckMsg;
import org.opends.server.replication.protocol.AddMsg;
import org.opends.server.replication.protocol.ReplicationMsg;
import org.opends.server.replication.protocol.StopMsg;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeValue;
import org.testng.annotations.BeforeClass;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.ByteString;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.Operation;
import org.opends.server.types.ResultCode;
import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.SearchScope;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.opends.server.TestCaseUtils.*;
import static org.testng.Assert.fail;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse;
import static org.opends.server.loggers.ErrorLogger.logError;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.testng.Assert.*;
/**
 * Test the client part (plugin) of the assured feature in both safe data and
@@ -1899,8 +1895,8 @@
    return resultMap;
  }
  private void waitOpResult(AbstractOperation operation,
      ResultCode expectedResult)
  private void waitOpResult(Operation operation, ResultCode expectedResult)
  {
    int ii=0;
    while((operation.getResultCode()==ResultCode.UNDEFINED) ||
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalTest.java
@@ -23,47 +23,45 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2012 ForgeRock AS
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.replication.plugin;
import org.opends.server.replication.protocol.LDAPUpdateMsg;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.service.ReplicationBroker;
import org.opends.server.replication.common.ChangeNumber;
import org.opends.server.replication.protocol.AddMsg;
import org.opends.server.replication.protocol.ModifyMsg;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.ldap.LDAPFilter;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.ChangeNumber;
import org.opends.server.replication.protocol.AddMsg;
import org.opends.server.replication.protocol.LDAPUpdateMsg;
import org.opends.server.replication.protocol.ModifyMsg;
import org.opends.server.replication.service.ReplicationBroker;
import org.opends.server.tools.LDAPModify;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.Attributes;
import org.opends.server.types.ByteString;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.Attribute;
import org.opends.server.types.Modification;
import org.opends.server.types.ModificationType;
import org.opends.server.types.AttributeType;
import org.opends.server.types.Operation;
import org.opends.server.types.ResultCode;
import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.SearchScope;
import org.opends.server.core.DirectoryServer;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import static org.testng.Assert.*;
import static org.opends.server.TestCaseUtils.*;
import java.net.ServerSocket;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ArrayList;
import java.util.UUID;
/**
@@ -239,7 +237,6 @@
    after = hist.encodeAndPurge();
    assertTrue(after.isEmpty());
    assertEquals(hist.getLastPurgedValuesCount(),11);
  }
  /**
@@ -470,7 +467,7 @@
    for (FakeOperation fake : ops)
    {
      LDAPUpdateMsg msg = (LDAPUpdateMsg) fake.generateMessage();
      AbstractOperation op =
      Operation op =
        msg.createOperation(InternalClientConnection.getRootConnection());
      op.setInternalOperation(true);
      op.setSynchronizationOperation(true);
@@ -488,7 +485,7 @@
   */
  private void assertFakeOperations(final DN dn1, Entry entry,
      Iterable<FakeOperation> ops, int assertCount) throws Exception
      {
  {
    int count = 0;
    for (FakeOperation op : ops)
    {
@@ -512,7 +509,7 @@
        if (count == 1)
        {
          // The first operation should be an ADD operation.
          assertTrue(false, "FakeAddOperation was not correctly generated"
          fail("FakeAddOperation was not correctly generated"
              + " from historical information");
        }
      }