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

davidely
02.00.2007 a5ce1b53bf9304c08bb51639b48bb77085cd62b3
opends/build.xml
@@ -266,7 +266,7 @@
  <target name="clean" depends="cleanadmin,cleanmessages"
       description="Clean up any files generated during the build process">
    <delete dir="${build.dir}"           />
    <delete dir="${build.dir}" />
    <delete file="${dynconstants.file}"  />
    <fileset dir="${lib.dir}">
      <include name="*.jar" />
@@ -1051,7 +1051,7 @@
  <!-- Prepare to execute the Directory Server TestNG unit tests. -->
  <target name="testinit" depends="buildtools, weave"
  <target name="testinit" depends="buildtools,compile"
         description="Prepare to execute the Directory Server TestNG unit tests.">
    <!-- If we are to perform coverage tests, then set that up. -->
    <path id="emma.lib">
@@ -1292,33 +1292,74 @@
          description="Execute the Directory Server TestNG unit tests in text mode with a coverage report.  Use -Dtest.packages, -Dtest.classes, or -Dtest.methods to control which unit tests are run.  Use -Dtest.diff.srcpath to control which src files show up in the coverage diff.  See the 'test' package for other properties you can set.">
  </target>
  <!-- Execute the Directory Server TestNG unit tests in text mode with a coverage report and slow tests. -->
  <target name="testallwithcoverage"
          depends="coverage,testall,coveragediff"
          description="The same as 'testwithcoverage' except 'testall' is run instead of 'test'.">
  </target>
  <!-- Execute the Directory Server TestNG unit tests specified from CLI in text mode with a coverage report. -->
  <target name="testcustomwithcoverage">
    <echo message="This target is deprecated. Please use the testwithcoverage target as it now supports the test.* properties." />
  </target>
  <target name="testhelp" unless="disable.test.help">
    <echo message="About to run the unit tests.  Ant options to control the tests:"/>
    <echo message=""/>
    <echo message="  -Dorg.opends.test.suppressOutput=false"/>
    <echo message="      writes the unit test output to the screen"/>
    <echo message=""/>
    <echo message="  -Dtest.progress=&quot;default,memory&quot;"/>
    <echo message="      Unless explicity disabled using -Dtest.progress=none, the"/>
    <echo message="      tests provide continuous progress of the tests that are being"/>
    <echo message="      run.  The specific options to set for this property are"/>
    <echo message=""/>
    <echo message="        none:         no progress output"/>
    <echo message="        all:          enables all progress (slows tests)"/>
    <echo message="        default:      same as &quot;time,count,restarts&quot;"/>
    <echo message="        time:         timing information for the tests"/>
    <echo message="        count:        # of run test classes, methods, and invocations"/>
    <echo message="        memory:       running total of memory usage (slows tests)"/>
    <echo message="        threadcount:  running total of active threads"/>
    <echo message="        threadchange: +/- changes for active threads between tests"/>
    <echo message="        restarts:     running total of in-core server restarts"/>
    <echo message=""/>
    <echo message="      To specifying multiple values, nseparate them with ',' and"/>
    <echo message="      quote the entire value.  For instance, when you want the default"/>
    <echo message="      output plus more, do -Dtest.progress=&quot;default,memory&quot;."/>
    <echo message=""/>
    <echo message="      Enabling memory progress slows down the tests significantly."/>
    <echo message="      Include the otherwise undocumented property &quot;gcs&quot; to see how"/>
    <echo message="      much time each progress line spends doing garbage collections"/>
    <echo message="      to get an accurate measure of memory usage."/>
    <echo message=""/>
    <echo message="      A new line of progress is written immediately before TestNG starts"/>
    <echo message="      to run the first test of a new class.  All @BeforeClass and"/>
    <echo message="      @BeforeMethod methods will have been invoked for the class as well"/>
    <echo message="      as the @DataProvider (if any) for the first test method."/>
    <echo message="      Also, some classes are still run out-of-order.  These will only"/>
    <echo message="      appear once in the output.  Keep these two things in mind when,"/>
    <echo message="      especially when debugging memory usage, running times, and thread "/>
    <echo message="      creation."/>
    <echo message=""/>
    <echo message="  -Dtestng.verbosity0to5=5"/>
    <echo message="      for example has TestNG dump the maximum amount of debugging"/>
    <echo message="      output to stdout.  This output is useful to check the order"/>
    <echo message="      in which test methods are invoked.  Valid values are integer"/>
    <echo message="      values from 0 (no output) to 5 (maximum output).  Since this"/>
    <echo message="      implicitly sets -Dorg.opends.test.suppressOutput=false,"/>
    <echo message="      other stderr/stdout output generated by the unit tests will"/>
    <echo message="      also be displayed."/>
    <echo message=""/>
    <echo message="  -Dorg.opends.test.pauseOnFailure=true"/>
    <echo message="      pauses the test suite whenever a failure occurs allowing you to inspect"/>
    <echo message="      the server more closely in the failure state"/>
    <echo message=""/>
    <echo message="  -Dorg.opends.test.copyClassesToTestPackage=true"/>
    <echo message="      copies the classes into the test server root.  This enables you to run"/>
    <echo message="      the server tools on the test server.  It can slow down the test startup"/>
    <echo message="      so the files are not copied by default."/>
    <echo message=""/>
    <echo message="  -Dtest.failed=true"/>
    <echo message="      runs only the tests that failed last time"/>
    <echo message=""/>
@@ -1333,7 +1374,14 @@
    <echo message="      definition is the same as the org.opends.server.debug.target.x" />
    <echo message="      property when starting ${SHORT_NAME}. " />
    <echo message="      Default debug target:"/>
    <echo message="      org.opends.server:level=warning,category=caught|data|database-access|message|protocol" />
    <echo message="      org.opends.server:level=warning,category=caught|data|database-access|message|protocol,stack" />
    <echo message=""/>
    <echo message="  -Dtest.diff.srcpath=src/server/org/opends/server/core"/>
    <echo message="      for example includes only the classes in"/>
    <echo message="      src/server/org/opends/server/core in the coveragediff report."/>
    <echo message="      To list multiple directories or files, separate them with"/>
    <echo message="      a space as you would an argument list to 'svn diff' and quote"/>
    <echo message="      the whole value."/>
    <echo message=""/>
    <echo message="  -Dtest.groups=exclude=slow"/>
    <echo message="      for example excludes the slow tests.  Each value is expected" />
@@ -1358,12 +1406,11 @@
    <echo message="      method names to the end separating them with a ',' and "/>
    <echo message="      quote the entire value. Debug logging is disabled."/>
    <echo message=""/>
    <echo message="  -Dtest.diff.srcpath=src/server/org/opends/server/core"/>
    <echo message="      for example includes only the classes in"/>
    <echo message="      src/server/org/opends/server/core in the coveragediff report."/>
    <echo message="      To list multiple directories or files, separate them with"/>
    <echo message="      a space as you would an argument list to 'svn diff' and quote"/>
    <echo message="      the whole value."/>
    <echo message="  -Dtest.remote.debug.port=5005"/>
    <echo message="      for example will allow you to remotely debug the unit tests from"/>
    <echo message="      the debugger of your choice by pointing it at port 5005."/>
    <echo message="      The unit tests will not start to run until the debugger is attached"/>
    <echo message="      unless you als specify -Dtest.remote.debug.suspend=n."/>
    <echo message=""/>
  </target>
@@ -1390,6 +1437,21 @@
      </not>
    </condition>
    <!-- This sets testng.verbosity if it's not already set. -->
    <condition property="testng.verbosity0to5" value="0">
      <not>
        <isset property="testng.verbosity0to5" />
      </not>
    </condition>
    <!-- This sets unsuppresses the test output if and only if testng
         is configured to dump debug output. -->
    <condition property="org.opends.test.suppressOutput" value="false">
      <not>
        <equals arg1="${testng.verbosity0to5}" arg2="0"/>
      </not>
    </condition>
    <!-- This sets org.opends.test.suppressOutput if and only if it's not
         already set. -->
    <condition property="org.opends.test.suppressOutput" value="true">
@@ -1409,12 +1471,54 @@
    <!-- This sets org.opends.test.debug.target if and only if its's not
         already set. -->
    <condition property="org.opends.test.debug.target"
               value="org.opends.server:level=warning,category=caught|data|database-access|message|protocol">
               value="org.opends.server:level=warning,category=caught|data|database-access|message|protocol,stack">
      <not>
        <isset property="org.opends.test.debug.target" />
      </not>
    </condition>
    <condition property="org.opends.test.copyClassesToTestPackage"
               value="false">
      <not>
        <isset property="org.opends.test.copyClassesToTestPackage" />
      </not>
    </condition>
    <condition property="test.progress"
               value="">
      <not>
        <isset property="test.progress" />
      </not>
    </condition>
    <!-- If the debug port was set, we pass these options into the <testng> target below:
           -Xdebug
           -Xnoagent
           -Djava.compiler=NONE
           -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
     -->
    <condition property="test.remote.debug.suspend" value="y">
       <not>
         <isset property="test.remote.debug.suspend" />
       </not>
    </condition>
    <condition property="jvm.debug.arg1" value="-Xdebug" else="-Dopends.bogus.debug.arg1">
       <isset property="test.remote.debug.port" />
    </condition>
    <condition property="jvm.debug.arg2" value="-Xnoagent" else="-Dopends.bogus.debug.arg2">
       <isset property="test.remote.debug.port" />
    </condition>
    <condition property="jvm.debug.arg3" value="-Djava.compiler=NONE" else="-Dopends.bogus.debug.arg3">
       <isset property="test.remote.debug.port" />
    </condition>
    <condition property="jvm.debug.arg4"
         value="-Xrunjdwp:transport=dt_socket,server=y,suspend=${test.remote.debug.suspend},address=${test.remote.debug.port}"
         else="-Dopends.bogus.debug.arg4">
       <isset property="test.remote.debug.port" />
    </condition>
    <!-- Cleanout the old reports.  Otherwise, the old testng-failed.xml
         will hang around even if all of the tests pass. -->
    <delete>
@@ -1428,6 +1532,7 @@
    <testng outputdir="${unittest.report.dir}"
            haltonfailure="false"
            verbose="${testng.verbosity0to5}"
            enableAssert="${TESTASSERT}"
            listeners="org.opends.server.TestListener org.testng.reporters.FailedReporter"
            useDefaultListeners="false"
@@ -1461,8 +1566,14 @@
      <jvmarg value="-Dorg.opends.test.suppressOutput=${org.opends.test.suppressOutput}" />
      <jvmarg value="-Dorg.opends.test.pauseOnFailure=${org.opends.test.pauseOnFailure}" />
      <jvmarg value="-Dorg.opends.test.debug.target=${org.opends.test.debug.target}" />
      <jvmarg value="-Dorg.opends.test.copyClassesToTestPackage=${org.opends.test.copyClassesToTestPackage}" />
      <jvmarg value="-Dtest.progress=${test.progress}" />
      <jvmarg value="-Xms${MEM}" />
      <jvmarg value="-Xmx${MEM}" />
      <jvmarg value="${jvm.debug.arg1}" />
      <jvmarg value="${jvm.debug.arg2}" />
      <jvmarg value="${jvm.debug.arg3}" />
      <jvmarg value="${jvm.debug.arg4}" />
      <xmlfileset dir="${unittest.resource.dir}" includes="testng.xml" />
    </testng>
opends/ext/testng/CHANGES.txt
@@ -1,4 +1,78 @@
===========================================================================
5.7
Fixed: TESTNG-169 Error message: <method> is depending on nonexistent method null ("null" is uninformative)
Fixed: -listener takes comma-separated classes
Added: RetryAnalyzer (experimental) (Jeremie)
===========================================================================
5.6
Added: SkipException/TimeBombedSkipException for manual skipping
Added: <tests> can now be disabled at xml level using <test enabled="false">
Added: Suite files that only contain other suites do not get reported
Fixed: @BeforeClass methods would incorrectly report cyclic graphs
Added: get/setAttribute to ITestContext
Added: plugging in factory objects to handle the actual instantiation of tests
Added: dataProvider to @Factory
Added: ISuite now gives access to the current XmlSuite
Fixed: TESTNG-139 dependsOnMethods gets confused when dependency is "protected"
Fixed: TESTNG-141 junit attribute set to false in testng-failed.xml when it should be true
Fixed: TESTNG-142 Exceptions in DataProvider are not reported as failed test
Added: Improved behavior for @Before/@AfterClass when using @Factory
(http://forums.opensymphony.com/thread.jspa?threadID=6594&messageID=122294#122294)
Added: Support for concurrent execution for invocationCount=1 threadPoolSize>1 and @DataProvider
(http://forums.opensymphony.com/thread.jspa?threadID=64738&tstart=0)
Added: New TestNG specific XML report, generated by default in 'xml' subdirectory of test-output
Added: support in strprotocol for passing the ITest.getTestName() information
Fixed: TESTNG-152 If DataProvider is not found, the exception message should tell exactly what happened
Eclipse plug-in
Fixed: Bug that made group launch configurations unusable
Fixed: The plugin doesn't create the correct launch configuration for @Factory
Fixed: Method based launchers cannot be editted
Fixed: Plugin hangs while executing test with dataprovider that sends \n, \r messages
Added: display ITest.getTestName()
IDEA plug-in
Fixed: IDEA 7.0 compatibility
Fixed: occasional 'illegal arguments exception'
Fixed: TESTNG-151 Final passing test result is not properly hidden
Added: Auto-completion for dependsOnMethods
Added: Highlighting of invalid groups/methods in dependsOn*
===========================================================================
5.5
Fixed: @BeforeGroup methods were run twice when in a base class
Fixed: @BeforeGroup methods were run twice with a @Test at class level
Fixed: parallel="tests" didn't work as advertised
Added: Support for thread-count at test level
Added: Method selectors receive a Context and can stop the chain with setStopped()
Fixed: XmlMethodSelector was always run first regardless of its priority
Added: @BeforeGroups/@AfterGroups can live in classes without @Test methods
Added: DataProvider can now take an ITestContext parameter
Fixed: Wasn't parsing <selector-class-name> correctly
Fixed: Annotation Transformers now work on class-level annotations
Fixed: Some class-level @Test attributes were not always honored
Added: Clean separation between @Test invocation events and @Configuration invocation events
       (see also TESTNG-111)
Added: Test instances created by @Factory now run in multiple threads in parallel mode
Fixed: @Before/@AfterGroups invocation order
Fixed: TESTNG-27: Parameters are not used on <test> level anymore
Fixed: TESTNG-107 don't create an output directory if "outputDirectory" is null
Fixed: TESTNG-127 UseDefaultListeners in Ant Task does not work
Fixed: TESTNG-119 Running TestNG runner with invalid '-sourcedir' on JDK14 JavaDoc annotated test classes won't fail.
Fixed: TESTNG-113 Dependent methods within the same static inner class are not found
Fixed: TESTNG-125 TestNG failed for test classes under *.java*.* pakages
Eclipse plug-in
Fixed: issue with launch configuration
Fixed: TESTNG-124: setting location of testng reports output
===========================================================================
5.4
Fixed: Ant task issue with paths containing spaces
opends/ext/testng/README_BEFORE_UPGRADING.txt
New file
@@ -0,0 +1,4 @@
We've had to make a few fixes to the TestNG source.  Before upgrading
to a newer version of TestNG, please make sure that the two fixes in
opends-fixes-diff.txt have made it into the TestNG trunk or apply them
yourself to a version that you check out.
opends/ext/testng/lib/testng-5.4-jdk15.jar
Binary files differ
opends/ext/testng/lib/testng-5.7b-jdk15.jar
Binary files differ
opends/ext/testng/opends-fixes-diff.txt
New file
@@ -0,0 +1,70 @@
Index: src/main/org/testng/internal/MethodInheritance.java
===================================================================
--- src/main/org/testng/internal/MethodInheritance.java  (revision 502)
+++ src/main/org/testng/internal/MethodInheritance.java  (working copy)
@@ -102,27 +102,19 @@
         // Sort them
         sortMethodsByInheritance(l, baseClassToChild);
-        // Set methodDependedUpon accordingly
-        if (baseClassToChild) {
-          for (int i = 1; i < l.size(); i++) {
-            ITestNGMethod m1 = l.get(i - 1);
-            ITestNGMethod m2 = l.get(i);
+        for (int i = 0; i < l.size(); i++) {
+          ITestNGMethod m1 = l.get(i);
+          // Look for any method further down that is a subclass of this one.
+          // This handles the case when there are multiple BeforeClass/AfterClass
+          // methods in the same class.
+          for (int j = i + 1; j < l.size(); j++) {
+            ITestNGMethod m2 = l.get(j);
             if (! equalsEffectiveClass(m1, m2)) {
               Utils.log("MethodInheritance", 4, m2 + " DEPENDS ON " + m1);
               m2.addMethodDependedUpon(MethodHelper.calculateMethodCanonicalName(m1));
             }
           }
         }
-        else {
-          for (int i = 0; i < l.size() - 1; i++) {
-            ITestNGMethod m1 = l.get(i);
-            ITestNGMethod m2 = l.get(i + 1);
-            if (! equalsEffectiveClass(m1, m2)) {
-              m2.addMethodDependedUpon(MethodHelper.calculateMethodCanonicalName(m1));
-              Utils.log("MethodInheritance", 4, m2 + " DEPENDS ON " + m1);
-            }
-          }
-        }
       }
     }
   }
Index: src/main/org/testng/TestRunner.java
===================================================================
--- src/main/org/testng/TestRunner.java   (revision 502)
+++ src/main/org/testng/TestRunner.java   (working copy)
@@ -536,9 +536,13 @@
     List<ITestNGMethod> parallelList= new ArrayList<ITestNGMethod>();
     computeTestLists(sequentialList, parallelList);
+
+    int sequentialSize = 0;
+    for (List<ITestNGMethod> methodList: sequentialList) {
+      sequentialSize += methodList.size();
+    }
+    log(3, "Found " + (sequentialSize + parallelList.size()) + " applicable methods");
-    log(3, "Found " + (sequentialList.size() + parallelList.size()) + " applicable methods");
-
     //
     // Create the workers
     //
@@ -753,7 +757,9 @@
           findAnnotation(cls, org.testng.internal.annotations.ITest.class);
       if (test != null) {
         if (test.getSequential()) {
-          String className = cls.getName();
+          // This must not be cls.getName() because that will sort methods in a super class together
+          // instead of with the instance class itself (i.e. the subclass).
+          String className = tm.getTestClass().getRealClass().getName();
           List<ITestNGMethod> list = sequentialAttributeList.get(className);
           if (list == null) {
             list = new ArrayList<ITestNGMethod>();
opends/ext/testng/src.zip
Binary files differ
opends/lib/je.jar
Binary files differ
opends/src/server/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
@@ -757,4 +757,15 @@
    }
    return ret;
  }
  /**
   * Finalizes static variables on shutdown so that we release the memory
   * associated with them (for the unit tests) and get fresh copies if we're
   * doing an in-core restart.
   */
  public static void finalizeOnShutdown() {
    AciEffectiveRights.aclRights = null;
    AciEffectiveRights.aclRightsInfo = null;
    AciEffectiveRights.dnAttributeType = null;
  }
}
opends/src/server/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -134,6 +134,13 @@
   public static final String ALL_OP_ATTRS_MATCHED = "allOpAttrsMatched";
   static {
     initStatics();
   }
  // We initialize these for each new AciHandler so that we can clear out
  // the stale references that can occur during an in-core restart.
  private static void initStatics()
  {
    if((aciType = DirectoryServer.getAttributeType("aci")) == null)
    {
      aciType = DirectoryServer.getDefaultAttributeType("aci");
@@ -167,7 +174,7 @@
     } catch (DirectoryException ex) {
       //Should never happen.
     }
   }
  }
  /**
   * Creates a new DSEE-compatible access control handler.
@@ -188,6 +195,7 @@
                   DseeCompatAccessControlHandlerCfg configuration)
         throws ConfigException, InitializationException
  {
    initStatics();
    DN configurationDN=configuration.dn();
    aciList = new AciList(configurationDN);
    aciListenerMgr = new AciListenerManager(aciList, configurationDN);
@@ -203,7 +211,7 @@
  @Override()
  public void finalizeAccessControlHandler()
  {
    // No implementation required.
    AciEffectiveRights.finalizeOnShutdown();
  }
opends/src/server/org/opends/server/authorization/dseecompat/GroupDN.java
@@ -57,11 +57,6 @@
     */
    private EnumBindRuleType type=null;
    /*
     * Group manager needed for group API.
     */
    private static GroupManager groupManager =
                                            DirectoryServer.getGroupManager();
    /**
     * Regular expression matching one or more LDAP URLs separated by
     * "||".
@@ -126,7 +121,7 @@
       Iterator<DN> it=groupDNs.iterator();
        for(; it.hasNext() && matched != EnumEvalResult.TRUE;) {
            DN  groupDN=it.next();
            Group group = groupManager.getGroupInstance(groupDN);
            Group group = getGroupManager().getGroupInstance(groupDN);
            if((group != null) && (evalCtx.isMemberOf(group)))
               matched = EnumEvalResult.TRUE;
        }
@@ -159,7 +154,7 @@
                if(suffixDN != null &&
                   !groupDN.isDescendantOf(suffixDN))
                        continue;
                Group group = groupManager.getGroupInstance(groupDN);
                Group group = getGroupManager().getGroupInstance(groupDN);
                if((group != null) && (evalCtx.isMemberOf(group))) {
                    matched=EnumEvalResult.TRUE;
                    break;
@@ -170,4 +165,8 @@
        }
        return matched;
    }
    private static GroupManager getGroupManager() {
        return DirectoryServer.getGroupManager();
    }
}
opends/src/server/org/opends/server/backends/jeb/AttributeIndex.java
@@ -1536,7 +1536,7 @@
  }
  /**
   * Set the index trust state.
   * Set the index truststate.
   * @param txn A database transaction, or null if none is required.
   * @param trusted True if this index should be trusted or false
   *                otherwise.
opends/src/server/org/opends/server/backends/jeb/EntryContainer.java
@@ -4362,6 +4362,44 @@
      {
        db.open();
      }
      Transaction txn = null;
      try
      {
        txn = beginTransaction();
        for(DatabaseContainer db : databases)
        {
          if (db instanceof Index)
          {
            Index index = (Index)db;
            index.setTrusted(txn, true);
          }
        }
        transactionCommit(txn);
      }
      catch(Exception de)
      {
        if (debugEnabled())
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, de);
        }
        // This is mainly used during the unit tests, so it's not essential.
        try
        {
          if (txn != null)
          {
            transactionAbort(txn);
          }
        }
        catch (Exception e)
        {
          if (debugEnabled())
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, de);
          }
        }
      }
    }
    return count;
opends/src/server/org/opends/server/backends/jeb/Index.java
@@ -728,6 +728,15 @@
  }
  /**
   * Return true iff this index is trusted.
   * @return the trusted state of this index
   */
  public synchronized boolean isTrusted()
  {
    return trusted;
  }
  /**
   * Set the rebuild status of this index.
   * @param rebuildRunning True if a rebuild process on this index
   *                       is running or False otherwise.
opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -73,6 +73,7 @@
import org.opends.server.api.AccessLogPublisher;
import org.opends.server.api.ErrorLogPublisher;
import org.opends.server.api.DebugLogPublisher;
import org.opends.server.api.AccessControlHandler;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.api.plugin.StartupPluginResult;
import org.opends.server.backends.RootDSEBackend;
@@ -187,6 +188,8 @@
import org.opends.server.util.args.StringArgument;
import org.opends.server.workflowelement.*;
import org.opends.server.workflowelement.localbackend.*;
import org.opends.server.protocols.internal.InternalConnectionHandler;
import org.opends.server.protocols.internal.InternalClientConnection;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
@@ -1461,6 +1464,8 @@
        removeErrorLogPublisher(startupErrorLogPublisher);
      }
      // Force the root connection to be initialized.
      InternalClientConnection.getRootConnection();
      // If a server.starting file exists, then remove it.
      File serverStartingFile =
@@ -8151,6 +8156,12 @@
      directoryServer.shuttingDown = true;
    }
    ConfigEntry rootConfigEntry = null;
    try {
      rootConfigEntry = directoryServer.configHandler.getConfigRootEntry();
    } catch (Exception e) {
    }
    // Send an alert notification that the server is shutting down.
    Message message = NOTE_SERVER_SHUTDOWN.get(className, reason);
@@ -8311,6 +8322,13 @@
      DirectoryServer.deregisterPasswordPolicy(configEntryDN);
    }
    // Finalize the access control handler
    AccessControlHandler accessControlHandler =
        AccessControlConfigManager.getInstance().getAccessControlHandler();
    if (accessControlHandler != null)
    {
      accessControlHandler.finalizeAccessControlHandler();
    }
    // Perform any necessary cleanup work for the group manager.
    if (directoryServer.groupManager != null)
@@ -8421,10 +8439,14 @@
      logError(message);
    }
    // Deregister all workflows.
    WorkflowImpl.deregisterAllOnShutdown();
    // Deregister all network group configuration.
    NetworkGroup.deregisterAll();
    NetworkGroup.deregisterAllOnShutdown();
    // Force a new InternalClientConnection to be created on restart.
    InternalConnectionHandler.clearRootClientConnectionAtShutdown();
    // Log a final message indicating that the server is stopped (which should
    // be true for all practical purposes), and then shut down all the error
opends/src/server/org/opends/server/core/NetworkGroup.java
@@ -30,6 +30,7 @@
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.TreeMap;
import java.util.Collection;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
@@ -584,12 +585,34 @@
   * Deregisters all network groups that have been registered.  This should be
   * called when the server is shutting down.
   */
  public static void deregisterAll()
  public static void deregisterAllOnShutdown()
  {
    synchronized (registeredNetworkGroupsLock)
    {
      // Invalidate all NetworkGroups so they cannot accidentally be used
      // after a restart.
      Collection<NetworkGroup> networkGroups = registeredNetworkGroups.values();
      for (NetworkGroup networkGroup: networkGroups)
      {
        networkGroup.invalidate();
      }
      defaultNetworkGroup.invalidate();
      registeredNetworkGroups = new TreeMap<String,NetworkGroup>();
      defaultNetworkGroup = new NetworkGroup ("default");
    }
  }
  /**
   * We've seen parts of the server hold references to a NetworkGroup
   * during an in-core server restart.  To help detect when this happens,
   * we null out the member variables, so we will fail fast with an NPE if an
   * invalidate NetworkGroup is used.
   */
  private void invalidate()
  {
    namingContexts = null;
    networkGroupID = null;
    rootDSEWorkflowNode = null;
  }
}
opends/src/server/org/opends/server/core/WorkflowImpl.java
@@ -229,4 +229,17 @@
    return workflowToDeregister;
  }
  /**
   * Deregisters all Workflows that have been registered.  This should be
   * called when the server is shutting down.
   */
  public static void deregisterAllOnShutdown()
  {
    synchronized (registeredWorkflowsLock)
    {
      registeredWorkflows =
        new TreeMap<String, Workflow>(registeredWorkflows);
    }
  }
}
opends/src/server/org/opends/server/extensions/SoftReferenceEntryCache.java
@@ -100,7 +100,9 @@
  // reference is freed.
  private ReferenceQueue<CacheEntry> referenceQueue;
  private Thread cleanerThread;
  private volatile boolean shutdown = false;
  static
  {
@@ -131,8 +133,7 @@
    setLockTimeout(LockManager.DEFAULT_TIMEOUT);
    referenceQueue = new ReferenceQueue<CacheEntry>();
    Thread cleanerThread =
         new Thread(this, "Soft Reference Entry Cache Cleaner");
    cleanerThread = new Thread(this, "Soft Reference Entry Cache Cleaner");
    cleanerThread.setDaemon(true);
    cleanerThread.start();
  }
@@ -167,10 +168,22 @@
  /**
   * {@inheritDoc}
   */
  public void finalizeEntryCache()
  public synchronized void finalizeEntryCache()
  {
    shutdown = true;
    dnMap.clear();
    idMap.clear();
    if (cleanerThread != null) {
      for (int i = 0; cleanerThread.isAlive() && (i < 5); i++) {
        cleanerThread.interrupt();
        try {
          cleanerThread.join(10);
        } catch (InterruptedException e) {
          // We'll exit eventually.
        }
      }
      cleanerThread = null;
    }
  }
@@ -595,7 +608,7 @@
   */
  public void run()
  {
    while (true)
    while (!shutdown)
    {
      try
      {
opends/src/server/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -149,7 +149,6 @@
    nextMessageID    = new AtomicInteger(1);
    nextConnectionID = new AtomicLong(-1);
    nextOperationID  = new AtomicLong(0);
    rootConnection   = new InternalClientConnection();
  }
@@ -380,6 +379,11 @@
   */
  public static InternalClientConnection getRootConnection()
  {
    if (rootConnection == null)
    {
      rootConnection = new InternalClientConnection();
    }
    return rootConnection;
  }
@@ -2219,5 +2223,15 @@
    buffer.append("\")");
  }
  /**
   * Called near the end of server shutdown.  This ensures that a new
   * InternalClientConnection is created if the server is immediately
   * restarted as part of an in-core restart.
   */
  static void clearRootClientConnectionAtShutdown()
  {
    rootConnection = null;
  }
}
opends/src/server/org/opends/server/protocols/internal/InternalConnectionHandler.java
@@ -258,5 +258,16 @@
  {
    buffer.append("Internal Connection Handler");
  }
  /**
   * Called near the end of server shutdown.  This ensures that a new
   * InternalClientConnection is created if the server is immediately
   * restarted as part of an in-core restart.
   */
  public static void clearRootClientConnectionAtShutdown()
  {
    InternalClientConnection.clearRootClientConnectionAtShutdown();
  }
}
opends/src/server/org/opends/server/types/Schema.java
@@ -2823,6 +2823,7 @@
      File configFile = new File(DirectoryServer.getConfigFile());
      File configDirectory  = configFile.getParentFile();
      File upgradeDirectory = new File(configDirectory, "upgrade");
      upgradeDirectory.mkdir();
      File concatFile       = new File(upgradeDirectory,
                                       SCHEMA_CONCAT_FILE_NAME);
      concatFilePath = concatFile.getAbsolutePath();
opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -2513,7 +2513,6 @@
        {
          Control c   = requestControls.get(i);
          String  oid = c.getOID();
          if (!AccessControlConfigManager.getInstance().
                  getAccessControlHandler().
                  isAllowed(baseDN, localOp, c))
opends/tests/unit-tests-testng/resource/config-changes.ldif
@@ -295,7 +295,7 @@
changetype: add
objectClass: top
objectClass: ds-cfg-plugin
cn: Delay PreOperation Plugin
cn: Update PreOperation Plugin
ds-cfg-plugin-class: org.opends.server.plugins.UpdatePreOpPlugin
ds-cfg-plugin-enabled: true
ds-cfg-plugin-type: preOperationAdd
opends/tests/unit-tests-testng/src/server/org/opends/messages/MessagesTestCase.java
@@ -37,7 +37,7 @@
/**
 * An abstract base class for all messages test cases.
 */
@Test(groups = { "precommit", "messages" })
@Test(groups = { "precommit", "messages" }, sequential=true)
public abstract class MessagesTestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/InstallationTest.java
@@ -36,7 +36,7 @@
/**
 * Installation Tester.
 */
@Test(groups = {"slow"})
@Test(groups = {"slow"}, sequential=true)
public class InstallationTest extends QuickSetupTestCase {
  Installation installation;
opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/QuickSetupTestCase.java
@@ -30,30 +30,18 @@
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.AfterSuite;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import java.io.IOException;
/**
 *
 */
public class QuickSetupTestCase {
  @BeforeSuite
  public final void suppressOutput() {
    TestCaseUtils.suppressOutput();
  }
public class QuickSetupTestCase extends DirectoryServerTestCase {
  @BeforeSuite
  public final void initServer()
          throws IOException, ApplicationException, InterruptedException
  {
    TestUtilities.initServer();
  }
  @AfterSuite
  public final void shutdownServer() throws ApplicationException {
    TestUtilities.stopServer();
    TestCaseUtils.unsupressOutput();
  }
}
opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/util/FileManagerTest.java
@@ -48,7 +48,7 @@
/**
 * FileManager Tester.
 */
@Test(groups = {"slow"})
@Test(groups = {"slow"}, sequential=true)
public class FileManagerTest extends QuickSetupTestCase {
  File fmWorkspace = null;
@@ -134,6 +134,7 @@
   * Tests the rename.
   * @throws Exception
   */
  @Test
  public void testRenameNonExistentTarget() throws Exception {
    File src = File.createTempFile("src", null);
    File target = new File(src.getParentFile(), "target");
opends/tests/unit-tests-testng/src/server/org/opends/quicksetup/util/UtilsTest.java
@@ -30,11 +30,13 @@
import static org.testng.Assert.*;
import org.testng.annotations.*;
import org.opends.quicksetup.Constants;
import org.opends.server.DirectoryServerTestCase;
/**
 * Utils Tester.
 */
public class UtilsTest {
@Test(sequential=true)
public class UtilsTest extends DirectoryServerTestCase {
  @DataProvider(name = "breakHtmlStringData")
  public Object[][] breakHtmlStringData() {
opends/tests/unit-tests-testng/src/server/org/opends/server/DirectoryServerTestCase.java
@@ -28,8 +28,15 @@
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass;
import org.opends.messages.Message;
import java.util.IdentityHashMap;
import java.util.Set;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
/**
 * This class defines a base test case that should be subclassed by all
 * unit tests used by the Directory Server.
@@ -37,6 +44,7 @@
 * This class adds the ability to print error messages and automatically
 * have them include the class name.
 */
@Test(sequential=true)
public abstract class DirectoryServerTestCase {
  @BeforeSuite
  public final void suppressOutput() {
@@ -48,4 +56,108 @@
    TestCaseUtils.shutdownServer(Message.raw("The current test suite has finished."));
    TestCaseUtils.unsupressOutput();
  }
  //
  // This is all a HACK to reduce the amount of memory that's consumed.
  //
  // This could be a problem if a subclass references a @DataProvider in
  // a super-class that provides static parameters, i.e. the parameters are
  // not regenerated for each invocation of the DataProvider.
  //
  /** A list of all parameters that were generated by a @DataProvider
   *  and passed to a test method of this class.  TestListener helps us
   *  keep this so that once all of the tests are finished, we can clear
   *  it out in an @AfterClass method.  We can't just clear it out right
   *  away in the TestListener because some methods share a @DataProvider.*/
  private final IdentityHashMap<Object[],Object> successfulTestParams = new IdentityHashMap<Object[],Object>();
  /** These are test parameters from a test that has failed.  We need to
   *  keep these around because the test report expects to find them when
   *  printing out failures. */
  private final IdentityHashMap<Object[],Object> failedTestParams = new IdentityHashMap<Object[],Object>();
  /**
   * Adds testParams to the list of all test parameters, so it can be
   * null'ed out later if it's not part.
   */
  void addParamsFromSuccessfulTests(Object[] testParams) {
    if (testParams != null) {
      successfulTestParams.put(testParams, testParams);
    }
  }
  /**
   * Adds testParams to the list of all failed test parameters, so that we
   * know to NOT null it out later.
   */
  void addParamsFromFailedTest(Object[] testParams) {
    if (testParams != null) {
      failedTestParams.put(testParams, testParams);
    }
  }
  /**
   * null out all test parameters except the ones used in failed tests
   * since we might need these again.
   */
  @AfterClass(alwaysRun = true)
  public void clearSuccessfulTestParams() {
    Set<Object[]> paramsSet = successfulTestParams.keySet();
    if (paramsSet == null) {  // Can this ever happen?
      return;
    }
    for (Object[] params: paramsSet) {
      if (failedTestParams.containsKey(params)) {
        continue;
      }
      for (int i = 0; i < params.length; i++) {
        params[i] = null;
      }
    }
    successfulTestParams.clear();
    failedTestParams.clear();
  }
  /**
   * The member variables of a test class can prevent lots of memory from being
   * reclaimed, so we use reflection to null out all of the member variables
   * after the tests have run.  Since all tests must inherit from
   * DirectoryServerTestCase, TestNG guarantees that this method runs after
   * all of the subclass methods, so this isn't too dangerous.
   */
  @AfterClass(alwaysRun = true)
  public void nullMemberVariablesAfterTest() {
    Class cls = this.getClass();
    // Iterate through all of the fields in all subclasses of
    // DirectoryServerTestCase, but not DirectoryServerTestCase itself.
    while (DirectoryServerTestCase.class.isAssignableFrom(cls) &&
           !DirectoryServerTestCase.class.equals(cls))
    {
      Field fields[] = cls.getDeclaredFields();
      for (int i = 0; i < fields.length; i++) {
        Field field = fields[i];
        int modifiers = field.getModifiers();
        Class fieldClass = field.getType();
        // If it's a non-static non-final non-primitive type, then null it out
        // so that the garbage collector can reclaim it and everything it
        // references.
        if (!fieldClass.isPrimitive() &&
            !fieldClass.isEnum()      &&
            !Modifier.isFinal(modifiers) &&
            !Modifier.isStatic(modifiers))
        {
          field.setAccessible(true);
          try {
            field.set(this, null);
          } catch (IllegalAccessException e) {
            // We're only doing this to save memory, so it's no big deal
            // if we can't set it.
          }
        }
      }
      cls = cls.getSuperclass();
    }
  }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/MemoryReductionTestCases.java
New file
@@ -0,0 +1,76 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.server;
import org.testng.annotations.Test;
import org.testng.Assert;
/**
 * This tests some of the hacks we have in place in DirectoryServerTestCase
 * to reduce the memory that we consume during the tests.
 */
public class MemoryReductionTestCases extends DirectoryServerTestCase {
  private Object normalMemberObj = "should be nulled";
  private String normalMemberStr = "should be nulled";
  private final String finalStr = "shouldn't be nulled";
  private static String staticStr = "shouldn't be nulled";
  private int justAnInt = 1; // Shouldn't be affected.
  /**
   * Test that nullMemberVariablesAfterTest can actually null out
   * member variables.
   */
  @Test
  public void testNullMemberVariablesAfterTest() {
    nullMemberVariablesAfterTest();
    Assert.assertNull(normalMemberStr);
    Assert.assertNull(normalMemberObj);
    Assert.assertNotNull(finalStr);
    Assert.assertNotNull(staticStr);
    Assert.assertEquals(justAnInt, 1);
  }
  @Test
  public void testClearedTestParameters() {
    String[] successfulOnly = {"", ""};
    String[] successfulAndFailed = {"", ""};
    String[] failedOnly = {"", ""};
    addParamsFromSuccessfulTests(successfulOnly);
    addParamsFromSuccessfulTests(successfulAndFailed);
    addParamsFromFailedTest(successfulAndFailed);
    addParamsFromFailedTest(failedOnly);
    clearSuccessfulTestParams();
    Assert.assertEquals(successfulOnly, new String[]{null, null});
    Assert.assertEquals(successfulAndFailed, new String[]{"", ""});
    Assert.assertEquals(failedOnly, new String[]{"", ""});
  }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -37,6 +37,9 @@
import java.util.Enumeration;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.TreeMap;
import java.util.LinkedHashSet;
import java.util.Collections;
import java.util.logging.Logger;
import java.util.logging.Handler;
import java.util.logging.LogManager;
@@ -50,10 +53,11 @@
import org.opends.server.backends.jeb.BackendImpl;
import org.opends.server.backends.jeb.EntryContainer;
import org.opends.server.backends.jeb.RootContainer;
import org.opends.server.backends.jeb.DatabaseContainer;
import org.opends.server.backends.jeb.Index;
import org.opends.server.config.ConfigException;
import org.opends.server.core.AddOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.LockFileManager;
import org.opends.server.extensions.ConfigFileHandler;
import org.opends.server.loggers.TextErrorLogPublisher;
import org.opends.server.loggers.TextAccessLogPublisher;
@@ -75,14 +79,17 @@
import org.opends.server.types.InitializationException;
import org.opends.server.types.OperatingSystem;
import org.opends.server.types.ResultCode;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeType;
import org.opends.server.types.AttributeValue;
import org.opends.server.util.EmbeddedUtils;
import static org.testng.Assert.*;
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;
import org.opends.server.api.Backend;
import org.opends.messages.Message;
/**
@@ -105,12 +112,40 @@
       "org.opends.server.LdapPort";
  /**
   * If this System property is set to true, then the classes/ directory
   * will be copied into the server package setup for the tests.  This allows
   * the server tools (e.g. ldapsearch) to be used on a live server, but it
   * takes a while to copy all of the files, so we don't do it by default.
   */
  public static final String PROPERTY_COPY_CLASSES_TO_TEST_PKG =
       "org.opends.test.copyClassesToTestPackage";
  /**
   * The string representation of the DN that will be used as the base entry for
   * the test backend.  This must not be changed, as there are a number of test
   * cases that depend on this specific value of "o=test".
   */
  public static final String TEST_ROOT_DN_STRING = "o=test";
  /**
   * The test text writer for the Debug Logger
   */
  public static TestTextWriter DEBUG_TEXT_WRITER =
      new TestTextWriter();
  /**
   * The test text writer for the Debug Logger
   */
  public static TestTextWriter ERROR_TEXT_WRITER =
      new TestTextWriter();
  /**
   * The test text writer for the Debug Logger
   */
  public static TestTextWriter ACCESS_TEXT_WRITER =
      new TestTextWriter();
  /**
   * Indicates whether the server has already been started.  The value of this
   * constant must not be altered by anything outside the
@@ -139,6 +174,11 @@
  private static int serverLdapsPort;
  /**
   * Incremented by one each time the server has restarted.
   */
  private static int serverRestarts = 0;
  /**
   * Starts the Directory Server so that it will be available for use while
   * running the unit tests.  This will only actually start the server once, so
   * subsequent attempts to start it will be ignored because it will already be
@@ -203,8 +243,11 @@
    File testLibDir       = new File(testRoot, "lib");
    File testBinDir       = new File(testRoot, "bin");
    copyDirectory(serverClassesDir, testClassesDir);
    copyDirectory(unitClassesDir, testClassesDir);
    if (Boolean.getBoolean(PROPERTY_COPY_CLASSES_TO_TEST_PKG)) {
      copyDirectory(serverClassesDir, testClassesDir);
      copyDirectory(unitClassesDir, testClassesDir);
    }
    copyDirectory(libDir, testLibDir);
    copyDirectory(new File(resourceDir, "bin"), testBinDir);
    copyDirectory(new File(resourceDir, "config"), testConfigDir);
@@ -225,7 +268,6 @@
    copyFile(new File(testResourceDir, "client-cert.p12"),
             new File(testConfigDir, "client-cert.p12"));
    for (File f : testBinDir.listFiles())
    {
      try
@@ -316,26 +358,135 @@
    config.addAccessLogger(
          TextAccessLogPublisher.getStartupTextAccessPublisher(
              TestListener.ACCESS_TEXT_WRITER, false));
              ACCESS_TEXT_WRITER, false));
    config.addErrorLogger(
         TextErrorLogPublisher.getStartupTextErrorPublisher(
              TestListener.ERROR_TEXT_WRITER));
              ERROR_TEXT_WRITER));
    config.addDebugLogger(
         TextDebugLogPublisher.getStartupTextDebugPublisher(
              TestListener.DEBUG_TEXT_WRITER));
              DEBUG_TEXT_WRITER));
    EmbeddedUtils.startServer(config);
    assertTrue(InvocationCounterPlugin.startupCalled());
    // Save config.ldif for when we restart the server
    backupServerConfigLdif();
    SERVER_STARTED = true;
    initializeTestBackend(true);
  }
  /**
   * Similar to startServer, but it will restart the server each time it is
   * called.  Since this is somewhat expensive, it should be called under
   * two circumstances.  Either in an @AfterClass method for a test that
   * makes lots of configuration changes to the server, or in a @BeforeClass
   * method for a test that is very sensitive to running in a clean server.
   *
   * @throws  IOException  If a problem occurs while interacting with the
   *                       filesystem to prepare the test package root.
   *
   * @throws  InitializationException  If a problem occurs while starting the
   *                                   server.
   *
   * @throws  ConfigException  If there is a problem with the server
   *                           configuration.
   */
  public static synchronized void restartServer()
         throws IOException, InitializationException, ConfigException,
                DirectoryException, Exception
  {
    if (!SERVER_STARTED) {
      startServer();
      return;
    }
    long startMs = System.currentTimeMillis();
    clearLoggersContents();
    clearJEBackends();
    restoreServerConfigLdif();
    memoryBackend = null;  // We need it to be recreated and reregistered
    EmbeddedUtils.restartServer(null, null, DirectoryServer.getEnvironmentConfig());
    initializeTestBackend(true);
    // This generates too much noise, so it's disabled by default.
    // outputLogContentsIfError("Potential problem during in-core restart.  You be the judge.");
    // Keep track of these so we can report how long they took in the test summary
    long durationMs = System.currentTimeMillis() - startMs;
    restartTimesMs.add(durationMs);
    serverRestarts++;
  }
  public static List<Long> restartTimesMs = new ArrayList<Long>();
  public static List<Long> getRestartTimesMs() {
    return Collections.unmodifiableList(restartTimesMs);
  }
  private static void outputLogContentsIfError(String prefix) {
    StringBuilder logContents = new StringBuilder(prefix + EOL);
    appendLogsContents(logContents);
    if (logContents.indexOf("ERROR") != -1) {
      originalSystemErr.println(logContents);
    }
  }
  private static void clearJEBackends() throws Exception
  {
    for (Backend backend: DirectoryServer.getBackends().values()) {
      if (backend instanceof BackendImpl) {
        TestCaseUtils.clearJEBackend(false, backend.getBackendID(), null);
      }
    }
  }
  public static void clearDataBackends() throws Exception
  {
    clearJEBackends();
    memoryBackend.clearMemoryBackend();
  }
  private static File getTestConfigDir()
  {
    String buildRoot = System.getProperty(PROPERTY_BUILD_ROOT);
    File   buildDir  = new File(buildRoot, "build");
    File   unitRoot  = new File(buildDir, "unit-tests");
    File   testRoot  = new File(unitRoot, "package");
    return new File(testRoot, "config");
  }
  private static void backupServerConfigLdif() throws IOException
  {
    File testConfigDir = getTestConfigDir();
    copyFile(new File(testConfigDir, "config.ldif"),
             new File(testConfigDir, "config.ldif.for-restart"));
  }
  private static void restoreServerConfigLdif() throws IOException {
    File testConfigDir = getTestConfigDir();
    File from = new File(testConfigDir, "config.ldif.for-restart");
    File to = new File(testConfigDir, "config.ldif");
    // Sometimes this fails because config.ldif is in use, so we wait
    // and try it again.
    try {
      copyFile(from, to);
    } catch (IOException e) {
      sleep(1000);
      copyFile(from, to);
    }
  }
  /**
   * 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
@@ -352,11 +503,16 @@
   */
  private static void waitForOpsToComplete()
  {
    WorkQueue workQueue = DirectoryServer.getWorkQueue();
    final long NO_TIMEOUT = -1;
    workQueue.waitUntilIdle(NO_TIMEOUT);
    try {
      WorkQueue workQueue = DirectoryServer.getWorkQueue();
      final long NO_TIMEOUT = -1;
      workQueue.waitUntilIdle(NO_TIMEOUT);
    } catch (Exception e) {
      // Ignore it, maybe the server hasn't been started.
    }
  }
  /**
   * Binds to the given socket port on the local host.
   * @return the bounded Server socket.
@@ -472,19 +628,51 @@
  {
    BackendImpl backend = (BackendImpl)DirectoryServer.getBackend(beID);
    RootContainer rootContainer = backend.getRootContainer();
    for (EntryContainer ec : rootContainer.getEntryContainers())
    {
      ec.clear();
      assertEquals(ec.getHighestEntryID().longValue(), 0L);
    }
    rootContainer.resetNextEntryID();
    if (rootContainer != null) {
      for (EntryContainer ec : rootContainer.getEntryContainers())
      {
        ec.clear();
        assertEquals(ec.getHighestEntryID().longValue(), 0L);
      }
      rootContainer.resetNextEntryID();
    if (createBaseEntry)
    {
      DN baseDN = DN.decode(dn);
      Entry e = createEntry(baseDN);
      backend = (BackendImpl)DirectoryServer.getBackend(beID);
      backend.addEntry(e, null);
      if (createBaseEntry)
      {
        DN baseDN = DN.decode(dn);
        Entry e = createEntry(baseDN);
        backend = (BackendImpl)DirectoryServer.getBackend(beID);
        backend.addEntry(e, null);
      }
    }
  }
  /**
   * This was used to track down which test was trashing the indexes.
   * We left it here because it might be useful again.
   */
  public static void printUntrustedIndexes()
  {
    try {
      BackendImpl backend = (BackendImpl)DirectoryServer.getBackend("userRoot");
      if (backend == null) {
        return;
      }
      RootContainer rootContainer = backend.getRootContainer();
      for (EntryContainer ec : rootContainer.getEntryContainers())
      {
        List<DatabaseContainer> databases = new ArrayList<DatabaseContainer>();
        ec.listDatabases(databases);
        for (DatabaseContainer dbContainer: databases) {
          if (dbContainer instanceof Index) {
            Index index = (Index)dbContainer;
            if (!index.isTrusted()) {
              originalSystemErr.println("ERROR:  The index " + index.toString() + " is no longer trusted.");
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace(originalSystemErr);
    }
  }
@@ -606,8 +794,8 @@
  }
  /**
   * Get teh LDAPS port the test environment Directory Server instance is
   * running on
   * Get the LDAPS port the test environment Directory Server instance is
   * running on.
   *
   * @return The port number.
   */
@@ -617,6 +805,17 @@
  }
  /**
   * Get the number of times the server has done an incore restart during
   * the unit tests.
   *
   * @return the number of server restarts.
   */
  public static int getNumServerRestarts()
  {
    return serverRestarts;
  }
  /**
   * Method for getting a file from the test resources directory.
   *
   * @return The directory as a File
@@ -1060,6 +1259,73 @@
    redirectedSystemErr.reset();
  }
  /**
   * clear everything written to the Access, Error, or Debug loggers
   */
  public synchronized static void clearLoggersContents() {
    ACCESS_TEXT_WRITER.clear();
    ERROR_TEXT_WRITER.clear();
    DEBUG_TEXT_WRITER.clear();
    clearSystemOutContents();
    clearSystemErrContents();
  }
  /**
   * Append the contents of the Access Log, Error Log, Debug Loggers,
   * System.out, System.err to the specified buffer.
   */
  public static void appendLogsContents(StringBuilder logsContents)
  {
    List<String> messages = TestCaseUtils.ACCESS_TEXT_WRITER.getMessages();
    if (! messages.isEmpty())
    {
      logsContents.append(EOL);
      logsContents.append("Access Log Messages:");
      logsContents.append(EOL);
      for (String message : messages)
      {
        logsContents.append(message);
        logsContents.append(EOL);
      }
    }
    messages = TestCaseUtils.ERROR_TEXT_WRITER.getMessages();
    if (! messages.isEmpty())
    {
      logsContents.append(EOL);
      logsContents.append("Error Log Messages:");
      logsContents.append(EOL);
      for (String message : messages)
      {
        logsContents.append(message);
        logsContents.append(EOL);
      }
    }
    messages = TestCaseUtils.DEBUG_TEXT_WRITER.getMessages();
    if(! messages.isEmpty())
    {
      logsContents.append(EOL);
      logsContents.append("Debug Log Messages:");
      logsContents.append(EOL);
      for (String message : messages)
      {
        logsContents.append(message);
        logsContents.append(EOL);
      }
    }
    String systemOut = TestCaseUtils.getSystemOutContents();
    if (systemOut.length() > 0) {
      logsContents.append(EOL + "System.out contents:" + EOL + systemOut);
    }
    String systemErr = TestCaseUtils.getSystemErrContents();
    if (systemErr.length() > 0) {
      logsContents.append(EOL + "System.err contents:" + EOL + systemErr);
    }
  }
  public synchronized static void unsupressOutput() {
    System.setOut(originalSystemOut);
    System.setErr(originalSystemErr);
@@ -1226,5 +1492,66 @@
    assertEquals(DSConfig.main(fullArgs, false, System.out, System.err), 0);
  }
  /**
   * Return a String representation of all of the current threads.
   * @return a dump of all Threads on the server
   */
  public static String threadStacksToString()
  {
    Map<Thread,StackTraceElement[]> threadStacks = Thread.getAllStackTraces();
    // Re-arrange all of the elements by thread ID so that there is some logical
    // order.
    TreeMap<Long,Map.Entry<Thread,StackTraceElement[]>> orderedStacks =
         new TreeMap<Long,Map.Entry<Thread,StackTraceElement[]>>();
    for (Map.Entry<Thread,StackTraceElement[]> e : threadStacks.entrySet())
    {
      orderedStacks.put(e.getKey().getId(), e);
    }
    final StringBuilder buffer = new StringBuilder();
    for (Map.Entry<Thread,StackTraceElement[]> e : orderedStacks.values())
    {
      Thread t                          = e.getKey();
      StackTraceElement[] stackElements = e.getValue();
      long id = t.getId();
      buffer.append("id=");
      buffer.append(id);
      buffer.append(" ---------- ");
      buffer.append(t.getName());
      buffer.append(" ----------");
      buffer.append(EOL);
      if (stackElements != null)
      {
        for (int j=0; j < stackElements.length; j++)
        {
          buffer.append("   ").append(stackElements[j].getClassName());
          buffer.append(".");
          buffer.append(stackElements[j].getMethodName());
          buffer.append("(");
          buffer.append(stackElements[j].getFileName());
          buffer.append(":");
          if (stackElements[j].isNativeMethod())
          {
            buffer.append("native");
          }
          else
          {
            buffer.append(stackElements[j].getLineNumber());
          }
          buffer.append(")").append(EOL);
        }
      }
      buffer.append(EOL);
    }
    return buffer.toString();
  }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/TestListener.java
@@ -33,6 +33,8 @@
import org.testng.IClass;
import org.testng.ITestNGMethod;
import org.testng.ITestContext;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
import org.testng.xml.XmlSuite;
import static org.opends.server.util.ServerConstants.EOL;
import static org.opends.server.TestCaseUtils.originalSystemErr;
@@ -44,17 +46,25 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Set;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.LinkedHashSet;
import java.util.Iterator;
import java.util.Arrays;
import java.io.PrintStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
/**
 * This class is our replacement for the test results that TestNG generates.
 *   It prints out test to the console as they happen.
 */
public class TestListener extends TestListenerAdapter implements IReporter {
  private final StringBuilder _bufferedTestFailures = new StringBuilder();
  public static final String REPORT_FILE_NAME = "results.txt";
@@ -62,23 +72,83 @@
  // fails, we can do the coverage report before failing the build.
  public static final String ANT_TESTS_FAILED_FILE_NAME = ".tests-failed-marker";
  /**
   * The test text writer for the Debug Logger
   */
  public static TestTextWriter DEBUG_TEXT_WRITER =
      new TestTextWriter();
  /**
   * The test text writer for the Debug Logger
   */
  public static TestTextWriter ERROR_TEXT_WRITER =
      new TestTextWriter();
  private final StringBuilder _bufferedTestFailures = new StringBuilder();
  /**
   * The test text writer for the Debug Logger
   */
  public static TestTextWriter ACCESS_TEXT_WRITER =
      new TestTextWriter();
  public static final String PROPERTY_TEST_PROGRESS = "test.progress";
  public static final String TEST_PROGRESS_NONE = "none";
  public static final String TEST_PROGRESS_ALL = "all";
  public static final String TEST_PROGRESS_DEFAULT = "default";
  public static final String TEST_PROGRESS_TIME = "time";
  public static final String TEST_PROGRESS_TEST_COUNT = "count";
  public static final String TEST_PROGRESS_MEMORY = "memory";
  public static final String TEST_PROGRESS_MEMORY_GCS = "gcs";  // Hidden for now, since it's not useful to most developers
  public static final String TEST_PROGRESS_RESTARTS = "restarts";
  public static final String TEST_PROGRESS_THREAD_COUNT = "threadcount";
  public static final String TEST_PROGRESS_THREAD_CHANGES = "threadchanges";
  private boolean doProgressNone = false;
  private boolean doProgressTime = true;
  private boolean doProgressTestCount = true;
  private boolean doProgressMemory = false;
  private boolean doProgressMemoryGcs = false;
  private boolean doProgressRestarts = true;
  private boolean doProgressThreadCount = false;
  private boolean doProgressThreadChanges = false;
  private void initializeProgressVars() {
    String prop = System.getProperty(PROPERTY_TEST_PROGRESS);
    if (prop == null) {
      return;
    }
    prop = prop.toLowerCase();
    List<String> progressValues = Arrays.asList(prop.split("\\s*\\W+\\s*"));
    if ((prop.length() == 0) || progressValues.isEmpty()) {
      // Accept the defaults
    } else if (progressValues.contains(TEST_PROGRESS_NONE)) {
      doProgressNone = true;
      doProgressTime = false;
      doProgressTestCount = false;
      doProgressMemory = false;
      doProgressMemoryGcs = false;
      doProgressRestarts = false;
      doProgressThreadCount = false;
      doProgressThreadChanges = false;
    } else if (progressValues.contains(TEST_PROGRESS_ALL)) {
      doProgressNone = false;
      doProgressTime = true;
      doProgressTestCount = true;
      doProgressMemory = true;
      doProgressMemoryGcs = true;
      doProgressRestarts = true;
      doProgressThreadCount = true;
      doProgressThreadChanges = true;
    } else {
      doProgressNone = false;
      doProgressTime = progressValues.contains(TEST_PROGRESS_TIME);
      doProgressTestCount = progressValues.contains(TEST_PROGRESS_TEST_COUNT);
      doProgressMemory = progressValues.contains(TEST_PROGRESS_MEMORY);
      doProgressMemoryGcs = progressValues.contains(TEST_PROGRESS_MEMORY_GCS);
      doProgressRestarts = progressValues.contains(TEST_PROGRESS_RESTARTS);
      doProgressThreadCount = progressValues.contains(TEST_PROGRESS_THREAD_COUNT);
      doProgressThreadChanges = progressValues.contains(TEST_PROGRESS_THREAD_CHANGES);
      // If we were asked to do the defaults, then restore anything that's on by default
      if (progressValues.contains(TEST_PROGRESS_DEFAULT)) {
        doProgressTime = true;
        doProgressTestCount = true;
        doProgressRestarts = true;
      }
    }
  }
  public TestListener() throws Exception {
    initializeProgressVars();
  }
  private static final String DIVIDER_LINE = "-------------------------------------------------------------------------------" + EOL;
@@ -100,7 +170,9 @@
  private void writeAntTestsFailedMarker(String outputDirectory) {
    // Signal 'ant' that all of the tests passed by removing this
    // special file.
    if (countTestsWithStatus(ITestResult.FAILURE) == 0) {
    if ((countTestsWithStatus(ITestResult.FAILURE) == 0) &&
        (countTestsWithStatus(ITestResult.SKIP) == 0))
    {
      new File(outputDirectory, ANT_TESTS_FAILED_FILE_NAME).delete();
    }
  }
@@ -118,11 +190,21 @@
    reportStream.println(center("UNIT TEST REPORT"));
    reportStream.println(center("----------------") + EOL);
    reportStream.println("Finished at: " + (new Date()));
    reportStream.println("# Test clases: " + _classResults.size());
    reportStream.println("# Test classes: " + _classResults.size());
    reportStream.println("# Test classes interleaved: " + _classesWithTestsRunInterleaved.size());
    reportStream.println("# Test methods: " + countTestMethods());
    reportStream.println("# Tests passed: " + countTestsWithStatus(ITestResult.SUCCESS));
    reportStream.println("# Tests failed: " + countTestsWithStatus(ITestResult.FAILURE));
    reportStream.println(EOL + DIVIDER_LINE + DIVIDER_LINE + EOL + EOL);
    reportStream.println(center("TEST CLASSES RUN INTERLEAVED"));
    reportStream.println(EOL + EOL);
    for (Iterator<Class> iterator = _classesWithTestsRunInterleaved.iterator(); iterator.hasNext();)
    {
      Class cls = iterator.next();
      reportStream.println("  " + cls.getName());
    }
    reportStream.println(EOL + DIVIDER_LINE + DIVIDER_LINE + EOL + EOL);
    reportStream.println(center("FAILED TESTS"));
    reportStream.println(EOL + EOL);
    reportStream.println(_bufferedTestFailures);
@@ -132,6 +214,12 @@
    reportStream.println(getTimingInfo());
    reportStream.close();
    if ((countTestsWithStatus(ITestResult.FAILURE) == 0) &&
        (countTestsWithStatus(ITestResult.SKIP) != 0)) {
      originalSystemErr.println("There were no explicit test failures, but some tests were skipped (possibly due to errors in @Before* or @After* methods).");
      System.exit(-1);
    }
  }
  private String getFqMethod(ITestResult result) {
@@ -165,9 +253,6 @@
      failed.append(EOL);
    }
    if (failed.length() > 0) {
      originalSystemErr.println("The following unit tests failed: ");
      originalSystemErr.println(failed);
@@ -180,37 +265,68 @@
    originalSystemErr.println();
    originalSystemErr.println("Wrote full test report to:");
    originalSystemErr.println(reportFile.getAbsolutePath());
    originalSystemErr.println("Test classes run interleaved: " + _classesWithTestsRunInterleaved.size());
    // Try to hard to reclaim as much memory as possible.
    runGc();
    originalSystemErr.printf("Final amount of memory in use: %.1f MB",
            (usedMemory() / (1024.0 * 1024.0))).println();
    if (doProgressMemory) {
      originalSystemErr.printf("Maximum amount of memory in use: %.1f MB",
              (maxMemInUse / (1024.0 * 1024.0))).println();
    }
    originalSystemErr.println("Final number of threads: " + Thread.activeCount());
    List<Long> systemRestartTimes = TestCaseUtils.getRestartTimesMs();
    long totalRestartMs = 0;
    for (long restartMs: systemRestartTimes) {
      totalRestartMs += restartMs;
    }
    double averageRestartSec = 0;
    if (systemRestartTimes.size() > 0) {
      averageRestartSec = totalRestartMs / (1000.0 * systemRestartTimes.size());
    }
    originalSystemErr.printf("In core restarts: %d  (took %.1fs on average)",
            TestCaseUtils.getNumServerRestarts(), averageRestartSec);
    originalSystemErr.println();
    if (doProgressThreadChanges) {
      originalSystemErr.print(TestCaseUtils.threadStacksToString());
    }
    if (_classesWithTestsRunInterleaved.size() > 0) {
      System.err.println("WARNING:  Some of the test methods for multiple classes " +
              "were run out of order (i.e. interleaved with other classes).  Either "  +
              "a class doesn't have the sequential=true annotation, which should " +
              "have been reported already or there has been a regression with TestNG.");
    }
  }
  public void onTestStart(ITestResult tr) {
    super.onTestStart(tr);
    ACCESS_TEXT_WRITER.clear();
    ERROR_TEXT_WRITER.clear();
    DEBUG_TEXT_WRITER.clear();
    TestCaseUtils.clearSystemOutContents();
    TestCaseUtils.clearSystemErrContents();
    enforceTestClassTypeAndAnnotations(tr);
    checkForInterleavedBetweenClasses(tr);
    enforceMethodHasAnnotation(tr);
  }
  private void onTestFinished(ITestResult tr) {
    // Clear when a test finishes instead before the next one starts
    // so that we get the output generated by any @BeforeClass method etc.
    TestCaseUtils.clearLoggersContents();
    addTestResult(tr);
  }
  public void onTestSuccess(ITestResult tr) {
    super.onTestSuccess(tr);
    addTestResult(tr);
    // Clear the test parameters on a successful test because they take up a lot
    // of memory and we won't need them again (as we might with a failed test).
    clearTestParameters(tr);
  }
  private static final String[][] CLEARED_TEST_PARAMETERS = {{"<test-parameters-cleared>"}};
  private void clearTestParameters(ITestResult tr) {
    tr.setParameters(CLEARED_TEST_PARAMETERS);
    onTestFinished(tr);
  }
  public void onTestFailure(ITestResult tr) {
    super.onTestFailure(tr);
    addTestResult(tr);
    IClass cls = tr.getTestClass();
    ITestNGMethod method = tr.getMethod();
@@ -232,54 +348,7 @@
      failureInfo.append("parameter[" + i + "]: ").append(parameter).append(EOL);
    }
    List<String> messages = ACCESS_TEXT_WRITER.getMessages();
    if (! messages.isEmpty())
    {
      failureInfo.append(EOL);
      failureInfo.append("Access Log Messages:");
      failureInfo.append(EOL);
      for (String message : messages)
      {
        failureInfo.append(message);
        failureInfo.append(EOL);
      }
    }
    messages = ERROR_TEXT_WRITER.getMessages();
    if (! messages.isEmpty())
    {
      failureInfo.append(EOL);
      failureInfo.append("Error Log Messages:");
      failureInfo.append(EOL);
      for (String message : messages)
      {
        failureInfo.append(message);
        failureInfo.append(EOL);
      }
    }
    messages = DEBUG_TEXT_WRITER.getMessages();
    if(! messages.isEmpty())
    {
      failureInfo.append(EOL);
      failureInfo.append("Debug Log Messages:");
      failureInfo.append(EOL);
      for (String message : messages)
      {
        failureInfo.append(message);
        failureInfo.append(EOL);
      }
    }
    String systemOut = TestCaseUtils.getSystemOutContents();
    if (systemOut.length() > 0) {
      failureInfo.append(EOL + "System.out contents:" + EOL + systemOut);
    }
    String systemErr = TestCaseUtils.getSystemErrContents();
    if (systemErr.length() > 0) {
      failureInfo.append(EOL + "System.err contents:" + EOL + systemErr);
    }
    appendFailureInfo(failureInfo);
    failureInfo.append(EOL + EOL);
    originalSystemErr.print(EOL + EOL + EOL + "                 T E S T   F A I L U R E ! ! !" + EOL + EOL);
@@ -291,41 +360,83 @@
    String pauseStr = System.getProperty("org.opends.test.pauseOnFailure");
    if ((pauseStr != null) && pauseStr.equalsIgnoreCase("true"))
    {
      File tempFile = null;
      pauseOnFailure();
    }
    onTestFinished(tr);
  }
  public static void pauseOnFailure() {
    File tempFile = null;
    try
    {
      tempFile = File.createTempFile("testfailure", "watchdog");
      tempFile.deleteOnExit();
      originalSystemErr.println("**** Pausing test execution until file " +
                                tempFile.getCanonicalPath() + " is removed.");
      originalSystemErr.println("LDAP Port:   " +
                                TestCaseUtils.getServerLdapPort());
      originalSystemErr.println("LDAPS Port:  " +
                                TestCaseUtils.getServerLdapsPort());
      originalSystemErr.println("JMX Port:    " +
                                TestCaseUtils.getServerJmxPort());
    }
    catch (Exception e)
    {
      originalSystemErr.println("**** ERROR:  Could not create a watchdog " +
           "file.  Pausing test execution indefinitely.");
      originalSystemErr.println("**** You will have to manually kill the " +
           "JVM when you're done investigating the problem.");
    }
    while ((tempFile != null) && tempFile.exists())
    {
      try
      {
        tempFile = File.createTempFile("testfailure", "watchdog");
        tempFile.deleteOnExit();
        originalSystemErr.println("**** Pausing test execution until file " +
                                  tempFile.getCanonicalPath() + " is removed.");
        originalSystemErr.println("LDAP Port:   " +
                                  TestCaseUtils.getServerLdapPort());
        originalSystemErr.println("LDAPS Port:  " +
                                  TestCaseUtils.getServerLdapsPort());
        originalSystemErr.println("JMX Port:    " +
                                  TestCaseUtils.getServerJmxPort());
      }
      catch (Exception e)
      {
        originalSystemErr.println("**** ERROR:  Could not create a watchdog " +
             "file.  Pausing test execution indefinitely.");
        originalSystemErr.println("**** You will have to manually kill the " +
             "JVM when you're done investigating the problem.");
      }
      while ((tempFile == null) || tempFile.exists())
      {
        try
        {
          Thread.sleep(100);
        } catch (Exception e) {}
      }
      originalSystemErr.println("**** Watchdog file removed.  Resuming test " +
                                "case execution.");
        Thread.sleep(100);
      } catch (Exception e) {}
    }
    originalSystemErr.println("**** Watchdog file removed.  Resuming test " +
                              "case execution.");
  }
  private void appendFailureInfo(StringBuilder failureInfo)
  {
    TestCaseUtils.appendLogsContents(failureInfo);
  }
  public void onConfigurationFailure(ITestResult tr) {
    super.onConfigurationFailure(tr);
    IClass cls = tr.getTestClass();
    ITestNGMethod method = tr.getMethod();
    String fqMethod = cls.getName() + "#" + method.getMethodName();
    StringBuilder failureInfo = new StringBuilder();
    failureInfo.append("Failed Test:  ").append(fqMethod).append(EOL);
    Object[] parameters = tr.getParameters();
    Throwable cause = tr.getThrowable();
    if (cause != null) {
      failureInfo.append("Failure Cause:  ").append(getTestngLessStack(cause));
    }
    appendFailureInfo(failureInfo);
    failureInfo.append(EOL + EOL);
    originalSystemErr.print(EOL + EOL + EOL + "         C O N F I G U R A T I O N   F A I L U R E ! ! !" + EOL + EOL);
    originalSystemErr.print(failureInfo);
    originalSystemErr.print(DIVIDER_LINE + EOL + EOL);
    _bufferedTestFailures.append(failureInfo);
  }
  private String getTestngLessStack(Throwable t) {
    StackTraceElement[] elements = t.getStackTrace();
@@ -344,6 +455,14 @@
      buffer.append("    ").append(elements[i]).append(EOL);
    }
    Throwable cause = t.getCause();
    if (t != null) {
      if (cause instanceof InvocationTargetException) {
        InvocationTargetException invocation = ((InvocationTargetException)cause);
        buffer.append("Invocation Target Exception: " + getTestngLessStack(invocation));
      }
    }
    return buffer.toString();
  }
@@ -362,16 +481,379 @@
  public void onTestSkipped(ITestResult tr) {
    super.onTestSkipped(tr);
    // TODO: do we need to do anything with this?
    onTestFinished(tr);
  }
  public void onTestFailedButWithinSuccessPercentage(ITestResult tr) {
    super.onTestFailedButWithinSuccessPercentage(tr);
    addTestResult(tr);
    onTestFinished(tr);
  }
  private void addTestResult(ITestResult result) {
    getResultsForClass(result.getTestClass()).addTestResult(result);
    // Read the comments in DirectoryServerTestCase to understand what's
    // going on here.
    Object[] testInstances = result.getMethod().getInstances();
    for (int i = 0; i < testInstances.length; i++) {
      Object testInstance = testInstances[i];
      if (testInstance instanceof DirectoryServerTestCase) {
        DirectoryServerTestCase dsTestCase = (DirectoryServerTestCase)testInstance;
        Object[] parameters = result.getParameters();
        if (result.getStatus() == ITestResult.SUCCESS) {
          dsTestCase.addParamsFromSuccessfulTests(parameters);
          // This can eat up a bunch of memory for tests that are expected to throw
          result.setThrowable(null);
        } else {
          dsTestCase.addParamsFromFailedTest(parameters);
          // When the test finishes later on, we might not have everything
          // that we need to print the result (e.g. the Schema for an Entry
          // or DN), so go ahead and convert it to a String now.
          result.setParameters(convertToStringParameters(parameters));
        }
      } else {
        // We already warned about it.
      }
    }
  }
  private String[] convertToStringParameters(Object[] parameters) {
    if (parameters == null) {
      return null;
    }
    String[] strParams = new String[parameters.length];
    for (int i = 0; i < parameters.length; i++) {
      strParams[i] = String.valueOf(parameters[i]).intern();
    }
    return strParams;
  }
  private Set<Class> _checkedForTypeAndAnnotations = new HashSet<Class>();
  private void enforceTestClassTypeAndAnnotations(ITestResult tr) {
    Class testClass = null;
    testClass = tr.getMethod().getRealClass();
    // Only warn once per class.
    if (_checkedForTypeAndAnnotations.contains(testClass)) {
      return;
    }
    _checkedForTypeAndAnnotations.add(testClass);
    if (!DirectoryServerTestCase.class.isAssignableFrom(testClass)) {
      String errorMessage =
              "The test class " + testClass.getName() + " must inherit (directly or indirectly) " +
              "from DirectoryServerTestCase.";
      TestCaseUtils.originalSystemErr.println("\n\nERROR: " + errorMessage + "\n\n");
      throw new RuntimeException(errorMessage);
    }
    Class<?> classWithTestAnnotation = findClassWithTestAnnotation(testClass);
    if (classWithTestAnnotation == null) {
      String errorMessage =
              "The test class " + testClass.getName() + " does not have a @Test annotation.  " +
              "All test classes must have a @Test annotation, and this annotation must have " +
              "sequential=true set to ensure that tests for a single class are run together.";
      TestCaseUtils.originalSystemErr.println("\n\nERROR: " + errorMessage + "\n\n");
      throw new RuntimeException(errorMessage);
    }
    Test testAnnotation = classWithTestAnnotation.getAnnotation(Test.class);
    if (!testAnnotation.sequential()) {
      // Give an error message that is as specific as possible.
      String errorMessage =
              "The @Test annotation for class " + testClass.getName() +
              (classWithTestAnnotation.equals(testClass) ? " " : (", which is declared by class " + classWithTestAnnotation.getName() + ", ")) +
              "must include sequential=true to ensure that tests for a single class are run together.";
      TestCaseUtils.originalSystemErr.println("\n\nERROR: " + errorMessage + "\n\n");
      throw new RuntimeException(errorMessage);
    }
  }
  private final LinkedHashSet<Class> _classesWithTestsRunInterleaved = new LinkedHashSet<Class>();
  private Object _lastTestObject = null;
  private final IdentityHashMap<Object,Object> _previousTestObjects = new IdentityHashMap<Object,Object>();
  private void checkForInterleavedBetweenClasses(ITestResult tr) {
    Object[] testInstances = tr.getMethod().getInstances();
    // This will almost always have a single element.  If it doesn't, just
    // skip it.
    if (testInstances.length != 1) {
      return;
    }
    Object testInstance = testInstances[0];
    // We're running another test on the same test object.  Everything is fine.
    if (_lastTestObject == testInstance) {
      return;
    }
    // Otherwise, we're running a new test, so save the old one.
    if (_lastTestObject != null) {
      _previousTestObjects.put(_lastTestObject, _lastTestObject);
    }
    // Output progress info since we're running a new class
    outputTestProgress(_lastTestObject, testInstance);
    // And make sure we don't have a test object that we already ran tests with.
    if (_previousTestObjects.containsKey(testInstance)) {
      _classesWithTestsRunInterleaved.add(testInstance.getClass());
    }
    _lastTestObject = testInstance;
  }
  private Set<Method> _checkedForAnnotation = new HashSet<Method>();
  private void enforceMethodHasAnnotation(ITestResult tr) {
    // Only warn once per method.
    Method testMethod = tr.getMethod().getMethod();
    if (_checkedForAnnotation.contains(testMethod)) {
      return;
    }
    _checkedForAnnotation.add(testMethod);
    Annotation testAnnotation = testMethod.getAnnotation(Test.class);
    Annotation dataProviderAnnotation = testMethod.getAnnotation(DataProvider.class);
    if ((testAnnotation == null) && (dataProviderAnnotation == null)) {
      String errorMessage =
              "The test method " + testMethod + " does not have a @Test annotation.  " +
              "However, TestNG assumes it is a test method because it's a public method " +
              "in a class with a class-level @Test annotation.  You can remove this warning by either " +
              "marking the method with @Test or by making it non-public.";
      TestCaseUtils.originalSystemErr.println("\n\nWARNING: " + errorMessage + "\n\n");
    }
  }
  // Return the class in cls's inheritence hierarchy that has the @Test
  // annotation defined.
  private Class findClassWithTestAnnotation(Class<?> cls) {
    while (cls != null) {
      if (cls.getAnnotation(Test.class) != null) {
        return cls;
      } else {
        cls = cls.getSuperclass();
      }
    }
    return null;
  }
  private boolean statusHeaderPrinted = false;
  private synchronized void printStatusHeaderOnce() {
    if (statusHeaderPrinted) {
      return;
    }
    statusHeaderPrinted = true;
    if (doProgressNone) {
      return;
    }
    originalSystemErr.println();
    originalSystemErr.println("How to read the progressive status info:");
    if (doProgressTime) {
      originalSystemErr.println("  Test duration status: {Total min:sec.  Since last status sec.}");
    }
    if (doProgressTestCount) {
      originalSystemErr.println("  Test count status:  {# test classes  # test methods  # test method invocations  # test failures}.");
    }
    if (doProgressMemory) {
      originalSystemErr.println("  Memory usage status: {MB in use  +/-change since last status}");
    }
    if (doProgressMemoryGcs) {
      originalSystemErr.println("  GCs during status:  {GCs done to settle used memory   time to do it}");
    }
    if (doProgressThreadCount) {
      originalSystemErr.println("  Thread count status:  {#td number of active threads}");
    }
    if (doProgressRestarts) {
      originalSystemErr.println("  In core restart status: {#rs number of in-core restarts}");
    }
    if (doProgressThreadChanges) {
      originalSystemErr.println("  Thread change status: +/- thread name for new or finished threads since last status");
    }
    originalSystemErr.println("  TestClass (the class that just completed)");
    originalSystemErr.println();
  }
  private final long startTimeMs = System.currentTimeMillis();
  private long prevTimeMs = System.currentTimeMillis();
  private List<String> prevThreads = new ArrayList<String>();
  private long prevMemInUse = 0;
  private long maxMemInUse = 0;
  private void outputTestProgress(Object finishedTestObject, Object nextTestObject) {
    if (doProgressNone) {
      return;
    }
    printStatusHeaderOnce();
    if (doProgressTime) {
      long curTimeMs = System.currentTimeMillis();
      long durationSec = (curTimeMs - startTimeMs) / 1000;
      long durationLastMs = curTimeMs - prevTimeMs;
      originalSystemErr.printf("{%2d:%02d (%3.0fs)}  ",
              (durationSec / 60),
              (durationSec % 60),
              (durationLastMs / 1000.0));
      prevTimeMs = curTimeMs;
    }
    if (doProgressTestCount) {
      originalSystemErr.printf("{%3dc %4dm %5di %df}  ",
            _classResults.size(), countTestMethods(), countTotalInvocations(),
              countTestsWithStatus(ITestResult.FAILURE));
    }
    if (doProgressMemory) {
      Runtime runtime = Runtime.getRuntime();
      TestCaseUtils.quiesceServer();
      long beforeGc = System.currentTimeMillis();
      int gcs = runGc();
      long gcDuration = System.currentTimeMillis() - beforeGc;
      long totalMemory = runtime.totalMemory();
      long freeMemory = runtime.freeMemory();
      long curMemInUse = totalMemory - freeMemory;
      long memDelta = curMemInUse - prevMemInUse;
      double perMegaByte = 1.0 / (1024.0 * 1024.0);
      maxMemInUse = Math.max(maxMemInUse, curMemInUse);
      originalSystemErr.printf("{%5.1fMB  %+5.1fMB}  ",
            curMemInUse * perMegaByte,
            memDelta * perMegaByte);
      if (doProgressMemoryGcs) {
        originalSystemErr.printf("{%2d gcs  %4.1fs}  ",
                gcs,
                gcDuration / 1000.0);
      }
      prevMemInUse = curMemInUse;
    }
    if (doProgressThreadCount) {
      originalSystemErr.printf("{#td %3d}  ", Thread.activeCount());
    }
    if (doProgressRestarts) {
      originalSystemErr.printf("{#rs %2d}  ", TestCaseUtils.getNumServerRestarts());
    }
    if (finishedTestObject == null) {
      originalSystemErr.println(": starting");
    } else {
      String abbrClass = packageLessClass(finishedTestObject);
      originalSystemErr.printf(": %s ", abbrClass).flush();
      originalSystemErr.println();
    }
    if (doProgressThreadChanges) {
      List<String> currentThreads = listAllThreadNames();
      List<String> newThreads = removeExactly(prevThreads, currentThreads);
      List<String> oldThreads = removeExactly(currentThreads, prevThreads);
      if (!newThreads.isEmpty()) {
        originalSystemErr.println("  Thread changes:");
        for (int i = 0; i < oldThreads.size(); i++) {
          String threadName =  oldThreads.get(i);
          originalSystemErr.println("    + " + threadName);
        }
        for (int i = 0; i < newThreads.size(); i++) {
          String threadName =  newThreads.get(i);
          originalSystemErr.println("    - " + threadName);
        }
      }
      prevThreads = currentThreads;
    }
  }
  private int runGc() {
    Runtime runtime = Runtime.getRuntime();
    int numGcs;
    long curMem = usedMemory();
    long prevMem = Long.MAX_VALUE;
    StringBuilder gcConvergence = new StringBuilder();
    for (numGcs = 0; (prevMem > curMem) && numGcs < 100; numGcs++) {
        runtime.runFinalization();
        runtime.gc();
        Thread.yield();
        Thread.yield();
        prevMem = curMem;
        curMem = usedMemory();
        gcConvergence.append("[" + numGcs + "]: " + (prevMem - curMem)).append("  ");
    }
    return numGcs;
  }
  private List<String> listAllThreadNames() {
    Thread currentThread = Thread.currentThread();
    ThreadGroup topGroup = currentThread.getThreadGroup();
    while (topGroup.getParent() != null) {
      topGroup = topGroup.getParent();
    }
    Thread threads[] = new Thread[topGroup.activeCount() * 2];
    int numThreads = topGroup.enumerate(threads);
    List<String> activeThreads = new ArrayList<String>();
    for (int i = 0; i < numThreads; i++) {
      Thread thread = threads[i];
      if (thread.isAlive()) {
        String fullName = thread.getName();
        activeThreads.add(fullName);
      }
    }
    Collections.sort(activeThreads);
    return activeThreads;
  }
  /**
   * Removes toRemove from base.  If there are duplicate items in base, then
   * only one is removed for each item in toRemove.
   *
   * @return a new List with base with toRemove items removed from it
   */
  private List<String> removeExactly(List<String> base, List<String> toRemove) {
    List<String> diff = new ArrayList<String>(base);
    for (int i = 0; i < toRemove.size(); i++) {
      String item = toRemove.get(i);
      diff.remove(item);
    }
    return diff;
  }
  private String packageLessClass(Object obj) {
    return obj.getClass().getName().replaceAll(".*\\.", "");
  }
  private long usedMemory() {
    Runtime runtime = Runtime.getRuntime();
    return runtime.totalMemory() - runtime.freeMemory();
  }
  private final LinkedHashMap<IClass, TestClassResults> _classResults = new LinkedHashMap<IClass, TestClassResults>();
@@ -415,6 +897,14 @@
    return count;
  }
  private int countTotalInvocations() {
    int count = 0;
    for (TestClassResults results: _classResults.values()) {
      count += results._totalInvocations;
    }
    return count;
  }
  synchronized private List<TestMethodResults> getAllMethodResults() {
    List<TestMethodResults> allResults = new ArrayList<TestMethodResults>();
    for (TestClassResults results: _classResults.values()) {
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/AbstractManagedObjectDefinitionTest.java
@@ -35,6 +35,7 @@
import java.util.Collections;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.admin.std.meta.ConnectionHandlerCfgDefn;
import org.opends.server.admin.std.meta.JMXConnectionHandlerCfgDefn;
import org.opends.server.admin.std.meta.LDAPConnectionHandlerCfgDefn;
@@ -47,7 +48,8 @@
/**
 * AbstractManagedObjectDefinition test cases.
 */
public class AbstractManagedObjectDefinitionTest {
@Test(sequential=true)
public class AbstractManagedObjectDefinitionTest extends DirectoryServerTestCase {
  /**
   * A test managed object definition.
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/AdminTestCase.java
@@ -32,7 +32,7 @@
/**
 * An abstract class that all admin unit tests should extend.
 */
@Test(groups = { "precommit", "admin" })
@Test(groups = { "precommit", "admin" }, sequential = true)
public abstract class AdminTestCase extends DirectoryServerTestCase {
  // No implementation required.
}
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java
@@ -32,6 +32,7 @@
import static org.testng.Assert.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
@@ -44,7 +45,7 @@
/**
 * AttributeTypePropertyDefinition Tester.
 */
public class AttributeTypePropertyDefinitionTest {
public class AttributeTypePropertyDefinitionTest extends DirectoryServerTestCase {
  /**
   * Sets up tests.
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java
@@ -30,6 +30,7 @@
import static org.testng.Assert.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -38,7 +39,7 @@
/**
 * BooleanPropertyDefinition Tester.
 */
public class BooleanPropertyDefinitionTest {
public class BooleanPropertyDefinitionTest extends DirectoryServerTestCase {
  BooleanPropertyDefinition.Builder builder = null;
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java
@@ -32,6 +32,7 @@
import java.util.List;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.DirectoryServerTestCase;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -39,7 +40,7 @@
/**
 * ClassPropertyDefinition Tester.
 */
public class ClassPropertyDefinitionTest {
public class ClassPropertyDefinitionTest extends DirectoryServerTestCase {
  ClassPropertyDefinition.Builder builder = null;
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DNPropertyDefinitionTest.java
@@ -32,6 +32,7 @@
import static org.testng.Assert.assertEquals;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
@@ -44,7 +45,7 @@
/**
 * ClassPropertyDefinition Tester.
 */
public class DNPropertyDefinitionTest {
public class DNPropertyDefinitionTest extends DirectoryServerTestCase {
  /**
   * Sets up tests
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java
@@ -25,11 +25,12 @@
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
package org.opends.server.admin;
import static org.testng.Assert.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -38,7 +39,7 @@
/**
 * DurationPropertyDefinition Tester.
 */
public class DurationPropertyDefinitionTest {
public class DurationPropertyDefinitionTest extends DirectoryServerTestCase {
  /**
   * Sets up tests
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationUnitTest.java
@@ -28,13 +28,14 @@
package org.opends.server.admin;
import static org.opends.server.admin.DurationUnit.*;
import org.opends.server.DirectoryServerTestCase;
import static org.testng.Assert.*;
import org.testng.annotations.*;
/**
 * DurationUnit Tester.
 */
public class DurationUnitTest {
public class DurationUnitTest extends DirectoryServerTestCase {
  /**
   * @return test data for testing getUnit
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java
@@ -30,6 +30,7 @@
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.DirectoryServerTestCase;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -37,7 +38,7 @@
/**
 * EnumPropertyDefinition Tester.
 */
public class EnumPropertyDefinitionTest {
public class EnumPropertyDefinitionTest extends DirectoryServerTestCase {
  private enum TestEnum { ONE, TWO, THREE }
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java
@@ -30,13 +30,14 @@
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.DirectoryServerTestCase;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/**
 * IntegerPropertyDefinition Tester.
 */
public class IntegerPropertyDefinitionTest {
public class IntegerPropertyDefinitionTest extends DirectoryServerTestCase {
  /**
   * Tests creation of builder succeeds
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/LDAPProfileTest.java
@@ -30,13 +30,14 @@
import static org.testng.Assert.*;
import org.testng.annotations.*;
import org.opends.server.admin.std.meta.GlobalCfgDefn;
import org.opends.server.DirectoryServerTestCase;
import java.util.List;
/**
 * LDAPProfile Tester.
 */
public class LDAPProfileTest {
public class LDAPProfileTest extends DirectoryServerTestCase {
  /**
   * Tests execution of getObjectClasses() and makes sure the
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResourceTest.java
@@ -30,13 +30,14 @@
import static org.testng.Assert.*;
import org.testng.annotations.*;
import org.opends.server.admin.std.meta.GlobalCfgDefn;
import org.opends.server.DirectoryServerTestCase;
import java.util.Locale;
/**
 * ManagedObjectDefinitionI18NResource Tester.
 */
public class ManagedObjectDefinitionI18NResourceTest {
public class ManagedObjectDefinitionI18NResourceTest extends DirectoryServerTestCase {
  ManagedObjectDefinitionI18NResource modr = null;
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ManagedObjectPathTest.java
@@ -34,6 +34,7 @@
import static org.testng.Assert.assertTrue;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.admin.std.client.ConnectionHandlerCfgClient;
import org.opends.server.admin.std.client.GlobalCfgClient;
import org.opends.server.admin.std.client.LDAPConnectionHandlerCfgClient;
@@ -54,7 +55,7 @@
/**
 * ManagedObjectPath test cases.
 */
public class ManagedObjectPathTest {
public class ManagedObjectPathTest extends DirectoryServerTestCase {
  /**
   * Sets up tests
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/RelativeInheritedDefaultBehaviorProviderTest.java
@@ -34,13 +34,13 @@
import org.testng.annotations.BeforeClass;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
/**
 * RelativeInheritedDefaultBehaviorProvider Tester.
 */
public class RelativeInheritedDefaultBehaviorProviderTest {
public class RelativeInheritedDefaultBehaviorProviderTest extends DirectoryServerTestCase {
  private static final int OFFSET = 0;
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java
@@ -30,6 +30,7 @@
import static org.testng.Assert.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -38,7 +39,7 @@
/**
 * SizePropertyDefinition Tester.
 */
public class SizePropertyDefinitionTest {
public class SizePropertyDefinitionTest extends DirectoryServerTestCase {
  /**
   * Sets up tests
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizeUnitTest.java
@@ -29,11 +29,12 @@
import static org.testng.Assert.*;
import org.testng.annotations.*;
import org.opends.server.DirectoryServerTestCase;
/**
 * SizeUnit Tester.
 */
public class SizeUnitTest {
public class SizeUnitTest extends DirectoryServerTestCase {
  /**
   * Creates data for testing String to SizeUnit conversions
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/StringPropertyDefinitionTest.java
@@ -32,6 +32,7 @@
import static org.testng.Assert.assertEquals;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.DirectoryServerTestCase;
import org.testng.annotations.Test;
@@ -39,7 +40,7 @@
/**
 * StringPropertyDefinition Tester.
 */
public class StringPropertyDefinitionTest {
public class StringPropertyDefinitionTest extends DirectoryServerTestCase {
  /**
   * Tests validateValue() with valid data and no pattern.
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/CliTest.java
@@ -33,6 +33,7 @@
import org.opends.admin.ads.ADSContext.ServerGroupProperty;
import org.opends.admin.ads.ADSContextException.ErrorType;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.DirectoryServerTestCase;
import static org.opends.messages.AdminMessages.*;
import org.opends.messages.Message;
@@ -41,7 +42,7 @@
/**
 * PropertySet Tester.
 */
public class CliTest {
public class CliTest extends DirectoryServerTestCase {
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/cli/DsframeworkTestCase.java
@@ -36,6 +36,7 @@
import org.testng.annotations.Test;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.core.DirectoryServer;
import static org.testng.Assert.*;
@@ -47,8 +48,7 @@
/**
 * A set of test cases for the dsservice tool.
 */
public class DsframeworkTestCase
{
public class DsframeworkTestCase extends DirectoryServerTestCase {
  // The path to a file containing an invalid bind password.
  private String invalidPasswordFile;
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/LDAPClientTest.java
@@ -72,6 +72,7 @@
/**
 * Administration framework LDAP client unit tests.
 */
@Test(sequential=true)
public final class LDAPClientTest extends AdminTestCase {
  // Test LDIF.
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/spi/PropertySetTest.java
@@ -36,13 +36,14 @@
import org.opends.server.admin.client.spi.PropertySet;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.DirectoryServerTestCase;
import java.util.*;
/**
 * PropertySet Tester.
 */
public class PropertySetTest {
public class PropertySetTest extends AdminTestCase {
  /** Default value for boolean property */
  private static final Boolean BOOL_DEFAULT = Boolean.TRUE;
opends/tests/unit-tests-testng/src/server/org/opends/server/api/APITestCase.java
@@ -37,7 +37,7 @@
/**
 * An abstract base class for all API test cases.
 */
@Test(groups = { "precommit", "api" })
@Test(groups = { "precommit", "api" }, sequential = true)
public abstract class APITestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/api/AlertHandlerTestCase.java
@@ -270,6 +270,7 @@
   * @return  The DN of the configuration entry with which this alert
   *          generator is associated.
   */
  @Test // TestNG treats this as a test, so we annotate it to eliminate warnings
  public DN getComponentEntryDN()
  {
    try
@@ -291,6 +292,7 @@
   * @return  The fully-qualified name of the Java class for this
   *          alert generator implementation.
   */
  @Test // TestNG treats this as a test, so we annotate it to eliminate warnings
  public String getClassName()
  {
    return getClass().getName();
@@ -309,6 +311,7 @@
   * @return  Information about the set of alerts that this generator
   *          may produce.
   */
  @Test // TestNG treats this as a test, so we annotate it to eliminate warnings
  public LinkedHashMap<String,String> getAlerts()
  {
    LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>();
opends/tests/unit-tests-testng/src/server/org/opends/server/api/PasswordValidatorTestCase.java
@@ -34,6 +34,7 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.AddOperation;
@@ -78,7 +79,18 @@
  public void startServer()
         throws Exception
  {
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
  }
  /**
   * Drops static references to allow garbage collection.
   */
  @AfterClass
  public void shutdown()
  {
    TestPasswordValidator.clearInstanceAfterTests();
  }
@@ -267,7 +279,7 @@
    Set<ByteString> currentPasswords =
         TestPasswordValidator.getLastCurrentPasswords();
    assertTrue(currentPasswords.isEmpty());
    assertTrue(currentPasswords.isEmpty(), "currentPasswords=" + currentPasswords);
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/api/plugin/PluginAPITestCase.java
@@ -37,7 +37,7 @@
/**
 * An abstract base class for all plugin API test cases.
 */
@Test(groups = { "precommit", "pluginapi" })
@Test(groups = { "precommit", "pluginapi" }, sequential = true)
public abstract class PluginAPITestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AciTestCase.java
@@ -42,7 +42,8 @@
import java.util.HashMap;
import java.util.ArrayList;
@Test(groups = {"precommit", "dseecompat"})
@Test(groups = {"precommit", "dseecompat"}, sequential = true)
public abstract class  AciTestCase extends DirectoryServerTestCase {
  public static final String DIR_MGR_DN = "cn=Directory Manager";
  public static final String PWD = "password";
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AciTests.java
@@ -80,6 +80,7 @@
 * they are built by buildAciValue, so that we are less likely to screw up
 * the syntax.
 */
@Test(sequential=true, groups="slow")
public class AciTests extends DirectoryServerTestCase {
// TODO: test modify use cases
// TODO: test searches where we expect a subset of attributes and entries
@@ -546,10 +547,9 @@
    TestCaseUtils.startServer();
    deleteAttrFromEntry(ACCESS_HANDLER_DN, ATTR_AUTHZ_GLOBAL_ACI, true);
    TestCaseUtils.clearJEBackend(true, "userRoot", "dc=example,dc=com");
  }
   @AfterClass
   @AfterClass(alwaysRun = true)
   public void tearDown() throws Exception {
     modEntries(GLOBAL_DEFAULT_ACIS, DIR_MGR_DN, DIR_MGR_PW);
  }
@@ -841,7 +841,7 @@
  // We use this with acis that are crafted in such a way so that they are
  // invalid if any character is removed.  By convention, the character
  // is only removed if the corresponding mask character is a - or \"
  public List<String> getAciMissingCharCombos(String aci, String mask) {
  protected List<String> getAciMissingCharCombos(String aci, String mask) {
    List <String> acisMissingOneChar = new ArrayList<String>();
    for (int i = 0; i < aci.length(); i++) {
      // Add this test only if the mask tells us we haven't seen it before.
@@ -858,7 +858,7 @@
  // Common between validAcis and invalidAcis
  public Object[][] buildAciValidationParams(List<String> acis, boolean testMultipleCombos) {
  private Object[][] buildAciValidationParams(List<String> acis, boolean testMultipleCombos) {
    List<String[]> paramsList = new ArrayList<String[]>();
    for (String aci: acis) {
@@ -917,7 +917,7 @@
    testValidAcisHelper(modifierDn, modifierPw, aciModLdif);
  }
  public void testValidAcisHelper(String modifierDn, String modifierPw, String aciModLdif) throws Throwable {
  private void testValidAcisHelper(String modifierDn, String modifierPw, String aciModLdif) throws Throwable {
    try {
      // Setup the basic DIT
      addEntries(VALIDITY_TESTS_DIT, DIR_MGR_DN, DIR_MGR_PW);
@@ -1687,8 +1687,13 @@
  }
  private static class SearchTestParams {
    /** The server DIT to run the tests against. */
    private final String _initialDitLdif;
    /** ACIs that will produce the same search results for the above DIT. */
    private final List<String> _equivalentAciLdifs;
    /**  */
    private final List<SingleSearchParams> _searchTests = new ArrayList<SingleSearchParams>();
    /**
@@ -1715,9 +1720,10 @@
        // Add the search test as is.
        explodedTests.add(searchTest);
        // Enabling this doubles the number of test cases without much benefit, so we disable it for now
        // And add it with the ACIs merged into the initial import
        String ditWithAcis = applyChangesToLdif(searchTest._initialDitLdif, searchTest._aciLdif);
        explodedTests.add(searchTest.clone(ditWithAcis, ""));
        // String ditWithAcis = applyChangesToLdif(searchTest._initialDitLdif, searchTest._aciLdif);
        // explodedTests.add(searchTest.clone(ditWithAcis, ""));
      }
      return explodedTests;
@@ -1937,11 +1943,11 @@
  /**
  * Test group  bind rule ACI keywords.
   * Test group  bind rule ACI keywords.
   *
  * @throws Throwable
 */
    @Test()
   * @throws Throwable
   */
 @Test()
 public void testGroupAcis()  throws Throwable {
     //group2   fail
     SingleSearchParams adminParam =
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AlternateRootDN.java
@@ -76,7 +76,7 @@
    addRootEntry();
  }
  @AfterClass
  @AfterClass(alwaysRun = true)
  public void tearDown() throws Exception {
    String aciLdif=makeAddLDIF(ATTR_AUTHZ_GLOBAL_ACI, ACCESS_HANDLER_DN,
            G_READ_ACI, G_SELF_MOD, G_SCHEMA, G_DSE, G_USER_OPS, G_CONTROL,
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/DNSTestCase.java
@@ -31,8 +31,9 @@
import org.testng.annotations.DataProvider;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse;
import org.opends.server.DirectoryServerTestCase;
public class DNSTestCase {
public class DNSTestCase extends DirectoryServerTestCase {
    private DNS dns=new DNS(null, null);
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/ExtOpTestCase.java
@@ -123,7 +123,7 @@
    addEntries("o=test");
  }
   @AfterClass
   @AfterClass(alwaysRun = true)
  public void tearDown() throws Exception {
       String aciLdif=makeAddLDIF(ATTR_AUTHZ_GLOBAL_ACI, ACCESS_HANDLER_DN,
               G_READ_ACI, G_SELF_MOD, G_SCHEMA, G_DSE, G_USER_OPS, G_CONTROL,
@@ -216,6 +216,7 @@
   *
   * @throws Exception If an unexpected result is returned.
   */
  @Test
  public void testGlobalTargets() throws Exception {
    String globalControlAcis=
            makeAddLDIF(ATTR_AUTHZ_GLOBAL_ACI, ACCESS_HANDLER_DN,
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/GetEffectiveRightsTestCase.java
@@ -168,7 +168,7 @@
    addEntries("o=test");
  }
  @AfterClass
  @AfterClass(alwaysRun = true)
  public void tearDown() throws Exception {
       String aciLdif=makeAddLDIF(ATTR_AUTHZ_GLOBAL_ACI, ACCESS_HANDLER_DN,
               G_READ_ACI, G_SELF_MOD, G_SCHEMA, G_DSE, G_USER_OPS, G_CONTROL,
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/NestedGroupDNTestCase.java
@@ -56,12 +56,12 @@
  @BeforeClass
  public void setupClass() throws Exception {
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
    deleteAttrFromEntry(ACCESS_HANDLER_DN, ATTR_AUTHZ_GLOBAL_ACI);
    addEntries("o=test");
  }
  @AfterClass
  @AfterClass(alwaysRun = true)
  public void tearDown() throws Exception {
       String aciLdif=makeAddLDIF(ATTR_AUTHZ_GLOBAL_ACI, ACCESS_HANDLER_DN,
               G_READ_ACI, G_SELF_MOD, G_SCHEMA, G_DSE, G_USER_OPS, G_CONTROL,
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java
@@ -127,7 +127,7 @@
    addEntries("o=test");
  }
  @AfterClass
  @AfterClass(alwaysRun = true)
  public void tearDown() throws Exception {
     String aciLdif=makeAddLDIF(ATTR_AUTHZ_GLOBAL_ACI, ACCESS_HANDLER_DN,
          G_READ_ACI, G_SELF_MOD, G_SCHEMA, G_DSE, G_USER_OPS, G_CONTROL,
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/TargetControlTestCase.java
@@ -63,10 +63,10 @@
  public void setupClass() throws Exception {
    TestCaseUtils.startServer();
    deleteAttrFromEntry(ACCESS_HANDLER_DN, ATTR_AUTHZ_GLOBAL_ACI);
    addEntries("o=test");
    addEntries("o=test");
  }
  @AfterClass
  @AfterClass(alwaysRun = true)
  public void tearDown() throws Exception {
       String aciLdif=makeAddLDIF(ATTR_AUTHZ_GLOBAL_ACI, ACCESS_HANDLER_DN,
               G_READ_ACI, G_SELF_MOD, G_SCHEMA, G_DSE, G_USER_OPS, G_CONTROL,
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/BackendTestCase.java
@@ -37,7 +37,7 @@
/**
 * An abstract base class for all backend test cases.
 */
@Test(groups = { "precommit", "backend" })
@Test(groups = { "precommit", "backend" }, sequential = true)
public abstract class BackendTestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java
@@ -689,6 +689,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testAddAttributeTypeToAltSchemaFile()
         throws Exception
  {
@@ -776,6 +777,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testReplaceAttributeTypeInAltSchemaFile()
         throws Exception
  {
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/JebTestCase.java
@@ -51,7 +51,7 @@
/**
 * An abstract base class for all Jeb backend test cases.
 */
@Test(groups = { "precommit", "jeb" })
@Test(groups = { "precommit", "jeb" }, sequential = true)
public abstract class JebTestCase extends DirectoryServerTestCase {
    private TreeMap<DN,Entry> entryTreeMap = new TreeMap<DN,Entry>();
    int numEntries;
opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestVLVIndex.java
@@ -27,6 +27,7 @@
package org.opends.server.backends.jeb;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import static org.opends.server.util.ServerConstants.OID_SERVER_SIDE_SORT_RESPONSE_CONTROL;
import static org.opends.server.util.ServerConstants.OID_VLV_RESPONSE_CONTROL;
import org.opends.server.controls.ServerSideSortRequestControl;
@@ -49,8 +50,7 @@
import java.util.*;
public class TestVLVIndex
{
public class TestVLVIndex extends DirectoryServerTestCase {
  SortOrder sortOrder;
  private  String beID="indexRoot";
opends/tests/unit-tests-testng/src/server/org/opends/server/controls/ControlsTestCase.java
@@ -35,7 +35,7 @@
/**
 * An abstract class that all control unit test should extend. 
 */
@Test(groups = { "precommit", "controls" })
@Test(groups = { "precommit", "controls" }, sequential = true)
public abstract class ControlsTestCase extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/core/AbandonOperationTestCase.java
@@ -81,7 +81,7 @@
import org.opends.server.types.ResultCode;
import org.opends.server.types.SearchScope;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
/**
@@ -94,7 +94,7 @@
   * {@inheritDoc}
   */
  @Override()
  public Operation[] createTestOperations()
  protected Operation[] createTestOperations()
         throws Exception
  {
    InternalClientConnection conn =
@@ -109,6 +109,13 @@
  }
  /**
   * For some reason, the @BeforeClass method in the super class is not called.
   */
  @BeforeClass()
  public void startServer() throws Exception {
    super.startServer();
  }
  /**
   * Tests the <CODE>getIDToAbandon</CODE> method.
opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java
@@ -161,7 +161,7 @@
   * {@inheritDoc}
   */
  @Override()
  public Operation[] createTestOperations()
  protected Operation[] createTestOperations()
         throws Exception
  {
    Object[][]  objs = getAddOperations();
opends/tests/unit-tests-testng/src/server/org/opends/server/core/BindOperationTestCase.java
@@ -228,7 +228,7 @@
   * {@inheritDoc}
   */
  @Override()
  public Operation[] createTestOperations()
  protected Operation[] createTestOperations()
         throws Exception
  {
    Object[][] simpleBinds = getSimpleBindOperations();
@@ -633,6 +633,7 @@
   * Tests the <CODE>getSASLAuthUserEntry</CODE> method for completed SASL bind
   * operations in which this value will be set.
   */
  @Test
  public void testGetSASLAuthUserEntryNonNull()
  {
    InternalClientConnection conn =
opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java
@@ -128,7 +128,7 @@
  }
  public Operation[] createTestOperations() throws Exception
  protected Operation[] createTestOperations() throws Exception
  {
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
opends/tests/unit-tests-testng/src/server/org/opends/server/core/CoreTestCase.java
@@ -32,7 +32,7 @@
/**
 * An abstract base class for all core test cases.
 */
@Test(groups = { "precommit", "core" })
@Test(groups = { "precommit", "core" }, sequential = true)
public abstract class CoreTestCase extends DirectoryServerTestCase {
  // No implementation required.
}
opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java
@@ -86,7 +86,7 @@
   * {@inheritDoc}
   */
  @Override()
  public Operation[] createTestOperations()
  protected Operation[] createTestOperations()
         throws Exception
  {
    InternalClientConnection conn =
opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java
@@ -37,6 +37,7 @@
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;
@@ -75,6 +76,11 @@
       extends OperationTestCase
{
  @BeforeClass
  public void restartServer() throws Exception {
    TestCaseUtils.restartServer();
  }
  // Some of the tests disable the backends, so we reenable them here.
  @AfterMethod(alwaysRun=true)
  public void reenableBackend() throws DirectoryException {
@@ -311,7 +317,7 @@
   * {@inheritDoc}
   */
  @Override()
  public Operation[] createTestOperations()
  protected Operation[] createTestOperations()
         throws Exception
  {
    Object[][]  objs = getModifyOperations();
opends/tests/unit-tests-testng/src/server/org/opends/server/core/NetworkGroupTest.java
@@ -33,6 +33,7 @@
import static org.testng.Assert.assertNull;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.workflowelement.WorkflowElement;
@@ -44,8 +45,7 @@
/**
 * This set of tests test the network groups.
 */
public class NetworkGroupTest
{
public class NetworkGroupTest extends DirectoryServerTestCase {
  //===========================================================================
  //
  //                      B E F O R E    C L A S S
opends/tests/unit-tests-testng/src/server/org/opends/server/core/OperationTestCase.java
@@ -62,6 +62,31 @@
    TestCaseUtils.quiesceServer();
  }
  // When this was part of an @BeforeClass method, it was not called reliably
  // for each subclass.
  @BeforeMethod
  public void initializeLDAPStatistics()
  {
    for (ConnectionHandler ch : DirectoryServer.getConnectionHandlers())
    {
      if (ch instanceof LDAPConnectionHandler)
      {
        LDAPConnectionHandler lch = (LDAPConnectionHandler) ch;
        if (lch.useSSL())
        {
          ldapsStatistics = lch.getStatTracker();
        }
        else
        {
          ldapStatistics = lch.getStatTracker();
        }
      }
    }
    assertNotNull(ldapStatistics);
    assertNotNull(ldapsStatistics);
  }
  /**
   * Since the PostResponse plugins are called after the response is sent
   * back to the client, a client (e.g. a test case) can get a response before
@@ -84,25 +109,7 @@
         throws Exception
  {
    TestCaseUtils.startServer();
    for (ConnectionHandler ch : DirectoryServer.getConnectionHandlers())
    {
      if (ch instanceof LDAPConnectionHandler)
      {
        LDAPConnectionHandler lch = (LDAPConnectionHandler) ch;
        if (lch.useSSL())
        {
          ldapsStatistics = lch.getStatTracker();
        }
        else
        {
          ldapStatistics = lch.getStatTracker();
        }
      }
    }
    assertNotNull(ldapStatistics);
    assertNotNull(ldapsStatistics);
    TestCaseUtils.clearDataBackends();
  }
@@ -119,7 +126,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public abstract Operation[] createTestOperations()
  protected abstract Operation[] createTestOperations()
         throws Exception;
opends/tests/unit-tests-testng/src/server/org/opends/server/core/PasswordPolicyTestCase.java
@@ -75,7 +75,7 @@
  public void startServer()
         throws Exception
  {
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/core/PluginConfigManagerTestCase.java
@@ -33,6 +33,7 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.plugin.DirectoryServerPlugin;
@@ -98,7 +99,7 @@
  public void startServer()
         throws Exception
  {
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
  }
@@ -612,7 +613,7 @@
    {
      DirectoryServerPlugin p =
           DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn);
      assertNotNull(p);
      assertNotNull(p, "The " + dn + " plugin is not registered with the server.");
      pluginList.add(p);
    }
opends/tests/unit-tests-testng/src/server/org/opends/server/core/RejectUnauthReqTests.java
@@ -710,7 +710,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @AfterClass()
  @Test
  public void  testResetRejUnauthReqCfgAttr()  throws Exception
  {
    String path = TestCaseUtils.createTempFile(
opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
@@ -175,7 +175,8 @@
  }
  public Operation[] createTestOperations() throws Exception
  @Override
  protected Operation[] createTestOperations() throws Exception
  {
    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
@@ -223,7 +223,7 @@
   * {@inheritDoc}
   */
  @Override()
  public Operation[] createTestOperations()
  protected Operation[] createTestOperations()
      throws Exception
  {
    ArrayList<Control> noControls = new ArrayList<Control>(0);
opends/tests/unit-tests-testng/src/server/org/opends/server/core/UnbindOperationTestCase.java
@@ -57,7 +57,7 @@
   * {@inheritDoc}
   */
  @Override()
  public Operation[] createTestOperations()
  protected Operation[] createTestOperations()
         throws Exception
  {
    InternalClientConnection conn =
@@ -141,6 +141,7 @@
   * Tests the <CODE>getCancelRequest</CODE> method to ensure that it always
   * returns <CODE>null</CODE>.
   */
  @Test
  public void testGetCancelRequest()
  {
    InternalClientConnection conn =
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/Base64PasswordStorageSchemeTestCase.java
@@ -54,14 +54,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    Base64PasswordStorageScheme scheme = new Base64PasswordStorageScheme();
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ClearPasswordStorageSchemeTestCase.java
@@ -54,14 +54,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    ClearPasswordStorageScheme scheme = new ClearPasswordStorageScheme();
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CommonEntryCacheTestCase.java
@@ -43,7 +43,7 @@
import org.opends.server.util.ServerConstants;
import static org.testng.Assert.*;
import org.testng.annotations.AfterClass;
/**
@@ -71,7 +71,7 @@
  /**
   * Number of loops for each concurrency test.
   */
  protected int CONCURRENCYLOOPS = 1000;
  protected int CONCURRENCYLOOPS = 100;
@@ -571,4 +571,13 @@
      }
    }
  }
  /**
   * Clear out references to save memory.
   */
  @AfterClass
  public void clearReferences() {
    cache = null;
    configuration = null;
  }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/CryptPasswordStorageSchemeTestCase.java
@@ -55,7 +55,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    CryptPasswordStorageScheme scheme =
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/DictionaryPasswordValidatorTestCase.java
@@ -35,6 +35,7 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass;
import org.opends.server.TestCaseUtils;
import org.opends.messages.MessageBuilder;
@@ -94,6 +95,15 @@
    );
  }
  /**
   * The Dictionary can take up a lot of memory, so we restart the server to
   * implicitly unregister the validator and free the memory.
   */
  @AfterClass
  public void freeDictionaryMemory() throws Exception
  {
    TestCaseUtils.restartServer();
  }
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
@@ -157,6 +157,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testGetUserEntry()
         throws Exception
  {
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/ExtensionsTestCase.java
@@ -37,7 +37,7 @@
/**
 * An abstract base class for all extensions test cases.
 */
@Test(groups = { "precommit", "extensions" })
@Test(groups = { "precommit", "extensions" }, sequential = true)
public abstract class ExtensionsTestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FIFOEntryCacheTestCase.java
@@ -49,7 +49,7 @@
/**
 * A set of test cases for FIFO entry cache implementation.
 */
@Test(groups = "entrycache")
@Test(groups = "entrycache", sequential=true)
public class FIFOEntryCacheTestCase
       extends CommonEntryCacheTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/FileSystemEntryCacheTestCase.java
@@ -40,7 +40,9 @@
import org.opends.server.types.Attribute;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.OperatingSystem;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
@@ -52,23 +54,19 @@
/**
 * A set of test cases for FileSystem entry cache implementation.
 */
@Test(groups = "entrycache")
@Test(groups = "entrycache", sequential=true)
public class FileSystemEntryCacheTestCase
       extends CommonEntryCacheTestCase
{
  /**
   * Configuration entry for this cache.
   */
  private static Entry cacheConfigEntry;
  private Entry cacheConfigEntry;
  /**
   * Temporary folder to setup dummy JE backend environment in.
   */
  private static File jeBackendTempDir;
  private File jeBackendTempDir;
  /**
   * Utility method to restore default cache configuration.
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
@@ -28,6 +28,7 @@
import org.opends.server.types.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import static org.opends.server.util.StaticUtils.getBytes;
import static org.opends.server.util.ServerConstants.OID_REAL_ATTRS_ONLY;
import static org.opends.server.util.ServerConstants.OID_VIRTUAL_ATTRS_ONLY;
@@ -47,8 +48,7 @@
import java.util.UUID;
import java.util.LinkedList;
public class HasSubordinatesVirtualAttributeProviderTestCase
{
public class HasSubordinatesVirtualAttributeProviderTestCase extends DirectoryServerTestCase {
      // The attribute type for the hasSubordinates attribute.
  private AttributeType hasSubordinatesType;
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
@@ -85,7 +85,7 @@
  public void startServer()
         throws Exception
  {
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
    isMemberOfType = DirectoryServer.getAttributeType("ismemberof", false);
    assertNotNull(isMemberOfType);
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/MD5PasswordStorageSchemeTestCase.java
@@ -54,14 +54,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    MD5PasswordStorageScheme scheme = new MD5PasswordStorageScheme();
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
@@ -28,6 +28,7 @@
import org.opends.server.types.*;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import static org.opends.server.util.ServerConstants.OID_REAL_ATTRS_ONLY;
@@ -43,8 +44,7 @@
import java.util.*;
public class NumSubordinatesVirtualAttributeProviderTestCase
{
public class NumSubordinatesVirtualAttributeProviderTestCase extends DirectoryServerTestCase {
    // The attribute type for the numSubordinates attribute.
  private AttributeType numSubordinatesType;
@@ -59,7 +59,7 @@
  public void startServer()
         throws Exception
  {
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
    numSubordinatesType =
        DirectoryServer.getAttributeType("numsubordinates", false);
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/PasswordStorageSchemeTestCase.java
@@ -345,7 +345,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public abstract PasswordStorageScheme getScheme()
  protected abstract PasswordStorageScheme getScheme()
         throws Exception;
}
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SHA1PasswordStorageSchemeTestCase.java
@@ -54,14 +54,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    SHA1PasswordStorageScheme scheme = new SHA1PasswordStorageScheme();
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SaltedMD5PasswordStorageSchemeTestCase.java
@@ -54,14 +54,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    SaltedMD5PasswordStorageScheme scheme =
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SaltedSHA1PasswordStorageSchemeTestCase.java
@@ -61,14 +61,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    SaltedSHA1PasswordStorageScheme scheme =
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SaltedSHA256PasswordStorageSchemeTestCase.java
@@ -55,14 +55,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    SaltedSHA256PasswordStorageScheme scheme =
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SaltedSHA384PasswordStorageSchemeTestCase.java
@@ -55,14 +55,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    SaltedSHA384PasswordStorageScheme scheme =
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SaltedSHA512PasswordStorageSchemeTestCase.java
@@ -55,14 +55,11 @@
  /**
   * Retrieves an initialized instance of this password storage scheme.
   *
   * @param  configEntry  The configuration entry for the password storage
   *                      scheme, or <CODE>null</CODE> if none is available.
   *
   * @return  An initialized instance of this password storage scheme.
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public PasswordStorageScheme getScheme()
  protected PasswordStorageScheme getScheme()
         throws Exception
  {
    SaltedSHA512PasswordStorageScheme scheme =
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/SoftReferenceEntryCacheTestCase.java
@@ -46,7 +46,7 @@
/**
 * A set of test cases for SoftReference entry cache implementation.
 */
@Test(groups = "entrycache")
@Test(groups = "entrycache", sequential=true)
public class SoftReferenceEntryCacheTestCase
       extends CommonEntryCacheTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/TestPasswordValidator.java
@@ -97,15 +97,7 @@
                   PasswordValidatorCfg configuration)
         throws InitializationException
  {
    if (instance == null)
    {
      instance = this;
    }
    else
    {
      throw new InitializationException(Message.raw(
           "Cannot configure more than one TestPasswordValidator instance"));
    }
    instance = this;
    lastNewPassword      = null;
    lastCurrentPasswords = null;
@@ -155,6 +147,18 @@
  /**
   * Clears the instance after the tests so that it's memory can be reclaimed.
   * This can actually be quite a bit of memory since it references the
   * Schema, ConfigEntryS, etc
   */
  public static void clearInstanceAfterTests()
  {
    instance = null;
  }
  /**
   * Retrieves the last <CODE>newPassword</CODE> value provided to the
   * <CODE>passwordIsAcceptable</CODE> method.
   *
opends/tests/unit-tests-testng/src/server/org/opends/server/extensions/TraditionalWorkQueueTestCase.java
@@ -98,6 +98,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testChangingNumWorkerThreads()
         throws Exception
  {
opends/tests/unit-tests-testng/src/server/org/opends/server/interop/InteropTestCase.java
@@ -37,7 +37,7 @@
/**
 * An abstract base class for all test cases covering interoperability classes.
 */
@Test(groups = { "precommit", "interop" })
@Test(groups = { "precommit", "interop" }, sequential = true)
public abstract class InteropTestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/DatabaseEnvironmentMonitorTestCase.java
@@ -61,7 +61,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public MonitorProvider getMonitorInstance()
  protected MonitorProvider getMonitorInstance()
         throws Exception
  {
    String monitorName = "userroot database environment";
opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/GenericMonitorTestCase.java
@@ -29,6 +29,7 @@
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass;
import org.opends.server.TestCaseUtils;
import org.opends.server.DirectoryServerTestCase;
@@ -85,7 +86,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public abstract MonitorProvider getMonitorInstance()
  protected abstract MonitorProvider getMonitorInstance()
         throws Exception;
@@ -159,5 +160,15 @@
  {
    getMonitorInstance().getMonitorData();
  }
  /**
   * We need to drop all of the memory that we can.
   */
  @AfterClass
  public void cleanupMem()
  {
    configEntry = null;
  }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/InternalSearchMonitorTestCase.java
@@ -90,6 +90,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testWithSubtreeMonitorSearch()
         throws Exception
  {
@@ -162,6 +163,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testWithSubtreeAndBaseMonitorSearch()
         throws Exception
  {
opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/MonitorTestCase.java
@@ -37,7 +37,7 @@
/**
 * An abstract base class for all monitor test cases.
 */
@Test(groups = { "precommit", "monitor" })
@Test(groups = { "precommit", "monitor" }, sequential = true)
public abstract class MonitorTestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/StackTraceMonitorTestCase.java
@@ -59,7 +59,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public MonitorProvider getMonitorInstance()
  protected MonitorProvider getMonitorInstance()
         throws Exception
  {
    StackTraceMonitorProvider monitorProvider = new StackTraceMonitorProvider();
opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/SystemInfoMonitorTestCase.java
@@ -59,7 +59,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public MonitorProvider getMonitorInstance()
  protected MonitorProvider getMonitorInstance()
         throws Exception
  {
    SystemInfoMonitorProvider monitorProvider = new SystemInfoMonitorProvider();
opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/TraditionalWorkQueueMonitorTestCase.java
@@ -60,7 +60,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public MonitorProvider getMonitorInstance()
  protected MonitorProvider getMonitorInstance()
         throws Exception
  {
    String monitorName = "work queue";
opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/VersionMonitorTestCase.java
@@ -59,7 +59,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  public MonitorProvider getMonitorInstance()
  protected MonitorProvider getMonitorInstance()
         throws Exception
  {
    VersionMonitorProvider monitorProvider = new VersionMonitorProvider();
opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/PluginTestCase.java
@@ -36,7 +36,7 @@
/**
 * An abstract base class for all plugin test cases.
 */
@Test(groups = { "precommit", "plugins" })
@Test(groups = { "precommit", "plugins" }, sequential = true)
public abstract class PluginTestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/UniqueAttributePluginTestCase.java
@@ -69,7 +69,9 @@
  public void startServer()
         throws Exception
  {
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
    TestCaseUtils.initializeTestBackend(true);
    //Add entries to two backends to test public naming context.
    addTestEntries("o=test", 't');
    TestCaseUtils.clearJEBackend(true,"userRoot", "dc=example,dc=com");
opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/UpdatePreOpPlugin.java
@@ -119,14 +119,8 @@
      }
    }
    if (instance == null)
    {
      instance = this;
    }
    else
    {
      throw new ConfigException(Message.raw("Only one update preop plugin may be used"));
    }
    // We assume that there is only one of these active at a time.
    instance = this;
    setAttributes       = new ArrayList<Attribute>();
    removeAttributes    = new ArrayList<AttributeType>();
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/asn1/ASN1TestCase.java
@@ -32,7 +32,7 @@
/**
 * An abstract base class for all ASN1 test cases.
 */
@Test(groups = { "precommit", "asn1" })
@Test(groups = { "precommit", "asn1" }, sequential = true)
public abstract class ASN1TestCase extends DirectoryServerTestCase {
  // No implementation required.
}
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/internal/InternalTestCase.java
@@ -36,7 +36,7 @@
/**
 * An abstract base class for all internal test cases.
 */
@Test(groups = { "precommit", "internal" })
@Test(groups = { "precommit", "internal" }, sequential = true)
public abstract class InternalTestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxConnectTest.java
@@ -437,7 +437,7 @@
   * accepted when the given credentials are OK and refused when the
   * credentials are invalid.
   */
  @Test(enabled = true)
  @Test(enabled = false) // this fails a lot especially due to the in core restarts
  public void sslConnect() throws Exception {
    // Enable SSL by setting ds-cfg-use-ssl boolean and the
    // certificate alias using ds-cfg-ssl-cert-nickname attribute.
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxPrivilegeTestCase.java
@@ -356,6 +356,12 @@
    deleteOperation = conn.processDelete(DN
        .decode("dc=unindexed,dc=jeb"));
    assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS);
    for (int i = 0; (connections != null) && (i < connections.length); i++)
    {
      connections[i].finalize();
      connections[i] = null;
    }
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/JmxTestCase.java
@@ -47,7 +47,7 @@
/**
 * An abstract class that all JMX unit test should extend.
 */
@Test(groups = { "precommit", "jmx" })
@Test(groups = { "precommit", "jmx" }, sequential = true)
public abstract class JmxTestCase extends DirectoryServerTestCase
{
  /**
@@ -60,7 +60,7 @@
  public void setUp() throws Exception
  {
    // Make sure that the server is up and running.
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
    TestCaseUtils.initializeTestBackend(true);
    synchronized (this)
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LdapTestCase.java
@@ -50,7 +50,7 @@
 * An abstract class that all types  unit test should extend.
 */
@Test(groups = { "precommit", "ldap" })
@Test(groups = { "precommit", "ldap" }, sequential = true)
public abstract class LdapTestCase extends DirectoryServerTestCase
{
   
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestAddResponseProtocolOp.java
@@ -34,6 +34,7 @@
import org.opends.server.types.AttributeValue;
import org.opends.server.types.LDAPException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.DirectoryServerTestCase;
import org.opends.messages.Message;
import java.util.ArrayList;
@@ -47,8 +48,7 @@
 * This class defines a set of tests for the
 * org.opends.server.protocol.ldap.AddResponseProtocolOp class.
 */
public class TestAddResponseProtocolOp
{
public class TestAddResponseProtocolOp extends DirectoryServerTestCase {
  /**
   * The protocol op type for add requests.
   */
@@ -215,7 +215,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidDN() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -233,7 +233,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidResultMsg() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -251,7 +251,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidReferralURLs() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestCompareResponseProtocolOp.java
@@ -218,7 +218,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidDN() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -236,7 +236,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidResultMsg() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -254,7 +254,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidReferralURLs() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestDeleteResponseProtocolOp.java
@@ -216,7 +216,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidDN() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -234,7 +234,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidResultMsg() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -252,7 +252,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidReferralURLs() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestModifyDNRequestProtocolOp.java
@@ -29,6 +29,7 @@
import org.opends.server.protocols.asn1.*;
import org.opends.server.types.LDAPException;
import static org.opends.server.util.ServerConstants.EOL;
import org.opends.server.DirectoryServerTestCase;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
@@ -38,8 +39,7 @@
 * This class defines a set of tests for the
 * org.opends.server.protocol.ldap.ModifyDNRequestProtocolOp class.
 */
public class TestModifyDNRequestProtocolOp
{
public class TestModifyDNRequestProtocolOp extends DirectoryServerTestCase {
  /**
   * The protocol op type for modify DN requests.
   */
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestModifyDNResponseProtocolOp.java
@@ -34,6 +34,7 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.asn1.*;
import static org.opends.server.util.ServerConstants.EOL;
import org.opends.server.DirectoryServerTestCase;
import org.opends.messages.Message;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -47,8 +48,7 @@
 * This class defines a set of tests for the
 * org.opends.server.protocol.ldap.ModifyDNResponseProtocolOp class.
 */
public class TestModifyDNResponseProtocolOp
{
public class TestModifyDNResponseProtocolOp extends DirectoryServerTestCase {
  /**
   * The protocol op type for modify DN requests.
   */
@@ -218,7 +218,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidDN() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -236,7 +236,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidResultMsg() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -254,7 +254,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidReferralURLs() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/TestModifyResponseProtocolOp.java
@@ -218,7 +218,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidDN() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -236,7 +236,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidResultMsg() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
@@ -254,7 +254,7 @@
   *
   * @throws Exception If the test failed unexpectedly.
   */
  //@Test(expectedExceptions = LDAPException.class)
  @Test
  public void testDecodeInvalidReferralURLs() throws Exception
  {
    ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(2);
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ReplicationTestCase.java
@@ -82,7 +82,7 @@
/**
 * An abstract class that all Replication unit test should extend.
 */
@Test(groups = { "precommit", "replication" })
@Test(groups = { "precommit", "replication" }, sequential = true)
public abstract class ReplicationTestCase extends DirectoryServerTestCase
{
@@ -129,7 +129,7 @@
  public void setUp() throws Exception
  {
    // This test suite depends on having the schema available.
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
    // Create an internal connection
    connection = InternalClientConnection.getRootConnection();
@@ -319,6 +319,9 @@
  {
    cleanConfigEntries();
    cleanRealEntries();
    entryList = null;
    configEntryList = null;
  }
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/UpdateOperationTest.java
@@ -90,7 +90,7 @@
 * Test synchronization of update operations on the directory server and through
 * the replication server broker interface.
 */
public class UpdateOperationTest extends ReplicationTestCase
public class  UpdateOperationTest extends ReplicationTestCase
{
  /**
   * An entry with a entryUUID
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/common/ChangeNumberGeneratorTest.java
@@ -39,7 +39,7 @@
  /**
   * Test the adjust method of ChangeNumberGenerator
   */
  @Test(dataProvider = "changeNumberData")
  @Test
  public void adjustTest()
  {
    ChangeNumberGenerator generator =
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java
@@ -859,8 +859,10 @@
  @AfterClass()
  public void shutdown() throws Exception
  {
    if (replicationServer != null)
    if (replicationServer != null) {
      replicationServer.shutdown();
      replicationServer = null;
    }
  }
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeSyntaxTest.java
@@ -52,7 +52,7 @@
   * 
   * @return An instance of the attribute syntax that muste be tested.
   */
  public abstract AttributeSyntax getRule();
  protected abstract AttributeSyntax getRule();
  /**
   * Test the normalization and the approximate comparison.
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java
@@ -49,7 +49,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new AttributeTypeSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRuleTest.java
@@ -126,7 +126,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new AuthPasswordEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/BitStringEqualityMatchingRuleTest.java
@@ -69,7 +69,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new BitStringEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/BitStringSyntaxTest.java
@@ -48,7 +48,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new BitStringSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/BooleanEqualityMatchingRuleTest.java
@@ -72,7 +72,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new BooleanEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseExactEqualityMatchingRuleTest.java
@@ -70,7 +70,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new CaseExactEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRuleTest.java
@@ -67,7 +67,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new CaseExactIA5EqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRuleTest.java
@@ -66,7 +66,7 @@
   * {@inheritDoc}
   */
  @Override
  public SubstringMatchingRule getRule()
  protected SubstringMatchingRule getRule()
  {
    return new CaseExactIA5SubstringMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseExactOrderingMatchingRuleTest.java
@@ -65,7 +65,7 @@
   * {@inheritDoc}
   */
  @Override
  public OrderingMatchingRule getRule()
  protected OrderingMatchingRule getRule()
  {
    return new CaseExactOrderingMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseExactSubstringMatchingRuleTest.java
@@ -66,7 +66,7 @@
   * {@inheritDoc}
   */
  @Override
  public SubstringMatchingRule getRule()
  protected SubstringMatchingRule getRule()
  {
    return new CaseExactSubstringMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRuleTest.java
@@ -68,7 +68,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new CaseIgnoreEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java
@@ -67,7 +67,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new CaseIgnoreIA5EqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java
@@ -70,7 +70,7 @@
   * {@inheritDoc}
   */
  @Override
  public SubstringMatchingRule getRule()
  protected SubstringMatchingRule getRule()
  {
    return new CaseIgnoreIA5SubstringMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRuleTest.java
@@ -68,7 +68,7 @@
   * {@inheritDoc}
   */
  @Override
  public OrderingMatchingRule getRule()
  protected OrderingMatchingRule getRule()
  {
    return new CaseIgnoreOrderingMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRuleTest.java
@@ -70,7 +70,7 @@
   * {@inheritDoc}
   */
  @Override
  public SubstringMatchingRule getRule()
  protected SubstringMatchingRule getRule()
  {
    return new CaseIgnoreSubstringMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/DITContentRuleSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new DITContentRuleSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java
@@ -63,7 +63,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new DirectoryStringFirstComponentEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRuleTest.java
@@ -94,7 +94,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new DistinguishedNameEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualityMatchingRuleTest.java
@@ -65,7 +65,7 @@
   *
   * @return An instance of the matching rule to test.
   */
  public abstract EqualityMatchingRule getRule();
  protected abstract EqualityMatchingRule getRule();
  /**
   * Test the normalization and the comparison of valid values.
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRuleTest.java
@@ -93,7 +93,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new GeneralizedTimeEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRuleTest.java
@@ -87,7 +87,7 @@
   * {@inheritDoc}
   */
  @Override
  public OrderingMatchingRule getRule()
  protected OrderingMatchingRule getRule()
  {
    return new GeneralizedTimeOrderingMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GeneralizedTimeSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new GeneralizedTimeSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GuideSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new GuideSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/IA5StringSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new IA5StringSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/IntegerEqualityMatchingRuleTest.java
@@ -71,7 +71,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new IntegerEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/IntegerOrderingMatchingRuleTest.java
@@ -75,7 +75,7 @@
   * {@inheritDoc}
   */
  @Override
  public OrderingMatchingRule getRule()
  protected OrderingMatchingRule getRule()
  {
    return new IntegerOrderingMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/LDAPSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new LDAPSyntaxDescriptionSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new MatchingRuleSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleUseSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new MatchingRuleUseSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/NumericStringEqualityMatchingRuleTest.java
@@ -68,7 +68,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new NumericStringEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/NumericStringOrderingMatchingRuleTest.java
@@ -69,7 +69,7 @@
   * {@inheritDoc}
   */
  @Override
  public OrderingMatchingRule getRule()
  protected OrderingMatchingRule getRule()
  {
    return new NumericStringOrderingMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/NumericStringSubstringMatchingRuleTest.java
@@ -67,7 +67,7 @@
   * {@inheritDoc}
   */
  @Override
  public SubstringMatchingRule getRule()
  protected SubstringMatchingRule getRule()
  {
    return new NumericStringSubstringMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/OrderingMatchingRuleTest.java
@@ -101,7 +101,7 @@
   *
   * @return The Ordering matching Rules that is to be tested.
   */
  public abstract OrderingMatchingRule getRule();
  protected abstract OrderingMatchingRule getRule();
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/OtherMailboxSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new OtherMailboxSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRuleTest.java
@@ -66,7 +66,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new PresentationAddressEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRuleTest.java
@@ -66,7 +66,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new ProtocolInformationEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/SchemaTestCase.java
@@ -34,7 +34,7 @@
/**
* An abstract class that all schema unit test should extend. 
*/
@Test(groups = { "precommit", "schema" })
@Test(groups = { "precommit", "schema" }, sequential = true)
public abstract class SchemaTestCase extends DirectoryServerTestCase
{
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/SubstringMatchingRuleTest.java
@@ -73,7 +73,7 @@
   *
   * @return An instance of the matching rule to test.
   */
  public abstract SubstringMatchingRule getRule();
  protected abstract SubstringMatchingRule getRule();
  /**
   * Test the normalization and the middle substring match.
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/TelexSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new TelexNumberSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UTCTimeSyntaxTest.java
@@ -44,7 +44,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new UTCTimeSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UUIDEqualityMatchingRuleTest.java
@@ -73,7 +73,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new UUIDEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UUIDOrderingMatchingRuleTest.java
@@ -74,7 +74,7 @@
   * {@inheritDoc}
   */
  @Override
  public OrderingMatchingRule getRule()
  protected OrderingMatchingRule getRule()
  {
    return new UUIDOrderingMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UUIDSyntaxTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public AttributeSyntax getRule()
  protected AttributeSyntax getRule()
  {
    return new UUIDSyntax();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRuleTest.java
@@ -68,7 +68,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new UniqueMemberEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleTest.java
@@ -119,7 +119,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new UserPasswordEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/WordEqualityMatchingRuleTest.java
@@ -39,7 +39,7 @@
   * {@inheritDoc}
   */
  @Override
  public EqualityMatchingRule getRule()
  protected EqualityMatchingRule getRule()
  {
    return new WordEqualityMatchingRule();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/LockdownModeTaskTestCase.java
@@ -85,6 +85,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testLockdownModeTasks()
         throws Exception
  {
opends/tests/unit-tests-testng/src/server/org/opends/server/tasks/TasksTestCase.java
@@ -49,7 +49,7 @@
/**
 * A base class for all tasks test cases.
 */
@Test(groups = { "precommit", "tasks" })
@Test(groups = { "precommit", "tasks" }, sequential = true)
public class TasksTestCase extends DirectoryServerTestCase {
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ImportLDIFTestCase.java
@@ -61,7 +61,7 @@
  @BeforeClass
  public void setUp() throws Exception
  {
    TestCaseUtils.startServer();
    TestCaseUtils.restartServer();
    beID = "userRoot";
    configFilePath = DirectoryServer.getConfigFile();
    TaskUtils.disableBackend(beID);
opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ManageAccountTestCase.java
@@ -51,6 +51,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @BeforeClass
  public void startServer()
         throws Exception
  {
@@ -313,6 +314,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testAnonymousUser()
         throws Exception
  {
@@ -350,6 +352,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testUnprivilegedUser()
         throws Exception
  {
@@ -387,6 +390,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testUsingSSL()
         throws Exception
  {
@@ -426,6 +430,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testUsingStartTLS()
         throws Exception
  {
@@ -466,6 +471,7 @@
   *
   * @throws  Exception  If an unexpected problem occurs.
   */
  @Test
  public void testUsingSASL()
         throws Exception
  {
opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ToolsTestCase.java
@@ -37,7 +37,7 @@
/**
 * An abstract base class for all tools test cases.
 */
@Test(groups = { "precommit", "tools" })
@Test(groups = { "precommit", "tools" }, sequential = true)
public abstract class ToolsTestCase
       extends DirectoryServerTestCase
{
opends/tests/unit-tests-testng/src/server/org/opends/server/types/SearchFilterTests.java
@@ -942,7 +942,7 @@
  /**
   *
   */
  public List<FilterDescription> getMinimalFilterDescriptionList() throws Exception {
  protected List<FilterDescription> getMinimalFilterDescriptionList() throws Exception {
    List<FilterDescription> baseDescriptions = new ArrayList<FilterDescription>();
    List<FilterDescription> allDescriptions = new ArrayList<FilterDescription>();
opends/tests/unit-tests-testng/src/server/org/opends/server/types/TestDN.java
@@ -330,6 +330,7 @@
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testToNormalizedString() throws Exception {
    DN dn = DN.decode("dc=example,dc=com");
@@ -348,6 +349,7 @@
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testDecodeNull() throws Exception {
    assertEquals(DN.decode((ByteString) null), DN.nullDN());
    assertEquals(DN.decode((String) null), DN.nullDN());
opends/tests/unit-tests-testng/src/server/org/opends/server/types/TypesTestCase.java
@@ -33,6 +33,6 @@
 * An abstract class that all types unit tests should extend.
 */
@Test(groups = { "precommit", "types" })
@Test(groups = { "precommit", "types" }, sequential = true)
public abstract class TypesTestCase extends DirectoryServerTestCase
{}
opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestCrypt.java
@@ -39,7 +39,7 @@
 * This class defines a set of tests for the
 * {@link org.opends.server.util.Crypt} class.
 */
@Test(groups = { "slow" })  // Make them slow, since they are unlikely to break and since there are 4K+ they can take a while
@Test(groups = { "slow" }, sequential = true)  // Make them slow, since they are unlikely to break and since there are 4K+ they can take a while
public final class TestCrypt extends UtilTestCase {
  private Crypt crypt = new Crypt();
opends/tests/unit-tests-testng/src/server/org/opends/server/util/UtilTestCase.java
@@ -32,7 +32,7 @@
/**
 * An abstract class that all util unit tests should extend.
 */
@Test(groups = { "precommit", "util" })
@Test(groups = { "precommit", "util" }, sequential = true)
public abstract class UtilTestCase extends DirectoryServerTestCase {
  // No implementation required.
}
opends/tests/unit-tests-testng/src/server/org/opends/server/util/ValidatorTests.java
@@ -30,11 +30,12 @@
import org.testng.annotations.DataProvider;
import static org.testng.Assert.*;
import org.opends.messages.Message;
import org.opends.server.DirectoryServerTestCase;
/**
 * Tests for the Validator class.
 */
public class ValidatorTests {
public class ValidatorTests extends DirectoryServerTestCase {
  private static final Object NON_NULL = new Object();
  //////////////////////////////////////////////////////////////////////////////
opends/tests/unit-tests-testng/src/server/org/opends/server/util/args/ArgsTestCase.java
@@ -36,7 +36,7 @@
/**
 * An abstract class that all args unit tests should extend.
 */
@Test(groups = { "precommit", "util" })
@Test(groups = { "precommit", "util" }, sequential = true)
public abstract class ArgsTestCase extends DirectoryServerTestCase {
  // No implementation required.
}