From caf74d75e44a4769e6d4489970838703eedb745f Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Mon, 31 Oct 2016 14:00:38 +0000
Subject: [PATCH] OPENDJ-2272 OPENDJ-2773 Tools unit tests migration

---
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle.ldif                         |   14 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFModifyTestCase.java          |  145 ++
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-reverse.ldif                  |   37 
 opendj-server-legacy/pom.xml                                                                       |    1 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications-with-error.ldif                    |   40 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/Base64TestCase.java              |  252 ++++
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModifyTestCase.java  |  160 ++
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple.ldif                         |   17 
 opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java                       |    1 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-nochanges.ldif                                |    0 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java              |   31 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-ignore-attributes.ldif        |    0 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-singlevalue.ldif              |    0 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/target-singleentry.ldif                            |    0 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications-invalid.ldif                       |    3 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/ignore-attributes                                  |    0 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java               |   66 +
 opendj-ldap-toolkit/src/test/resources/ldifsearch.ldif                                             |  523 +++++++++
 opendj-ldap-toolkit/src/test/resources/ldifdiff/source-empty.ldif                                  |    0 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/target-multipleentries.ldif                        |    1 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-reverse-singlevalue.ldif      |    0 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-reverse.ldif                 |   10 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_2.ldif                        |   15 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/expected-no-wrapping.ldif                        |    5 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/ignore-entries                                     |    0 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle-reverse.ldif                 |   26 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singleentry-reverse.ldif                      |    2 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java            |    3 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolLdapServer.java              |  170 ++
 opendj-ldap-toolkit/src/test/resources/ldifdiff/source-singleentry.ldif                            |    0 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ArgumentParserToolsTestCase.java |  140 ++
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries.ldif                          |   30 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singleentry.ldif                              |    2 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-no-wrapping.ldif             |   17 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_1.ldif                        |   17 
 pom.xml                                                                                            |    2 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/source.ldif                                      |    0 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPModifyTestCase.java          |  288 +++++
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle-reverse-singlevalue.ldif     |    0 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/expected.ldif                                    |    6 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications.ldif                               |   34 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestUtils.java              |  140 ++
 opendj-ldap-toolkit/src/test/resources/ldifmodify/expected-continue-on-error.ldif                  |    6 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java           |    3 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareTestCase.java         |  197 +++
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPDeleteTestCase.java          |  140 ++
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPToolsTestCase.java           |  101 +
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFSearchTestCase.java          |  224 +++
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchTestCase.java          |  267 ++++
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-emptytosingle.ldif                            |    1 
 opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_3.ldif                        |   14 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletoempty.ldif                            |    2 
 /dev/null                                                                                          |    6 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/source-multipleentries.ldif                        |    0 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-ignore-entries.ldif           |    0 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/target-empty.ldif                                  |    0 
 opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-singlevalue.ldif             |    0 
 opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFDiffTestCase.java            |  214 +++
 58 files changed, 3,238 insertions(+), 135 deletions(-)

diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java
index aa3d126..4e62063 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java
@@ -291,6 +291,7 @@
                 while ((line = reader.readLine()) != null) {
                     filesLines.add(line);
                 }
+                filesLines.add("");
             } catch (final IOException e) {
                 throw newToolParamException(
                         e, ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ.get(filePath, e.getLocalizedMessage()));
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ArgumentParserToolsTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ArgumentParserToolsTestCase.java
new file mode 100644
index 0000000..3497c86
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ArgumentParserToolsTestCase.java
@@ -0,0 +1,140 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ *  Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.INFO_GLOBAL_HELP_REFERENCE;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_ERROR_PARSING_ARGS;
+import static com.forgerock.opendj.ldap.tools.Utils.runTool;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.forgerock.opendj.ldap.ResultCode.CLIENT_SIDE_PARAM_ERROR;
+import static org.forgerock.util.Utils.closeSilently;
+
+import java.io.PrintStream;
+
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.testng.ForgeRockTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * This class tests that help reference message is prompted for all tools when
+ * no arguments are provided or if they failed to be parsed.
+ */
+@Test
+public class ArgumentParserToolsTestCase extends ForgeRockTestCase {
+
+    ByteStringBuilder out;
+    ByteStringBuilder err;
+    PrintStream outStream;
+    PrintStream errStream;
+
+    @BeforeMethod
+    void refreshStream() {
+        out = new ByteStringBuilder();
+        err = new ByteStringBuilder();
+        outStream = new PrintStream(out.asOutputStream());
+        errStream = new PrintStream(err.asOutputStream());
+    }
+
+    @AfterMethod
+    void closeStream() {
+        closeSilently(outStream, errStream);
+    }
+
+    String errOnSingleLine() {
+        return err.toString().replace(System.lineSeparator(), " ");
+    }
+
+    @DataProvider
+    public Object[][] invalidArg() throws Exception {
+        return new Object[][] { { new String[] { "-42" } } };
+    }
+
+    @DataProvider
+    public Object[][] invalidArgs() throws Exception {
+        return new Object[][] { { new String[] {} }, { new String[] { "-42" } } };
+    }
+
+    @Test(dataProvider = "invalidArg")
+    public void testBase64(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new Base64(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArgs")
+    public void testLDAPCompare(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new LDAPCompare(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArg")
+    public void testLDAPDelete(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new LDAPDelete(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArg")
+    public void testLDAPModify(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new LDAPModify(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArg")
+    public void testLDAPPasswordModify(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new LDAPPasswordModify(outStream, errStream), args))
+                  .isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArgs")
+    public void testLDAPSearch(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new LDAPSearch(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArgs")
+    public void testLDIFDiff(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new LDIFDiff(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArgs")
+    public void testLDIFModify(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new LDIFModify(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArg")
+    public void testLDIFSearch(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new LDIFSearch(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    @Test(dataProvider = "invalidArg")
+    public void testMakeLdif(final String[] args) throws LDAPToolException {
+        assertThat(runTool(new MakeLDIF(outStream, errStream), args)).isEqualTo(CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertToolFailsWithUsage();
+    }
+
+    private void assertToolFailsWithUsage() {
+        assertThat(out.toString()).isEmpty();
+        final String streamToCheck = errOnSingleLine();
+        assertThat(streamToCheck).matches(".*" + INFO_GLOBAL_HELP_REFERENCE.get("(.*)") + ".*");
+        assertThat(streamToCheck).contains(ERR_ERROR_PARSING_ARGS.get(""));
+    }
+}
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/Base64TestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/Base64TestCase.java
new file mode 100644
index 0000000..02bf3e7
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/Base64TestCase.java
@@ -0,0 +1,252 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_FILEARG_NO_SUCH_FILE;
+import static com.forgerock.opendj.cli.CliMessages.ERR_SUBCMDPARSER_NO_ARGUMENT_FOR_SHORT_ID;
+import static com.forgerock.opendj.cli.CliMessages.ERR_SUBCMDPARSER_NO_GLOBAL_ARGUMENT_FOR_LONG_ID;
+import static com.forgerock.opendj.cli.CliMessages.ERR_SUBCMDPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_BASE64_DECODE_INVALID_LENGTH;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_BASE64_ERROR_DECODING_RAW_DATA;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** This class defines a set of tests for the {@link com.forgerock.opendj.ldap.tools.Base64} class. */
+@Test
+public final class Base64TestCase extends ToolsTestCase {
+
+    private static final boolean ENCODE = true;
+    private static final boolean DECODE = false;
+
+    @BeforeMethod
+    private void testSetup() {
+        refreshStream();
+    }
+
+    @AfterMethod
+    private void testTearDown() {
+        closeStream();
+    }
+
+    @Test
+    public void testNoSubcommandProvided() throws Exception {
+        final int res = runTool();
+        assertThat(res).isEqualTo(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertThat(err.toString()).contains(ToolsMessages.ERR_BASE64_NO_SUBCOMMAND_SPECIFIED.get().toString());
+        assertThat(out.toString()).isEmpty();
+    }
+
+    @DataProvider
+    public Object[][] invalidArgumentsEncode() throws Exception {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        addValueNeededShortArgs(argLists, reasonList, "d", "f", "o");
+
+        argLists.add(args("-I"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_ARGUMENT_FOR_SHORT_ID.get("I"));
+
+        argLists.add(args("--invalidLongArgument"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_GLOBAL_ARGUMENT_FOR_LONG_ID.get("invalidLongArgument"));
+
+        argLists.add(args("--rawData"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID.get("rawdata"));
+
+        argLists.add(args("--rawDataFile"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID.get("rawdatafile"));
+
+        argLists.add(args("--toEncodedFile"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID.get("toencodedfile"));
+
+        argLists.add(args("-f", "no.such.file"));
+        reasonList.add(ERR_FILEARG_NO_SUCH_FILE.get("no.such.file", "rawDataFile"));
+
+        argLists.add(args("--rawDataFile", "no.such.file"));
+        reasonList.add(ERR_FILEARG_NO_SUCH_FILE.get("no.such.file", "rawDataFile"));
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @Override
+    @Test(dataProvider = "invalidArgumentsEncode")
+    public void testInvalidArguments(final String[] args, String invalidReason) throws LDAPToolException {
+        assertThat(testBase64(ENCODE, args)).isEqualTo(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertThat(errOnSingleLine()).contains(invalidReason);
+        assertThat(out.toString()).isEmpty();
+    }
+
+    @DataProvider
+    public Object[][] invalidArgumentsDecode() throws Exception {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        addValueNeededShortArgs(argLists, reasonList, "d", "f", "o");
+
+        argLists.add(args("-I"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_ARGUMENT_FOR_SHORT_ID.get("I"));
+
+        argLists.add(args("--invalidLongArgument"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_GLOBAL_ARGUMENT_FOR_LONG_ID.get("invalidLongArgument"));
+
+        argLists.add(args("--encodedData"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID.get("encodeddata"));
+
+        argLists.add(args("--encodedDataFile"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID.get("encodeddatafile"));
+
+        argLists.add(args("--toRawFile"));
+        reasonList.add(ERR_SUBCMDPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID.get("torawfile"));
+
+        argLists.add(args("-f", "no.such.file"));
+        reasonList.add(ERR_FILEARG_NO_SUCH_FILE.get("no.such.file", "encodedDataFile"));
+
+        argLists.add(args("--encodedDataFile", "no.such.file"));
+        reasonList.add(ERR_FILEARG_NO_SUCH_FILE.get("no.such.file", "encodedDataFile"));
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @DataProvider
+    public Object[][] invalidEncodedDataLength() {
+        // FIXME: fix cases ==== and ==x=
+        return new Object[][] { { "=" }, { "==" }, { "===" }, { "A" }, { "AA" }, { "AAA" } };
+    }
+
+    @Test(dataProvider = "invalidEncodedDataLength")
+    public void testDecodeInvalidDataLength(final String encodedData) throws Exception {
+        final int res = testBase64(DECODE, "-d", encodedData);
+        assertThat(res).isEqualTo(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertThat(errOnSingleLine()).contains(ERR_BASE64_DECODE_INVALID_LENGTH.get(encodedData));
+        assertThat(out.toString()).isEmpty();
+    }
+
+    @DataProvider
+    public Object[][] invalidEncodedData() {
+        return new Object[][] {
+            { "AA`=" }, { "AA~=" }, { "AA!=" }, { "AA@=" },
+            { "AA#=" }, { "AA$=" }, { "AA%=" }, { "AA^=" },
+            { "AA*=" }, { "AA(=" }, { "AA)=" }, { "AA_=" },
+            { "AA-=" }, { "AA{=" }, { "AA}=" }, { "AA|=" },
+            { "AA[=" }, { "AA]=" }, { "AA\\=" }, { "AA;=" },
+            { "AA'=" }, { "AA\"=" }, { "AA:=" }, { "AA,=" },
+            { "AA.=" }, { "AA<=" }, { "AA>=" }, { "AA?=" },
+            { "AA;=" }
+        };
+    }
+
+    @Test(dataProvider = "invalidEncodedData")
+    public void testDecodeInvalidData(final String encodedData) throws Exception {
+        final int res = testBase64(DECODE, "-d", encodedData);
+        assertThat(res).isEqualTo(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertThat(errOnSingleLine()).contains(ERR_BASE64_ERROR_DECODING_RAW_DATA.get(encodedData));
+        assertThat(out.toString()).isEmpty();
+    }
+
+    /**
+     * Base 64 valid test data provider.
+     *
+     * @return Returns an array of decoded and valid encoded base64 data.
+     */
+    @DataProvider
+    public Object[][] validData() {
+        return new Object[][] {
+            { "dont panic", "ZG9udCBwYW5pYw==" },
+
+            { "Time is an illusion. Lunchtime doubly so.",
+              "VGltZSBpcyBhbiBpbGx1c2lvbi4gTHVuY2h0aW1lIGRvdWJseSBzby4=" },
+
+            { "I would far rather be happy than right any day.",
+              "SSB3b3VsZCBmYXIgcmF0aGVyIGJlIGhhcHB5IHRoYW4gcmlnaHQgYW55IGRheS4=" },
+
+            { "This must be Thursday, said Arthur to himself, sinking low over his beer. "
+                      + "I never could get the hang of Thursdays",
+              "VGhpcyBtdXN0IGJlIFRodXJzZGF5LCBzYWlkIEFydGh1ciB0byBoaW1zZWxmLCBzaW5raW5nIGxvdyBvdmVyIGhpcyBiZWVy"
+                      + "LiBJIG5ldmVyIGNvdWxkIGdldCB0aGUgaGFuZyBvZiBUaHVyc2RheXM=" },
+        };
+    }
+
+    @Test(dataProvider = "validData")
+    public void testEncodeRawData(final String clearData, final String encodedData) throws Exception {
+        testValidData(ENCODE, clearData, encodedData);
+    }
+
+    @Test(dataProvider = "validData")
+    public void testDecodeRawData(final String encodedData, final String clearData) throws Exception {
+        testValidData(DECODE, clearData, encodedData);
+    }
+
+    @Test(dataProvider = "validData")
+    public void testEncodeDataWithFiles(final String clearData, final String encodedData) throws Exception {
+        testValidDataWithFiles(ENCODE, clearData, encodedData);
+    }
+
+    @Test(dataProvider = "validData")
+    public void testDecodeDataWithFiles(final String encodedData, final String clearData) throws Exception {
+        testValidDataWithFiles(DECODE, clearData, encodedData);
+    }
+
+    private void testValidData(final boolean mode, final String dataIn, final String dataOut) throws LDAPToolException {
+        final int res = testBase64(mode, "-d", dataIn);
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        assertThat(out.toString()).contains(dataOut);
+    }
+
+    private void testValidDataWithFiles(final boolean mode, final String dataIn, final String dataOut)
+            throws Exception {
+        final File dataInFile = File.createTempFile("Base64TestCase", ".data");
+        Files.write(dataInFile.toPath(), dataIn.getBytes());
+        final String dataOutFilePath = ToolsTestUtils.createTempFile();
+        final int res = testBase64(mode, "-f", dataInFile.getAbsolutePath(), "-o", dataOutFilePath);
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        assertThat(out.toString()).isEmpty();
+        assertThat(err.toString()).isEmpty();
+        assertThat(readFirstLine(dataOutFilePath)).isEqualTo(dataOut);
+    }
+
+    private String readFirstLine(final String resultFilePath) throws IOException {
+        try (final BufferedReader reader = new BufferedReader(new FileReader(resultFilePath))) {
+            return reader.readLine();
+        }
+    }
+
+    private Integer testBase64(final boolean encode, final String... args) throws LDAPToolException {
+        final List<String> arguments = new ArrayList<>();
+        arguments.add(encode ? "encode" : "decode");
+        arguments.addAll(Arrays.asList(args));
+        return runTool(arguments.toArray(new String[arguments.size()]));
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new Base64(outStream, errStream);
+    }
+}
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java
index e3cc539..38e62f4 100644
--- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java
@@ -19,6 +19,7 @@
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_COMPARE_OPERATION_RESULT_FALSE;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_COMPARE_OPERATION_RESULT_TRUE;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_LDAPCOMPARE_TOOL_DESCRIPTION;
+import static com.forgerock.opendj.ldap.tools.Utils.runTool;
 
 import java.io.PrintStream;
 import java.util.Random;
@@ -85,7 +86,7 @@
 
         try (PrintStream outStream = new PrintStream(out.asOutputStream());
              PrintStream errStream = new PrintStream(err.asOutputStream())) {
-            LDAPCompare.run(outStream, errStream, arguments);
+            runTool(new LDAPCompare(outStream, errStream), arguments);
             checkOuputStreams(out, err, expectedOut, expectedErr);
         } catch (final LDAPToolException ae) {
             checkOuputStreams(out, err, expectedOut, expectedErr);
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareTestCase.java
new file mode 100644
index 0000000..52df1f6
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareTestCase.java
@@ -0,0 +1,197 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2013-2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_NO_ARGUMENT_WITH_LONG_ID;
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_NO_ARGUMENT_WITH_SHORT_ID;
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS;
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARG_CANNOT_DECODE_AS_INT;
+import static com.forgerock.opendj.cli.CliMessages.ERR_FILEARG_NO_SUCH_FILE;
+import static com.forgerock.opendj.cli.CliMessages.ERR_INTARG_VALUE_ABOVE_UPPER_BOUND;
+import static com.forgerock.opendj.cli.CliMessages.ERR_TOOL_CONFLICTING_ARGS;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_LDAP_FILTER_NO_EQUAL_SIGN;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_LDAPCOMPARE_INVALID_ATTR_STRING;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_TOOL_INVALID_CONTROL_STRING;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededLongArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.fest.assertions.Assertions.assertThat;
+import static org.forgerock.opendj.ldap.ResultCode.COMPARE_TRUE;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.forgerock.opendj.ldap.controls.RealAttributesOnlyRequestControl;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LdapResultHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.controls.AssertionRequestControl;
+import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** A set of test cases for the LDAPCompare tool. */
+@SuppressWarnings("javadoc")
+@Test
+public class LDAPCompareTestCase extends LDAPToolsTestCase {
+
+    private final class LdapCompareToolLdapServer extends ToolLdapServer {
+        private final class LdapCompareRequestHandler extends ToolLdapServer.ToolLdapServerConnection {
+            @Override
+            public void handleCompare(final Integer requestContext,
+                                      final CompareRequest request,
+                                      final IntermediateResponseHandler intermediateResponseHandler,
+                                      final LdapResultHandler<CompareResult> resultHandler) {
+                assertThat(request.getName().toString()).isEqualTo("uid=marvin");
+                assertThat(request.getAssertionValueAsString()).isEqualTo("the paranoid android");
+                assertThat(request.getAttributeDescription().toString()).isEqualTo("description");
+                assertThatControlsHaveBeenSentInRequest(request.getControls());
+                resultHandler.handleResult(Responses.newCompareResult(COMPARE_TRUE));
+            }
+        }
+
+        @Override
+        ToolLdapServerConnection newServerConnection() {
+            return new LdapCompareRequestHandler();
+        }
+    }
+
+    @Override
+    ToolLdapServer createFakeServer() {
+        return new LdapCompareToolLdapServer();
+    }
+
+    /**
+     * Retrieves sets of invalid arguments that may not be used to initialize
+     * the LDAPCompare tool.
+     *
+     * @return Sets of invalid arguments that may not be used to initialize the
+     * LDAPCompare tool.
+     */
+    @DataProvider(name = "invalidArgs")
+    public Object[][] getInvalidArgumentLists() throws Exception {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        argLists.add(args());
+        reasonList.add(ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(2));
+
+        addValueNeededShortArgs(argLists, reasonList, "D", "w", "j", "K", "P", "W", "h", "p", "J", "o");
+        addValueNeededLongArgs(argLists, reasonList, "assertionFilter", "hostname", "port", "control");
+
+        argLists.add(args("-I"));
+        reasonList.add(ERR_ARGPARSER_NO_ARGUMENT_WITH_SHORT_ID.get("I"));
+
+        argLists.add(args("--invalidLongArgument"));
+        reasonList.add(ERR_ARGPARSER_NO_ARGUMENT_WITH_LONG_ID.get("invalidLongArgument"));
+
+        argLists.add(args("--assertionFilter", "(invalidfilter)", "uid:test.user", "uid=test.user,o=test"));
+        reasonList.add(ERR_LDAP_FILTER_NO_EQUAL_SIGN.get("(invalidfilter)", 1, 14));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-j", "no.such.file", "uid:test.user", "uid=test.user,o=test"));
+        reasonList.add(ERR_FILEARG_NO_SUCH_FILE.get("no.such.file", "bindPasswordFile"));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-w", "password", "-j", "src/test/resources/dummy-truststore",
+                          "uid:test.user", "uid=test.user,o=test"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("bindPassword", "bindPasswordFile"));
+
+        argLists.add(args("-J", "1.2.3.4:invalidcriticality", "uid:test.user", "uid=test.user,o=test"));
+        reasonList.add(ERR_TOOL_INVALID_CONTROL_STRING.get("1.2.3.4:invalidcriticality"));
+
+        argLists.add(args("-Z", "-q", "o=test", "o=test2"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("useStartTLS", "useSSL"));
+
+        argLists.add(args("-p", "nonnumeric", "uid:test.user", "uid=test.user,o=test"));
+        reasonList.add(ERR_ARG_CANNOT_DECODE_AS_INT.get("nonnumeric", "port"));
+
+        argLists.add(args("-p", "999999", "uid:test.user", "uid=test.user,o=test"));
+        reasonList.add(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get("port", 999999, 65535));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-w", "password"));
+        reasonList.add(ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(2));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-w", "password", "uid:test.user"));
+        reasonList.add(ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(2));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-w", "password", "malformed", "uid=test.user,o=test"));
+        reasonList.add(ERR_LDAPCOMPARE_INVALID_ATTR_STRING.get("malformed"));
+
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @Test
+    public void simpleComparison() throws Exception {
+        runToolOnMockedServer("description:the paranoid android",
+                              "uid=marvin");
+    }
+
+    @Test
+    public void simpleComparisonUseReturnCode() throws Exception {
+        runToolOnMockedServer(ResultCode.COMPARE_TRUE,
+                              "-m",
+                              "description:the paranoid android",
+                              "uid=marvin");
+    }
+
+    @Test
+    public void simpleComparisonWithProxyAs() throws Exception {
+        controls.add(ProxiedAuthV2RequestControl.newControl("u:arthurdent"));
+        runToolOnMockedServer("-Y", "u:arthurdent",
+                              "description:the paranoid android",
+                              "uid=marvin");
+    }
+
+    @Test
+    public void comparisonWithAssertionFilter() throws Exception {
+        controls.add(AssertionRequestControl.newControl(true, Filter.equality("initials", "FP")));
+        runToolOnMockedServer("--assertionFilter", "(initials=FP)",
+                              "description:the paranoid android",
+                              "uid=marvin");
+    }
+
+    @Test
+    public void comparisonWithAssertionFilterAndControl() throws Exception {
+        controls.add(RealAttributesOnlyRequestControl.newControl(true));
+        controls.add(AssertionRequestControl.newControl(true, Filter.equality("initials", "M")));
+        runToolOnMockedServer("--assertionFilter", "(initials=M)",
+                              "-J", "2.16.840.1.113730.3.4.17:true",
+                              "description:the paranoid android",
+                              "uid=marvin");
+    }
+
+    @Test
+    public void comparisonWithAssertionFilterAndControlDryRun() throws Exception {
+        controls.add(RealAttributesOnlyRequestControl.newControl(true));
+        controls.add(AssertionRequestControl.newControl(true, Filter.equality("initials", "M")));
+        runToolOnMockedServer("--assertionFilter", "(initials=M)",
+                              "-J", "2.16.840.1.113730.3.4.17:true",
+                              "-n",
+                              "description:the paranoid android",
+                              "uid=marvin");
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new LDAPCompare(outStream, errStream);
+    }
+}
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPDeleteTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPDeleteTestCase.java
new file mode 100644
index 0000000..e82fc52
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPDeleteTestCase.java
@@ -0,0 +1,140 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ *  Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARG_CANNOT_DECODE_AS_INT;
+import static com.forgerock.opendj.cli.CliMessages.ERR_FILEARG_NO_SUCH_FILE;
+import static com.forgerock.opendj.cli.CliMessages.ERR_INTARG_VALUE_ABOVE_UPPER_BOUND;
+import static com.forgerock.opendj.cli.CliMessages.ERR_TOOL_CONFLICTING_ARGS;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_TOOL_INVALID_CONTROL_STRING;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.fest.assertions.Assertions.assertThat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LdapResultHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.controls.GenericControl;
+import org.forgerock.opendj.ldap.controls.SubtreeDeleteRequestControl;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** A set of test cases for the LDAPDelete tool. */
+@Test
+public class LDAPDeleteTestCase extends LDAPToolsTestCase {
+
+    private final class LdapDeleteToolLdapServer extends ToolLdapServer {
+        private final class LdapDeleteRequestHandler extends ToolLdapServer.ToolLdapServerConnection {
+            @Override
+            public void handleDelete(final Integer requestContext,
+                                     final DeleteRequest request,
+                                     final IntermediateResponseHandler intermediateResponseHandler,
+                                     final LdapResultHandler<Result> resultHandler) {
+                assertThat(request.getName().toString()).isEqualTo("uid=marvin");
+                assertThatControlsHaveBeenSentInRequest(request.getControls());
+                resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+            }
+        }
+
+        @Override
+        ToolLdapServerConnection newServerConnection() {
+            return new LdapDeleteRequestHandler();
+        }
+    }
+
+    @Override
+    ToolLdapServer createFakeServer() {
+        return new LdapDeleteToolLdapServer();
+    }
+
+    /**
+     * Retrieves sets of invalid arguments that may not be used to initialize
+     * the LDAPDelete tool.
+     *
+     * @return Sets of invalid arguments that may not be used to initialize the
+     * LDAPDelete tool.
+     */
+    @DataProvider(name = "invalidArgs")
+    public Object[][] getInvalidArgumentLists() {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        addValueNeededShortArgs(
+                argLists, reasonList, "D", "w", "j", "K", "P", "W", "h", "p", "J", "o");
+
+        argLists.add(args("-D", "cn=Directory Manager", "-j", "no.such.file", "o=test"));
+        reasonList.add(ERR_FILEARG_NO_SUCH_FILE.get("no.such.file", "bindPasswordFile"));
+
+        argLists.add(args("-J", "1.2.3.4:invalidcriticality", "o=test"));
+        reasonList.add(ERR_TOOL_INVALID_CONTROL_STRING.get("1.2.3.4:invalidcriticality"));
+
+        argLists.add(args("-Z", "-q", "o=test"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("useStartTLS", "useSSL"));
+
+        argLists.add(args("-p", "nonnumeric", "o=test"));
+        reasonList.add(ERR_ARG_CANNOT_DECODE_AS_INT.get("nonnumeric", "port"));
+
+        argLists.add(args("-p", "999999", "o=test"));
+        reasonList.add(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get("port", 999999, 65535));
+
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @Test
+    public void simpleDelete() throws Exception {
+        runToolOnMockedServer("uid=marvin");
+    }
+
+    @Test
+    public void deleteWithControl() throws Exception {
+        controls.add(GenericControl.newControl("1.2.3.4.5.6.7.42", false, "testcontrol"));
+        runToolOnMockedServer("-J", "1.2.3.4.5.6.7.42:false:testcontrol",
+                              "uid=marvin");
+    }
+
+    @Test
+    public void subtreeDeleteWithControl() throws Exception {
+        controls.add(GenericControl.newControl("1.2.3.4.5.6.7.42", false, "testcontrol"));
+        controls.add(SubtreeDeleteRequestControl.newControl(false));
+        runToolOnMockedServer("-J", "1.2.3.4.5.6.7.42:false:testcontrol",
+                              "--deleteSubtree",
+                              "uid=marvin");
+    }
+
+    @Test
+    public void subtreeDeleteWithControlDryRun() throws Exception {
+        controls.add(GenericControl.newControl("1.2.3.4.5.6.7.42", false, "testcontrol"));
+        controls.add(SubtreeDeleteRequestControl.newControl(false));
+        runToolOnMockedServer("-J", "1.2.3.4.5.6.7.42:false:testcontrol",
+                              "--deleteSubtree",
+                              "-n",
+                              "uid=marvin");
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new LDAPDelete(outStream, errStream);
+    }
+}
+
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPModifyTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPModifyTestCase.java
new file mode 100644
index 0000000..31656d9
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPModifyTestCase.java
@@ -0,0 +1,288 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ *  Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARG_CANNOT_DECODE_AS_INT;
+import static com.forgerock.opendj.cli.CliMessages.ERR_FILEARG_NO_SUCH_FILE;
+import static com.forgerock.opendj.cli.CliMessages.ERR_INTARG_VALUE_ABOVE_UPPER_BOUND;
+import static com.forgerock.opendj.cli.CliMessages.ERR_TOOL_CONFLICTING_ARGS;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_LDAP_FILTER_NO_EQUAL_SIGN;
+import static com.forgerock.opendj.ldap.tools.ToolLdapServer.DIRECTORY_MANAGER;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_TOOL_INVALID_CONTROL_STRING;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededLongArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.createTempFile;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.fest.assertions.Assertions.assertThat;
+import static org.forgerock.opendj.ldap.ModificationType.ADD;
+import static org.forgerock.opendj.ldap.ModificationType.DELETE;
+import static org.forgerock.opendj.ldap.ModificationType.REPLACE;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.forgerock.opendj.ldap.controls.RealAttributesOnlyRequestControl;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LdapResultHandler;
+import org.forgerock.opendj.ldap.Modification;
+import org.forgerock.opendj.ldap.ModificationType;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.controls.AssertionRequestControl;
+import org.forgerock.opendj.ldap.controls.PostReadRequestControl;
+import org.forgerock.opendj.ldap.controls.PreReadRequestControl;
+import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** A set of test cases for the LDAPModify tool. */
+@SuppressWarnings("javadoc")
+@Test
+public class LDAPModifyTestCase extends LDAPToolsTestCase {
+
+    private final class LdapModifyToolLdapServer extends ToolLdapServer {
+        private final class LdapModifyRequestHandler extends ToolLdapServer.ToolLdapServerConnection {
+            @Override
+            public void handleAdd(final Integer requestContext,
+                                  final AddRequest request,
+                                  final IntermediateResponseHandler intermediateResponseHandler,
+                                  final LdapResultHandler<Result> resultHandler) {
+                if (request.getName().toString().equals("uid=error")) {
+                    errorRaised = true;
+                    resultHandler.handleResult(Responses.newResult(ResultCode.INSUFFICIENT_ACCESS_RIGHTS));
+                    return;
+                }
+                assertThat(request.getName().toString()).isEqualTo("uid=marvin");
+                assertThatControlsHaveBeenSentInRequest(request.getControls());
+                resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+            }
+
+            @Override
+            public void handleDelete(final Integer requestContext,
+                                     final DeleteRequest request,
+                                     final IntermediateResponseHandler intermediateResponseHandler,
+                                     final LdapResultHandler<Result> resultHandler) {
+                if (errorRaised && !continueOnError) {
+                    throw new RuntimeException(
+                            "ldapmodify continues to process requests without the --continueOnError flag");
+                }
+                assertThat(request.getName().toString()).isEqualTo("uid=marvin");
+                assertThatControlsHaveBeenSentInRequest(request.getControls());
+                resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+            }
+
+            @Override
+            public void handleModify(final Integer requestContext,
+                                     final ModifyRequest request,
+                                     final IntermediateResponseHandler intermediateResponseHandler,
+                                     final LdapResultHandler<Result> resultHandler) {
+                assertThat(request.getName().toString()).isEqualTo("uid=marvin");
+                final List<Modification> modifications = request.getModifications();
+                assertThat(modifications.size()).isEqualTo(3);
+                assertThatModificationIsEqualTo(modifications.get(0), ADD, "attributetoadd", "value");
+                assertThatModificationIsEqualTo(
+                        modifications.get(1), REPLACE, "description", "The paranoid android");
+                assertThatModificationIsEqualTo(
+                        modifications.get(2), DELETE, "todelete", "");
+                assertThat(modifications.get(1).getModificationType()).isEqualTo(REPLACE);
+                resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+            }
+
+            private void assertThatModificationIsEqualTo(final Modification modification,
+                                                         final ModificationType type,
+                                                         final String attributeName,
+                                                         final String attributeValue) {
+                assertThat(modification.getModificationType()).isEqualTo(type);
+                assertThat(modification.getAttribute().getAttributeDescriptionAsString()).isEqualTo(attributeName);
+                if (type != DELETE) {
+                    assertThat(modification.getAttribute().firstValueAsString()).isEqualTo(attributeValue);
+                }
+            }
+
+            @Override
+            public void handleModifyDN(final Integer requestContext,
+                                       final ModifyDNRequest request,
+                                       final IntermediateResponseHandler intermediateResponseHandler,
+                                       final LdapResultHandler<Result> resultHandler) {
+                assertThat(request.getName().toString()).isEqualTo("uid=marvin");
+                assertThat(request.getNewRDN().toString()).isEqualTo("uid=arthurdent");
+                assertThat(request.isDeleteOldRDN()).isTrue();
+                assertThatControlsHaveBeenSentInRequest(request.getControls());
+                resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+            }
+        }
+
+        @Override
+        ToolLdapServerConnection newServerConnection() {
+            return new LdapModifyRequestHandler();
+        }
+    }
+
+    @Override
+    ToolLdapServer createFakeServer() {
+        return new LdapModifyToolLdapServer();
+    }
+
+    private boolean continueOnError;
+    private boolean errorRaised;
+
+    /**
+     * Retrieves sets of invalid arguments that may not be used to initialize
+     * the LDAPModify tool.
+     *
+     * @return Sets of invalid arguments that may not be used to initialize the
+     * LDAPModify tool.
+     */
+    @DataProvider(name = "invalidArgs")
+    public Object[][] getInvalidArgumentLists() {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        addValueNeededShortArgs(argLists, reasonList, "D", "w", "j", "Y", "K", "P", "W", "h", "p", "J", "o");
+        addValueNeededLongArgs(argLists, reasonList, "assertionFilter", "hostname",
+                               "port", "control", "preReadAttributes", "postReadAttributes");
+
+        argLists.add(args("-D", "cn=Directory Manager", "-j", "no.such.file"));
+        reasonList.add(ERR_FILEARG_NO_SUCH_FILE.get("no.such.file", "bindPasswordFile"));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-w", "password", "-j", "src/test/resources/dummy-truststore"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("bindPassword", "bindPasswordFile"));
+
+        argLists.add(args("-J", "1.2.3.4:invalidcriticality"));
+        reasonList.add(ERR_TOOL_INVALID_CONTROL_STRING.get("1.2.3.4:invalidcriticality"));
+
+        argLists.add(args("-Z", "-q"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("useStartTLS", "useSSL"));
+
+        argLists.add(args("-p", "nonnumeric"));
+        reasonList.add(ERR_ARG_CANNOT_DECODE_AS_INT.get("nonnumeric", "port"));
+
+        argLists.add(args("-p", "999999"));
+        reasonList.add(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get("port", 999999, 65535));
+
+        argLists.add(args("--assertionFilter", "(invalid)"));
+        reasonList.add(ERR_LDAP_FILTER_NO_EQUAL_SIGN.get("(invalid)", 1, 8));
+
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @Test
+    public void testNoContinueOnError() throws Exception {
+        final String tmpFilePath = createTempFile("dn: uid=error",
+                                                  "changetype: add",
+                                                  "description: An error will be raised by server",
+                                                  "",
+                                                  "dn: uid=marvin",
+                                                  "changetype: delete");
+        final int res = runTool("-h", server.getHostName(),
+                                "-p", server.getPort(),
+                                "-D", DIRECTORY_MANAGER,
+                                "-w", "password",
+                                "-f", tmpFilePath);
+        assertThat(res).isEqualTo(ResultCode.INSUFFICIENT_ACCESS_RIGHTS.intValue());
+    }
+
+    @Test
+    public void testSimpleModifyRequests() throws Exception {
+        final String tmpFilePath = createTempFile("dn: uid=marvin",
+                                                  "changetype: modify",
+                                                  "add: attributetoadd",
+                                                  "attributetoadd: value",
+                                                  "-",
+                                                  "replace: description",
+                                                  "description: The paranoid android",
+                                                  "-",
+                                                  "delete: todelete",
+                                                  "");
+        final String tmpFilePath2 = createTempFile("dn: uid=marvin",
+                                                   "changetype: add");
+        runToolOnMockedServer(tmpFilePath, tmpFilePath2);
+    }
+
+    @Test
+    public void testAddAndDeleteRequests() throws Exception {
+        controls.add(AssertionRequestControl.newControl(true,
+                Filter.and(Filter.equality("uid", "marvin"), Filter.equality("description", "The paranoid android"))));
+        controls.add(PostReadRequestControl.newControl(true, "uid"));
+        final String tmpFilePath = createTempFile("dn: uid=marvin",
+                                                  "changetype: add",
+                                                  "description: The paranoid android",
+                                                  "",
+                                                  "dn: uid=marvin",
+                                                  "changetype: delete");
+        runToolOnMockedServer("--postReadAttributes", "uid",
+                              "--assertionFilter", "(&(uid=marvin)(description=The paranoid android))",
+                              "-f", tmpFilePath);
+    }
+
+    @Test
+    public void testContinueOnError() throws Exception {
+        continueOnError = true;
+        controls.add(RealAttributesOnlyRequestControl.newControl(true));
+        final String tmpFilePath = createTempFile("dn: uid=error",
+                                                  "changetype: add",
+                                                  "description: An error will be raised by server",
+                                                  "",
+                                                  "dn: uid=marvin",
+                                                  "changetype: delete");
+        runToolOnMockedServer("-c",
+                              "-J", "2.16.840.1.113730.3.4.17:true",
+                              tmpFilePath);
+    }
+
+    @Test
+    public void testModifyDN() throws Exception {
+        controls.add(ProxiedAuthV2RequestControl.newControl("dn: uid=marvin"));
+        controls.add(PreReadRequestControl.newControl(true, "uid"));
+        final String tmpFilePath = createTempFile("dn: uid=marvin",
+                                                  "changetype: moddn",
+                                                  "newrdn: uid=arthurdent",
+                                                  "deleteoldrdn: 1");
+        runToolOnMockedServer("-c",
+                              "--preReadAttributes", "uid",
+                              "-Y", "dn: uid=marvin",
+                              tmpFilePath);
+    }
+
+    @Test
+    public void testModifyDNDryRun() throws Exception {
+        controls.add(ProxiedAuthV2RequestControl.newControl("dn: uid=marvin"));
+        controls.add(PreReadRequestControl.newControl(true, "uid"));
+        final String tmpFilePath = createTempFile("dn: uid=marvin",
+                                                  "changetype: moddn",
+                                                  "newrdn: uid=arthurdent",
+                                                  "deleteoldrdn: 1");
+        runToolOnMockedServer("-c",
+                              "--preReadAttributes", "uid",
+                              "-Y", "dn: uid=marvin",
+                              "-n",
+                              tmpFilePath);
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new LDAPModify(outStream, errStream);
+    }
+}
+
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModifyTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModifyTestCase.java
new file mode 100644
index 0000000..a79dadb
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModifyTestCase.java
@@ -0,0 +1,160 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ *  Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARG_CANNOT_DECODE_AS_INT;
+import static com.forgerock.opendj.cli.CliMessages.ERR_FILEARG_NO_SUCH_FILE;
+import static com.forgerock.opendj.cli.CliMessages.ERR_INTARG_VALUE_ABOVE_UPPER_BOUND;
+import static com.forgerock.opendj.cli.CliMessages.ERR_TOOL_CONFLICTING_ARGS;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededLongArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.buildArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.createTempFile;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.assertj.core.api.Assertions.fail;
+import static org.fest.assertions.Assertions.assertThat;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.forgerock.opendj.ldap.controls.AccountUsabilityRequestControl;
+import com.forgerock.opendj.ldap.tools.ToolsTestUtils.Args;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DecodeOptions;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LdapResultHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.controls.PasswordPolicyRequestControl;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+/** A set of test cases for the LDAPPasswordModify tool. */
+@Test
+public class LDAPPasswordModifyTestCase extends LDAPToolsTestCase {
+
+    private final class LdapPasswordModifyToolLdapServer extends ToolLdapServer {
+        private final class LdapPasswordModifyRequestHandler extends ToolLdapServer.ToolLdapServerConnection {
+            @Override
+            public <R extends ExtendedResult> void handleExtendedRequest(final Integer requestContext,
+                                                                         final ExtendedRequest<R> request,
+                                                                         final IntermediateResponseHandler irh,
+                                                                         final LdapResultHandler<R> resultHandler) {
+                assertThat(request.getOID()).isEqualTo("1.3.6.1.4.1.4203.1.11.1");
+                assertThat(request.getValue().toASCIIString()).isEqualTo(
+                        "0*%80%0Edn: uid=marvin%81%0Boldpassword%82%0Bnewpassword");
+                assertThatControlsHaveBeenSentInRequest(request.getControls());
+                try {
+                    resultHandler.handleResult(request.getResultDecoder().decodeExtendedResult(
+                            Responses.newPasswordModifyExtendedResult(ResultCode.SUCCESS), new DecodeOptions()));
+                } catch (DecodeException e) {
+                    fail("Unexpected error occurred while mocking server password modify response.", e);
+                }
+            }
+        }
+
+        @Override
+        ToolLdapServerConnection newServerConnection() {
+            return new LdapPasswordModifyRequestHandler();
+        }
+    }
+
+    @Override
+    ToolLdapServer createFakeServer() {
+        return new LdapPasswordModifyToolLdapServer();
+    }
+
+    /**
+     * Retrieves sets of invalid arguments that may not be used to initialize
+     * the LDAPPasswordModify tool.
+     *
+     * @return Sets of invalid arguments that may not be used to initialize the
+     * LDAPPasswordModify tool.
+     */
+    @DataProvider(name = "invalidArgs")
+    public Object[][] getInvalidArgumentLists() {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        addValueNeededShortArgs(argLists, reasonList, "a", "N", "n", "c", "C", "D", "w", "j", "K", "P", "W", "h", "p");
+        addValueNeededLongArgs(argLists, reasonList, "hostname", "port", "control",
+                "keyStorePasswordFile", "trustStorePassword", "trustStorePasswordFile");
+
+        argLists.add(args("-D", "cn=Directory Manager", "-j", "no.such.file"));
+        reasonList.add(ERR_FILEARG_NO_SUCH_FILE.get("no.such.file", "bindPasswordFile"));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-w", "password", "-j", "src/test/resources/dummy-truststore"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("bindPassword", "bindPasswordFile"));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-c", "password", "-C", "src/test/resources/dummy-truststore"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("currentPassword", "currentPasswordFile"));
+
+        argLists.add(args("-D", "cn=Directory Manager", "-n", "password", "-F", "src/test/resources/dummy-truststore"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("newPassword", "newPasswordFile"));
+
+        argLists.add(args("-Z", "-q"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("useStartTLS", "useSSL"));
+
+        argLists.add(args("-p", "nonnumeric"));
+        reasonList.add(ERR_ARG_CANNOT_DECODE_AS_INT.get("nonnumeric", "port"));
+
+        argLists.add(args("-p", "999999"));
+        reasonList.add(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get("port", 999999, 65535));
+
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @Test
+    public void testLdapPasswordModify() throws Exception {
+        runToolOnMockedServer("-c", "oldpassword",
+                              "-n", "newpassword");
+    }
+
+    @Test
+    public void testLdapPasswordModifyWithPasswordInFiles() throws Exception {
+        final String oldPwdFilePath = createTempFile("oldpassword");
+        final String newPwdFilePath = createTempFile("newpassword");
+        runToolOnMockedServer("-C", oldPwdFilePath,
+                              "-F", newPwdFilePath);
+    }
+
+    @Test
+    public void testLdapPasswordModifyWithControls() throws Exception {
+        controls.add(PasswordPolicyRequestControl.newControl(false));
+        controls.add(AccountUsabilityRequestControl.newControl(false));
+        runToolOnMockedServer("-J", "1.3.6.1.4.1.42.2.27.8.5.1:false",
+                              "-J", "1.3.6.1.4.1.42.2.27.9.5.8:false",
+                              "-c", "oldpassword",
+                              "-n", "newpassword");
+    }
+
+    @Override
+    Args toolConstantArguments() {
+        return buildArgs().add("-a", "dn: uid=marvin");
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new LDAPPasswordModify(outStream, errStream);
+    }
+}
+
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java
index a3c0b42..97c58dc 100644
--- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java
@@ -19,6 +19,7 @@
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_ERROR_PARSING_ARGS;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_LDAPSEARCH_MATCHING_ENTRY_COUNT;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_LDAPSEARCH_TOOL_DESCRIPTION;
+import static com.forgerock.opendj.ldap.tools.Utils.runTool;
 
 import java.io.PrintStream;
 import java.util.Random;
@@ -75,7 +76,7 @@
 
         try (PrintStream outStream = new PrintStream(out.asOutputStream());
              PrintStream errStream = new PrintStream(err.asOutputStream())) {
-            LDAPSearch.run(outStream, errStream, arguments);
+            runTool(new LDAPSearch(outStream, errStream), arguments);
             checkOuputStreams(out, err, expectedOut, expectedErr);
         } catch (final LDAPToolException e) {
             checkOuputStreams(out, err, expectedOut, expectedErr);
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchTestCase.java
new file mode 100644
index 0000000..f74170e
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchTestCase.java
@@ -0,0 +1,267 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ *  Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_NO_VALUE_FOR_REQUIRED_ARG;
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS;
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARG_CANNOT_DECODE_AS_INT;
+import static com.forgerock.opendj.cli.CliMessages.ERR_INTARG_VALUE_ABOVE_UPPER_BOUND;
+import static com.forgerock.opendj.cli.CliMessages.ERR_MCARG_VALUE_NOT_ALLOWED;
+import static com.forgerock.opendj.cli.CliMessages.ERR_TOOL_CONFLICTING_ARGS;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_LDAP_FILTER_NO_EQUAL_SIGN;
+import static com.forgerock.opendj.ldap.tools.ToolLdapServer.DIRECTORY_MANAGER;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_PSEARCH_DOESNT_START_WITH_PS;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_PSEARCH_INVALID_CHANGE_TYPE;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_TOOL_INVALID_CONTROL_STRING;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededLongArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.fest.assertions.Assertions.assertThat;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.buildArgs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
+import org.forgerock.opendj.ldap.Filter;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LdapResultHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.controls.AssertionRequestControl;
+import org.forgerock.opendj.ldap.controls.GenericControl;
+import org.forgerock.opendj.ldap.controls.GetEffectiveRightsRequestControl;
+import org.forgerock.opendj.ldap.controls.MatchedValuesRequestControl;
+import org.forgerock.opendj.ldap.controls.PersistentSearchChangeType;
+import org.forgerock.opendj.ldap.controls.PersistentSearchRequestControl;
+import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl;
+import org.forgerock.opendj.ldap.controls.ServerSideSortRequestControl;
+import org.forgerock.opendj.ldap.controls.SimplePagedResultsControl;
+import org.forgerock.opendj.ldap.controls.SubentriesRequestControl;
+import org.forgerock.opendj.ldap.controls.VirtualListViewRequestControl;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** A set of test cases for the LDAPSearch tool. */
+@SuppressWarnings("javadoc")
+@Test
+public class LDAPSearchTestCase extends LDAPToolsTestCase {
+
+    private final class LdapSearchToolLdapServer extends ToolLdapServer {
+
+        private final class LdapSearchRequestHandler extends ToolLdapServer.ToolLdapServerConnection {
+            @Override
+            public void handleSearch(final Integer requestContext,
+                                     final SearchRequest request,
+                                     final IntermediateResponseHandler intermediateResponseHandler,
+                                     final SearchResultHandler entryHandler,
+                                     final LdapResultHandler<Result> resultHandler) {
+                assertThat(request.getName().toString()).isEqualTo("ou=people,dc=example,dc=com");
+                assertThat(request.getDereferenceAliasesPolicy()).isEqualTo(DereferenceAliasesPolicy.FINDING_BASE);
+                assertThat(request.getSizeLimit()).isEqualTo(100);
+                assertThat(request.isTypesOnly()).isTrue();
+                assertThat(request.getTimeLimit()).isEqualTo(120);
+                assertThat(request.getScope()).isEqualTo(SearchScope.SUBORDINATES);
+                assertThat(request.getAttributes()).containsExactly("uid", "objectclass", "description");
+                assertThat(request.getFilter().toString()).isEqualTo("(st=Alabama)");
+                assertThatControlsHaveBeenSentInRequest(request.getControls());
+                resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS));
+            }
+        }
+        @Override
+        ToolLdapServerConnection newServerConnection() {
+            return new LdapSearchRequestHandler();
+        }
+
+    }
+
+    @Override
+    ToolLdapServer createFakeServer() {
+        return new LdapSearchToolLdapServer();
+    }
+
+    /**
+     * Retrieves sets of invalid arguments that may not be used to initialize
+     * the LDAPSearch tool.
+     *
+     * @return Sets of invalid arguments that may not be used to initialize the
+     * LDAPSearch tool.
+     */
+    @DataProvider(name = "invalidArgs")
+    public Object[][] getInvalidArgumentLists() {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        argLists.add(args());
+        reasonList.add(ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(1));
+
+        addValueNeededShortArgs(argLists, reasonList,
+                "b", "D", "w", "j", "Y", "K", "P", "W", "h", "p", "J", "z", "l", "s", "a", "o");
+        addValueNeededLongArgs(argLists, reasonList,
+                               "assertionFilter", "matchedValuesFilter", "hostname", "port", "control");
+
+        argLists.add(args("(objectClass=*)"));
+        reasonList.add(ERR_ARGPARSER_NO_VALUE_FOR_REQUIRED_ARG.get("baseDN"));
+
+        argLists.add(args("-b", ""));
+        reasonList.add(ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(1));
+
+        argLists.add(args("-b", "", "--assertionFilter", "(invalidfilter)", "(objectClass=*)"));
+        reasonList.add(ERR_LDAP_FILTER_NO_EQUAL_SIGN.get("(invalidfilter)", 1, 14));
+
+        argLists.add(args("-b", "", "--matchedValuesFilter", "(invalidfilter)", "(objectClass=*)"));
+        reasonList.add(ERR_LDAP_FILTER_NO_EQUAL_SIGN.get("(invalidfilter)", 1, 14));
+
+        argLists.add(args("-D", "cn=Directory Manager",
+                          "-j", "src/test/resources/dummy-truststore",
+                          "-w", "password",
+                          "-b", "",
+                          "(objectClass=*)"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("bindPassword", "bindPasswordFile"));
+
+        argLists.add(args("-b", "", "-J", "1.2.3.4:invalidcriticality", "(objectClass=*)"));
+        reasonList.add(ERR_TOOL_INVALID_CONTROL_STRING.get("1.2.3.4:invalidcriticality"));
+
+        argLists.add(args("-b", "", "-s", "invalid", "(objectClass=*)"));
+        reasonList.add(ERR_MCARG_VALUE_NOT_ALLOWED.get("searchScope", "invalid"));
+
+        argLists.add(args("-b", "", "-a", "invalid", "(objectClass=*)"));
+        reasonList.add(ERR_MCARG_VALUE_NOT_ALLOWED.get("dereferencePolicy", "invalid"));
+
+        argLists.add(args("-b", "", "-C", "invalid", "(objectClass=*)"));
+        reasonList.add(ERR_PSEARCH_DOESNT_START_WITH_PS.get("invalid"));
+
+        argLists.add(args("-b", "", "-C", "ps:invalid", "(objectClass=*)"));
+        reasonList.add(ERR_PSEARCH_INVALID_CHANGE_TYPE.get("invalid"));
+
+        argLists.add(args("-Z", "-q", "-b", "", "(objectClass=*"));
+        reasonList.add(ERR_TOOL_CONFLICTING_ARGS.get("useStartTLS", "useSSL"));
+
+        argLists.add(args("-p", "nonnumeric", "-b", "", "(objectClass=*)"));
+        reasonList.add(ERR_ARG_CANNOT_DECODE_AS_INT.get("nonnumeric", "port"));
+
+        argLists.add(args("-p", "999999", "-b", "", "(objectClass=*)"));
+        reasonList.add(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get("port", 999999, 65535));
+
+        argLists.add(args("-z", "nonnumeric", "-b", "", "(objectClass=*)"));
+        reasonList.add(ERR_ARG_CANNOT_DECODE_AS_INT.get("nonnumeric", "sizeLimit"));
+
+        argLists.add(args("-l", "nonnumeric", "-b", "", "(objectClass=*)"));
+        reasonList.add(ERR_ARG_CANNOT_DECODE_AS_INT.get("nonnumeric", "timeLimit"));
+
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @Test
+    public void testLdapSearch() throws Exception {
+        runToolOnMockedServer();
+    }
+
+    @Test
+    public void testLdapSearchWithAssertionFilter() throws Exception {
+        controls.add(AssertionRequestControl.newControl(true, Filter.or(Filter.equality("uid", "user.1"),
+                                                                        Filter.greaterOrEqual("age", "40"))));
+        runToolOnMockedServer("--assertionFilter", "(|(uid=user.1)(age>=40))");
+    }
+
+    @Test
+    public void testLdapSearchWithPersistentSearch() throws Exception {
+        controls.add(PersistentSearchRequestControl.newControl(true, false, true, PersistentSearchChangeType.ADD));
+        runToolOnMockedServer("-C", "ps:add:0:1");
+    }
+
+    @Test
+    public void testLdapSearchWithProxyAuthz() throws Exception {
+        controls.add(ProxiedAuthV2RequestControl.newControl("dn: uid=marvin"));
+        runToolOnMockedServer("-Y", "dn: uid=marvin");
+    }
+
+    @Test
+    public void testLdapSearchWithGetEffectiveRightsProxyAuthz() throws Exception {
+        controls.add(GetEffectiveRightsRequestControl.newControl(false, "uid=marvin", "description", "objectclass"));
+        runToolOnMockedServer("-g", "dn: uid=marvin",
+                              "-e", "description",
+                              "-e", "objectclass");
+    }
+
+    @Test
+    public void testLdapSearchWithVLVControl() throws Exception {
+        controls.add(ServerSideSortRequestControl.newControl(false, "sn"));
+        controls.add(VirtualListViewRequestControl.newOffsetControl(true, 10, 2, 1, 3, null));
+        runToolOnMockedServer("-G", "1:3:10:2",
+                              "--sortOrder", "sn");
+    }
+
+    @Test
+    public void testLdapSearchWithMatchedValuesFilter() throws Exception {
+        controls.add(MatchedValuesRequestControl.newControl(true, "uid=user.1*"));
+        runToolOnMockedServer("--matchedValuesFilter", "uid=user.1*");
+    }
+
+    @Test
+    public void testLdapSearchWithSubEntriesControl() throws Exception {
+        controls.add(GenericControl.newControl("1.2.3.4.5.6.7.8", false, "myvalue"));
+        controls.add(SubentriesRequestControl.newControl(true, true));
+        runToolOnMockedServer("-J", "1.2.3.4.5.6.7.8:false:myvalue",
+                              "--subEntries");
+    }
+
+    @Test
+    public void testLdapSearchWithSubEntriesControlDryRun() throws Exception {
+        controls.add(GenericControl.newControl("1.2.3.4.5.6.7.8", false, "myvalue"));
+        controls.add(SubentriesRequestControl.newControl(true, true));
+        runToolOnMockedServer("-J", "1.2.3.4.5.6.7.8:false:myvalue",
+                              "--subEntries",
+                              "-n");
+    }
+
+    @Test
+    public void testLdapSearchWithSimplePaged() throws Exception {
+        controls.add(SimplePagedResultsControl.newControl(true, 10, ByteString.empty()));
+        runToolOnMockedServer("--simplePageSize", "10");
+    }
+
+    @Override
+    int runToolOnMockedServer(final String... additionalArgs) {
+        final int res = runTool(buildArgs().add("-h", server.getHostName())
+                                           .add("-p", server.getPort())
+                                           .add("-D", DIRECTORY_MANAGER)
+                                           .add("-w", "password")
+                                           .add("-b", "ou=people,dc=example,dc=com")
+                                           .add("-a", "find")
+                                           .add("-A")
+                                           .add("-s", "subordinates")
+                                           .add("-l", "120")
+                                           .add("-z", "100")
+                                           .addAll(additionalArgs)
+                                           .addAll("(st=Alabama)", "uid", "objectclass", "description")
+                                           .toArray());
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        return res;
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new LDAPSearch(outStream, errStream);
+    }
+}
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPToolsTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPToolsTestCase.java
new file mode 100644
index 0000000..119303d
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPToolsTestCase.java
@@ -0,0 +1,101 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.ldap.tools.ToolLdapServer.DIRECTORY_MANAGER;
+import static org.fest.assertions.Assertions.assertThat;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.buildArgs;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.forgerock.opendj.ldap.tools.ToolsTestUtils.Args;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.controls.Control;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("javadocs")
+@Test
+abstract class LDAPToolsTestCase extends ToolsTestCase {
+
+    List<Control> controls;
+    ToolLdapServer server;
+
+    @BeforeClass
+    void setUp() throws IOException {
+        server = createFakeServer();
+        server.start();
+    }
+
+    @AfterClass
+    void tearDown() throws IOException {
+        server.stop();
+    }
+
+    @BeforeMethod
+    void initializeTest() {
+        controls = new ArrayList<>();
+    }
+
+    void assertThatControlsHaveBeenSentInRequest(final List<Control> requestControls) {
+        if (!controls.isEmpty()) {
+            int i = 0;
+            assertThat(requestControls.size()).isEqualTo(controls.size());
+            for (final Control requestControl : requestControls) {
+                final Control clientControl = controls.get(i++);
+                assertThat(requestControl.getOID()).isEqualTo(clientControl.getOID());
+                assertThat(requestControl.isCritical()).isEqualTo(clientControl.isCritical());
+                assertThat(requestControl.getValue()).isEqualTo(clientControl.getValue());
+            }
+        }
+    }
+
+    /**
+     * Run this ldap* tool on this mocked server.
+     * Use root user DN and root user password common to the tests.
+     * Other constant arguments should be added by the tool implementation by overriding
+     * {@link LDAPToolsTestCase#toolConstantArguments()}
+     *
+     * @param specificTestArgs
+     *         Arguments specific for a test case.
+     * @return An int which represents the code returned by the ldap* tool
+     */
+    int runToolOnMockedServer(final String... specificTestArgs) {
+        return runToolOnMockedServer(ResultCode.SUCCESS, specificTestArgs);
+    }
+
+    int runToolOnMockedServer(final ResultCode expectedRC, final String... specificTestArgs) {
+        final int res = runTool(buildArgs().add("-h", server.getHostName())
+                                           .add("-p", server.getPort())
+                                           .add("-D", DIRECTORY_MANAGER)
+                                           .add("-w", "password")
+                                           .addAll(toolConstantArguments())
+                                           .addAll(specificTestArgs)
+                                           .toArray());
+        assertThat(res).isEqualTo(expectedRC.intValue());
+        return res;
+    }
+
+    Args toolConstantArguments() {
+        return buildArgs();
+    }
+
+    abstract ToolLdapServer createFakeServer();
+}
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFDiffTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFDiffTestCase.java
new file mode 100644
index 0000000..84e0104
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFDiffTestCase.java
@@ -0,0 +1,214 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ *  Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS;
+import static com.forgerock.opendj.ldap.tools.LDIFDiff.DIFFERENCES_FOUND;
+import static com.forgerock.opendj.ldap.tools.LDIFDiff.NO_DIFFERENCES_FOUND;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_LDIFDIFF_MULTIPLE_USES_OF_STDIN;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededLongArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.calcChecksum;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.fest.assertions.Assertions.assertThat;
+
+import java.io.File;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** A set of test cases for the LDIFDiff tool. */
+@Test
+public class LDIFDiffTestCase extends ToolsTestCase {
+
+    private static final String LDIF_RESOURCES_PATH =
+            Paths.get("src", "test", "resources", "ldifdiff").toAbsolutePath().toString();
+
+    /**
+     * Retrieves sets of invalid arguments that may not be used to initialize the LDAPSearch tool.
+     *
+     * @return Sets of invalid arguments that may not be used to initialize the LDAPSearch tool.
+     */
+    @DataProvider
+    public Object[][] invalidArgs() {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        argLists.add(args());
+        reasonList.add(ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(2));
+
+        addValueNeededShortArgs(argLists, reasonList, "o");
+        addValueNeededLongArgs(argLists, reasonList, "outputLdif");
+
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    /**
+     * Retrieves the names of the files that should be used when testing the
+     * ldifdiff tool.  Each element of the outer array should be an array
+     * containing the following elements:
+     * <OL>
+     * <LI>The path to the source LDIF file</LI>
+     * <LI>The path to the target LDIF file</LI>
+     * <LI>The path to the diff file, or {@code null} if the diff is supposed
+     * to fail</LI>
+     * </OL>
+     */
+    @DataProvider
+    public Object[][] testDataNoDiffs() {
+        return new Object[][] {
+            // Both files are empty.
+            { "source-empty.ldif", "target-empty.ldif" },
+
+            // Both files are the single-entry source.
+            { "source-singleentry.ldif", "source-singleentry.ldif" },
+
+            // Both files are the single-entry target.
+            { "target-singleentry.ldif", "target-singleentry.ldif" },
+
+            // Both files are the multiple-entry source.
+            { "source-multipleentries.ldif", "source-multipleentries.ldif" },
+
+            // Both files are the multiple-entry target.
+            { "target-multipleentries.ldif", "target-multipleentries.ldif" },
+        };
+    }
+
+    @Test(dataProvider = "testDataNoDiffs")
+    public void testLdifDiffWithoutDiffs(final String sourceFileName, final String targetFileName) throws Exception {
+        testLdifDiff(sourceFileName, targetFileName, "diff-nochanges.ldif");
+    }
+
+    /**
+     * Retrieves the names of the files that should be used when testing the
+     * ldifdiff tool.  Each element of the outer array should be an array
+     * containing the following elements:
+     * <OL>
+     * <LI>The path to the source LDIF file</LI>
+     * <LI>The path to the target LDIF file</LI>
+     * <LI>The path to the diff file, or {@code null} if the diff is supposed
+     * to fail</LI>
+     * </OL>
+     */
+    @DataProvider
+    public Object[][] testDataWithDiffs() {
+        return new Object[][] {
+            // The source is empty but the target has a single entry.
+            { "source-empty.ldif", "target-singleentry.ldif", "diff-emptytosingle.ldif" },
+
+            // The source has a single entry but the target is empty.
+            { "source-singleentry.ldif", "target-empty.ldif", "diff-singletoempty.ldif" },
+
+            // Make a change to only a single entry in the source->target direction.
+            { "source-singleentry.ldif", "target-singleentry.ldif", "diff-singleentry.ldif" },
+
+            // Make a change to only a single entry in the target->source direction.
+            { "target-singleentry.ldif", "source-singleentry.ldif", "diff-singleentry-reverse.ldif" },
+
+            // Make changes to multiple entries in the source->target direction.
+            { "source-multipleentries.ldif", "target-multipleentries.ldif", "diff-multipleentries.ldif" },
+
+            // Make changes to multiple entries in the target->source direction.
+            { "target-multipleentries.ldif", "source-multipleentries.ldif", "diff-multipleentries-reverse.ldif" },
+
+            // Go from one entry to multiple in the source->target direction.
+            { "source-singleentry.ldif", "target-multipleentries.ldif", "diff-singletomultiple.ldif" },
+
+            // Go from one entry to multiple in the target->source direction.
+            { "target-singleentry.ldif", "source-multipleentries.ldif", "diff-singletomultiple-reverse.ldif" },
+
+            // Go from multiple entries to one in the source->target direction.
+            { "source-multipleentries.ldif", "target-singleentry.ldif", "diff-multipletosingle.ldif" },
+
+            // Go from multiple entries to one in the target->source direction.
+            { "target-multipleentries.ldif", "source-singleentry.ldif", "diff-multipletosingle-reverse.ldif" }
+        };
+    }
+
+    @Test(dataProvider = "testDataWithDiffs")
+    public void testReconstructWithLdifModify(final String sourceFileName,
+                                              final String targetFileName,
+                                              final String expectedResultFileName) throws Exception {
+        final String ldifDiffResultFilePath = testLdifDiff(sourceFileName, targetFileName, expectedResultFileName);
+
+        final File ldifModifyResultFile = new File(LDIF_RESOURCES_PATH, "ldifDiffAndModifyTestCase.ldif");
+        ldifModifyResultFile.deleteOnExit();
+
+        final int ldifModifyRes = Utils.runTool(new LDIFModify(outStream, errStream),
+                                                "-o", ldifModifyResultFile.getAbsolutePath(),
+                                                absolutePath(sourceFileName),
+                                                ldifDiffResultFilePath);
+        assertThat(ldifModifyRes).isEqualTo(ResultCode.SUCCESS.intValue());
+
+        testLdifDiff(targetFileName, "ldifDiffAndModifyTestCase.ldif", "diff-nochanges.ldif");
+    }
+
+    private String testLdifDiff(final String sourceFileName,
+                                final String targetFileName,
+                                final String expectedResultFileName) throws Exception {
+        final String ldifDiffOutputFilePath = ToolsTestUtils.createTempFile();
+        final int res = runTool("-o", ldifDiffOutputFilePath,
+                                absolutePath(sourceFileName),
+                                absolutePath(targetFileName));
+
+        final boolean expectNoDiffs = expectedResultFileName.equals("diff-nochanges.ldif");
+        assertThat(res).isEqualTo(expectNoDiffs ? NO_DIFFERENCES_FOUND
+                                                : DIFFERENCES_FOUND);
+        assertThat(calcChecksum(ldifDiffOutputFilePath)).isEqualTo(
+                   calcChecksum(absolutePath(expectedResultFileName)));
+
+        return ldifDiffOutputFilePath;
+    }
+
+    @Test
+    public void testLdifDiffWithoutWrapping() throws Exception {
+        final String ldifDiffOutputFilePath = ToolsTestUtils.createTempFile();
+        final int res = runTool("-o", ldifDiffOutputFilePath,
+                                "-t", "0",
+                                absolutePath("source-singleentry.ldif"),
+                                absolutePath("target-multipleentries.ldif"));
+        assertThat(res).isEqualTo(DIFFERENCES_FOUND);
+        assertThat(calcChecksum(ldifDiffOutputFilePath)).isEqualTo(
+                   calcChecksum(absolutePath("diff-singletomultiple-no-wrapping.ldif")));
+    }
+
+    @Test
+    public void testLdifDiffWithBothSourceAndTargetOnStdin() throws Exception {
+        final String ldifDiffOutputFilePath = ToolsTestUtils.createTempFile();
+        final int res = runTool("-o", ldifDiffOutputFilePath,
+                                "--",
+                                "-",
+                                "-");
+        assertThat(res).isEqualTo(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertThat(errOnSingleLine()).contains(ERR_LDIFDIFF_MULTIPLE_USES_OF_STDIN.get().toString());
+    }
+
+    private String absolutePath(final String fileName) {
+        return LDIF_RESOURCES_PATH + File.separator + fileName;
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new LDIFDiff(outStream, errStream);
+    }
+}
+
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFModifyTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFModifyTestCase.java
new file mode 100644
index 0000000..77ec35a
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFModifyTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS;
+import static com.forgerock.opendj.ldap.CoreMessages.ERR_LDIF_NO_DN;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_LDIFMODIFY_MULTIPLE_USES_OF_STDIN;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededLongArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.buildArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.calcChecksum;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.fest.assertions.Assertions.assertThat;
+
+import java.io.File;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("javadoc")
+@Test
+public class LDIFModifyTestCase extends ToolsTestCase {
+
+    private static final String LDIF_RESOURCES_PATH =
+            Paths.get("src", "test", "resources", "ldifmodify").toAbsolutePath().toString();
+
+    /**
+     * Retrieves sets of invalid arguments that may not be used to initialize the LDAPSearch tool.
+     *
+     * @return Sets of invalid arguments that may not be used to initialize the LDAPSearch tool.
+     */
+    @DataProvider
+    public Object[][] invalidArgs() {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        argLists.add(args());
+        reasonList.add(ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(1));
+
+        addValueNeededShortArgs(argLists, reasonList, "o");
+        addValueNeededLongArgs(argLists, reasonList, "outputLdif");
+
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @Test
+    public void testSimpleLdifModifyWithMultipleChangeFiles() throws Exception {
+        final String ldifModifyOutputFilePath = ToolsTestUtils.createTempFile();
+        final int res = runTool(buildArgs().add("-o", ldifModifyOutputFilePath)
+                                           .add(absolutePath("source.ldif"))
+                                           .add(absolutePath("modifications_part_1.ldif"))
+                                           .add(absolutePath("modifications_part_2.ldif"))
+                                           .add(absolutePath("modifications_part_3.ldif"))
+                                           .toArray());
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        assertThat(calcChecksum(absolutePath("expected-no-wrapping.ldif"))).isEqualTo(
+                   calcChecksum(ldifModifyOutputFilePath));
+    }
+
+    @Test
+    public void testSimpleLdifModifyWithWrapping() throws Exception {
+        testSimpleLdifModify(ResultCode.SUCCESS, "modifications.ldif", "expected.ldif", "-t", "80");
+    }
+
+    @Test
+    public void testLdifModifyWithBothSourceAndChangesOnStdin() throws Exception {
+        final String ldifDiffOutputFilePath = ToolsTestUtils.createTempFile();
+        final int res = runTool("-o", ldifDiffOutputFilePath,
+                                "--",
+                                "-",
+                                "-");
+        assertThat(res).isEqualTo(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertThat(errOnSingleLine()).contains(ERR_LDIFMODIFY_MULTIPLE_USES_OF_STDIN.get().toString());
+    }
+
+    @Test
+    public void testSimpleLdifModifyWithoutWrapping() throws Exception {
+        testSimpleLdifModify(ResultCode.SUCCESS, "modifications.ldif", "expected-no-wrapping.ldif", "-t", "0");
+    }
+
+    @Test
+    public void testSimpleLdifModifyWithErrorInModifications() throws Exception {
+        testSimpleLdifModify(ResultCode.CLIENT_SIDE_LOCAL_ERROR, "modifications-with-error.ldif", "Not Applicable");
+    }
+
+    @Test
+    public void testSimpleLdifModifyWithContinueOnError() throws Exception {
+        testSimpleLdifModify(ResultCode.SUCCESS,
+                             "modifications-with-error.ldif",
+                             "expected-continue-on-error.ldif",
+                             "-c");
+    }
+
+    @Test
+    public void testSimpleLdifModifyWithIncorrectLdifModifications() throws Exception {
+        testSimpleLdifModify(ResultCode.CLIENT_SIDE_LOCAL_ERROR, "modifications-invalid.ldif", "Not Applicable");
+        assertThat(errOnSingleLine()).contains(ERR_LDIF_NO_DN.get(1, "changetype: modify").toString());
+        assertThat(out.toString()).isEmpty();
+    }
+
+    private void testSimpleLdifModify(final ResultCode expectedRC,
+                                      final String modificationsFileName,
+                                      final String expectedOutputFileName,
+                                      final String... additionalArgs) throws Exception {
+        final String ldifModifyOutputFilePath = ToolsTestUtils.createTempFile();
+        final int res = runTool(buildArgs().add("-o", ldifModifyOutputFilePath)
+                                           .addAll(additionalArgs)
+                                           .add(absolutePath("source.ldif"))
+                                           .add(absolutePath(modificationsFileName))
+                                           .toArray());
+        assertThat(res).isEqualTo(expectedRC.intValue());
+        if (expectedRC == ResultCode.SUCCESS) {
+            assertThat(calcChecksum(absolutePath(expectedOutputFileName))).isEqualTo(
+                       calcChecksum(ldifModifyOutputFilePath));
+        }
+    }
+
+    private String absolutePath(final String fileName) {
+        return LDIF_RESOURCES_PATH + File.separator + fileName;
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new LDIFModify(outStream, errStream);
+    }
+}
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFSearchTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFSearchTestCase.java
new file mode 100644
index 0000000..afef3fe
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDIFSearchTestCase.java
@@ -0,0 +1,224 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ *  Copyright 2016 ForgeRock AS.
+ */
+
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededLongArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.addValueNeededShortArgs;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.args;
+import static com.forgerock.opendj.ldap.tools.ToolsTestUtils.toDataProviderArray;
+import static org.fest.assertions.Assertions.assertThat;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.Attribute;
+import org.forgerock.opendj.ldap.Entry;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.TestCaseUtils;
+import org.forgerock.opendj.ldif.LDIFEntryReader;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** LDIFSearch test cases. */
+@SuppressWarnings("javadoc")
+@Test
+public class LDIFSearchTestCase extends ToolsTestCase {
+
+    private String ldifSearchSourceFilePath;
+    private String ldifSearchOutputFilePath;
+
+    @BeforeClass
+    private void setUp() throws Exception {
+        ldifSearchSourceFilePath = Paths.get("src", "test", "resources", "ldifsearch.ldif").toAbsolutePath().toString();
+        ldifSearchOutputFilePath = TestCaseUtils.createTempFile();
+    }
+
+    /**
+     * Retrieves sets of invalid arguments that may not be used to initialize the LDAPSearch tool.
+     *
+     * @return Sets of invalid arguments that may not be used to initialize the LDAPSearch tool.
+     */
+    @DataProvider(name = "invalidArgs")
+    public Object[][] getInvalidArgumentLists() {
+        final List<List<String>> argLists = new ArrayList<>();
+        final List<LocalizableMessage> reasonList = new ArrayList<>();
+
+        argLists.add(args());
+        reasonList.add(ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS.get(2));
+
+        addValueNeededShortArgs(argLists, reasonList, "b", "l", "s", "z");
+        addValueNeededLongArgs(argLists, reasonList, "baseDN", "timeLimit", "outputLDIF", "searchScope", "sizeLimit");
+
+        return toDataProviderArray(argLists, reasonList);
+    }
+
+    @Test
+    public void testLDIFSearchStarOps() throws Exception {
+        final int res = runTool("-b", "ou=ldifsearch,o=unit tests,dc=example,dc=com",
+                                "-o", ldifSearchOutputFilePath,
+                                ldifSearchSourceFilePath,
+                                "(objectclass=*)",
+                                "*", "+");
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        try (final LDIFEntryReader reader = new LDIFEntryReader(new FileReader(ldifSearchOutputFilePath))) {
+            while (reader.hasNext()) {
+                assertThat(reader.readEntry().getAllAttributes("objectclass")).isNotEmpty();
+            }
+        }
+    }
+
+    @Test
+    public void testLDIFSearchOperationalAttributesOnly() throws Exception {
+        final int res = runTool("-b", "ou=ldifsearch,o=unit tests,dc=example,dc=com",
+                                "-o", ldifSearchOutputFilePath,
+                                "-s", "sub",
+                                ldifSearchSourceFilePath,
+                                "(objectclass=*)",
+                                "+");
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        try (final LDIFEntryReader reader = new LDIFEntryReader(new FileReader(ldifSearchOutputFilePath))) {
+            while (reader.hasNext()) {
+                assertThat(reader.readEntry().getAllAttributes("objectclass")).isEmpty();
+            }
+        }
+    }
+
+    @Test
+    public void testLDIFSearchUserAndOperationalAttributes() throws Exception {
+        final int res = runTool("-b", "ou=ldifsearch,o=unit tests,dc=example,dc=com",
+                                "-o", ldifSearchOutputFilePath,
+                                "-s", "subordinates",
+                                ldifSearchSourceFilePath,
+                                "(objectclass=*)",
+                                "+", "mail", "uid");
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        try (final LDIFEntryReader reader = new LDIFEntryReader(new FileReader(ldifSearchOutputFilePath))) {
+            while (reader.hasNext()) {
+                final Entry e = reader.readEntry();
+                assertThat(e.getAllAttributes("objectclass")).isEmpty();
+                assertThat(e.getAllAttributes("mail")).isNotEmpty();
+                assertThat(e.getAllAttributes("uid")).isNotEmpty();
+            }
+        }
+    }
+
+    @Test
+    public void testLDIFSearchAttrsOnly() throws Exception {
+        final int res = runTool("-b", "ou=ldifsearch,o=unit tests,dc=example,dc=com",
+                                "-o", ldifSearchOutputFilePath,
+                                "-s", "subordinates",
+                                "-A",
+                                ldifSearchSourceFilePath,
+                                "(objectclass=*)",
+                                "mail");
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        try (final LDIFEntryReader reader = new LDIFEntryReader(new FileReader(ldifSearchOutputFilePath))) {
+            while (reader.hasNext()) {
+                final Entry e = reader.readEntry();
+                assertThat(e.getAllAttributes("objectclass")).isEmpty();
+                final Iterable<Attribute> mails = e.getAllAttributes("mail");
+                assertThat(mails).isNotEmpty();
+                for (final Attribute mail : mails) {
+                    assertThat(mail.firstValueAsString()).isEmpty();
+                }
+            }
+        }
+    }
+
+    @Test
+    public void testLDIFSearchSizeLimit() throws Exception {
+        final int res = runTool("-b", "ou=ldifsearch,o=unit tests,dc=example,dc=com",
+                                "-o", ldifSearchOutputFilePath,
+                                "-s", "subordinates",
+                                "-z", "10",
+                                ldifSearchSourceFilePath,
+                                "(objectclass=*)",
+                                "mail", "uid", "initials");
+        assertThat(res).isEqualTo(ResultCode.SIZE_LIMIT_EXCEEDED.intValue());
+        int nbEntriesRead = 0;
+        try (final LDIFEntryReader reader = new LDIFEntryReader(new FileReader(ldifSearchOutputFilePath))) {
+            while (reader.hasNext()) {
+                nbEntriesRead++;
+                final Entry e = reader.readEntry();
+                assertThat(e.getAllAttributes("mail")).isNotEmpty();
+                assertThat(e.getAllAttributes("initials")).isNotEmpty();
+                assertThat(e.getAllAttributes("cn")).isEmpty();
+            }
+        }
+        assertThat(nbEntriesRead).isEqualTo(10);
+    }
+
+    @Test
+    public void testLDIFSearchWrapping() throws Exception {
+        final int res = runTool("-b", "ou=ldifsearch,o=unit tests,dc=example,dc=com",
+                                "-o", ldifSearchOutputFilePath,
+                                "-t", "80",
+                                ldifSearchSourceFilePath,
+                                "(uid=user.1)",
+                                "mail", "uid", "description");
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        assertThatUser1DescriptionIsReadable();
+        assertThat(countLdifSearchOutputFileLines()).isEqualTo(7);
+    }
+
+    @Test
+    public void testLDIFSearchNoWrapping() throws Exception {
+        final int res = runTool("-b", "ou=ldifsearch,o=unit tests,dc=example,dc=com",
+                                "-o", ldifSearchOutputFilePath,
+                                ldifSearchSourceFilePath,
+                                "(uid=user.1)",
+                                "mail", "uid", "description");
+        assertThat(res).isEqualTo(ResultCode.SUCCESS.intValue());
+        assertThatUser1DescriptionIsReadable();
+        assertThat(countLdifSearchOutputFileLines()).isEqualTo(5);
+    }
+
+    private int countLdifSearchOutputFileLines() throws Exception {
+        try (final BufferedReader reader = new BufferedReader(new FileReader(ldifSearchOutputFilePath))) {
+            int nbLines = 0;
+            while (reader.readLine() != null) {
+                nbLines++;
+            }
+            return nbLines;
+        }
+    }
+
+    private void assertThatUser1DescriptionIsReadable() throws Exception {
+        try (final LDIFEntryReader reader = new LDIFEntryReader(new FileReader(ldifSearchOutputFilePath))) {
+            final Entry e = reader.readEntry();
+            assertThat(e.getAllAttributes("mail")).isNotEmpty();
+            assertThat(e.getAllAttributes("uid")).isNotEmpty();
+            final Iterable<Attribute> descriptions = e.getAllAttributes("description");
+            assertThat(descriptions).isNotEmpty();
+            for (final Attribute desc : descriptions) {
+                assertThat(desc.firstValueAsString()).endsWith("to not wrap is specified.");
+            }
+            assertThat(reader.hasNext()).isFalse();
+        }
+    }
+
+    @Override
+    ToolConsoleApplication createInstance() {
+        return new LDIFSearch(outStream, errStream);
+    }
+}
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java
index 4e185cb..49715aa 100644
--- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java
@@ -15,6 +15,7 @@
  */
 package com.forgerock.opendj.ldap.tools;
 
+import static com.forgerock.opendj.ldap.tools.Utils.runTool;
 import static org.fest.assertions.Assertions.*;
 import static org.forgerock.util.Utils.*;
 import static com.forgerock.opendj.ldap.CoreMessages.*;
@@ -105,22 +106,22 @@
     @Test(dataProvider = "validArguments")
     public void testMakeLDIFValidUseCases(final String[] arguments, final LocalizableMessage expectedOut)
             throws Exception {
-        run(arguments, SUCCESS, expectedOut);
+        run(arguments, SUCCESS, expectedOut, "");
     }
 
     @Test(dataProvider = "invalidArguments")
     public void testMakeLDIFInvalidUseCases(final String[] arguments, final LocalizableMessage expectedErr)
             throws Exception {
-        run(arguments, FAILURE, expectedErr);
+        run(arguments, FAILURE, "", expectedErr);
     }
 
     /** See OPENDJ-2505 */
     @Test
     public void testMakeLDIFInvalidLineFolding() throws Exception {
-        final LocalizableMessage expectedOutput = ERR_LDIF_GEN_TOOL_EXCEPTION_DURING_PARSE.get(
+        final LocalizableMessage expectedErr = ERR_LDIF_GEN_TOOL_EXCEPTION_DURING_PARSE.get(
                 ERR_TEMPLATE_FILE_INVALID_LEADING_SPACE.get(
                         27, " \"lineFoldingTest\":\\[\"This line should not be accepted by the parser\"\\],"));
-        run(args("src/test/resources/invalid_test_template.ldif"), FAILURE, expectedOutput);
+        run(args("src/test/resources/invalid_test_template.ldif"), FAILURE, "", expectedErr);
     }
 
     /** See OPENDJ-2505 */
@@ -130,7 +131,9 @@
         run(args("-o", tempOutputFile.toString(),
                  "-t", "80",
                  VALID_TEMPLATE_FILE_PATH),
-                SUCCESS, INFO_MAKELDIF_PROCESSING_COMPLETE.get(2));
+            SUCCESS,
+            INFO_MAKELDIF_PROCESSING_COMPLETE.get(2),
+            "");
         assertFilesAreEquals(TEMP_OUTPUT_FILE, "expected_output_80_column.ldif");
         Files.delete(tempOutputFile);
     }
@@ -139,8 +142,12 @@
     @Test
     public void testMakeLDIFSupportsLineFoldingAndLineWrapping() throws Exception {
         final Path tempOutputFile = Paths.get(TEST_RESOURCE_PATH, TEMP_OUTPUT_FILE);
-        run(args("-o", tempOutputFile.toString(), "-t", "0", VALID_TEMPLATE_FILE_PATH),
-                SUCCESS, INFO_MAKELDIF_PROCESSING_COMPLETE.get(2));
+        run(args("-o", tempOutputFile.toString(),
+                 "-t", "0",
+                 VALID_TEMPLATE_FILE_PATH),
+            SUCCESS,
+            INFO_MAKELDIF_PROCESSING_COMPLETE.get(2),
+            "");
         assertFilesAreEquals(TEMP_OUTPUT_FILE, "expected_output.ldif");
         Files.delete(tempOutputFile);
     }
@@ -150,10 +157,12 @@
                    Files.readAllBytes(Paths.get(TEST_RESOURCE_PATH, expectedOutputFileName)));
     }
 
-    private void run(final String[] arguments, final boolean expectsSuccess, final LocalizableMessage expectedOutput)
-            throws Exception {
-        final int retCode = MakeLDIF.run(outStream, errStream, arguments);
-        checkOuputStreams(out, err, expectedOutput, "");
+    private void run(final String[] arguments,
+                     final boolean expectsSuccess,
+                     final Object expectedOutput,
+                     final Object expectedErr) throws Exception {
+        final int retCode = runTool(new MakeLDIF(outStream, errStream), arguments);
+        checkOuputStreams(out, err, expectedOutput, expectedErr);
         if (expectsSuccess) {
             assertThat(retCode).isEqualTo(0);
         } else {
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolLdapServer.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolLdapServer.java
new file mode 100644
index 0000000..7e49c4a
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolLdapServer.java
@@ -0,0 +1,170 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ * Copyright 2016 ForgeRock AS.
+ */
+package com.forgerock.opendj.ldap.tools;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.forgerock.opendj.ldap.TestCaseUtils.findFreeSocketAddress;
+
+import java.io.IOException;
+
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
+import org.forgerock.opendj.ldap.LDAPClientContext;
+import org.forgerock.opendj.ldap.LDAPListener;
+import org.forgerock.opendj.ldap.LdapException;
+import org.forgerock.opendj.ldap.LdapResultHandler;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.SearchResultHandler;
+import org.forgerock.opendj.ldap.ServerConnection;
+import org.forgerock.opendj.ldap.ServerConnectionFactory;
+import org.forgerock.opendj.ldap.requests.AbandonRequest;
+import org.forgerock.opendj.ldap.requests.AddRequest;
+import org.forgerock.opendj.ldap.requests.BindRequest;
+import org.forgerock.opendj.ldap.requests.CompareRequest;
+import org.forgerock.opendj.ldap.requests.DeleteRequest;
+import org.forgerock.opendj.ldap.requests.ExtendedRequest;
+import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
+import org.forgerock.opendj.ldap.requests.ModifyRequest;
+import org.forgerock.opendj.ldap.requests.SearchRequest;
+import org.forgerock.opendj.ldap.requests.UnbindRequest;
+import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.opendj.ldap.responses.CompareResult;
+import org.forgerock.opendj.ldap.responses.ExtendedResult;
+import org.forgerock.opendj.ldap.responses.Responses;
+import org.forgerock.opendj.ldap.responses.Result;
+
+/** Mocked request handler sketelon for tools test cases. */
+class ToolLdapServer implements ServerConnectionFactory<LDAPClientContext, Integer> {
+
+    static final String DIRECTORY_MANAGER = "cn=Directory Manager";
+
+    static class ToolLdapServerConnection implements ServerConnection<Integer> {
+
+        @Override
+        public void handleAbandon(final Integer requestContext, final AbandonRequest request) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleBind(final Integer requestContext,
+                               final int version,
+                               final BindRequest request,
+                               final IntermediateResponseHandler intermediateResponseHandler,
+                               final LdapResultHandler<BindResult> resultHandler) {
+            assertThat(request.getName()).isEqualTo(DIRECTORY_MANAGER);
+            resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS));
+        }
+
+        @Override
+        public void handleConnectionClosed(final Integer requestContext, final UnbindRequest request) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleConnectionDisconnected(final ResultCode resultCode, final String message) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleConnectionError(final Throwable error) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleAdd(final Integer requestContext,
+                              final AddRequest request,
+                              final IntermediateResponseHandler intermediateResponseHandler,
+                              final LdapResultHandler<Result> resultHandler) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleCompare(final Integer requestContext,
+                                  final CompareRequest request,
+                                  final IntermediateResponseHandler intermediateResponseHandler,
+                                  final LdapResultHandler<CompareResult> resultHandler) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleDelete(final Integer requestContext,
+                                 final DeleteRequest request,
+                                 final IntermediateResponseHandler intermediateResponseHandler,
+                                 final LdapResultHandler<Result> resultHandler) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public <R extends ExtendedResult> void handleExtendedRequest(final Integer requestContext,
+                                                                     final ExtendedRequest<R> request,
+                                                                     final IntermediateResponseHandler responseHandler,
+                                                                     final LdapResultHandler<R> resultHandler) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleModify(final Integer requestContext,
+                                 final ModifyRequest request,
+                                 final IntermediateResponseHandler intermediateResponseHandler,
+                                 final LdapResultHandler<Result> resultHandler) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleModifyDN(final Integer requestContext,
+                                   final ModifyDNRequest request,
+                                   final IntermediateResponseHandler intermediateResponseHandler,
+                                   final LdapResultHandler<Result> resultHandler) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+
+        @Override
+        public void handleSearch(final Integer requestContext,
+                                 final SearchRequest request,
+                                 final IntermediateResponseHandler intermediateResponseHandler,
+                                 final SearchResultHandler entryHandler,
+                                 final LdapResultHandler<Result> resultHandler) {
+            throw new UnsupportedOperationException("This method should not have been called in the test.");
+        }
+    }
+
+    private LDAPListener listener;
+
+    @Override
+    public ServerConnection<Integer> handleAccept(final LDAPClientContext clientContext) throws LdapException {
+        return newServerConnection();
+    }
+
+    /** Must be overriding by client code. */
+    ToolLdapServerConnection newServerConnection() {
+        return new ToolLdapServerConnection();
+    }
+
+    void start() throws IOException {
+        listener = new LDAPListener(findFreeSocketAddress(), this);
+    }
+
+    void stop() {
+        listener.close();
+    }
+
+    String getHostName() {
+        return listener.getSocketAddress().getHostName();
+    }
+
+    String getPort() {
+        return Integer.toString(listener.getSocketAddress().getPort());
+    }
+}
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java
index 2ea2c2e..eb7045f 100644
--- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java
@@ -12,19 +12,79 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2010 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2016 ForgeRock AS.
  */
 
 package com.forgerock.opendj.ldap.tools;
 
+import static org.fest.assertions.Assertions.assertThat;
+import static org.forgerock.util.Utils.closeSilently;
+
+import java.io.PrintStream;
+
+import org.forgerock.opendj.ldap.ByteStringBuilder;
+import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.testng.ForgeRockTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 /**
  * An abstract class that all tools unit tests should extend. A tool represents
  * the classes found directly under the package com.forgerock.opendj.ldap.tools.
  */
-
-@Test(groups = { "precommit", "tools", "sdk" })
+@Test
 public abstract class ToolsTestCase extends ForgeRockTestCase {
+
+    ByteStringBuilder out;
+    ByteStringBuilder err;
+    PrintStream outStream;
+    PrintStream errStream;
+
+    @BeforeMethod
+    void refreshStream() {
+        out = new ByteStringBuilder();
+        err = new ByteStringBuilder();
+        outStream = new PrintStream(out.asOutputStream());
+        errStream = new PrintStream(err.asOutputStream());
+    }
+
+    @AfterMethod
+    void closeStream() {
+        closeSilently(outStream, errStream);
+    }
+
+    /**
+     * Tests the LDAPSearch tool with sets of invalid arguments.
+     *
+     * @param args
+     *         The set of arguments to use for the LDAPDelete tool.
+     * @param invalidReason
+     *         The reason the provided set of arguments is invalid.
+     */
+    @Test(dataProvider = "invalidArgs")
+    public void testInvalidArguments(String[] args, String invalidReason) throws Exception {
+        assertThat(runTool(args)).isEqualTo(ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue());
+        assertThat(errOnSingleLine()).contains(invalidReason);
+        assertThat(out.toString()).isEmpty();
+    }
+
+    /** Tests the LDAPSearch tool with the "--help" option. */
+    @Test
+    public void testHelp() throws Exception {
+        final int success = ResultCode.SUCCESS.intValue();
+        assertThat(runTool("--help")).isEqualTo(success);
+        assertThat(runTool("-H")).isEqualTo(success);
+        assertThat(runTool("-?")).isEqualTo(success);
+    }
+
+    String errOnSingleLine() {
+        return err.toString().replace(System.lineSeparator(), " ");
+    }
+
+    int runTool(final String... args) {
+        return Utils.runTool(createInstance(), args);
+    }
+
+    abstract ToolConsoleApplication createInstance();
 }
diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestUtils.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestUtils.java
new file mode 100644
index 0000000..fc34bba
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestUtils.java
@@ -0,0 +1,140 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
+ *
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
+ *
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
+ *
+ *  Copyright 2016 ForgeRock AS.
+ */
+
+package com.forgerock.opendj.ldap.tools;
+
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID;
+import static com.forgerock.opendj.cli.CliMessages.ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_SHORT_ID;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.forgerock.i18n.LocalizableMessage;
+
+/** Useful set of methods to manage tools unit tests. **/
+@SuppressWarnings("javadoc")
+class ToolsTestUtils {
+    static Args buildArgs() {
+        return new Args();
+    }
+
+    /** Helper class to represent arguments for command-line programs. */
+    static class Args {
+        private final List<String> args = new ArrayList<>();
+
+        Args add(String arg) {
+            args.add(arg);
+            return this;
+        }
+
+        Args add(String arg, Object value) {
+            args.add(arg);
+            args.add(value.toString());
+            return this;
+        }
+
+        Args addAll(String... args) {
+            this.args.addAll(Arrays.asList(args));
+            return this;
+        }
+
+        Args addAll(final Args args) {
+            this.args.addAll(Arrays.asList(args.toArray()));
+            return this;
+        }
+
+        String[] toArray() {
+            return args.toArray(new String[args.size()]);
+        }
+
+        @Override
+        public String toString() {
+            return args.toString();
+        }
+    }
+
+
+    static List<String> args(final String... arguments) {
+        return Arrays.asList(arguments);
+    }
+
+    static void addValueNeededShortArgs(
+            final List<List<String>> argsList, final List<LocalizableMessage> reasonList, final String... args) {
+        testValueNeededArg(argsList, reasonList, "-", args);
+    }
+
+    static void addValueNeededLongArgs(
+            final List<List<String>> argsList, final List<LocalizableMessage> reasonList, final String... args) {
+        testValueNeededArg(argsList, reasonList, "--", args);
+    }
+
+    private static void testValueNeededArg(final List<List<String>> argsList,
+                                           final List<LocalizableMessage> reasonList,
+                                           final String prefix,
+                                           final String[] argIDs) {
+        for (final String argID : argIDs) {
+            argsList.add(args(prefix + argID));
+            reasonList.add(prefix.equals("--")
+                                           ? ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID.get(argID)
+                                           : ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_SHORT_ID.get(argID));
+        }
+    }
+
+    static Object[][] toDataProviderArray(final List<List<String>> argLists,
+                                          final List<LocalizableMessage> reasonList) {
+        final Object[][] array = new Object[argLists.size()][2];
+        for (int i = 0; i < argLists.size(); i++) {
+            final List<String> args = argLists.get(i);
+            array[i][0] = args.toArray(new String[args.size()]);
+            array[i][1] = reasonList.get(i).toString();
+        }
+        return array;
+    }
+
+    static String createTempFile(final String... lines) throws Exception {
+        final File f = File.createTempFile("ToolsTestUtils", ".txt");
+        f.deleteOnExit();
+
+        if (lines.length > 0) {
+            final StringBuilder builder = new StringBuilder();
+            for (final String line : lines) {
+                builder.append(line).append(System.lineSeparator());
+            }
+
+            try (final FileOutputStream fos = new FileOutputStream(f.getPath())) {
+                fos.write(builder.toString().getBytes());
+            }
+        }
+        return f.getAbsolutePath();
+    }
+
+    /** Calculates the checksum of a file. */
+    static long calcChecksum(final String filePath) throws Exception {
+        long checksum = 0L;
+        try (final BufferedReader reader = new BufferedReader(new FileReader(new File(filePath)))) {
+            String line;
+            while ((line = reader.readLine()) != null) {
+                checksum += line.hashCode();
+            }
+        }
+        return checksum;
+    }
+}
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-emptytosingle.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-emptytosingle.ldif
similarity index 98%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-emptytosingle.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-emptytosingle.ldif
index 73edf02..aeb9b6b 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-emptytosingle.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-emptytosingle.ldif
@@ -4,4 +4,3 @@
 objectClass: domain
 dc: example
 description: test
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-ignore-attributes.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-ignore-attributes.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-ignore-attributes.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-ignore-attributes.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-ignore-entries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-ignore-entries.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-ignore-entries.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-ignore-entries.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-reverse-singlevalue.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-reverse-singlevalue.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-reverse-singlevalue.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-reverse-singlevalue.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-reverse.ldif
similarity index 76%
copy from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif
copy to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-reverse.ldif
index 8b48b71..84c60c4 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-reverse.ldif
@@ -1,42 +1,47 @@
 dn: dc=example,dc=com
 changetype: modify
 delete: objectClass
-objectClass: domain
--
-add: objectClass
 objectClass: organization
 objectClass: dcObject
 -
-add: o
-o: Example Corp.
+add: objectClass
+objectClass: domain
 -
-add: description
+delete: description
 description: description 1
 description: description 2
 description: description 3
+-
+delete: o
+o: Example Corp.
+-
 
 dn: ou=Applications,dc=example,dc=com
+changetype: delete
+
+dn: ou=Groups,dc=example,dc=com
 changetype: add
 objectClass: top
 objectClass: organizationalUnit
-ou: Applications
+ou: Groups
 
 dn: ou=People,dc=example,dc=com
-changetype: add
-objectClass: top
-objectClass: organizationalUnit
-ou: People
+changetype: modify
+delete: description
 description: This is where you put the people
+-
 
 dn: cn=Test User,ou=People,dc=example,dc=com
+changetype: delete
+
+dn: uid=test.user,ou=People,dc=example,dc=com
 changetype: add
-objectClass: inetOrgPerson
-objectClass: person
 objectClass: top
+objectClass: person
 objectClass: organizationalPerson
-cn: Test User
+objectClass: inetOrgPerson
+uid: test.user
 givenName: Test
 sn: User
-uid: test.user
+cn: Test User
 userPassword: password
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-singlevalue.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-singlevalue.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-singlevalue.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries-singlevalue.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries.ldif
similarity index 76%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries.ldif
index 1b6b331..a5a55ff 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipleentries.ldif
@@ -7,13 +7,14 @@
 objectClass: organization
 objectClass: dcObject
 -
-add: o
-o: Example Corp.
--
 add: description
 description: description 1
 description: description 2
 description: description 3
+-
+add: o
+o: Example Corp.
+-
 
 dn: ou=Applications,dc=example,dc=com
 changetype: add
@@ -23,36 +24,25 @@
 
 dn: ou=Groups,dc=example,dc=com
 changetype: delete
-# objectClass: top
-# objectClass: organizationalUnit
-# ou: Groups
 
 dn: ou=People,dc=example,dc=com
 changetype: modify
 add: description
 description: This is where you put the people
+-
 
 dn: cn=Test User,ou=People,dc=example,dc=com
 changetype: add
-objectClass: inetOrgPerson
-objectClass: person
 objectClass: top
+objectClass: person
 objectClass: organizationalPerson
-cn: Test User
+objectClass: inetOrgPerson
+uid: test.user
 givenName: Test
 sn: User
-uid: test.user
+cn: Test User
 userPassword: password
+description: This is a very long description used to test that the ldif tools manage to deal with ldif wrapping standards.
 
 dn: uid=test.user,ou=People,dc=example,dc=com
 changetype: delete
-# objectClass: inetOrgPerson
-# objectClass: person
-# objectClass: top
-# objectClass: organizationalPerson
-# cn: Test User
-# givenName: Test
-# sn: User
-# uid: test.user
-# userPassword: password
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipletosingle-reverse-singlevalue.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle-reverse-singlevalue.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipletosingle-reverse-singlevalue.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle-reverse-singlevalue.ldif
diff --git a/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle-reverse.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle-reverse.ldif
new file mode 100644
index 0000000..aa80c333
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle-reverse.ldif
@@ -0,0 +1,26 @@
+dn: dc=example,dc=com
+changetype: modify
+delete: objectClass
+objectClass: organization
+objectClass: dcObject
+-
+add: objectClass
+objectClass: domain
+-
+delete: description
+description: description 1
+description: description 2
+description: description 3
+-
+delete: o
+o: Example Corp.
+-
+
+dn: ou=Applications,dc=example,dc=com
+changetype: delete
+
+dn: ou=People,dc=example,dc=com
+changetype: delete
+
+dn: cn=Test User,ou=People,dc=example,dc=com
+changetype: delete
diff --git a/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle.ldif
new file mode 100644
index 0000000..4b209a9
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-multipletosingle.ldif
@@ -0,0 +1,14 @@
+dn: dc=example,dc=com
+changetype: modify
+add: description
+description: test
+-
+
+dn: ou=Groups,dc=example,dc=com
+changetype: delete
+
+dn: ou=People,dc=example,dc=com
+changetype: delete
+
+dn: uid=test.user,ou=People,dc=example,dc=com
+changetype: delete
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-nochanges.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-nochanges.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-nochanges.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-nochanges.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singleentry-reverse.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singleentry-reverse.ldif
similarity index 97%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singleentry-reverse.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singleentry-reverse.ldif
index 4959671..a1b77b9 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singleentry-reverse.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singleentry-reverse.ldif
@@ -2,4 +2,4 @@
 changetype: modify
 delete: description
 description: test
-
+-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singleentry.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singleentry.ldif
similarity index 96%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singleentry.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singleentry.ldif
index 3cb38ff..a112416 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singleentry.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singleentry.ldif
@@ -2,4 +2,4 @@
 changetype: modify
 add: description
 description: test
-
+-
diff --git a/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletoempty.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletoempty.ldif
new file mode 100644
index 0000000..1bc2c5a
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletoempty.ldif
@@ -0,0 +1,2 @@
+dn: dc=example,dc=com
+changetype: delete
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-no-wrapping.ldif
similarity index 85%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-no-wrapping.ldif
index 8b48b71..d66e490 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-no-wrapping.ldif
@@ -7,13 +7,14 @@
 objectClass: organization
 objectClass: dcObject
 -
-add: o
-o: Example Corp.
--
 add: description
 description: description 1
 description: description 2
 description: description 3
+-
+add: o
+o: Example Corp.
+-
 
 dn: ou=Applications,dc=example,dc=com
 changetype: add
@@ -30,13 +31,13 @@
 
 dn: cn=Test User,ou=People,dc=example,dc=com
 changetype: add
-objectClass: inetOrgPerson
-objectClass: person
 objectClass: top
+objectClass: person
 objectClass: organizationalPerson
-cn: Test User
+objectClass: inetOrgPerson
+uid: test.user
 givenName: Test
 sn: User
-uid: test.user
+cn: Test User
 userPassword: password
-
+description: This is a very long description used to test that the ldif tools manage to deal with ldif wrapping standards.
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple-reverse.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-reverse.ldif
similarity index 99%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple-reverse.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-reverse.ldif
index 571916a..39e8a96 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple-reverse.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-reverse.ldif
@@ -2,6 +2,7 @@
 changetype: modify
 delete: description
 description: test
+-
 
 dn: ou=Groups,dc=example,dc=com
 changetype: add
@@ -17,13 +18,12 @@
 
 dn: uid=test.user,ou=People,dc=example,dc=com
 changetype: add
-objectClass: inetOrgPerson
-objectClass: person
 objectClass: top
+objectClass: person
 objectClass: organizationalPerson
-cn: Test User
+objectClass: inetOrgPerson
+uid: test.user
 givenName: Test
 sn: User
-uid: test.user
+cn: Test User
 userPassword: password
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple-singlevalue.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-singlevalue.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple-singlevalue.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple-singlevalue.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple.ldif
similarity index 85%
copy from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif
copy to opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple.ldif
index 8b48b71..d66e490 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletomultiple.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/diff-singletomultiple.ldif
@@ -7,13 +7,14 @@
 objectClass: organization
 objectClass: dcObject
 -
-add: o
-o: Example Corp.
--
 add: description
 description: description 1
 description: description 2
 description: description 3
+-
+add: o
+o: Example Corp.
+-
 
 dn: ou=Applications,dc=example,dc=com
 changetype: add
@@ -30,13 +31,13 @@
 
 dn: cn=Test User,ou=People,dc=example,dc=com
 changetype: add
-objectClass: inetOrgPerson
-objectClass: person
 objectClass: top
+objectClass: person
 objectClass: organizationalPerson
-cn: Test User
+objectClass: inetOrgPerson
+uid: test.user
 givenName: Test
 sn: User
-uid: test.user
+cn: Test User
 userPassword: password
-
+description: This is a very long description used to test that the ldif tools manage to deal with ldif wrapping standards.
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/ignore-attributes b/opendj-ldap-toolkit/src/test/resources/ldifdiff/ignore-attributes
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/ignore-attributes
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/ignore-attributes
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/ignore-entries b/opendj-ldap-toolkit/src/test/resources/ldifdiff/ignore-entries
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/ignore-entries
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/ignore-entries
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/source-empty.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/source-empty.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/source-empty.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/source-empty.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/source-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/source-multipleentries.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/source-multipleentries.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/source-multipleentries.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/source-singleentry.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/source-singleentry.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/source-singleentry.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/source-singleentry.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-empty.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/target-empty.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-empty.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/target-empty.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/target-multipleentries.ldif
similarity index 84%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/target-multipleentries.ldif
index 56a5d9b..3974595 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifdiff/target-multipleentries.ldif
@@ -29,4 +29,5 @@
 sn: User
 cn: Test User
 userPassword: password
+description: This is a very long description used to test that the ldif tools manage to deal with ldif wrapping standards.
 
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-singleentry.ldif b/opendj-ldap-toolkit/src/test/resources/ldifdiff/target-singleentry.ldif
similarity index 100%
rename from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-singleentry.ldif
rename to opendj-ldap-toolkit/src/test/resources/ldifdiff/target-singleentry.ldif
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/expected-continue-on-error.ldif
similarity index 68%
copy from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif
copy to opendj-ldap-toolkit/src/test/resources/ldifmodify/expected-continue-on-error.ldif
index 56a5d9b..3a58932 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/expected-continue-on-error.ldif
@@ -3,21 +3,22 @@
 objectClass: organization
 objectClass: dcObject
 dc: example
-o: Example Corp.
 description: description 1
 description: description 2
 description: description 3
+o: Example Corp.
 
 dn: ou=Applications,dc=example,dc=com
 objectClass: top
 objectClass: organizationalUnit
 ou: Applications
+description: An entry with this DN has already been added. If -c flag is present this modification should be ignored, otherwise an error should be raised.
 
 dn: ou=People,dc=example,dc=com
 objectClass: top
 objectClass: organizationalUnit
 ou: People
-description: This is where you put the people
+description: This is a very long description used to test that the ldif tools manage to deal with ldif wrapping standards.
 
 dn: cn=Test User,ou=People,dc=example,dc=com
 objectClass: top
@@ -29,4 +30,3 @@
 sn: User
 cn: Test User
 userPassword: password
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/expected-no-wrapping.ldif
similarity index 82%
copy from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif
copy to opendj-ldap-toolkit/src/test/resources/ldifmodify/expected-no-wrapping.ldif
index 56a5d9b..f066949 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/expected-no-wrapping.ldif
@@ -3,10 +3,10 @@
 objectClass: organization
 objectClass: dcObject
 dc: example
-o: Example Corp.
 description: description 1
 description: description 2
 description: description 3
+o: Example Corp.
 
 dn: ou=Applications,dc=example,dc=com
 objectClass: top
@@ -17,7 +17,7 @@
 objectClass: top
 objectClass: organizationalUnit
 ou: People
-description: This is where you put the people
+description: This is a very long description used to test that the ldif tools manage to deal with ldif wrapping standards.
 
 dn: cn=Test User,ou=People,dc=example,dc=com
 objectClass: top
@@ -29,4 +29,3 @@
 sn: User
 cn: Test User
 userPassword: password
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/expected.ldif
similarity index 82%
copy from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif
copy to opendj-ldap-toolkit/src/test/resources/ldifmodify/expected.ldif
index 56a5d9b..8885b23 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/target-multipleentries.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/expected.ldif
@@ -3,10 +3,10 @@
 objectClass: organization
 objectClass: dcObject
 dc: example
-o: Example Corp.
 description: description 1
 description: description 2
 description: description 3
+o: Example Corp.
 
 dn: ou=Applications,dc=example,dc=com
 objectClass: top
@@ -17,7 +17,8 @@
 objectClass: top
 objectClass: organizationalUnit
 ou: People
-description: This is where you put the people
+description: This is a very long description used to test that the ldif tools ma
+ nage to deal with ldif wrapping standards.
 
 dn: cn=Test User,ou=People,dc=example,dc=com
 objectClass: top
@@ -29,4 +30,3 @@
 sn: User
 cn: Test User
 userPassword: password
-
diff --git a/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications-invalid.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications-invalid.ldif
new file mode 100644
index 0000000..9719cbb
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications-invalid.ldif
@@ -0,0 +1,3 @@
+changetype: modify
+delete: objectClass
+objectClass: domain
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications-with-error.ldif
similarity index 66%
copy from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif
copy to opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications-with-error.ldif
index 1b6b331..0012ca5 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications-with-error.ldif
@@ -7,13 +7,14 @@
 objectClass: organization
 objectClass: dcObject
 -
-add: o
-o: Example Corp.
--
 add: description
 description: description 1
 description: description 2
 description: description 3
+-
+add: o
+o: Example Corp.
+-
 
 dn: ou=Applications,dc=example,dc=com
 changetype: add
@@ -23,36 +24,31 @@
 
 dn: ou=Groups,dc=example,dc=com
 changetype: delete
-# objectClass: top
-# objectClass: organizationalUnit
-# ou: Groups
 
 dn: ou=People,dc=example,dc=com
 changetype: modify
 add: description
-description: This is where you put the people
+description: This is a very long description used to test that the ldif tools manage to deal with ldif wrapping standards.
+-
+
+dn: ou=Applications,dc=example,dc=com
+changetype: add
+objectClass: top
+objectClass: organizationalUnit
+ou: Applications
+description: An entry with this DN has already been added. If -c flag is present this modification should be ignored, otherwise an error should be raised.
 
 dn: cn=Test User,ou=People,dc=example,dc=com
 changetype: add
-objectClass: inetOrgPerson
-objectClass: person
 objectClass: top
+objectClass: person
 objectClass: organizationalPerson
-cn: Test User
+objectClass: inetOrgPerson
+uid: test.user
 givenName: Test
 sn: User
-uid: test.user
+cn: Test User
 userPassword: password
 
 dn: uid=test.user,ou=People,dc=example,dc=com
-changetype: delete
-# objectClass: inetOrgPerson
-# objectClass: person
-# objectClass: top
-# objectClass: organizationalPerson
-# cn: Test User
-# givenName: Test
-# sn: User
-# uid: test.user
-# userPassword: password
-
+changetype: delete
\ No newline at end of file
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications.ldif
similarity index 72%
copy from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif
copy to opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications.ldif
index 1b6b331..5d83e74 100644
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries.ldif
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications.ldif
@@ -7,13 +7,14 @@
 objectClass: organization
 objectClass: dcObject
 -
-add: o
-o: Example Corp.
--
 add: description
 description: description 1
 description: description 2
 description: description 3
+-
+add: o
+o: Example Corp.
+-
 
 dn: ou=Applications,dc=example,dc=com
 changetype: add
@@ -23,36 +24,25 @@
 
 dn: ou=Groups,dc=example,dc=com
 changetype: delete
-# objectClass: top
-# objectClass: organizationalUnit
-# ou: Groups
 
 dn: ou=People,dc=example,dc=com
 changetype: modify
 add: description
-description: This is where you put the people
+description: This is a very long description used to test that the ldif tools manage to deal with ldif
+  wrapping standards.
+-
 
 dn: cn=Test User,ou=People,dc=example,dc=com
 changetype: add
-objectClass: inetOrgPerson
-objectClass: person
 objectClass: top
+objectClass: person
 objectClass: organizationalPerson
-cn: Test User
+objectClass: inetOrgPerson
+uid: test.user
 givenName: Test
 sn: User
-uid: test.user
+cn: Test User
 userPassword: password
 
 dn: uid=test.user,ou=People,dc=example,dc=com
-changetype: delete
-# objectClass: inetOrgPerson
-# objectClass: person
-# objectClass: top
-# objectClass: organizationalPerson
-# cn: Test User
-# givenName: Test
-# sn: User
-# uid: test.user
-# userPassword: password
-
+changetype: delete
\ No newline at end of file
diff --git a/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_1.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_1.ldif
new file mode 100644
index 0000000..a338076
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_1.ldif
@@ -0,0 +1,17 @@
+dn: dc=example,dc=com
+changetype: modify
+delete: objectClass
+objectClass: domain
+-
+add: objectClass
+objectClass: organization
+objectClass: dcObject
+-
+add: description
+description: description 1
+description: description 2
+description: description 3
+-
+add: o
+o: Example Corp.
+-
diff --git a/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_2.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_2.ldif
new file mode 100644
index 0000000..dba9d8f
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_2.ldif
@@ -0,0 +1,15 @@
+dn: ou=Applications,dc=example,dc=com
+changetype: add
+objectClass: top
+objectClass: organizationalUnit
+ou: Applications
+
+dn: ou=Groups,dc=example,dc=com
+changetype: delete
+
+dn: ou=People,dc=example,dc=com
+changetype: modify
+add: description
+description: This is a very long description used to test that the ldif tools manage to deal with ldif
+  wrapping standards.
+-
diff --git a/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_3.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_3.ldif
new file mode 100644
index 0000000..f31251d
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/resources/ldifmodify/modifications_part_3.ldif
@@ -0,0 +1,14 @@
+dn: cn=Test User,ou=People,dc=example,dc=com
+changetype: add
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: inetOrgPerson
+uid: test.user
+givenName: Test
+sn: User
+cn: Test User
+userPassword: password
+
+dn: uid=test.user,ou=People,dc=example,dc=com
+changetype: delete
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/source-multipleentries.ldif b/opendj-ldap-toolkit/src/test/resources/ldifmodify/source.ldif
similarity index 100%
copy from opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/source-multipleentries.ldif
copy to opendj-ldap-toolkit/src/test/resources/ldifmodify/source.ldif
diff --git a/opendj-ldap-toolkit/src/test/resources/ldifsearch.ldif b/opendj-ldap-toolkit/src/test/resources/ldifsearch.ldif
new file mode 100644
index 0000000..ad03e32
--- /dev/null
+++ b/opendj-ldap-toolkit/src/test/resources/ldifsearch.ldif
@@ -0,0 +1,523 @@
+dn: dc=com
+objectClass: top
+objectClass: domain
+dc: com
+
+dn: dc=example,dc=com
+objectClass: top
+objectClass: domain
+dc: example
+
+dn: o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: organization
+o: unit tests
+
+dn: ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: organizationalunit
+ou: ldifsearch
+
+dn: uid=user.0,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Aaccf
+sn: Amar
+cn: Aaccf Amar
+initials: APA
+employeeNumber: 0
+uid: user.0
+mail: user.0@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 140 374 9062
+homePhone: +1 413 500 4984
+pager: +1 250 147 3106
+mobile: +1 086 604 6557
+street: 83837 Central Street
+l: Santa Barbara
+st: NJ
+postalCode: 57656
+postalAddress: Aaccf Amar$83837 Central Street$Santa Barbara, NJ  57656
+description: This is the description for Aaccf Amar.
+
+dn: uid=user.1,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Aaren
+sn: Atp
+cn: Aaren Atp
+initials: AVA
+employeeNumber: 1
+uid: user.1
+mail: user.1@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 705 284 6303
+homePhone: +1 119 705 9603
+pager: +1 575 714 2075
+mobile: +1 206 947 0972
+street: 90369 Lincoln Street
+l: Lafayette
+st: RI
+postalCode: 61381
+postalAddress: Aaren Atp$90369 Lincoln Street$Lafayette, RI  61381
+description: This is the very long description for Aaren Atp. This text should be automatically wrapped by ldif tools unless the specific option to not wrap is specified.
+
+dn: uid=user.2,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Aarika
+sn: Atpco
+cn: Aarika Atpco
+initials: AQA
+employeeNumber: 2
+uid: user.2
+mail: user.2@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 240 116 1006
+homePhone: +1 524 998 9690
+pager: +1 808 020 8342
+mobile: +1 885 252 0855
+street: 64447 Spruce Street
+l: Providence
+st: WA
+postalCode: 89035
+postalAddress: Aarika Atpco$64447 Spruce Street$Providence, WA  89035
+description: This is the description for Aarika Atpco.
+
+dn: uid=user.3,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Aaron
+sn: Atrc
+cn: Aaron Atrc
+initials: AAA
+employeeNumber: 3
+uid: user.3
+mail: user.3@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 980 000 3369
+homePhone: +1 870 933 0016
+pager: +1 096 390 4404
+mobile: +1 863 963 6402
+street: 96369 Sixth Street
+l: San Antonio
+st: ND
+postalCode: 07852
+postalAddress: Aaron Atrc$96369 Sixth Street$San Antonio, ND  07852
+description: This is the description for Aaron Atrc.
+
+dn: uid=user.4,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Aartjan
+sn: Aalders
+cn: Aartjan Aalders
+initials: AYA
+employeeNumber: 4
+uid: user.4
+mail: user.4@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 428 104 9299
+homePhone: +1 239 749 1115
+pager: +1 205 023 3110
+mobile: +1 188 661 6039
+street: 38248 Johnson Street
+l: North Platte
+st: LA
+postalCode: 03941
+postalAddress: Aartjan Aalders$38248 Johnson Street$North Platte, LA  03941
+description: This is the description for Aartjan Aalders.
+
+dn: uid=user.5,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abagael
+sn: Aasen
+cn: Abagael Aasen
+initials: AEA
+employeeNumber: 5
+uid: user.5
+mail: user.5@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 093 200 1952
+homePhone: +1 691 947 3811
+pager: +1 932 721 7390
+mobile: +1 614 906 3581
+street: 23182 Park Street
+l: Albany
+st: ID
+postalCode: 12135
+postalAddress: Abagael Aasen$23182 Park Street$Albany, ID  12135
+description: This is the description for Abagael Aasen.
+
+dn: uid=user.6,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abagail
+sn: Abadines
+cn: Abagail Abadines
+initials: AMA
+employeeNumber: 6
+uid: user.6
+mail: user.6@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 694 083 3855
+homePhone: +1 500 993 9169
+pager: +1 533 256 0160
+mobile: +1 230 330 8000
+street: 26941 Spring Street
+l: Odessa
+st: NC
+postalCode: 83936
+postalAddress: Abagail Abadines$26941 Spring Street$Odessa, NC  83936
+description: This is the description for Abagail Abadines.
+
+dn: uid=user.7,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abahri
+sn: Abazari
+cn: Abahri Abazari
+initials: AQA
+employeeNumber: 7
+uid: user.7
+mail: user.7@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 161 596 0055
+homePhone: +1 969 953 0776
+pager: +1 457 746 5176
+mobile: +1 067 931 1430
+street: 46783 Broadway Street
+l: Utica
+st: IA
+postalCode: 38700
+postalAddress: Abahri Abazari$46783 Broadway Street$Utica, IA  38700
+description: This is the description for Abahri Abazari.
+
+dn: uid=user.8,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abbas
+sn: Abbatantuono
+cn: Abbas Abbatantuono
+initials: AWA
+employeeNumber: 8
+uid: user.8
+mail: user.8@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 823 213 8309
+homePhone: +1 600 875 1608
+pager: +1 820 928 3917
+mobile: +1 581 548 0349
+street: 00731 Elm Street
+l: Idaho Falls
+st: UT
+postalCode: 73519
+postalAddress: Abbas Abbatantuono$00731 Elm Street$Idaho Falls, UT  73519
+description: This is the description for Abbas Abbatantuono.
+
+dn: uid=user.9,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abbe
+sn: Abbate
+cn: Abbe Abbate
+initials: ACA
+employeeNumber: 9
+uid: user.9
+mail: user.9@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 279 584 8705
+homePhone: +1 177 021 3181
+pager: +1 384 810 8815
+mobile: +1 906 839 9329
+street: 17094 Pine Street
+l: Sioux City
+st: WV
+postalCode: 41031
+postalAddress: Abbe Abbate$17094 Pine Street$Sioux City, WV  41031
+description: This is the description for Abbe Abbate.
+
+dn: uid=user.10,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abbey
+sn: Abbie
+cn: Abbey Abbie
+initials: ABA
+employeeNumber: 10
+uid: user.10
+mail: user.10@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 055 508 5801
+homePhone: +1 793 080 9078
+pager: +1 567 779 0093
+mobile: +1 270 791 9926
+street: 11399 Pine Street
+l: Phoenix
+st: DE
+postalCode: 38670
+postalAddress: Abbey Abbie$11399 Pine Street$Phoenix, DE  38670
+description: This is the description for Abbey Abbie.
+
+dn: uid=user.11,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abbi
+sn: Abbott
+cn: Abbi Abbott
+initials: AMA
+employeeNumber: 11
+uid: user.11
+mail: user.11@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 694 313 5401
+homePhone: +1 776 680 9667
+pager: +1 202 494 4051
+mobile: +1 945 344 9474
+street: 76335 Twelfth Street
+l: Austin
+st: MN
+postalCode: 06878
+postalAddress: Abbi Abbott$76335 Twelfth Street$Austin, MN  06878
+description: This is the description for Abbi Abbott.
+
+dn: uid=user.12,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abbie
+sn: Abdalla
+cn: Abbie Abdalla
+initials: AOA
+employeeNumber: 12
+uid: user.12
+mail: user.12@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 244 411 0729
+homePhone: +1 242 003 0330
+pager: +1 505 920 0623
+mobile: +1 202 363 3841
+street: 87230 Spruce Street
+l: Bloomington
+st: TN
+postalCode: 02103
+postalAddress: Abbie Abdalla$87230 Spruce Street$Bloomington, TN  02103
+description: This is the description for Abbie Abdalla.
+
+dn: uid=user.13,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abby
+sn: Abdo
+cn: Abby Abdo
+initials: AXA
+employeeNumber: 13
+uid: user.13
+mail: user.13@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 284 036 0260
+homePhone: +1 038 533 8903
+pager: +1 557 025 3367
+mobile: +1 288 706 7620
+street: 16749 Eighth Street
+l: Minneapolis
+st: NY
+postalCode: 81286
+postalAddress: Abby Abdo$16749 Eighth Street$Minneapolis, NY  81286
+description: This is the description for Abby Abdo.
+
+dn: uid=user.14,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abbye
+sn: Abdollahi
+cn: Abbye Abdollahi
+initials: ALA
+employeeNumber: 14
+uid: user.14
+mail: user.14@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 511 008 7304
+homePhone: +1 957 901 3534
+pager: +1 098 383 0133
+mobile: +1 190 164 3464
+street: 60320 Fourteenth Street
+l: Victoria
+st: LA
+postalCode: 25003
+postalAddress: Abbye Abdollahi$60320 Fourteenth Street$Victoria, LA  25003
+description: This is the description for Abbye Abdollahi.
+
+dn: uid=user.15,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abdalla
+sn: Abdou
+cn: Abdalla Abdou
+initials: ARA
+employeeNumber: 15
+uid: user.15
+mail: user.15@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 335 505 2675
+homePhone: +1 339 080 8037
+pager: +1 400 194 9235
+mobile: +1 003 587 0243
+street: 18792 Eleventh Street
+l: Flint
+st: AL
+postalCode: 75440
+postalAddress: Abdalla Abdou$18792 Eleventh Street$Flint, AL  75440
+description: This is the description for Abdalla Abdou.
+
+dn: uid=user.16,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abdallah
+sn: Abdul-Nour
+cn: Abdallah Abdul-Nour
+initials: AHA
+employeeNumber: 16
+uid: user.16
+mail: user.16@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 200 104 9808
+homePhone: +1 544 505 0502
+pager: +1 040 921 5645
+mobile: +1 102 337 0237
+street: 42171 Laurel Street
+l: Dothan
+st: MT
+postalCode: 14713
+postalAddress: Abdallah Abdul-Nour$42171 Laurel Street$Dothan, MT  14713
+description: This is the description for Abdallah Abdul-Nour.
+
+dn: uid=user.17,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abdul
+sn: Abdulla
+cn: Abdul Abdulla
+initials: ACA
+employeeNumber: 17
+uid: user.17
+mail: user.17@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 622 798 2216
+homePhone: +1 008 048 2102
+pager: +1 789 023 0275
+mobile: +1 171 370 0198
+street: 37767 Forest Street
+l: Fort Wayne
+st: NV
+postalCode: 52716
+postalAddress: Abdul Abdulla$37767 Forest Street$Fort Wayne, NV  52716
+description: This is the description for Abdul Abdulla.
+
+dn: uid=user.18,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abdullah
+sn: Abdullah
+cn: Abdullah Abdullah
+initials: AZA
+employeeNumber: 18
+uid: user.18
+mail: user.18@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 103 079 4939
+homePhone: +1 974 673 5856
+pager: +1 693 142 0500
+mobile: +1 075 275 2392
+street: 67821 Walnut Street
+l: Superior
+st: SC
+postalCode: 30443
+postalAddress: Abdullah Abdullah$67821 Walnut Street$Superior, SC  30443
+description: This is the description for Abdullah Abdullah.
+
+dn: uid=user.19,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abe
+sn: Abe
+cn: Abe Abe
+initials: AGA
+employeeNumber: 19
+uid: user.19
+mail: user.19@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 736 431 3653
+homePhone: +1 940 495 0950
+pager: +1 934 208 1404
+mobile: +1 830 519 2697
+street: 88733 Locust Street
+l: Parkersburg
+st: UT
+postalCode: 69480
+postalAddress: Abe Abe$88733 Locust Street$Parkersburg, UT  69480
+description: This is the description for Abe Abe.
+
+dn: uid=user.20,ou=ldifsearch,o=unit tests,dc=example,dc=com
+objectClass: top
+objectClass: person
+objectClass: organizationalperson
+objectClass: inetorgperson
+givenName: Abel
+sn: Abedi
+cn: Abel Abedi
+initials: AHA
+employeeNumber: 20
+uid: user.20
+mail: user.20@example.com
+userPassword: {SSHA}LrBv0i/fIEMDnvrCRXuZuRn5nNLdTKeQc1jBKw==
+telephoneNumber: +1 806 813 1788
+homePhone: +1 339 913 5003
+pager: +1 838 937 9478
+mobile: +1 196 300 2356
+street: 76048 Fourteenth Street
+l: Pocatello
+st: MI
+postalCode: 55008
+postalAddress: Abel Abedi$76048 Fourteenth Street$Pocatello, MI  55008
+description: This is the description for Abel Abedi.
diff --git a/opendj-server-legacy/pom.xml b/opendj-server-legacy/pom.xml
index d8f2043..d876762 100644
--- a/opendj-server-legacy/pom.xml
+++ b/opendj-server-legacy/pom.xml
@@ -90,6 +90,7 @@
       <groupId>org.forgerock.opendj</groupId>
       <artifactId>opendj-config</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.forgerock.opendj</groupId>
       <artifactId>opendj-config</artifactId>
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPCompareTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPCompareTestCase.java
deleted file mode 100644
index 03f3060..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPCompareTestCase.java
+++ /dev/null
@@ -1,1632 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2013-2016 ForgeRock AS.
- */
-package org.opends.server.tools;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.util.ArrayList;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.api.Backend;
-import org.opends.server.core.DirectoryServer;
-import org.forgerock.opendj.ldap.DN;
-import org.opends.server.util.Base64;
-import org.opends.server.util.StaticUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import static org.opends.server.protocols.ldap.LDAPResultCode.*;
-import static org.testng.Assert.*;
-
-/**
- * A set of test cases for the LDAPCompare tool.
- */
-@SuppressWarnings("javadoc")
-public class LDAPCompareTestCase
-       extends ToolsTestCase
-{
-  /** The path to a file containing a valid bind password. */
-  private String validPasswordFile;
-
-
-
-  /**
-   * Ensures that the Directory Server is running and performs other necessary
-   * setup.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @BeforeClass
-  public void startServerAndCreatePasswordFiles()
-         throws Exception
-  {
-    TestCaseUtils.startServer();
-
-
-    TestCaseUtils.dsconfig(
-            "set-sasl-mechanism-handler-prop",
-            "--handler-name", "DIGEST-MD5",
-            "--set", "server-fqdn:" + "127.0.0.1");
-
-    File pwFile = File.createTempFile("valid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    FileWriter fileWriter = new FileWriter(pwFile);
-    fileWriter.write("password" + System.getProperty("line.separator"));
-    fileWriter.close();
-    validPasswordFile = pwFile.getAbsolutePath();
-
-    pwFile = File.createTempFile("invalid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    fileWriter = new FileWriter(pwFile);
-    fileWriter.write("wrongPassword" + System.getProperty("line.separator"));
-    fileWriter.close();
-  }
-
-  @AfterClass
-  public void tearDown() throws Exception {
-    TestCaseUtils.dsconfig(
-            "set-sasl-mechanism-handler-prop",
-            "--handler-name", "DIGEST-MD5",
-            "--remove", "server-fqdn:" + "127.0.0.1");
-  }
-
-
-  /**
-   * Retrieves sets of invalid arguments that may not be used to initialize
-   * the LDAPCompare tool.
-   *
-   * @return  Sets of invalid arguments that may not be used to initialize the
-   *          LDAPCompare tool.
-   */
-  @DataProvider(name = "invalidArgs")
-  public Object[][] getInvalidArgumentLists()
-  {
-    ArrayList<String[]> argLists   = new ArrayList<>();
-    ArrayList<String>   reasonList = new ArrayList<>();
-
-    String[] args = {};
-    argLists.add(args);
-    reasonList.add("No arguments");
-
-    args = new String[]
-    {
-      "-D",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-D' argument");
-
-    args = new String[]
-    {
-      "-w",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-w' argument");
-
-    args = new String[]
-    {
-      "-j",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-j' argument");
-
-    args = new String[]
-    {
-      "-i",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-i' argument");
-
-    args = new String[]
-    {
-      "-K",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-K' argument");
-
-    args = new String[]
-    {
-      "-P",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-P' argument");
-
-    args = new String[]
-    {
-      "-W",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-W' argument");
-
-    args = new String[]
-    {
-      "-h",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-h' argument");
-
-    args = new String[]
-    {
-      "-p",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-p' argument");
-
-    args = new String[]
-    {
-      "-V",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-V' argument");
-
-    args = new String[]
-    {
-      "-f",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-f' argument");
-
-    args = new String[]
-    {
-      "-J",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-J' argument");
-
-    args = new String[]
-    {
-      "-o",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-o' argument");
-
-    args = new String[]
-    {
-      "--assertionFilter",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '--assertionFilter' argument");
-
-    args = new String[]
-    {
-      "-I"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid short argument");
-
-    args = new String[]
-    {
-      "--invalidLongArgument"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid long argument");
-
-    args = new String[]
-    {
-      "--assertionFilter", "(invalidfilter)",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid assertion filter");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-j", "no.such.file",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid bind password file path");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-j", validPasswordFile,
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Both bind password and password file");
-
-    args = new String[]
-    {
-      "-V", "nonnumeric",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric LDAP version");
-
-    args = new String[]
-    {
-      "-V", "1",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid LDAP version");
-
-    args = new String[]
-    {
-      "-f", "no.such.file",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid DN file path");
-
-    args = new String[]
-    {
-      "-J", "1.2.3.4:invalidcriticality",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid control criticality");
-
-    args = new String[]
-    {
-      "-p", "nonnumeric",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric port");
-
-    args = new String[]
-    {
-      "-p", "999999",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Port value out of range");
-
-    args = new String[]
-    {
-      "-r",
-      "-K", "key.store.file",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("SASL external without SSL or StartTLS");
-
-    args = new String[]
-    {
-      "-Z",
-      "-r",
-      "uid:test.user",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("SASL external without keystore file");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password"
-    };
-    argLists.add(args);
-    reasonList.add("No trailing arguments");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "uid:test.user"
-    };
-    argLists.add(args);
-    reasonList.add("Only one trailing argument");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "malformed",
-      "uid=test.user,o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Malformed attribute-value assertion");
-
-
-    Object[][] returnArray = new Object[argLists.size()][2];
-    for (int i=0; i < argLists.size(); i++)
-    {
-      returnArray[i][0] = argLists.get(i);
-      returnArray[i][1] = reasonList.get(i);
-    }
-    return returnArray;
-  }
-
-
-
-  /**
-   * Tests the LDAPCompare tool with sets of invalid arguments.
-   *
-   * @param  args           The set of arguments to use for the LDAPCompare
-   *                        tool.
-   * @param  invalidReason  The reason the provided set of arguments is invalid.
-   */
-  @Test(dataProvider = "invalidArgs")
-  public void testInvalidArguments(String[] args, String invalidReason)
-  {
-    assertFalse(LDAPCompare.mainCompare(args, false, null, null) == SUCCESS,
-                "Should have been invalid because:  " + invalidReason);
-  }
-
-
-
-  /**
-   * Tests a simple LDAPv2 compare.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleLDAPv2Compare()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "2",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "2",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "o:test",
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple LDAPv3 compare in which the assertion is true.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleLDAPv3CompareTrue()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "o:test",
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple LDAPv3 compare in which the assertion is false.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleLDAPv3CompareFalse()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:nottest",
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "o:nottest",
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_FALSE);
-  }
-
-
-  /**
-   * Tests two LDAPv3 compares in which the assertion is true for all.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMultipleCompareAllTrue() throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    Backend<?> memoryBackend =
-        DirectoryServer.getBackend(TestCaseUtils.TEST_BACKEND_ID);
-    String dn1 = "arg=success,o=test1,o=test";
-    String dn2 = "arg=success,o=test2,o=test";
-    addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn1));
-    addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn2));
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--continueOnError",
-      "arg:success",
-      dn1,
-      dn2
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "--continueOnError",
-      "arg:success",
-      dn1,
-      dn2
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-  /**
-   * Tests two LDAPv3 compares in which one assertion is true and one is false.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMultipleCompareOneCompareIsFalse() throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    Backend<?> memoryBackend =
-        DirectoryServer.getBackend(TestCaseUtils.TEST_BACKEND_ID);
-    String dn1 = "arg=success,o=test1,o=test";
-    String dn2 = "arg=fail,o=test2,o=test";
-    addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn1));
-    addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn2));
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--continueOnError",
-      "arg:success",
-      dn1,
-      dn2
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "--continueOnError",
-      "arg:success",
-      dn1,
-      dn2
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_FALSE);
-  }
-
-  /**
-   * Tests two LDAPv3 compares in which one assertion is true and one returns no
-   * such object.
-   *
-   * @throws Exception
-   *           If an unexpected problem occurs.
-   */
-  @Test
-  public void testMultipleCompareOneNoSuchObject() throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    Backend<?> memoryBackend =
-        DirectoryServer.getBackend(TestCaseUtils.TEST_BACKEND_ID);
-    String dn1 = "arg=success,o=test1,o=test";
-    addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn1));
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--continueOnError",
-      "arg:success",
-      dn1,
-      "arg=fail,o=test2,o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "--continueOnError",
-      "arg:success",
-      dn1,
-      "arg=fail,o=test2,o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), NO_SUCH_OBJECT);
-  }
-
-
-  private void addEntriesUpToParentDN(Backend<?> backend, DN entryDN) throws Exception
-  {
-    if (!backend.entryExists(entryDN.parent()))
-    {
-      addEntriesUpToParentDN(backend, entryDN.parent());
-    }
-    backend.addEntry(StaticUtils.createEntry(entryDN), null);
-  }
-
-  /**
-   * Tests a simple compare using SSL with blind trust.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLBlindTrust()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-X",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-X",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "o:test",
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple compare using SSL with a trust store.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLTrustStore()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-P", trustStorePath,
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-P", trustStorePath,
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "o:test",
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple compare using StartTLS with blind trust.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testStartTLSBlindTrust()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-X",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-X",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "o:test",
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple compare using StartTLS with a trust store.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testStartTLSTrustStore()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-P", trustStorePath,
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-P", trustStorePath,
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "o:test",
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP compare over SSL using a trust store and SASL EXTERNAL
-   * authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleCompareSSLTrustStoreSASLExternal()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "ds-privilege-name: bypass-acl",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-P", trustStorePath,
-      "--noPropertiesFile",
-      "-r",
-      "cn:Test User",
-      "cn=Test User,o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-P", trustStorePath,
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "-r",
-      "cn:Test User",
-      "cn=Test User,o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP compare over SSL using a trust store and SASL EXTERNAL
-   * authentication when explicitly specifying a valid client certificate.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleCompareSSLTrustStoreSASLExternalValidClientCert()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "ds-privilege-name: bypass-acl",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-N", "client-cert",
-      "-P", trustStorePath,
-      "--noPropertiesFile",
-      "-r",
-      "cn:Test User",
-      "cn=Test User,o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-N", "client-cert",
-      "-P", trustStorePath,
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "-r",
-      "cn:Test User",
-      "cn=Test User,o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP compare over SSL using a trust store and SASL EXTERNAL
-   * authentication when explicitly specifying an invalid client certificate.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleCompareSSLTrustStoreSASLExternalInvalidClientCert()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "ds-privilege-name: bypass-acl",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-N", "invalid",
-      "-P", trustStorePath,
-      "--noPropertiesFile",
-      "-r",
-      "cn:Test User",
-      "cn=Test User,o=test"
-    };
-
-    assertFalse(LDAPCompare.mainCompare(args, false, null, null) == SUCCESS);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP compare using StartTLS with a trust store and SASL
-   * EXTERNAL authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleCompareStartTLSTrustStoreSASLExternal()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "ds-privilege-name: bypass-acl",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-P", trustStorePath,
-      "--noPropertiesFile",
-      "-r",
-      "cn:Test User",
-      "cn=Test User,o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-P", trustStorePath,
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "-r",
-      "cn:Test User",
-      "cn=Test User,o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple compare operation using CRAM-MD5 authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCRAMMD5()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "ds-privilege-name: bypass-acl",
-         "userPassword: password",
-         "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
-              "cn=Password Policies,cn=config");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=CRAM-MD5",
-      "-o", "authid=u:test.user",
-      "-w", "password",
-      "--noPropertiesFile",
-      "givenName:Test",
-      "uid=test.user,o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=CRAM-MD5",
-      "-o", "authid=u:test.user",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "givenName:Test",
-      "uid=test.user,o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple compare operation using DIGEST-MD5 authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDigestMD5()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "ds-privilege-name: bypass-acl",
-         "ds-privilege-name: proxied-auth",
-         "userPassword: password",
-         "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
-              "cn=Password Policies,cn=config");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=DIGEST-MD5",
-      "-o", "authid=u:test.user",
-      "-o", "authzid=u:test.user",
-      "-w", "password",
-      "--noPropertiesFile",
-      "givenName:Test",
-      "uid=test.user,o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=DIGEST-MD5",
-      "-o", "authid=u:test.user",
-      "-o", "authzid=u:test.user",
-      "-w", "password",
-      "--useCompareResultCode",
-      "--noPropertiesFile",
-      "givenName:Test",
-      "uid=test.user,o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a simple compare operation using PLAIN authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testPLAIN()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: password");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=PLAIN",
-      "-o", "authid=dn:cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "givenName:Test",
-      "uid=test.user,o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=PLAIN",
-      "-o", "authid=dn:cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "--useCompareResultCode",
-      "givenName:Test",
-      "uid=test.user,o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a a comparison in which the assertion value is base64-encoded with a
-   * valid encoding.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCompareValidBase64Assertion()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o::" + Base64.encode("test".getBytes("UTF-8")),
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--useCompareResultCode",
-      "--noPropertiesFile",
-      "o::" + Base64.encode("test".getBytes("UTF-8")),
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a a comparison in which the assertion value should be base64-encoded
-   * but uses an incorrect encoding.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCompareInvalidBase64Assertion()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o::***invalidencoding***",
-      "o=test"
-    };
-
-    assertFalse(LDAPCompare.mainCompare(args, false, null, null) == SUCCESS);
-  }
-
-
-
-  /**
-   * Tests a a comparison in which the assertion value is contained in a file.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCompareAssertionValueFromFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    File f = File.createTempFile("testCompareAssertionValueFromFile", ".txt");
-    f.deleteOnExit();
-    FileWriter w = new FileWriter(f);
-    w.write("test");
-    w.close();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:<" + f.getAbsolutePath(),
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--useCompareResultCode",
-      "--noPropertiesFile",
-      "o:<" + f.getAbsolutePath(),
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a a comparison in which the assertion value is contained in a file
-   * that does not exist.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCompareAssertionValueFromNonExistentFile()
-         throws Exception
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o:<does.not.exist",
-      "o=test"
-    };
-
-    assertFalse(LDAPCompare.mainCompare(args, false, null, null) == SUCCESS);
-  }
-
-
-
-  /**
-   * Tests a a comparison using the LDAP assertion control in which the
-   * assertion is true.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCompareLDAPAssertionControlTrue()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--assertionFilter", "(o=test)",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-
-    String[] argsUseCompare =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--assertionFilter", "(o=test)",
-      "--useCompareResultCode",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-
-    assertEquals(LDAPCompare.mainCompare(args, false, null, System.err),
-        SUCCESS);
-    assertEquals(LDAPCompare.mainCompare(argsUseCompare, false, null,
-        System.err), COMPARE_TRUE);
-  }
-
-
-
-  /**
-   * Tests a a comparison using the LDAP assertion control in which the
-   * assertion is not true.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCompareLDAPAssertionControlNotTrue()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--assertionFilter", "(o=notAMatch)",
-      "--noPropertiesFile",
-      "o:test",
-      "o=test"
-    };
-    assertFalse(LDAPCompare.mainCompare(args, false, null, null) == SUCCESS);
-  }
-
-
-
-  /**
-   * Tests a a compare operation reading the DNs to compare from a file.  Some
-   * of the compares will succeed and others will not.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCompareDNsFromFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "o=test",
-         "dc=example,dc=com",
-         "o=nonexistentsuffix",
-         "malformed",
-         "o=nonexistent,o=test");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-c",
-      "-f", path,
-      "--noPropertiesFile",
-      "o:test",
-    };
-
-    LDAPCompare.mainCompare(args, false, null, null);
-  }
-
-
-
-  /**
-   * Tests a a compare operation reading the DNs to compare from a file that
-   * doesn't exist.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCompareDNsFromNonExistentFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-c",
-      "-f", "does.not.exist",
-      "--noPropertiesFile",
-      "o:test",
-    };
-
-    assertFalse(LDAPCompare.mainCompare(args, false, null, null) == SUCCESS);
-  }
-
-
-
-  /**
-   * Tests the LDAPCompare tool with the "--help" option.
-   */
-  @Test
-  public void testHelp()
-  {
-    String[] args = { "--help" };
-    assertEquals(LDAPCompare.mainCompare(args, false, null, null), SUCCESS);
-
-    args = new String[] { "-H" };
-    assertEquals(LDAPCompare.mainCompare(args, false, null, null), SUCCESS);
-
-    args = new String[] { "-?" };
-    assertEquals(LDAPCompare.mainCompare(args, false, null, null), SUCCESS);
-  }
-
-
-
-  @DataProvider(name = "aggregateResults")
-  public Object[][] getAggregateResultCodeParamsAndResults()
-  {
-    return new Object[][] { { SUCCESS, SUCCESS, SUCCESS },
-      { SUCCESS, COMPARE_TRUE, COMPARE_TRUE },
-      { SUCCESS, COMPARE_FALSE, COMPARE_FALSE },
-      { SUCCESS, OPERATIONS_ERROR, OPERATIONS_ERROR },
-      { COMPARE_TRUE, COMPARE_TRUE, COMPARE_TRUE },
-      { COMPARE_TRUE, COMPARE_FALSE, COMPARE_FALSE },
-      { COMPARE_TRUE, OPERATIONS_ERROR, OPERATIONS_ERROR },
-      { COMPARE_FALSE, COMPARE_TRUE, COMPARE_FALSE },
-      { COMPARE_FALSE, COMPARE_FALSE, COMPARE_FALSE },
-      { COMPARE_FALSE, OPERATIONS_ERROR, OPERATIONS_ERROR },
-      { OPERATIONS_ERROR, COMPARE_TRUE, OPERATIONS_ERROR },
-      { OPERATIONS_ERROR, COMPARE_FALSE, OPERATIONS_ERROR },
-      { OPERATIONS_ERROR, OPERATIONS_ERROR, OPERATIONS_ERROR } };
-  }
-
-  /**
-   * Test the results of calling function
-   * {@link LDAPCompare#aggregateResultCode(int, int)}.
-   */
-  @Test(dataProvider = "aggregateResults")
-  public void testAggregateResultCode(int currentAggregatedResult,
-      int newResultCode, int finalAggregatedResult)
-  {
-    LDAPCompare obj = new LDAPCompare(new AtomicInteger(), null, null);
-    assertEquals(obj
-        .aggregateResultCode(currentAggregatedResult, newResultCode),
-        finalAggregatedResult);
-  }
-}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPDeleteTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPDeleteTestCase.java
deleted file mode 100644
index 883edb9..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPDeleteTestCase.java
+++ /dev/null
@@ -1,936 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
- */
-package org.opends.server.tools;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.util.ArrayList;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import static org.opends.server.util.ServerConstants.*;
-import static org.testng.Assert.*;
-
-/**
- * A set of test cases for the LDAPDelete tool.
- */
-public class LDAPDeleteTestCase
-       extends ToolsTestCase
-{
-  /** The path to a file containing an invalid bind password. */
-  private String invalidPasswordFile;
-
-  /** The path to a file containing a valid bind password. */
-  private String validPasswordFile;
-
-
-
-  /**
-   * Ensures that the Directory Server is running and performs other necessary
-   * setup.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @BeforeClass
-  public void startServerAndCreatePasswordFiles()
-         throws Exception
-  {
-    TestCaseUtils.startServer();
-
-    File pwFile = File.createTempFile("valid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    FileWriter fileWriter = new FileWriter(pwFile);
-    fileWriter.write("password" + System.getProperty("line.separator"));
-    fileWriter.close();
-    validPasswordFile = pwFile.getAbsolutePath();
-
-    pwFile = File.createTempFile("invalid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    fileWriter = new FileWriter(pwFile);
-    fileWriter.write("wrongPassword" + System.getProperty("line.separator"));
-    fileWriter.close();
-    invalidPasswordFile = pwFile.getAbsolutePath();
-  }
-
-
-
-  /**
-   * Retrieves sets of invalid arguments that may not be used to initialize
-   * the LDAPDelete tool.
-   *
-   * @return  Sets of invalid arguments that may not be used to initialize the
-   *          LDAPDelete tool.
-   */
-  @DataProvider(name = "invalidArgs")
-  public Object[][] getInvalidArgumentLists()
-  {
-    ArrayList<String[]> argLists   = new ArrayList<>();
-    ArrayList<String>   reasonList = new ArrayList<>();
-
-    String[] args = new String[]
-    {
-      "-D",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-D' argument");
-
-    args = new String[]
-    {
-      "-w",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-w' argument");
-
-    args = new String[]
-    {
-      "-j",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-j' argument");
-
-    args = new String[]
-    {
-      "-i",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-i' argument");
-
-    args = new String[]
-    {
-      "-K",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-K' argument");
-
-    args = new String[]
-    {
-      "-P",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-P' argument");
-
-    args = new String[]
-    {
-      "-W",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-W' argument");
-
-    args = new String[]
-    {
-      "-h",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-h' argument");
-
-    args = new String[]
-    {
-      "-p",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-p' argument");
-
-    args = new String[]
-    {
-      "-V",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-V' argument");
-
-    args = new String[]
-    {
-      "-f",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-f' argument");
-
-    args = new String[]
-    {
-      "-J",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-J' argument");
-
-    args = new String[]
-    {
-      "-o",
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-o' argument");
-
-    args = new String[]
-    {
-      "-I"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid short argument");
-
-    args = new String[]
-    {
-      "--invalidLongArgument"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid long argument");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-j", "no.such.file",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid bind password file path");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-j", validPasswordFile,
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Both bind password and password file");
-
-    args = new String[]
-    {
-      "-V", "nonnumeric",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric LDAP version");
-
-    args = new String[]
-    {
-      "-V", "1",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid LDAP version");
-
-    args = new String[]
-    {
-      "-f", "no.such.file",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid DN file path");
-
-    args = new String[]
-    {
-      "-J", "1.2.3.4:invalidcriticality",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid control criticality");
-
-    args = new String[]
-    {
-      "-p", "nonnumeric",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric port");
-
-    args = new String[]
-    {
-      "-p", "999999",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("Port value out of range");
-
-    args = new String[]
-    {
-      "-r",
-      "-K", "key.store.file",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("SASL external without SSL or StartTLS");
-
-    args = new String[]
-    {
-      "-Z",
-      "-r",
-      "o=test"
-    };
-    argLists.add(args);
-    reasonList.add("SASL external without keystore file");
-
-
-    Object[][] returnArray = new Object[argLists.size()][2];
-    for (int i=0; i < argLists.size(); i++)
-    {
-      returnArray[i][0] = argLists.get(i);
-      returnArray[i][1] = reasonList.get(i);
-    }
-    return returnArray;
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool with sets of invalid arguments.
-   *
-   * @param  args           The set of arguments to use for the LDAPDelete tool.
-   * @param  invalidReason  The reason the provided set of arguments was
-   *                        invalid.
-   */
-  @Test(dataProvider = "invalidArgs")
-  public void testInvalidArguments(String[] args, String invalidReason)
-  {
-    assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0,
-                "Should have been invalid because:  " + invalidReason);
-  }
-
-
-
-  /**
-   * Tests a simple LDAPv2 delete.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testSimpleLDAPv2Delete()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "2",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAPv3 delete.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testSimpleLDAPv3Delete()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool using SSL with blind trust.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteSSLBlindTrust()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-X",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool using SSL with a trust store.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteSSLTrustStore()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-P", trustStorePath,
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool using StartTLS with blind trust.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteStartTLSBlindTrust()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-X",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool using StartTLS with a trust store.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteStartTLSTrustStore()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-P", trustStorePath,
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool using SASL PLAIN authentication.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeletePLAIN()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=PLAIN",
-      "-o", "authid=dn:cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests deleting an entry that doesn't exist.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteNonExistent()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "cn=Does Not Exist,o=test"
-    };
-
-    assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests deleting with a malformed DN.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteMalformedDN()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "malformed"
-    };
-
-    assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests deleting an entry with one or more children but not including the
-   * subtree delete control.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteParentNoSubtreeDeleteControl()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: password");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool reading a valid bind password from a file.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteValidPasswordFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-j", validPasswordFile,
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool reading an invalid bind password from a file.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteInvalidPasswordFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-j", invalidPasswordFile,
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool reading the bind password from a nonexistent
-   * file.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteNonExistentPasswordFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-j", "does.not.exist",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool reading the DNs to delete from a file.  Some of
-   * the deletes will succeed and some will fail.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteDNsFromFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: password");
-
-
-    String path = TestCaseUtils.createTempFile(
-         "o=test",
-         "uid=test.user,o=test",
-         "malformed",
-         "o=suffix does not exist",
-         "uid=entry does not exist,o=test",
-         "o=test");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-j", validPasswordFile,
-      "-c",
-      "-f", path,
-      "--noPropertiesFile"
-    };
-
-    LDAPDelete.mainDelete(args, false, null, null);
-  }
-
-
-
-  /**
-   * Tests a subtree delete operation.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSubtreeDelete()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: password");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-x",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a subtree delete operation using an alternate name for the control.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testSubtreeDeleteAltName()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: password");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", "subtreedelete:true",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple delete using the client-side no-op option.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteClientSideNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-n",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple delete using the server-side no-op control.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteServerSideNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", OID_LDAP_NOOP_OPENLDAP_ASSIGNED + ":true",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple delete using the server-side no-op control with an alternate
-   * name for the no-op control.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testDeleteServerSideNoOpAltName()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", "no-op:true",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests the inclusion of multiple arbitrary controls in the request to the
-   * server.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testMultipleRequestControls()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", OID_MANAGE_DSAIT_CONTROL + ":false",
-      "-J", OID_SUBTREE_DELETE_CONTROL + ":true",
-      "--noPropertiesFile",
-      "o=test"
-    };
-
-    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPDelete tool with the "--help" option.
-   */
-  @Test
-  public void testHelp()
-  {
-    String[] args = { "--help" };
-    assertEquals(LDAPDelete.mainDelete(args, false, null, null), 0);
-
-    args = new String[] { "-H" };
-    assertEquals(LDAPDelete.mainDelete(args, false, null, null), 0);
-
-    args = new String[] { "-?" };
-    assertEquals(LDAPDelete.mainDelete(args, false, null, null), 0);
-
-  }
-}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPModifyTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPModifyTestCase.java
deleted file mode 100644
index 4f83842..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPModifyTestCase.java
+++ /dev/null
@@ -1,1905 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
- */
-package org.opends.server.tools;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.util.ArrayList;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import static org.opends.server.util.ServerConstants.*;
-import static org.testng.Assert.*;
-
-/**
- * A set of test cases for the LDAPModify tool.
- */
-@SuppressWarnings("javadoc")
-public class LDAPModifyTestCase
-       extends ToolsTestCase
-{
-  /** The path to a file containing an invalid bind password. */
-  private String invalidPasswordFile;
-
-  /** The path to a file containing a valid bind password. */
-  private String validPasswordFile;
-
-  /** The path to a file containing a simple, valid modification. */
-  private String modifyFilePath;
-
-
-
-  /**
-   * Ensures that the Directory Server is running and performs other necessary
-   * setup.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @BeforeClass
-  public void startServerAndCreatePasswordFiles()
-         throws Exception
-  {
-    TestCaseUtils.startServer();
-
-    TestCaseUtils.dsconfig(
-            "set-sasl-mechanism-handler-prop",
-            "--handler-name", "DIGEST-MD5",
-            "--set", "server-fqdn:" + "127.0.0.1");
-
-    File pwFile = File.createTempFile("valid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    FileWriter fileWriter = new FileWriter(pwFile);
-    fileWriter.write("password" + System.getProperty("line.separator"));
-    fileWriter.close();
-    validPasswordFile = pwFile.getAbsolutePath();
-
-    pwFile = File.createTempFile("invalid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    fileWriter = new FileWriter(pwFile);
-    fileWriter.write("wrongPassword" + System.getProperty("line.separator"));
-    fileWriter.close();
-    invalidPasswordFile = pwFile.getAbsolutePath();
-
-    modifyFilePath = TestCaseUtils.createTempFile("dn: o=test",
-                                                  "changetype: modify",
-                                                  "replace: description",
-                                                  "description: foo");
-  }
-
-
-  @AfterClass
-  public void tearDown() throws Exception {
-
-    TestCaseUtils.dsconfig(
-            "set-sasl-mechanism-handler-prop",
-            "--handler-name", "DIGEST-MD5",
-            "--remove", "server-fqdn:" + "127.0.0.1");
-  }
-
-  /**
-   * Retrieves sets of invalid arguments that may not be used to initialize
-   * the LDAPModify tool.
-   *
-   * @return  Sets of invalid arguments that may not be used to initialize the
-   *          LDAPModify tool.
-   */
-  @DataProvider(name = "invalidArgs")
-  public Object[][] getInvalidArgumentLists()
-  {
-    ArrayList<String[]> argLists   = new ArrayList<>();
-    ArrayList<String>   reasonList = new ArrayList<>();
-
-    String[] args;
-    args = new String[]
-    {
-      "-D"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-D' argument");
-
-    args = new String[]
-    {
-      "-w"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-w' argument");
-
-    args = new String[]
-    {
-      "-j"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-j' argument");
-
-    args = new String[]
-    {
-      "-Y"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-Y' argument");
-
-    args = new String[]
-    {
-      "-i"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-i' argument");
-
-    args = new String[]
-    {
-      "-K"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-K' argument");
-
-    args = new String[]
-    {
-      "-P"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-P' argument");
-
-    args = new String[]
-    {
-      "-W"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-W' argument");
-
-    args = new String[]
-    {
-      "-h"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-h' argument");
-
-    args = new String[]
-    {
-      "-p"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-p' argument");
-
-    args = new String[]
-    {
-      "-V"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-V' argument");
-
-    args = new String[]
-    {
-      "-f"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-f' argument");
-
-    args = new String[]
-    {
-      "-J"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-J' argument");
-
-    args = new String[]
-    {
-      "-o"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-o' argument");
-
-    args = new String[]
-    {
-      "-assertionFilter"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '--assertionFilter' argument");
-
-    args = new String[]
-    {
-      "--preReadAttributes"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '--preReadAttributes' argument");
-
-    args = new String[]
-    {
-      "--postReadAttributes"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '--postReadAttributes' argument");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-j", "no.such.file",
-    };
-    argLists.add(args);
-    reasonList.add("Invalid bind password file path");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-j", validPasswordFile,
-    };
-    argLists.add(args);
-    reasonList.add("Both bind password and password file");
-
-    args = new String[]
-    {
-      "-V", "nonnumeric",
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric LDAP version");
-
-    args = new String[]
-    {
-      "-V", "1",
-    };
-    argLists.add(args);
-    reasonList.add("Invalid LDAP version");
-
-    args = new String[]
-    {
-      "-J", "1.2.3.4:invalidcriticality",
-    };
-    argLists.add(args);
-    reasonList.add("Invalid control criticality");
-
-    args = new String[]
-    {
-      "-p", "nonnumeric",
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric port");
-
-    args = new String[]
-    {
-      "-p", "999999",
-    };
-    argLists.add(args);
-    reasonList.add("Port value out of range");
-
-    args = new String[]
-    {
-      "-r",
-      "-K", "key.store.file",
-    };
-    argLists.add(args);
-    reasonList.add("SASL external without SSL or StartTLS");
-
-    args = new String[]
-    {
-      "-Z",
-      "-r",
-    };
-    argLists.add(args);
-    reasonList.add("SASL external without keystore file");
-
-    args = new String[]
-    {
-      "--assertionFilter", "(invalid)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid LDAP assertion filter");
-
-    args = new String[]
-    {
-      "-f", "no.such.file"
-    };
-    argLists.add(args);
-    reasonList.add("No such LDIF file");
-
-
-    Object[][] returnArray = new Object[argLists.size()][2];
-    for (int i=0; i < argLists.size(); i++)
-    {
-      returnArray[i][0] = argLists.get(i);
-      returnArray[i][1] = reasonList.get(i);
-    }
-    return returnArray;
-  }
-
-
-
-  /**
-   * Tests the LDAPModify tool with sets of invalid arguments.
-   *
-   * @param  args           The set of arguments to use for the LDAPModify tool.
-   * @param  invalidReason  The reason the provided arguments were invalid.
-   */
-  @Test(dataProvider = "invalidArgs")
-  public void testInvalidArguments(String[] args, String invalidReason)
-  {
-    assertFalse(LDAPModify.mainModify(args, false, null, null) == 0,
-                "Should have been invalid because:  " + invalidReason);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using LDAPv2.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testLDAPv2Modify()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-V", "2",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using LDAPv3.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testLDAPv3Modify()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-V", "3",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation over SSL using blind trust.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLBlindTrust()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-X",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation over SSL using a trust store.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLTrustStore()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-P", trustStorePath,
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation with StartTSL using blind trust.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testStartTLSBlindTrust()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-X",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation with StartTLS using a trust store.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testStartTLSTrustStore()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-P", trustStorePath,
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation over SSL using a trust store and SASL
-   * EXTERNAL.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLTrustStoreSASLExternal()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "ds-privilege-name: bypass-acl",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-P", trustStorePath,
-      "-r",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation over SSL using a trust store and SASL
-   * EXTERNAL while explicitly specifying a valid client certificate.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLTrustStoreSASLExternalValidClientCert()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "ds-privilege-name: bypass-acl",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-N", "client-cert",
-      "-P", trustStorePath,
-      "-r",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation over SSL using a trust store and SASL
-   * EXTERNAL while explicitly specifying an invalid client certificate.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLTrustStoreSASLExternalInvalidClientCert()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "ds-privilege-name: bypass-acl",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-N", "invalid",
-      "-P", trustStorePath,
-      "-r",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertFalse(LDAPModify.mainModify(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation with StartTLS using a trust store and SASL
-   * EXTERNAL.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testStartTLSTrustStoreSASLExternal()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "ds-privilege-name: bypass-acl",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-P", trustStorePath,
-      "-r",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using CRAM-MD5 authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCRAMMD5()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "ds-privilege-name: bypass-acl",
-         "userPassword: password",
-         "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
-              "cn=Password Policies,cn=config");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=CRAM-MD5",
-      "-o", "authid=u:test.user",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using DIGEST-MD5 authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDigestMD5()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "ds-privilege-name: bypass-acl",
-         "userPassword: password",
-         "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
-              "cn=Password Policies,cn=config");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=DIGEST-MD5",
-      "-o", "authid=u:test.user",
-      "-o", "authzid=u:test.user",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using PLAIN authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testPLAIN()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=PLAIN",
-      "-o", "authid=dn:cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using the --dry-run client-side option.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyClientSideNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--dry-run",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple add operation using the --dry-run client-side option.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAddClientSideNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: add",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "o: test");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--dry-run",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple delete operation using the --dry-run client-side option.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDeleteClientSideNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: o=test",
-         "changetype: delete");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--dry-run",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify DN operation using the --dry-run client-side option.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyDNClientSideNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: moddn",
-         "newRDN: ou=Users",
-         "deleteOldRDN: 1");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--dry-run",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using LDAP No-Op control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyLDAPNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", OID_LDAP_NOOP_OPENLDAP_ASSIGNED + ":true",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using LDAP No-Op control with an alternate
-   * name.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyLDAPNoOpAltName()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", "no-op:true",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple add operation using LDAP No-Op control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAddLDAPNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: add",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", OID_LDAP_NOOP_OPENLDAP_ASSIGNED + ":true",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple add operation using LDAP No-Op control with an alternate
-   * name.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAddLDAPNoOpAltName()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: add",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", "no-op:true",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple delete operation using LDAP No-Op control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDeleteLDAPNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: o=test",
-         "changetype: delete");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", OID_LDAP_NOOP_OPENLDAP_ASSIGNED + ":true",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple delete operation using LDAP No-Op control with an alternate
-   * name.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDeleteLDAPNoOpAltName()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: o=test",
-         "changetype: delete");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", "no-op:true",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple modify DN operation using LDAP No-Op control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyDNLDAPNoOp()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: ou=People,o=test",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: moddn",
-         "newRDN: ou=Users",
-         "deleteOldRDN: 1");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", OID_LDAP_NOOP_OPENLDAP_ASSIGNED + ":true",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple modify DN operation using LDAP No-Op control with an
-   * alternate name.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyDNLDAPNoOpAltName()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: ou=People,o=test",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: moddn",
-         "newRDN: ou=Users",
-         "deleteOldRDN: 1");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", "no-op:true",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using the LDAP assertion control in which
-   * the assertion is true.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyLDAPAssertionTrue()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--assertionFilter", "(o=test)",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using the LDAP assertion control in which
-   * the assertion is not true.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyLDAPAssertionFalse()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--assertionFilter", "(o=foo)",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertFalse(LDAPModify.mainModify(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests a simple delete operation using the LDAP assertion control in which
-   * the assertion is true.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDeleteLDAPAssertionTrue()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile("dn: o=test",
-                                               "changetype: delete");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--assertionFilter", "(o=test)",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify DN operation using the LDAP assertion control in
-   * which the assertion is true.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyDNLDAPAssertionTrue()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: ou=People,o=test",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String path = TestCaseUtils.createTempFile("dn: ou=People,o=test",
-                                               "changetype: moddn",
-                                               "newRDN: ou=Users",
-                                               "deleteOldRDN: 1");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--assertionFilter", "(ou=People)",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using the LDAP pre-read control with a
-   * single attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyLDAPPreReadSingleAttribute()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--preReadAttributes", "o",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using the LDAP pre-read control with a
-   * single attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyLDAPPreReadMultipleAttributes()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--preReadAttributes", "o,objectClass",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple delete operation using the LDAP pre-read control with a
-   * single attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDeleteLDAPPreReadSingleAttribute()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile("dn: o=test",
-                                               "changetype: delete");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--preReadAttributes", "o",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify DN operation using the LDAP pre-read control with a
-   * single attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyDNLDAPPreReadSingleAttribute()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: ou=People,o=test",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String path = TestCaseUtils.createTempFile("dn: ou=People,o=test",
-                                               "changetype: moddn",
-                                               "newRDN: ou=Users",
-                                               "deleteOldRDN: 1");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--preReadAttributes", "o",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using the LDAP post-read control with a
-   * single attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyLDAPostReadSingleAttribute()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--postReadAttributes", "o",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify operation using the LDAP post-read control with a
-   * single attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyLDAPPostReadMultipleAttributes()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--postReadAttributes", "o,objectClass",
-      "--noPropertiesFile",
-      "-f", modifyFilePath
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple add operation using the LDAP post-read control with a
-   * single attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAddLDAPostReadSingleAttribute()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: add",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--postReadAttributes", "o",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple modify DN operation using the LDAP post-read control with a
-   * single attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyDNLDAPostReadSingleAttribute()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: ou=People,o=test",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String path = TestCaseUtils.createTempFile("dn: ou=People,o=test",
-                                               "changetype: moddn",
-                                               "newRDN: ou=Users",
-                                               "deleteOldRDN: 1");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--postReadAttributes", "o",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a modify operation that will fail on the server side.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testServerSideModifyFailure()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: modify",
-         "replace: description",
-         "description: foo");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--postReadAttributes", "o,objectClass",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertFalse(LDAPModify.mainModify(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests performing an add operation with an explicit changetype.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAddExplicitChangeType()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: add",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests performing an add operation with an implied changetype.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAddImplicitChangeType()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests performing a modify DN operation.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testModifyDN()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: add",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People",
-         "",
-         "dn: ou=People,o=test",
-         "changetype: moddn",
-         "newRDN: ou=Users",
-         "deleteOldRDN: 1");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests performing a delete operation.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDelete()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: ou=People,o=test",
-         "changetype: add",
-         "objectClass: top",
-         "objectClass: organizationalUnit",
-         "ou: People",
-         "",
-         "dn: ou=People,o=test",
-         "changetype: delete");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the inclusion of multiple arbitrary controls in the request to the
-   * server.
-   *
-   * @throws  Exception  If an unexpectd problem occurs.
-   */
-  @Test
-  public void testMultipleRequestControls()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: o=test",
-         "changetype: delete");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-J", OID_MANAGE_DSAIT_CONTROL + ":false",
-      "-J", OID_SUBTREE_DELETE_CONTROL + ":true",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with various forms of malformed LDIF changes.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testMalformedLDIF()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: o=test",
-         "description: No Changetype",
-         "",
-         "dn: o=test",
-         "changetype: invalid",
-         "replace: description",
-         "description: Invalid Changetype",
-         "",
-         "dn: o=test",
-         "changetype: modify",
-         "invalid: description",
-         "description: Invalid Attribute Modification",
-         "",
-         "dn: ou=People,o=test",
-         "",
-         "dn: ou=People,o=test",
-         "changetype: add",
-         "",
-         "dn: ou=People,o=test",
-         "changetype: moddn",
-         "",
-         "dn: ou=People,o=test",
-         "changetype: moddn",
-         "newrdn: invalid",
-         "deleteOldRDN: 1",
-         "",
-         "dn: ou=People,o=test",
-         "changetype: moddn",
-         "newrdn: ou=Users",
-         "deleteOldRDN: invalid");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-c",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    LDAPModify.mainModify(args, false, null,null);
-  }
-
-
-
-  /**
-   * Tests a modify attempt failure without continueOnError.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testMalformedLDIFNoContinueOnError()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String path = TestCaseUtils.createTempFile(
-         "dn: o=test",
-         "description: No Changetype",
-         "",
-         "dn: o=test",
-         "changetype: invalid",
-         "replace: description",
-         "description: Invalid Changetype");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "--noPropertiesFile",
-      "-f", path
-    };
-
-    LDAPModify.mainModify(args, false, null,null);
-  }
-
-
-
-  /**
-   * Tests the LDAPModify tool with the "--help" option.
-   */
-  @Test
-  public void testHelp()
-  {
-    String[] args = { "--help" };
-    assertEquals(LDAPModify.mainModify(args, false, null, null), 0);
-
-    args = new String[] { "-H" };
-    assertEquals(LDAPModify.mainModify(args, false, null, null), 0);
-
-    args = new String[] { "-?" };
-    assertEquals(LDAPModify.mainModify(args, false, null, null), 0);
-  }
-}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPPasswordModifyTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPPasswordModifyTestCase.java
deleted file mode 100644
index c8af860..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPPasswordModifyTestCase.java
+++ /dev/null
@@ -1,1124 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
- */
-package org.opends.server.tools;
-
-
-
-import java.io.File;
-import java.io.FileWriter;
-import java.util.ArrayList;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import static org.testng.Assert.*;
-
-import static org.opends.server.util.ServerConstants.*;
-
-
-
-/**
- * A set of test cases for the LDAPPasswordModify tool.
- */
-public class LDAPPasswordModifyTestCase
-       extends ToolsTestCase
-{
-  /** The path to a file containing the current bind password. */
-  private String currentPasswordFile;
-
-  /** The path to a file containing the new password. */
-  private String newPasswordFile;
-
-
-
-  /**
-   * Ensures that the Directory Server is running and performs other necessary
-   * setup.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @BeforeClass
-  public void startServerAndCreatePasswordFiles()
-         throws Exception
-  {
-    TestCaseUtils.startServer();
-
-    File pwFile = File.createTempFile("valid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    FileWriter fileWriter = new FileWriter(pwFile);
-    fileWriter.write("newPassword" + System.getProperty("line.separator"));
-    fileWriter.close();
-    newPasswordFile = pwFile.getAbsolutePath();
-
-    pwFile = File.createTempFile("invalid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    fileWriter = new FileWriter(pwFile);
-    fileWriter.write("password" + System.getProperty("line.separator"));
-    fileWriter.close();
-    currentPasswordFile = pwFile.getAbsolutePath();
-  }
-
-
-
-  /**
-   * Retrieves sets of invalid arguments that may not be used to initialize
-   * the LDAPModify tool.
-   *
-   * @return  Sets of invalid arguments that may not be used to initialize the
-   *          LDAPModify tool.
-   */
-  @DataProvider(name = "invalidArgs")
-  public Object[][] getInvalidArgumentLists()
-  {
-    ArrayList<String[]> argLists   = new ArrayList<>();
-    ArrayList<String>   reasonList = new ArrayList<>();
-
-    String[] args = {};
-    argLists.add(args);
-    reasonList.add("No arguments were provided");
-
-    args = new String[]
-    {
-      "-h"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-h' argument");
-
-    args = new String[]
-    {
-      "-p"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-p' argument");
-
-    args = new String[]
-    {
-      "-D"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-D' argument");
-
-    args = new String[]
-    {
-      "-w"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-w' argument");
-
-    args = new String[]
-    {
-      "-j"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-j' argument");
-
-    args = new String[]
-    {
-      "-a"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-a' argument");
-
-    args = new String[]
-    {
-      "-n"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-n' argument");
-
-    args = new String[]
-    {
-      "-N"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-N' argument");
-
-    args = new String[]
-    {
-      "-c"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-c' argument");
-
-    args = new String[]
-    {
-      "-C"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-C' argument");
-
-    args = new String[]
-    {
-      "-K"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-K' argument");
-
-    args = new String[]
-    {
-      "-W"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-W' argument");
-
-    args = new String[]
-    {
-      "--keyStorePasswordFile"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '--keyStorePasswordFile' argument");
-
-    args = new String[]
-    {
-      "-P"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '-P' argument");
-
-    args = new String[]
-    {
-      "--trustStorePassword"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '--trustStorePassword' argument");
-
-    args = new String[]
-    {
-      "--trustStorePasswordFile"
-    };
-    argLists.add(args);
-    reasonList.add("No value for '--trustStorePasswordFile' argument");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-j", "no.such.file"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid bind password file path");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-j", currentPasswordFile
-    };
-    argLists.add(args);
-    reasonList.add("Both bind password and bind password file");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-c", "password",
-      "-C", currentPasswordFile
-    };
-    argLists.add(args);
-    reasonList.add("Both current password and current password file");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-n", "password",
-      "-N", newPasswordFile
-    };
-    argLists.add(args);
-    reasonList.add("Both new password and new password file");
-
-    args = new String[]
-    {
-      "-Z",
-      "-q"
-    };
-    argLists.add(args);
-    reasonList.add("Both SSL and StartTLS");
-
-    args = new String[]
-    {
-      "-p", "nonnumeric"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric port");
-
-    args = new String[]
-    {
-      "-p", "999999"
-    };
-    argLists.add(args);
-    reasonList.add("Port value out of range");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager"
-    };
-    argLists.add(args);
-    reasonList.add("Bind Dn without a password or password file");
-
-    args = new String[]
-    {
-      "-w", "password"
-    };
-    argLists.add(args);
-    reasonList.add("Bind password without a DN");
-
-    args = new String[]
-    {
-      "-j", currentPasswordFile
-    };
-    argLists.add(args);
-    reasonList.add("Bind password file without a DN");
-
-    args = new String[]
-    {
-      "-a", "u:test.user"
-    };
-    argLists.add(args);
-    reasonList.add("No bind credentials, with authzID, no current PW");
-
-    args = new String[]
-    {
-      "-A"
-    };
-    argLists.add(args);
-    reasonList.add("Provide DN for authzID without DN");
-
-
-    Object[][] returnArray = new Object[argLists.size()][2];
-    for (int i=0; i < argLists.size(); i++)
-    {
-      returnArray[i][0] = argLists.get(i);
-      returnArray[i][1] = reasonList.get(i);
-    }
-    return returnArray;
-  }
-
-
-
-  /**
-   * Tests the LDAPModify tool with sets of invalid arguments.
-   *
-   * @param  args           The set of arguments to use for the LDAPModify tool.
-   * @param  invalidReason  The reason the provided arguments were invalid.
-   */
-  @Test(dataProvider = "invalidArgs")
-  public void testInvalidArguments(String[] args, String invalidReason)
-  {
-    assertFalse(LDAPPasswordModify.mainPasswordModify(args, false, null,
-                                                      null) == 0,
-                "Should have been invalid because:  " + invalidReason);
-  }
-
-  /**
-   * Add a test user.
-   */
-  private static void addTestUser() throws Exception
-  {
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "ds-privilege-name: bypass-acl",
-         "userPassword: password");
-  }
-
-  /**
-   * Tests the ability to perform a self change including both the current and
-   * new passwords.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSelfChangeCurrentPasswordNewPassword()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "uid=test.user,o=test",
-      "-w", "password",
-      "-c", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a self change including a new password but no
-   * current password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSelfChangeNoCurrentPasswordNewPassword()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "uid=test.user,o=test",
-      "-w", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a self change including the current password
-   * but no new password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSelfChangeCurrentPasswordNoNewPassword()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "uid=test.user,o=test",
-      "-w", "password",
-      "-c", "password",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a self change including neither the current
-   * nor new passwords.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSelfChangeNoCurrentPasswordNoNewPassword()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "uid=test.user,o=test",
-      "-w", "password",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform an authenticated self change including an
-   * explicit authorization ID, a current password, and a new password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAuthenticatedSelfExplicitAuthzIDCurrentNew()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "uid=test.user,o=test",
-      "-w", "password",
-      "-a", "u:test.user",
-      "-c", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform an authenticated self change including an
-   * implicit authorization ID, a current password, and a new password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAuthenticatedSelfImplicitAuthzIDCurrentNew()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "uid=test.user,o=test",
-      "-w", "password",
-      "-A",
-      "-c", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform an authenticated self change including an
-   * implicit authorization ID, an implicit current password, and an explicit
-   * new password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAuthenticatedSelfImplicitAuthzIDNoCurrentNew()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "uid=test.user,o=test",
-      "-w", "password",
-      "-A",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform an unauthenticated self change with a new
-   * password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testUnauthenticatedSelfChangeNewPassword()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-a", "dn:uid=test.user,o=test",
-      "-c", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform an unauthenticated self change with no new
-   * password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testUnauthenticatedSelfChangeNoNewPassword()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-a", "dn:uid=test.user,o=test",
-      "-c", "password",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform an administrative reset with a new password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAdminResetNewPassword()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:uid=test.user,o=test",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform an administrative reset with no new password.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testAdminResetNoNewPassword()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:uid=test.user,o=test",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a password change over SSL with blind trust.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLBlindTrust()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-X",
-      "-a", "dn:uid=test.user,o=test",
-      "-c", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a password change over SSL with a trust store.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSSLTrustStore()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-P", trustStorePath,
-      "-a", "dn:uid=test.user,o=test",
-      "-c", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a password change using StartTLS with blind
-   * trust.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testStartTLSBlindTrust()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-X",
-      "-a", "dn:uid=test.user,o=test",
-      "-c", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a password change using StartTLS with a trust
-   * store.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testStartTLSTrustStore()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-P", trustStorePath,
-      "-a", "dn:uid=test.user,o=test",
-      "-c", "password",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a password reset when reading the bind and new
-   * passwords from a file.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testBindAndNewPasswordsFromFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-j", currentPasswordFile,
-      "-a", "dn:uid=test.user,o=test",
-      "-N", newPasswordFile,
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests the ability to perform a password change when reading the current and
-   * new passwords from a file.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCurrentAndNewPasswordsFromFile()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-a", "u:test.user",
-      "-C", currentPasswordFile,
-      "-N", newPasswordFile,
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-
-
-
-  /**
-   * Tests a failure when attempting an administrative reset with an invalid DN
-   * in the authorization ID.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testResetWithInvalidAuthzDN()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:invalid",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertFalse(LDAPPasswordModify.mainPasswordModify(args, false, null,
-                                                      null) == 0);
-  }
-
-
-
-  /**
-   * Tests a failure when attempting an administrative reset on a user entry
-   * that doesn't exist.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testResetOnNonExistentUser()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:cn=Does Not Exist,o=test",
-      "-n", "newPassword",
-      "--noPropertiesFile"
-    };
-
-    assertFalse(LDAPPasswordModify.mainPasswordModify(args, false, null,
-                                                      null) == 0);
-  }
-
-
-
-  /**
-   * Tests a failure when attempting an administrative reset on a user entry
-   * that has been disabled.  Also include the password policy control in the
-   * request.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testResetOnDisabledUser()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: password",
-         "ds-pwp-account-disabled: true");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:uid=test.user,o=test",
-      "-n", "newPassword",
-      "-J", "pwpolicy:true",
-      "--noPropertiesFile"
-    };
-
-    assertFalse(LDAPPasswordModify.mainPasswordModify(args, false, null,
-                                                      null) == 0);
-  }
-
-
-
-  /**
-   * Tests the password modify extended operation in conjunction with a control
-   * that is marked critical but that is not supported by the server.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testUnsupportedCriticalControl()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:uid=test.user,o=test",
-      "-n", "newPassword",
-      "-J", "1.2.3.4:true",
-      "--noPropertiesFile"
-    };
-
-    assertFalse(LDAPPasswordModify.mainPasswordModify(args, false, null, null)
-                == 0);
-  }
-
-
-
-  /**
-   * Tests the password modify extended operation in conjunction with the LDAP
-   * no-op control using the explicit OID for that control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testLDAPNoOpExplicitOID()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:uid=test.user,o=test",
-      "-n", "newPassword",
-      "-J", OID_LDAP_NOOP_OPENLDAP_ASSIGNED + ":true",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests the password modify extended operation in conjunction with the LDAP
-   * no-op control using a more user-friendly name instead of an OID.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testLDAPNoOpImplicitOID()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:uid=test.user,o=test",
-      "-n", "newPassword",
-      "-J", "noop:true",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests the password modify extended operation in conjunction with multiple
-   * request controls.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testLDAPMultipleControls()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    addTestUser();
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-a", "dn:uid=test.user,o=test",
-      "-n", "newPassword",
-      "-J", OID_LDAP_NOOP_OPENLDAP_ASSIGNED + ":true",
-      "-J", OID_PASSWORD_POLICY_CONTROL + ":true",
-      "--noPropertiesFile"
-    };
-
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 LDAPResultCode.NO_OPERATION);
-  }
-
-
-
-  /**
-   * Tests the LDAPModify tool with the "--help" option.
-   */
-  @Test
-  public void testHelp()
-  {
-    String[] args = { "--help" };
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-
-    args = new String[] { "-H" };
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-
-    args = new String[] { "-?" };
-    assertEquals(LDAPPasswordModify.mainPasswordModify(args, false, null, null),
-                 0);
-  }
-}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPSearchNoServerTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPSearchNoServerTestCase.java
deleted file mode 100644
index bbb2d08..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPSearchNoServerTestCase.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2013 ForgeRock AS.
- */
-package org.opends.server.tools;
-
-import static org.testng.Assert.*;
-
-import java.net.InetSocketAddress;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.testng.annotations.Test;
-
-/**
- * A set of test cases for the LDAPSearch tool.
- */
-public class LDAPSearchNoServerTestCase
-       extends ToolsTestCase
-{
-
-  /**
-   * Tests a simple search with the server down, we should get error code 91.
-   */
-  @Test
-  public void testSearchWithServerDown()
-  {
-    InetSocketAddress freeAddress =
-        (InetSocketAddress) TestCaseUtils.findFreeSocketAddress();
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(freeAddress.getPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err),
-        LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR);
-  }
-
-}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPSearchTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPSearchTestCase.java
deleted file mode 100644
index a769313..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDAPSearchTestCase.java
+++ /dev/null
@@ -1,2464 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011-2015 ForgeRock AS.
- */
-package org.opends.server.tools;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.core.DirectoryServer;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import static org.opends.server.util.ServerConstants.*;
-import static org.testng.Assert.*;
-
-/**
- * A set of test cases for the LDAPSearch tool.
- */
-@SuppressWarnings("javadoc")
-public class LDAPSearchTestCase
-       extends ToolsTestCase
-{
-  /** The path to a file containing an invalid bind password. */
-  private String invalidPasswordFile;
-
-  /** The path to a file containing a valid bind password. */
-  private String validPasswordFile;
-
-
-
-  /**
-   * Ensures that the Directory Server is running and performs other necessary
-   * setup.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @BeforeClass
-  public void startServerAndCreatePasswordFiles() throws Exception
-  {
-    TestCaseUtils.startServer();
-
-    TestCaseUtils.dsconfig(
-            "set-sasl-mechanism-handler-prop",
-            "--handler-name", "DIGEST-MD5",
-            "--set", "server-fqdn:" + "127.0.0.1");
-
-    File pwFile = File.createTempFile("valid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    FileWriter fileWriter = new FileWriter(pwFile);
-    fileWriter.write("password" + System.getProperty("line.separator"));
-    fileWriter.close();
-    validPasswordFile = pwFile.getAbsolutePath();
-
-    pwFile = File.createTempFile("invalid-bind-password-", ".txt");
-    pwFile.deleteOnExit();
-    fileWriter = new FileWriter(pwFile);
-    fileWriter.write("wrongPassword" + System.getProperty("line.separator"));
-    fileWriter.close();
-    invalidPasswordFile = pwFile.getAbsolutePath();
-  }
-
-
-  @AfterClass
-  public void tearDown() throws Exception {
-    TestCaseUtils.dsconfig(
-            "set-sasl-mechanism-handler-prop",
-            "--handler-name", "DIGEST-MD5",
-            "--remove", "server-fqdn:" + "127.0.0.1");
-  }
-
-  /**
-   * Retrieves sets of invalid arguments that may not be used to initialize
-   * the LDAPSearch tool.
-   *
-   * @return  Sets of invalid arguments that may not be used to initialize the
-   *          LDAPSearch tool.
-   */
-  @DataProvider(name = "invalidArgs")
-  public Object[][] getInvalidArgumentLists()
-  {
-    ArrayList<String[]> argLists   = new ArrayList<>();
-    ArrayList<String>   reasonList = new ArrayList<>();
-
-    String[] args = {};
-    argLists.add(args);
-    reasonList.add("No arguments");
-
-    List<String> options =
-        Arrays.asList("-b", "-D", "-w", "-j", "-Y", "-i", "-K", "-P", "-W",
-            "-h", "-p", "-V", "-f", "-J", "-z", "-l", "-s", "-a", "-o", "-c",
-            "--assertionFilter", "--matchedValuesFilter");
-    for (String option : options)
-    {
-      args = new String[] { option };
-      argLists.add(args);
-      reasonList.add("No value for '" + option + "' argument");
-    }
-
-    args = new String[]
-    {
-      "-I"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid short argument");
-
-    args = new String[]
-    {
-      "--invalidLongArgument"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid long argument");
-
-    args = new String[]
-    {
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("No base DN");
-
-    args = new String[]
-    {
-      "-b", ""
-    };
-    argLists.add(args);
-    reasonList.add("No filter");
-
-    args = new String[]
-    {
-      "-b", "",
-      "(invalidfilter)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid search filter");
-
-    args = new String[]
-    {
-      "-b", "",
-      "--assertionFilter", "(invalidfilter)",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid assertion filter");
-
-    args = new String[]
-    {
-      "-b", "",
-      "--matchedValuesFilter", "(invalidfilter)",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid matched values filter");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-j", "no.such.file",
-      "-b", "",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid bind password file path");
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-j", validPasswordFile,
-      "-b", "",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Both bind password and bind password file");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-V", "nonnumeric",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric LDAP version");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-V", "1",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid LDAP version");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-f", "no.such.file"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid filter file path");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-J", "1.2.3.4:invalidcriticality",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid control criticality");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-s", "invalid",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid scope");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-a", "invalid",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid dereference policy");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-C", "invalid",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid psearch descriptor");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-C", "ps:invalid",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid psearch changetype");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-C", "ps:add,delete,modify,modifydn,invalid",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid psearch changetype in list");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-C", "ps:all:invalid",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid psearch changesOnly");
-
-    args = new String[]
-    {
-      "-b", "",
-      "-C", "ps:all:1:invalid",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Invalid psearch entryChangeControls");
-
-    args = new String[]
-    {
-      "-p", "nonnumeric",
-      "-b", "",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric port");
-
-    args = new String[]
-    {
-      "-p", "999999",
-      "-b", "",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Port value out of range");
-
-    args = new String[]
-    {
-      "-z", "nonnumeric",
-      "-b", "",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric size limit");
-
-    args = new String[]
-    {
-      "-l", "nonnumeric",
-      "-b", "",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("Non-numeric time limit");
-
-    args = new String[]
-    {
-      "-r",
-      "-b", "",
-      "-K", "key.store.file",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("SASL external without SSL or StartTLS");
-
-    args = new String[]
-    {
-      "-Z",
-      "-r",
-      "-b", "",
-      "(objectClass=*)"
-    };
-    argLists.add(args);
-    reasonList.add("SASL external without a keystore file");
-
-
-    Object[][] returnArray = new Object[argLists.size()][2];
-    for (int i=0; i < argLists.size(); i++)
-    {
-      returnArray[i][0] = argLists.get(i);
-      returnArray[i][1] = reasonList.get(i);
-    }
-    return returnArray;
-  }
-
-
-
-  /**
-   * Tests the LDAPSearch tool with sets of invalid arguments.
-   *
-   * @param  args           The set of arguments to use for the LDAPSearch tool.
-   * @param  invalidReason  The reason that the set of arguments is not valid.
-   */
-  @Test(dataProvider = "invalidArgs")
-  public void testInvalidArguments(String[] args, String invalidReason)
-  {
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0,
-                "Should have been invalid because:  " + invalidReason);
-  }
-
-
-
-  /**
-   * Tests a simple LDAPv2 search.
-   */
-  @Test
-  public void testSimpleLDAPv2Search()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "2",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAPv3 search.
-   */
-  @Test
-  public void testSimpleLDAPv3Search()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple search with verbose output.
-   */
-  @Test
-  public void testSimpleVerboseSearch()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-v",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple invocation using the "--dry-run" option with a valid argument
-   * set.
-   */
-  @Test
-  public void testNoOpSearchValidArguments()
-  {
-    String[] args =
-    {
-      "-h", "doesnt.need.to.resolve",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--dry-run",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple invocation using the "--dry-run" option with an invalid
-   * argument set.
-   */
-  @Test
-  public void testNoOpSearchInvalidArguments()
-  {
-    String[] args =
-    {
-      "-h", "doesnt.need.to.resolve",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-V", "3",
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "",
-      "-s", "invalid",
-      "--dry-run",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, System.err) == 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP search over SSL using blind trust.
-   */
-  @Test
-  public void testSimpleSearchSSLBlindTrust()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-X",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP search over SSL using a trust store.
-   */
-  @Test
-  public void testSimpleSearchSSLTrustStore()
-  {
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-P", trustStorePath,
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP search using StartTLS with blind trust.
-   */
-  @Test
-  public void testSimpleSearchStartTLSBlindTrust()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-X",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP search using StartTLS with a trust store.
-   */
-  @Test
-  public void testSimpleSearchStartTLSTrustStore()
-  {
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-P", trustStorePath,
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP search over SSL using a trust store and SASL EXTERNAL
-   * authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleSearchSSLTrustStoreSASLExternal()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-P", trustStorePath,
-      "-r",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP search over SSL using a trust store and SASL EXTERNAL
-   * authentication when explicitly specifying a valid client certificate.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleSearchSSLTrustStoreSASLExternalValidClientCert()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-N", "client-cert",
-      "-P", trustStorePath,
-      "-r",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP search over SSL using a trust store and SASL EXTERNAL
-   * authentication when explicitly specifying an invalid client certificate.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleSearchSSLTrustStoreSASLExternalInvalidClientCert()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapsPort()),
-      "-Z",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-N", "invalid",
-      "-P", trustStorePath,
-      "-r",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests a simple LDAP search using StartTLS with a trust store and SASL
-   * EXTERNAL authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimpleSearchStartTLSTrustStoreSASLExternal()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: cn=Test User,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "cn: Test User",
-         "givenName: Test",
-         "sn: User");
-
-
-    String keyStorePath   = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.keystore";
-    String trustStorePath = DirectoryServer.getInstanceRoot() + File.separator +
-                            "config" + File.separator + "client.truststore";
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-q",
-      "-K", keyStorePath,
-      "-W", "password",
-      "-P", trustStorePath,
-      "-r",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple search operation using CRAM-MD5 authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testCRAMMD5()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: password",
-         "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
-              "cn=Password Policies,cn=config");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=CRAM-MD5",
-      "-o", "authid=u:test.user",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple search operation using CRAM-MD5 authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testDigestMD5()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry(
-         "dn: uid=test.user,o=test",
-         "objectClass: top",
-         "objectClass: person",
-         "objectClass: organizationalPerson",
-         "objectClass: inetOrgPerson",
-         "uid: test.user",
-         "givenName: Test",
-         "sn: User",
-         "cn: Test User",
-         "userPassword: password",
-         "ds-pwp-password-policy-dn: cn=Clear UserPassword Policy," +
-              "cn=Password Policies,cn=config");
-
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=DIGEST-MD5",
-      "-o", "authid=u:test.user",
-      "-o", "authzid=u:test.user",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a simple search operation using PLAIN authentication.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testPLAIN()
-         throws Exception
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-o", "mech=PLAIN",
-      "-o", "authid=dn:cn=Directory Manager",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a search with a malformed bind DN.
-   */
-  @Test
-  public void testMalformedBindDN()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "malformed",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests a search with a nonexistent bind DN.
-   */
-  @Test
-  public void testNonExistentBindDN()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Does Not Exist",
-      "-w", "password",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests a search with an invalid password.
-   */
-  @Test
-  public void testInvalidBindPassword()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "wrongPassword",
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests a search with a valid password read from a file.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testValidPasswordFromFile()
-         throws Exception
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-j", validPasswordFile,
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests a search with an invalid password read from a file.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testInvalidPasswordFromFile()
-         throws Exception
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-j", invalidPasswordFile,
-      "-b", "",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests a search with a malformed base DN.
-   */
-  @Test
-  public void testMalformedBaseDN()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "malformed",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests a search with a nonexistent base DN.
-   */
-  @Test
-  public void testNonExistentBaseDN()
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "o=does not exist",
-      "-s", "base",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Retrieves the set of valid search scopes.
-   *
-   * @return  The set of valid search scopes.
-   */
-  @DataProvider(name = "scopes")
-  public Object[][] getSearchScopes()
-  {
-    return new Object[][]
-    {
-      new Object[] { "base" },
-      new Object[] { "one" },
-      new Object[] { "sub" },
-      new Object[] { "subordinate" },
-    };
-  }
-
-
-
-  /**
-   * Tests searches with the various allowed search scopes.
-   *
-   * @param  scope  The scope to use for the search.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "scopes")
-  public void testSearchScopes(String scope)
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "o=test",
-      "-s", scope,
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Retrieves the set of valid alias dereferencing policies.
-   *
-   * @return  The set of valid alias dereferencing policies.
-   */
-  @DataProvider(name = "derefPolicies")
-  public Object[][] getDerefPolicies()
-  {
-    return new Object[][]
-    {
-      new Object[] { "never" },
-      new Object[] { "always" },
-      new Object[] { "search" },
-      new Object[] { "find" },
-    };
-  }
-
-
-
-  /**
-   * Tests searches with the various allowed dereference policy values.
-   *
-   * @param  derefPolicy  The alias dereferencing policy for the search.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "derefPolicies")
-  public void testDerefPolicies(String derefPolicy)
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "o=test",
-      "-s", "base",
-      "-a", derefPolicy,
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with the typesOnly option.
-   */
-  @Test
-  public void testTypesOnly()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "o=test",
-      "-s", "base",
-      "-A",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with the reportAuthzID option for an unauthenticated search.
-   */
-  @Test
-  public void testReportAuthzIDUnauthenticated()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "o=test",
-      "-s", "base",
-      "--reportAuthzID",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with the reportAuthzID option for an authenticated search.
-   */
-  @Test
-  public void testReportAuthzIDAuthenticated()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "--reportAuthzID",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with the usePasswordPolicyControl option for an authenticated search.
-   */
-  @Test
-  public void testUsePasswordPolicyControl()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "--usePasswordPolicyControl",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with the account usability control for an authenticated search.
-   */
-  @Test
-  public void testAccountUsabilityControl()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "-J", OID_ACCOUNT_USABLE_CONTROL + ":true",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with the account usability control with an alternate name for an
-   * authenticated search.
-   */
-  @Test
-  public void testAccountUsabilityControlAltName()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "-J", "accountusable:true",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with the LDAP assertion control in which the assertion is true.
-   */
-  @Test
-  public void testLDAPAssertionControlTrue()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "--assertionFilter", "(objectClass=top)",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests with the LDAP assertion control in which the assertion is false.
-   */
-  @Test
-  public void testLDAPAssertionControlFalse()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "--assertionFilter", "(objectClass=doesNotMatch)",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests with the LDAP matched values control.
-   */
-  @Test
-  public void testMatchedValuesControl()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "--matchedValuesFilter", "(objectClass=*person)",
-      "--noPropertiesFile",
-      "(objectClass=*)",
-      "objectClass"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the LDAP subentries control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSubentriesControl()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-    TestCaseUtils.addEntry("dn: cn=test,o=test",
-                                      "objectClass: top",
-                                      "objectClass: ldapSubEntry",
-                                      "cn: test");
-
-    String[] args =
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "o=test",
-      "-s", "sub",
-      "--countEntries",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, true, null, System.err), 1);
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "o=test",
-      "-s", "sub",
-      "--countEntries",
-      "--noPropertiesFile",
-      "--subEntries",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, true, null, System.err), 1);
-
-    args = new String[]
-    {
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-b", "cn=test,o=test",
-      "-s", "base",
-      "--countEntries",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, true, null, System.err), 1);
-  }
-
-
-
-  /**
-   * Tests the inclusion of multiple arbitrary controls in the request to the
-   * server.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testMultipleRequestControls()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "-J", OID_ACCOUNT_USABLE_CONTROL + ":true",
-      "-J", OID_MANAGE_DSAIT_CONTROL + ":false",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the simple paged results control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSimplePagedResults()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    TestCaseUtils.addEntries(
-      "dn: cn=device 1,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: device",
-      "cn: device 1",
-      "",
-      "dn: cn=device 2,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: device",
-      "cn: device 2",
-      "",
-      "dn: cn=device 3,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: device",
-      "cn: device 3",
-      "",
-      "dn: cn=device 4,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: device",
-      "cn: device 4",
-      "",
-      "dn: cn=device 5,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: device",
-      "cn: device 5");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "one",
-      "--simplePageSize", "2",
-      "--countEntries",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, true, null, System.err), 5);
-  }
-
-
-
-  /**
-   * Tests the use of both the server-side sort control and the simple paged
-   * results control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortWithPagedResults()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    TestCaseUtils.addEntries(
-      "dn: uid=albert.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Albert",
-      "sn: Zimmerman",
-      "cn: Albert Zimmerman",
-      "",
-      "dn: uid=albert.smith,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.smith",
-      "givenName: Albert",
-      "sn: Smith",
-      "cn: Albert Smith",
-      "",
-      "dn: uid=aaron.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Aaron",
-      "givenName: Zeke",
-      "sn: Zimmerman",
-      "cn: Aaron Zimmerman",
-      "",
-      "dn: uid=mary.jones,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: mary.jones",
-      "givenName: Mary",
-      "sn: Jones",
-      "cn: Mary Jones",
-      "",
-      "dn: uid=margaret.jones,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: margaret.jones",
-      "givenName: Margaret",
-      "givenName: Maggie",
-      "sn: Jones",
-      "sn: Smith",
-      "cn: Maggie Jones-Smith",
-      "",
-      "dn: uid=aaccf.johnson,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: aaccf.johnson",
-      "givenName: Aaccf",
-      "sn: Johnson",
-      "cn: Aaccf Johnson",
-      "",
-      "dn: uid=sam.zweck,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: sam.zweck",
-      "givenName: Sam",
-      "sn: Zweck",
-      "cn: Sam Zweck",
-      "",
-      "dn: uid=lowercase.mcgee,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: lowercase.mcgee",
-      "givenName: lowercase",
-      "sn: mcgee",
-      "cn: lowercase mcgee",
-      "",
-      "dn: uid=zorro,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: zorro",
-      "sn: Zorro",
-      "cn: Zorro");
-
-    String[] pagedArgs =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "givenName",
-      "--simplePageSize", "2",
-      "--countEntries",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    String[] unpagedArgs =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "givenName",
-      "--countEntries",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(
-        LDAPSearch.mainSearch(pagedArgs, false, true, null, System.err),
-        LDAPSearch.mainSearch(unpagedArgs, false, true, null, System.err));
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with valid sort criteria.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortValidGivenNameAscending()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    TestCaseUtils.addEntries(
-      "dn: uid=albert.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Albert",
-      "sn: Zimmerman",
-      "cn: Albert Zimmerman",
-      "",
-      "dn: uid=albert.smith,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.smith",
-      "givenName: Albert",
-      "sn: Smith",
-      "cn: Albert Smith",
-      "",
-      "dn: uid=aaron.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Aaron",
-      "givenName: Zeke",
-      "sn: Zimmerman",
-      "cn: Aaron Zimmerman");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "givenName",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with valid sort criteria.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortValidGivenNameDescending()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    TestCaseUtils.addEntries(
-      "dn: uid=albert.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Albert",
-      "sn: Zimmerman",
-      "cn: Albert Zimmerman",
-      "",
-      "dn: uid=albert.smith,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.smith",
-      "givenName: Albert",
-      "sn: Smith",
-      "cn: Albert Smith",
-      "",
-      "dn: uid=aaron.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Aaron",
-      "givenName: Zeke",
-      "sn: Zimmerman",
-      "cn: Aaron Zimmerman");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "-givenName",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with valid sort criteria.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortValidGivenNameAscendingCaseExactOrderingMatch()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    TestCaseUtils.addEntries(
-      "dn: uid=albert.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Albert",
-      "sn: Zimmerman",
-      "cn: Albert Zimmerman",
-      "",
-      "dn: uid=albert.smith,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.smith",
-      "givenName: Albert",
-      "sn: Smith",
-      "cn: Albert Smith",
-      "",
-      "dn: uid=aaron.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Aaron",
-      "givenName: Zeke",
-      "sn: Zimmerman",
-      "cn: Aaron Zimmerman");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "givenName:caseExactOrderingMatch",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with valid sort criteria.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortValidSnAscendingGivenNameAscending()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    TestCaseUtils.addEntries(
-      "dn: uid=albert.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Albert",
-      "sn: Zimmerman",
-      "cn: Albert Zimmerman",
-      "",
-      "dn: uid=albert.smith,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.smith",
-      "givenName: Albert",
-      "sn: Smith",
-      "cn: Albert Smith",
-      "",
-      "dn: uid=aaron.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Aaron",
-      "givenName: Zeke",
-      "sn: Zimmerman",
-      "cn: Aaron Zimmerman");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "sn,givenName",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with valid sort criteria.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortValidSnAscendingGivenNameDescending()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    TestCaseUtils.addEntries(
-      "dn: uid=albert.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Albert",
-      "sn: Zimmerman",
-      "cn: Albert Zimmerman",
-      "",
-      "dn: uid=albert.smith,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.smith",
-      "givenName: Albert",
-      "sn: Smith",
-      "cn: Albert Smith",
-      "",
-      "dn: uid=aaron.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Aaron",
-      "givenName: Zeke",
-      "sn: Zimmerman",
-      "cn: Aaron Zimmerman");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "sn,-givenName",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with an empty sort order.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortEmptySortOrder()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with a sort order containing
-   * a key with no attribute type.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortSortOrderMissingType()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "-,sn",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with a sort order containing
-   * a key with a colon but no matching rule.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortSortOrderMissingMatchingRule()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "-sn:",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with an undefined attribute.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortUndefinedAttribute()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "undefined",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with an undefined ordering
-   * rule.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortUndefinedOrderingRule()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "givenName:undefined",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-  /**
-   * Tests the use of a control with an empty value.
-   * We use the ManageDSAIt control for this.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testControlNoValue()
-         throws Exception
-  {
-    TestCaseUtils.initializeTestBackend(true);
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "o=test",
-      "-s", "base",
-      "-J", "managedsait:false:",
-      "--noPropertiesFile",
-      "(objectClass=*)",
-      "dn"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
-  }
-
-
-
-  /**
-   * Tests the use of the virtual list view control without the server-side sort
-   * control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testVLVWithoutSort()
-         throws Exception
-  {
-    // Test is supposed to fail in parsing arguments. But we do not
-    // want it to fail because there no backend to search in.
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-G", "0:9:1:0",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the use of the server-side sort control with both the simple paged
-   * results and virtual list view controls.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortWithVLVAndPagedResults()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "sn,givenName",
-      "--simplePageSize", "2",
-      "-G", "0:3:1:0",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the use of the virtual list view control with an invalid descriptor
-   * with no colons.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testVLVInvalidDescriptorNoColons()
-         throws Exception
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "sn,givenName",
-      "-G", "invalid",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the use of the virtual list view control with an invalid descriptor
-   * with two colons.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testVLVInvalidDescriptorTwoColons()
-         throws Exception
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "sn,givenName",
-      "-G", "invalid:9:invalid",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the use of the virtual list view control with an invalid descriptor
-   * with three colons.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testVLVInvalidDescriptorThreeColons()
-         throws Exception
-  {
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "sn,givenName",
-      "-G", "invalid:9:1:0",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
-  }
-
-
-
-  /**
-   * Tests the use of both the server-side sort control and the virtual list
-   * view control.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test
-  public void testSortWithVLV()
-         throws Exception
-  {
-    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
-
-    TestCaseUtils.addEntries(
-      "dn: uid=albert.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Albert",
-      "sn: Zimmerman",
-      "cn: Albert Zimmerman",
-      "",
-      "dn: uid=albert.smith,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.smith",
-      "givenName: Albert",
-      "sn: Smith",
-      "cn: Albert Smith",
-      "",
-      "dn: uid=aaron.zimmerman,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: albert.zimmerman",
-      "givenName: Aaron",
-      "givenName: Zeke",
-      "sn: Zimmerman",
-      "cn: Aaron Zimmerman",
-      "",
-      "dn: uid=mary.jones,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: mary.jones",
-      "givenName: Mary",
-      "sn: Jones",
-      "cn: Mary Jones",
-      "",
-      "dn: uid=margaret.jones,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: margaret.jones",
-      "givenName: Margaret",
-      "givenName: Maggie",
-      "sn: Jones",
-      "sn: Smith",
-      "cn: Maggie Jones-Smith",
-      "",
-      "dn: uid=aaccf.johnson,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: aaccf.johnson",
-      "givenName: Aaccf",
-      "sn: Johnson",
-      "cn: Aaccf Johnson",
-      "",
-      "dn: uid=sam.zweck,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: sam.zweck",
-      "givenName: Sam",
-      "sn: Zweck",
-      "cn: Sam Zweck",
-      "",
-      "dn: uid=lowercase.mcgee,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: lowercase.mcgee",
-      "givenName: lowercase",
-      "sn: mcgee",
-      "cn: lowercase mcgee",
-      "",
-      "dn: uid=zorro,dc=example,dc=com",
-      "objectClass: top",
-      "objectClass: person",
-      "objectClass: organizationalPerson",
-      "objectClass: inetOrgPerson",
-      "uid: zorro",
-      "sn: Zorro",
-      "cn: Zorro");
-
-    String[] args =
-    {
-      "-h", "127.0.0.1",
-      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
-      "-D", "cn=Directory Manager",
-      "-w", "password",
-      "-b", "dc=example,dc=com",
-      "-s", "sub",
-      "-S", "givenName",
-      "-G", "1:3:1:0",
-      "--noPropertiesFile",
-      "(objectClass=*)"
-    };
-
-    assertEquals(LDAPSearch.mainSearch(args, false, null, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDAPSearch tool with the "--help" option.
-   */
-  @Test
-  public void testHelp()
-  {
-    String[] args = { "--help" };
-    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
-
-    args = new String[] { "-H" };
-    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
-
-    args = new String[] { "-?" };
-    assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
-  }
-}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDIFDiffTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/LDIFDiffTestCase.java
deleted file mode 100644
index eaedf64..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDIFDiffTestCase.java
+++ /dev/null
@@ -1,782 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
- */
-package org.opends.server.tools;
-
-
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.core.DirectoryServer;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import static org.opends.server.protocols.ldap.LDAPResultCode.*;
-import static org.testng.Assert.*;
-
-
-
-/**
- * A set of test cases for the LDIFDiff tool.
- */
-public class LDIFDiffTestCase
-       extends ToolsTestCase
-{
-  /**
-   * The path to the file that will be used if there are no differences between
-   * the source and target LDIF data sets.
-   */
-  private String noDiffsFile =
-       System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT) + File.separator +
-       "tests" + File.separator + "unit-tests-testng" + File.separator +
-       "resource" + File.separator + "ldif-diff" + File.separator +
-       "diff-nochanges.ldif";
-
-
-
-  /**
-   * Make sure that the server is running, since we need it for schema
-   * handling.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @BeforeClass
-  public void startServer()
-         throws Exception
-  {
-    TestCaseUtils.startServer();
-  }
-
-
-  /** Calculates the checksum of a file. */
-  private long calcChecksum(String filename) throws Exception
-  {
-    return calcChecksum(new File(filename));
-  }
-
-  private long calcChecksum(File file) throws Exception
-  {
-    long checksum = 0L;
-    BufferedReader reader = new BufferedReader(new FileReader(file));
-    String line = null;
-    while ((line =reader.readLine()) != null)
-    {
-      checksum += line.hashCode();
-    }
-    reader.close();
-    return checksum;
-  }
-
-
-  /**
-   * Tests the LDIFDiff tool with an argument that will simply cause it to
-   * display usage information.
-   */
-  @Test
-  public void testUsage()
-  {
-    String[] args = { "--help" };
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-
-    args = new String[] { "-H" };
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-
-    args = new String[] { "-?" };
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-  }
-
-
-
-  /**
-   * Tests the LDIFDiff tool with an invalid set of arguments.
-   */
-  @Test
-  public void testInvalidArguments()
-  {
-    String[] args =
-    {
-      "--invalid"
-    };
-
-    assertFalse(LDIFDiff.mainDiff(args, true, System.out, System.err) == 0);
-  }
-
-
-
-  /**
-   * Retrieves the names of the files that should be used when testing the
-   * ldif-diff tool.  Each element of the outer array should be an array
-   * containing the following elements:
-   * <OL>
-   *   <LI>The path to the source LDIF file</LI>
-   *   <LI>The path to the target LDIF file</LI>
-   *   <LI>The path to the diff file, or {@code null} if the diff is supposed
-   *       to fail</LI>
-   * </OL>
-   */
-  @DataProvider(name = "testdata")
-  public Object[][] getTestData()
-  {
-    String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
-    String ldifRoot  = buildRoot + File.separator + "tests" + File.separator +
-                       "unit-tests-testng" + File.separator + "resource" +
-                       File.separator + "ldif-diff" + File.separator;
-
-    return new Object[][]
-    {
-      // Both files are empty.
-      new Object[] { ldifRoot + "source-empty.ldif",
-                     ldifRoot + "target-empty.ldif",
-                     noDiffsFile, noDiffsFile,
-                     COMPARE_TRUE },
-
-      // Both files are the single-entry source.
-      new Object[] { ldifRoot + "source-singleentry.ldif",
-                     ldifRoot + "source-singleentry.ldif",
-                     noDiffsFile, noDiffsFile,
-                     COMPARE_TRUE },
-
-      // Both files are the single-entry target.
-      new Object[] { ldifRoot + "target-singleentry.ldif",
-                     ldifRoot + "target-singleentry.ldif",
-                     noDiffsFile, noDiffsFile,
-                     COMPARE_TRUE },
-
-      // Both files are the multiple-entry source.
-      new Object[] { ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "source-multipleentries.ldif",
-                     noDiffsFile, noDiffsFile,
-                     COMPARE_TRUE },
-
-      // Both files are the multiple-entry target.
-      new Object[] { ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "target-multipleentries.ldif",
-                     noDiffsFile, noDiffsFile,
-                     COMPARE_TRUE },
-
-      // The source is empty but the target has a single entry.
-      new Object[] { ldifRoot + "source-empty.ldif",
-                     ldifRoot + "target-singleentry.ldif",
-                     ldifRoot + "diff-emptytosingle.ldif",
-                     ldifRoot + "diff-emptytosingle.ldif",
-                     COMPARE_FALSE },
-
-      // The source has a single entry but the target is empty.
-      new Object[] { ldifRoot + "source-singleentry.ldif",
-                     ldifRoot + "target-empty.ldif",
-                     ldifRoot + "diff-singletoempty.ldif",
-                     ldifRoot + "diff-singletoempty.ldif",
-                     COMPARE_FALSE },
-
-      // Make a change to only a single entry in the source->target direction.
-      new Object[] { ldifRoot + "source-singleentry.ldif",
-                     ldifRoot + "target-singleentry.ldif",
-                     ldifRoot + "diff-singleentry.ldif",
-                     ldifRoot + "diff-singleentry.ldif",
-                     COMPARE_FALSE },
-
-      // Make a change to only a single entry in the target->source direction.
-      new Object[] { ldifRoot + "target-singleentry.ldif",
-                     ldifRoot + "source-singleentry.ldif",
-                     ldifRoot + "diff-singleentry-reverse.ldif",
-                     ldifRoot + "diff-singleentry-reverse.ldif",
-                     COMPARE_FALSE },
-
-      // Make changes to multiple entries in the source->target direction.
-      new Object[] { ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "diff-multipleentries.ldif",
-                     ldifRoot + "diff-multipleentries-singlevalue.ldif",
-                     COMPARE_FALSE },
-
-      // Make changes to multiple entries in the target->source direction.
-      new Object[] { ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "diff-multipleentries-reverse.ldif",
-                     ldifRoot +
-                          "diff-multipleentries-reverse-singlevalue.ldif",
-                     COMPARE_FALSE },
-
-      // Go from one entry to multiple in the source->target direction.
-      new Object[] { ldifRoot + "source-singleentry.ldif",
-                     ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "diff-singletomultiple.ldif",
-                     ldifRoot + "diff-singletomultiple-singlevalue.ldif",
-                     COMPARE_FALSE },
-
-      // Go from one entry to multiple in the target->source direction.
-      new Object[] { ldifRoot + "target-singleentry.ldif",
-                     ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "diff-singletomultiple-reverse.ldif",
-                     ldifRoot + "diff-singletomultiple-reverse.ldif",
-                     COMPARE_FALSE },
-
-      // Go from multiple entries to one in the source->target direction.
-      new Object[] { ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "target-singleentry.ldif",
-                     ldifRoot + "diff-multipletosingle.ldif",
-                     ldifRoot + "diff-multipletosingle.ldif",
-                     COMPARE_FALSE },
-
-      // Go from multiple entries to one in the target->source direction.
-      new Object[] { ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "source-singleentry.ldif",
-                     ldifRoot + "diff-multipletosingle-reverse.ldif",
-                     ldifRoot +
-                          "diff-multipletosingle-reverse-singlevalue.ldif",
-                     COMPARE_FALSE },
-
-      // The source file doesn't exist.
-      new Object[] { ldifRoot + "source-notfound.ldif",
-                     ldifRoot + "target-singleentry.ldif",
-                     null, null,
-                     COMPARE_FALSE },
-
-      // The target file doesn't exist.
-      new Object[] { ldifRoot + "source-singleentry.ldif",
-                     ldifRoot + "target-notfound.ldif",
-                     null, null,
-                     COMPARE_FALSE }
-    };
-  }
-
-
-  /**
-   * Tests the LDIFDiff tool with the provided information to ensure that the
-   * normal mode of operation works as expected.  This is a bit tricky because
-   * the attributes and values will be written in an indeterminate order, so we
-   * can't just use string equality.  We'll have to use a crude checksum
-   * mechanism to test whether they are equal.  Combined with other methods in
-   * this class, this should be good enough.
-   *
-   * @param  sourceFile           The path to the file containing the source
-   *                              data set.
-   * @param  targetFile           The path to the file containing the target
-   *                              data set.
-   * @param  normalDiffFile       The path to the file containing the expected
-   *                              diff in "normal" form (at most one record per
-   *                              entry), or {@code null} if the diff is
-   *                              supposed to fail.
-   * @param  singleValueDiffFile  The path to the file containing the expected
-   *                              diff in "single-value" form, where each
-   *                              attribute-level change results in a separate
-   *                              entry per attribute value.
-   * @param resultCode            The result code that should be returned with
-   *                              --useCompareResultCode flag
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "testdata")
-  public void testVerifyNormal(String sourceFile, String targetFile,
-      String normalDiffFile, String singleValueDiffFile, int resultCode)
-      throws Exception
-  {
-    File outputFile = File.createTempFile("difftest", "ldif");
-    outputFile.deleteOnExit();
-
-    String[] args =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      "-o", outputFile.getAbsolutePath(),
-      "-O"
-    };
-    String[] argsUseCompare =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      // No need to write to the outputFile
-      "--useCompareResultCode"
-    };
-
-    if (normalDiffFile == null)
-    {
-      // We expect this to fail, so just make sure that it does.
-      assertFalse(LDIFDiff.mainDiff(args, true, System.out, System.err) == 0);
-      outputFile.delete();
-      return;
-    }
-
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-    assertEquals(calcChecksum(outputFile), calcChecksum(normalDiffFile));
-
-    assertEquals(LDIFDiff
-        .mainDiff(argsUseCompare, true, System.out, System.err), resultCode);
-    outputFile.delete();
-  }
-
-
-
-
-  /**
-   * Tests the LDIFDiff tool with the provided information to ensure that the
-   * single value changes mode of operation works as expected.  This is a bit
-   * tricky because the attributes and values will be written in an
-   * indeterminate order, so we can't just use string equality.  We'll have to
-   * use a crude checksum mechanism to test whether they are equal.  Combined
-   * with other methods in this class, this should be good enough.
-   *
-   * @param  sourceFile           The path to the file containing the source
-   *                              data set.
-   * @param  targetFile           The path to the file containing the target
-   *                              data set.
-   * @param  normalDiffFile       The path to the file containing the expected
-   *                              diff in "normal" form (at most one record per
-   *                              entry), or {@code null} if the diff is
-   *                              supposed to fail.
-   * @param  singleValueDiffFile  The path to the file containing the expected
-   *                              diff in "single-value" form, where each
-   *                              attribute-level change results in a separate
-   *                              entry per attribute value.
-   * @param resultCode            The result code that should be returned with
-   *                              --useCompareResultCode flag
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "testdata")
-  public void testVerifySingleValue(String sourceFile, String targetFile,
-      String normalDiffFile, String singleValueDiffFile, int resultCode)
-      throws Exception
-  {
-    File outputFile = File.createTempFile("difftest", "ldif");
-    outputFile.deleteOnExit();
-
-    String[] args =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      "-o", outputFile.getAbsolutePath(),
-      "-O",
-      "-S"
-    };
-    String[] argsUseCompare =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      // No need to write to the outputFile
-      "--useCompareResultCode"
-    };
-
-    if (singleValueDiffFile == null)
-    {
-      // We expect this to fail, so just make sure that it does.
-      assertFalse(LDIFDiff.mainDiff(args, true, System.out, System.err) == 0);
-      outputFile.delete();
-      return;
-    }
-
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-    assertEquals(calcChecksum(outputFile), calcChecksum(singleValueDiffFile));
-
-    assertEquals(LDIFDiff
-        .mainDiff(argsUseCompare, true, System.out, System.err), resultCode);
-    outputFile.delete();
-  }
-
-
-
-  /**
-   * Tests the LDIFDiff tool by first identifying the differences between the
-   * source and the target and then using the LDIFModify tool to apply the
-   * identified changes to the source LDIF and verify that it matches the
-   * target.
-   *
-   * @param  sourceFile           The path to the file containing the source
-   *                              data set.
-   * @param  targetFile           The path to the file containing the target
-   *                              data set.
-   * @param  normalDiffFile       The path to the file containing the expected
-   *                              diff in "normal" form (at most one record per
-   *                              entry), or {@code null} if the diff is
-   *                              supposed to fail.
-   * @param  singleValueDiffFile  The path to the file containing the expected
-   *                              diff in "single-value" form, where each
-   *                              attribute-level change results in a separate
-   *                              entry per attribute value.
-   * @param resultCode            The result code that should be returned with
-   *                              --useCompareResultCode flag
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "testdata")
-  public void testReconstructNormal(String sourceFile, String targetFile,
-      String normalDiffFile, String singleValueDiffFile, int resultCode)
-      throws Exception
-  {
-    // If the command is expected to fail, or if there aren't any differences,
-    // then bail out now.
-    if (normalDiffFile == null || normalDiffFile.equals(noDiffsFile))
-    {
-      return;
-    }
-
-
-    // Generate the diff file.
-    File diffOutputFile = File.createTempFile("difftest", "ldif");
-    diffOutputFile.deleteOnExit();
-
-    String[] args =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      "-o", diffOutputFile.getAbsolutePath()
-    };
-    String[] argsUseCompare =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      // No need to write to the outputFile
-      "--useCompareResultCode"
-    };
-
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-    assertEquals(LDIFDiff
-        .mainDiff(argsUseCompare, true, System.out, System.err), resultCode);
-
-
-    // Use LDIFModify to generate a new target file.
-    File newTargetFile = File.createTempFile("difftest", "newtarget.ldif");
-    newTargetFile.deleteOnExit();
-
-    DirectoryServer.getInstance();
-    args = new String[]
-    {
-      "-c", DirectoryServer.getConfigFile(),
-      "-s", sourceFile,
-      "-m", diffOutputFile.getAbsolutePath(),
-      "-t", newTargetFile.getAbsolutePath()
-    };
-
-    assertEquals(LDIFModify.ldifModifyMain(args, true, System.out, System.err),
-                 0);
-
-
-    // Use LDIFDiff again to verify that there are effectively no differences
-    // between the original target and the new target.
-    File newDiffFile = File.createTempFile("difftest", "newdiff.ldif");
-    newDiffFile.deleteOnExit();
-
-    args = new String[]
-    {
-      "-s", targetFile,
-      "-t", newTargetFile.getAbsolutePath(),
-      "-o", newDiffFile.getAbsolutePath()
-    };
-    argsUseCompare = new String[]
-    {
-      "-s", targetFile,
-      "-t", newTargetFile.getAbsolutePath(),
-      // No need to write to the outputFile
-      "--useCompareResultCode"
-    };
-
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-    assertEquals(calcChecksum(newDiffFile), calcChecksum(noDiffsFile));
-    assertEquals(LDIFDiff
-        .mainDiff(argsUseCompare, true, System.out, System.err), COMPARE_TRUE);
-
-    diffOutputFile.delete();
-    newTargetFile.delete();
-    newDiffFile.delete();
-  }
-
-
-
-  /**
-   * Tests the LDIFDiff tool by first identifying the differences between the
-   * source and the target (using the single-value format) and then using the
-   * LDIFModify tool to apply the identified changes to the source LDIF and
-   * verify that it matches the target.
-   *
-   * @param  sourceFile           The path to the file containing the source
-   *                              data set.
-   * @param  targetFile           The path to the file containing the target
-   *                              data set.
-   * @param  normalDiffFile       The path to the file containing the expected
-   *                              diff in "normal" form (at most one record per
-   *                              entry), or {@code null} if the diff is
-   *                              supposed to fail.
-   * @param  singleValueDiffFile  The path to the file containing the expected
-   *                              diff in "single-value" form, where each
-   *                              attribute-level change results in a separate
-   *                              entry per attribute value.
-   * @param resultCode            The result code that should be returned with
-   *                              --useCompareResultCode flag
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "testdata")
-  public void testReconstructSingleValue(String sourceFile, String targetFile,
-      String normalDiffFile, String singleValueDiffFile, int resultCode)
-      throws Exception
-  {
-    // If the command is expected to fail, or if there aren't any differences,
-    // then bail out now.
-    if (normalDiffFile == null || singleValueDiffFile.equals(noDiffsFile))
-    {
-      return;
-    }
-
-
-    // Generate the diff file.
-    File diffOutputFile = File.createTempFile("difftest", "ldif");
-    diffOutputFile.deleteOnExit();
-
-    String[] args =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      "-o", diffOutputFile.getAbsolutePath(),
-      "-S"
-    };
-    String[] argsUseCompare =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      // No need to write to the outputFile
-      "--useCompareResultCode"
-    };
-
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-    assertEquals(LDIFDiff
-        .mainDiff(argsUseCompare, true, System.out, System.err), resultCode);
-
-
-    // Use LDIFModify to generate a new target file.
-    File newTargetFile = File.createTempFile("difftest", "newtarget.ldif");
-    newTargetFile.deleteOnExit();
-
-    DirectoryServer.getInstance();
-    args = new String[]
-    {
-      "-c", DirectoryServer.getConfigFile(),
-      "-s", sourceFile,
-      "-m", diffOutputFile.getAbsolutePath(),
-      "-t", newTargetFile.getAbsolutePath()
-    };
-
-    assertEquals(LDIFModify.ldifModifyMain(args, true, System.out, System.err),
-                 0);
-
-
-    // Use LDIFDiff again to verify that there are effectively no differences
-    // between the original target and the new target.
-    File newDiffFile = File.createTempFile("difftest", "newdiff.ldif");
-    newDiffFile.deleteOnExit();
-
-    args = new String[]
-    {
-      "-s", targetFile,
-      "-t", newTargetFile.getAbsolutePath(),
-      "-o", newDiffFile.getAbsolutePath()
-    };
-    argsUseCompare = new String[]
-    {
-      "-s", targetFile,
-      "-t", newTargetFile.getAbsolutePath(),
-      // No need to write to the outputFile
-      "--useCompareResultCode"
-    };
-
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-    assertEquals(calcChecksum(newDiffFile), calcChecksum(noDiffsFile));
-    assertEquals(LDIFDiff
-        .mainDiff(argsUseCompare, true, System.out, System.err), COMPARE_TRUE);
-
-    diffOutputFile.delete();
-    newTargetFile.delete();
-    newDiffFile.delete();
-  }
-
-
-  /**
-   * Retrieves the names of the files that should be used when testing the
-   * ldif-diff tool.  Each element of the outer array should be an array
-   * containing the following elements:
-   * <OL>
-   *   <LI>The path to the source LDIF file</LI>
-   *   <LI>The path to the target LDIF file</LI>
-   *   <LI>The path to the file with attributes to be ignored</LI>
-   *   <LI>The path to the diff file</LI>
-   * </OL>
-   */
-  @DataProvider(name = "ignoreattributesdata")
-  public Object[][] getIATestData()
-  {
-    String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
-    String ldifRoot  = buildRoot + File.separator + "tests" + File.separator +
-                       "unit-tests-testng" + File.separator + "resource" +
-                       File.separator + "ldif-diff" + File.separator;
-
-    return new Object[][]
-    {
-      // Make changes to multiple entries in the target->source direction.
-      new Object[] { ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "ignore-attributes",
-                     ldifRoot + "diff-multipleentries-ignore-attributes.ldif" },
-
-      new Object[] { ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "does-not-exist",
-                     ldifRoot + "diff-multipleentries-ignore-attributes.ldif" }
-    };
-
-  }
-
-
-
-  /**
-   * Tests the LDIFDiff tool with the provided information to ensure that the
-   * normal mode of operation works as expected.  This is a bit tricky because
-   * the attributes and values will be written in an indeterminate order, so we
-   * can't just use string equality.  We'll have to use a crude checksum
-   * mechanism to test whether they are equal.  Combined with other methods in
-   * this class, this should be good enough.
-   *
-   * @param  sourceFile           The path to the file containing the source
-   *                              data set.
-   * @param  targetFile           The path to the file containing the target
-   *                              data set.
-   * @param  normalDiffFile       The path to the file containing the expected
-   *                              diff in "normal" form (at most one record per
-   *                              entry), or {@code null} if the diff is
-   *                              supposed to fail.
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "ignoreattributesdata")
-  public void testVerifyIgnoreAttributes(String sourceFile, String targetFile,
-                               String ignoreAttributesFile,
-                               String normalDiffFile)
-         throws Exception
-  {
-    File outputFile = File.createTempFile("difftest", "ldif");
-    outputFile.deleteOnExit();
-
-    String[] args =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      "-a", ignoreAttributesFile,
-      "-o", outputFile.getAbsolutePath(),
-      "-O"
-    };
-
-    if (ignoreAttributesFile.endsWith("does-not-exist"))
-    {
-      // We expect this to fail, so just make sure that it does.
-      assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 1);
-      return;
-    }
-
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-    assertEquals(calcChecksum(outputFile), calcChecksum(normalDiffFile));
-
-    outputFile.delete();
-  }
-
-
-  /**
-   * Retrieves the names of the files that should be used when testing the
-   * ldif-diff tool.  Each element of the outer array should be an array
-   * containing the following elements:
-   * <OL>
-   *   <LI>The path to the source LDIF file</LI>
-   *   <LI>The path to the target LDIF file</LI>
-   *   <LI>The path to the file with entries to be ignored</LI>
-   *   <LI>The path to the diff file</LI>
-   * </OL>
-   */
-  @DataProvider(name = "ignoreentriesdata")
-  public Object[][] getIETestData()
-  {
-    String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT);
-    String ldifRoot  = buildRoot + File.separator + "tests" + File.separator +
-                       "unit-tests-testng" + File.separator + "resource" +
-                       File.separator + "ldif-diff" + File.separator;
-
-    return new Object[][]
-    {
-      // Make changes to multiple entries in the target->source direction.
-      new Object[] { ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "ignore-entries",
-                     ldifRoot + "diff-multipleentries-ignore-entries.ldif" },
-
-      new Object[] { ldifRoot + "source-multipleentries.ldif",
-                     ldifRoot + "target-multipleentries.ldif",
-                     ldifRoot + "does-not-exist",
-                     ldifRoot + "diff-multipleentries-ignore-entries.ldif" }
-    };
-
-  }
-
-
-
-  /**
-   * Tests the LDIFDiff tool with the provided information to ensure that the
-   * normal mode of operation works as expected.  This is a bit tricky because
-   * the attributes and values will be written in an indeterminate order, so we
-   * can't just use string equality.  We'll have to use a crude checksum
-   * mechanism to test whether they are equal.  Combined with other methods in
-   * this class, this should be good enough.
-   *
-   * @param  sourceFile           The path to the file containing the source
-   *                              data set.
-   * @param  targetFile           The path to the file containing the target
-   *                              data set.
-   * @param  normalDiffFile       The path to the file containing the expected
-   *                              diff in "normal" form (at most one record per
-   *                              entry), or {@code null} if the diff is
-   *                              supposed to fail.
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @Test(dataProvider = "ignoreentriesdata")
-  public void testVerifyIgnoreEntries(String sourceFile, String targetFile,
-                               String ignoreEntriesFile,
-                               String normalDiffFile)
-         throws Exception
-  {
-    File outputFile = File.createTempFile("difftest", "ldif");
-    outputFile.deleteOnExit();
-
-    String[] args =
-    {
-      "-s", sourceFile,
-      "-t", targetFile,
-      "-e", ignoreEntriesFile,
-      "-o", outputFile.getAbsolutePath(),
-      "-O"
-    };
-
-    if (ignoreEntriesFile.endsWith("does-not-exist"))
-    {
-      // We expect this to fail, so just make sure that it does.
-      assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 1);
-      return;
-    }
-
-    assertEquals(LDIFDiff.mainDiff(args, true, System.out, System.err), 0);
-    assertEquals(calcChecksum(outputFile), calcChecksum(normalDiffFile));
-
-    outputFile.delete();
-  }
-}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDIFSearchTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tools/LDIFSearchTestCase.java
deleted file mode 100644
index 0a3b2cd..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/tools/LDIFSearchTestCase.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015-2016 ForgeRock AS.
- */
-
-package org.opends.server.tools;
-
-import static org.assertj.core.api.Assertions.*;
-import static org.testng.Assert.*;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.opends.server.TestCaseUtils;
-import org.opends.server.types.Entry;
-import org.opends.server.types.LDIFImportConfig;
-import org.opends.server.util.LDIFException;
-import org.opends.server.util.LDIFReader;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/** LDIFSearch test cases. */
-@SuppressWarnings("javadoc")
-public class LDIFSearchTestCase extends ToolsTestCase {
-
-
-  private String ldifFilePath;
-  private String outLdifFilePath;
-  private File tempDir;
-
-  @BeforeClass
-  public void setUp() throws Exception {
-    TestCaseUtils.startServer();
-    String entry =
-            "dn: dc=example,dc=com\n" +
-                    "objectclass: domain\n" +
-                    "objectclass: top\n" +
-                    "dc: example\n\n" +
-                    "dn: uid=user.0,dc=example,dc=com\n" +
-                    "objectClass: person\n" +
-                    "objectClass: inetorgperson\n" +
-                    "objectClass: organizationalPerson\n" +
-                    "objectClass: top\n" +
-                    "givenName: Aaccf\n" +
-                    "sn: Amar\n" +
-                    "cn: Aaccf Amar\n" +
-                    "employeeNumber: 0\n" +
-                    "uid: user.0\n" +
-                    "mail: user.0@example.com\n" +
-                    "userPassword: password\n" +
-                    "telephoneNumber: 380-535-2354\n" +
-                    "description: This is the description for Aaccf Amar\n" +
-                    "creatorsName: Import\n" +
-                    "modifiersName: Import\n";
-
-    tempDir = TestCaseUtils.createTemporaryDirectory("LDIFSearchtest");
-    String homeDirName = tempDir.getAbsolutePath();
-    ldifFilePath =  homeDirName + File.separator + "entries.ldif";
-    outLdifFilePath =  homeDirName + File.separator + "out.ldif";
-    FileOutputStream ldifFile = new FileOutputStream(ldifFilePath);
-    PrintStream writer = new PrintStream(ldifFile);
-    writer.println(entry);
-    writer.close();
-    ldifFile.close();
-  }
-
-
-  /**
-   * Clean up method.
-   *
-   * @throws  Exception  If an unexpected problem occurs.
-   */
-  @AfterClass
-  public void cleanUp() throws Exception
-  {
-     TestCaseUtils.deleteDirectory(tempDir);
-  }
-
-
-  /**
-   * Test that objectclass is returned when both user attributes '*' and
-   * operational attributes is specified '+'.
-   *
-   * @throws Exception The objectclass attribute is not returned.
-   */
- @Test
-  public void testLDIFSearchStarOps() throws Exception {
-    String[] args =
-    {
-      "-b", "uid=user.0, dc=example,dc=com",
-      "-l", ldifFilePath,
-      "-o", outLdifFilePath,
-      "-O",
-      "(objectclass=*)",
-      "*", "+"
-    };
-    assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0);
-    Entry e = readEntry();
-    assertThat(e.getAllAttributes("objectclass")).isNotEmpty();
-  }
-
-  /**
-   * Test that objectclass attribute is not returned when all operational
-   * attributes  only is specified '+'.
-   *
-   * @throws Exception  The objectclass attribute is returned.
-   */
-  @Test
-  public void testLDIFSearchOpsOnly() throws Exception {
-    String[] args =
-    {
-      "-b", "uid=user.0, dc=example,dc=com",
-      "-l", ldifFilePath,
-      "-o", outLdifFilePath,
-      "-O",
-      "(objectclass=*)",
-      "+"
-    };
-    assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0);
-    Entry e = readEntry();
-    assertThat(e.getAllAttributes("objectclass")).isEmpty();
-  }
-
-  /**
-   * Test that objectclass attribute is not returned when attributes are
-   * requested to be returned along with all operational attributes '+'.
-   *
-   * @throws Exception  The objectclass attribute is returned or one of the
-   * specified attributes is not returned.
-   */
- @Test
-  public void testLDIFSearchOpsAttrs() throws Exception {
-    String[] args =
-    {
-      "-b", "uid=user.0, dc=example,dc=com",
-      "-l", ldifFilePath,
-      "-o", outLdifFilePath,
-      "-O",
-      "(objectclass=*)",
-      "+", "mail", "uid"
-    };
-    assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0);
-    Entry e = readEntry();
-    assertThat(e.getAllAttributes("objectclass")).isEmpty();
-    assertThat(e.getAllAttributes("mail")).isNotEmpty();
-    assertThat(e.getAllAttributes("uid")).isNotEmpty();
-  }
-
-
-  private Entry readEntry() throws IOException, LDIFException
-  {
-    LDIFImportConfig ldifConfig = new LDIFImportConfig(outLdifFilePath);
-    ldifConfig.setValidateSchema(false);
-    try (LDIFReader reader = new LDIFReader(ldifConfig))
-    {
-      return reader.readEntry();
-    }
-  }
-
-  /**
-   * Test that objectclass attribute is not returned when specific attributes
-   * are requested to be returned.
-   *
-   * @throws Exception  The objectclass attribute is returned or one of the
-   * specified attributes is not returned.
-   */
-  @Test
-  public void testLDIFSearchAttrsOnly() throws Exception {
-
-    String[] args =
-    {
-      "-b", "uid=user.0, dc=example,dc=com",
-      "-l", ldifFilePath,
-      "-o", outLdifFilePath,
-      "-O",
-      "(objectclass=*)",
-      "mail", "uid"
-    };
-    assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0);
-    Entry e = readEntry();
-    assertThat(e.getAllAttributes("objectclass")).isEmpty();
-    assertThat(e.getAllAttributes("mail")).isNotEmpty();
-    assertThat(e.getAllAttributes("uid")).isNotEmpty();
-  }
-}
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-reverse.ldif b/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-reverse.ldif
deleted file mode 100644
index 0d85be3..0000000
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipleentries-reverse.ldif
+++ /dev/null
@@ -1,58 +0,0 @@
-dn: dc=example,dc=com
-changetype: modify
-delete: objectClass
-objectClass: organization
-objectClass: dcObject
--
-add: objectClass
-objectClass: domain
--
-delete: o
-o: Example Corp.
--
-delete: description
-description: description 1
-description: description 2
-description: description 3
-
-dn: ou=Applications,dc=example,dc=com
-changetype: delete
-# objectClass: top
-# objectClass: organizationalUnit
-# ou: Applications
-
-dn: ou=Groups,dc=example,dc=com
-changetype: add
-objectClass: top
-objectClass: organizationalUnit
-ou: Groups
-
-dn: ou=People,dc=example,dc=com
-changetype: modify
-delete: description
-description: This is where you put the people
-
-dn: cn=Test User,ou=People,dc=example,dc=com
-changetype: delete
-# objectClass: inetOrgPerson
-# objectClass: person
-# objectClass: top
-# objectClass: organizationalPerson
-# cn: Test User
-# givenName: Test
-# sn: User
-# uid: test.user
-# userPassword: password
-
-dn: uid=test.user,ou=People,dc=example,dc=com
-changetype: add
-objectClass: inetOrgPerson
-objectClass: person
-objectClass: top
-objectClass: organizationalPerson
-cn: Test User
-givenName: Test
-sn: User
-uid: test.user
-userPassword: password
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipletosingle-reverse.ldif b/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipletosingle-reverse.ldif
deleted file mode 100644
index 1ed6adf..0000000
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipletosingle-reverse.ldif
+++ /dev/null
@@ -1,42 +0,0 @@
-dn: dc=example,dc=com
-changetype: modify
-delete: objectClass
-objectClass: organization
-objectClass: dcObject
--
-add: objectClass
-objectClass: domain
--
-delete: o
-o: Example Corp.
--
-delete: description
-description: description 1
-description: description 2
-description: description 3
-
-dn: ou=Applications,dc=example,dc=com
-changetype: delete
-# objectClass: top
-# objectClass: organizationalUnit
-# ou: Applications
-
-dn: ou=People,dc=example,dc=com
-changetype: delete
-# objectClass: top
-# objectClass: organizationalUnit
-# ou: People
-# description: This is where you put the people
-
-dn: cn=Test User,ou=People,dc=example,dc=com
-changetype: delete
-# objectClass: inetOrgPerson
-# objectClass: person
-# objectClass: top
-# objectClass: organizationalPerson
-# cn: Test User
-# givenName: Test
-# sn: User
-# uid: test.user
-# userPassword: password
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipletosingle.ldif b/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipletosingle.ldif
deleted file mode 100644
index d2ec40b..0000000
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-multipletosingle.ldif
+++ /dev/null
@@ -1,29 +0,0 @@
-dn: dc=example,dc=com
-changetype: modify
-add: description
-description: test
-
-dn: ou=Groups,dc=example,dc=com
-changetype: delete
-# objectClass: top
-# objectClass: organizationalUnit
-# ou: Groups
-
-dn: ou=People,dc=example,dc=com
-changetype: delete
-# objectClass: top
-# objectClass: organizationalUnit
-# ou: People
-
-dn: uid=test.user,ou=People,dc=example,dc=com
-changetype: delete
-# objectClass: inetOrgPerson
-# objectClass: person
-# objectClass: top
-# objectClass: organizationalPerson
-# cn: Test User
-# givenName: Test
-# sn: User
-# uid: test.user
-# userPassword: password
-
diff --git a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletoempty.ldif b/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletoempty.ldif
deleted file mode 100644
index a01b3f9..0000000
--- a/opendj-server-legacy/tests/unit-tests-testng/resource/ldif-diff/diff-singletoempty.ldif
+++ /dev/null
@@ -1,6 +0,0 @@
-dn: dc=example,dc=com
-changetype: delete
-# objectClass: top
-# objectClass: domain
-# dc: example
-
diff --git a/pom.xml b/pom.xml
index 22599fb..0b452df 100644
--- a/pom.xml
+++ b/pom.xml
@@ -403,6 +403,8 @@
                             <disabledFile>legal-notices/CDDLv1_0.txt</disabledFile>
                             <disabledFile>**/tests/unit-tests-testng/resource/config-changes.ldif</disabledFile>
                             <disabledFile>opendj-rest2ldap-servlet/src/main/webapp/WEB-INF/classes/logging.properties</disabledFile>
+                            <disabledFile>opendj-ldap-toolkit/src/test/resources/*.ldif</disabledFile>
+                            <disabledFile>opendj-ldap-toolkit/src/test/resources/**/*.ldif</disabledFile>
                         </disabledFiles>
                     </configuration>
                 </plugin>

--
Gitblit v1.10.0