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

Nicolas Capponi
08.37.2016 6e562514f52ba0c0f79bdca84cd2acd506b9cd21
OPENDJ-3417 Fix functional tests failures

- Fix searching subordinates backends of the RootDSE
- Fix initialization of RestoreDB (missing crypto services initialization)
- Fix restart by ensuring RestartTaskThread is not a daemon thread
6 files modified
33 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/RestartTaskThread.java 4 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java 1 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/RestoreDB.java 1 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
@@ -546,11 +546,8 @@
      case SINGLE_LEVEL:
      case WHOLE_SUBTREE:
      case SUBORDINATES:
        throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
            ERR_ROOTDSE_NOT_SUPPORTED_SCOPE.get(
                searchOperation.getConnectionID(),
                searchOperation.getOperationID(),
                searchOperation.getScope()));
        // nothing to return
        break;
      default:
        LocalizableMessage message = ERR_ROOTDSE_INVALID_SEARCH_SCOPE.
            get(searchOperation.getConnectionID(),
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
@@ -460,6 +460,16 @@
  public Set<BackendAndName> getSubordinateBackends(DN baseDN)
  {
    final Set<BackendAndName> subs = new HashSet<>();
    if (baseDN.isRootDN())
    {
      Map<DN, LocalBackend<?>> namingContexts = getAllPublicNamingContexts();
      for (Map.Entry<DN, LocalBackend<?>> b : namingContexts.entrySet())
      {
        subs.add(new BackendAndName(b.getValue(), b.getKey()));
      }
      return subs;
    }
    LocalBackend<?> backend = getLocalBackendWithBaseDN(baseDN);
    if (backend == null)
    {
opendj-server-legacy/src/main/java/org/opends/server/tasks/RestartTaskThread.java
@@ -19,7 +19,6 @@
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.core.DirectoryServer;
import org.opends.server.api.DirectoryThread;
/**
 * This class defines a thread that will be spawned to invoke a Directory Server
@@ -35,8 +34,7 @@
 * daemon thread.  These changes are needed to guarantee that the JVM does not
 * exit before we get a chance to restart it if all non-daemon threads go away.
 */
public class RestartTaskThread
       extends DirectoryThread
public class RestartTaskThread extends Thread
{
  /**
   * The fully-qualified name of this class.
opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java
@@ -169,6 +169,7 @@
      // Since the process will not be killed, we can proceed exactly the same
      // way with or without windows service configured.
      RestartTaskThread restartThread = new RestartTaskThread(shutdownMessage);
      restartThread.setDaemon(false);
      restartThread.start();
    }
    else
opendj-server-legacy/src/main/java/org/opends/server/tools/RestoreDB.java
@@ -280,6 +280,7 @@
      try
      {
        new DirectoryServer.InitializationBuilder(configFile.getValue())
            .requireCryptoServices()
            .requireErrorAndDebugLogPublisher(out, err)
            .initialize();
      }
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -743,15 +743,11 @@
    executeOperation(operation, backendAndName.getBackend());
    if (!entryDN.isRootDN())
    // For subtree search operation we need to go through the subordinate nodes.
    if (operation.getOperationType() == OperationType.SEARCH)
    {
      // For subtree search operation we need to go through the subordinate nodes.
      if (operation.getOperationType() == OperationType.SEARCH)
      {
        executeSearchOnSubordinates((SearchOperation) operation, backendAndName.getBaseDn());
      }
      executeSearchOnSubordinates((SearchOperation) operation, backendAndName.getBaseDn());
    }
    return true;
  }