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

davidely
18.43.2007 39b6bdb24bae1de63de3b979369f2e5bd285ef6a
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -79,6 +79,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import org.opends.server.tasks.TaskUtils;
import org.opends.server.api.WorkQueue;
/**
 * This class defines some utility functions which can be used by test
@@ -316,6 +317,28 @@
  }
  /**
   * Bring the server to a quiescent state.  This includes waiting for all
   * operations to complete.  This can be used in a @BeforeMethod setup method
   * to make sure that the server has finished processing all operations
   * from previous tests.
   */
  public static void quiesceServer()
  {
    waitForOpsToComplete();
  }
  /**
   * This can be made public if quiesceServer becomes too heavy-weight in
   * some circumstance.
   */
  private static void waitForOpsToComplete()
  {
    WorkQueue workQueue = DirectoryServer.getWorkQueue();
    final long NO_TIMEOUT = -1;
    workQueue.waitUntilIdle(NO_TIMEOUT);
  }
  /**
   * Binds to the given socket port on the local host.
   * @return the bounded Server socket.
   *