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

neil_a_wilson
12.27.2006 6af27032f03ac2b79aa92b20cbf6094d553a22b7
Update code in the org.opends.server.util package to use the
Validator.ensureNotNull method for arguments that are not allowed to be null,
and also update the javadoc for the corresponding @param tags to indicate this.

Also, update the ModifyDNChangeRecordEntry class to rearrange the order of the
constructor arguments to be more consistent with the rest of the codebase, as
well as the standard definitions in LDAP and LDIF.

Reviewed by davidely.
15 files modified
281 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/util/AddChangeRecordEntry.java 9 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/Base64.java 10 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/ChangeRecordEntry.java 14 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/DeleteChangeRecordEntry.java 3 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/LDIFException.java 8 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/LDIFReader.java 18 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/LDIFWriter.java 54 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/ModifyChangeRecordEntry.java 9 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/ModifyDNChangeRecordEntry.java 19 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/TimeThread.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestAddChangeRecordEntry.java 25 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestChangeRecordEntry.java 16 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestDeleteChangeRecordEntry.java 17 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestModifyChangeRecordEntry.java 26 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestModifyDNChangeRecordEntry.java 51 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/util/AddChangeRecordEntry.java
@@ -30,6 +30,7 @@
import static org.opends.server.loggers.Debug.debugConstructor;
import static org.opends.server.loggers.Debug.debugEnter;
import static org.opends.server.util.Validator.*;
import java.util.ArrayList;
import java.util.Collections;
@@ -67,9 +68,11 @@
   * Creates a new entry with the provided information.
   *
   * @param dn
   *          The distinguished name for this entry.
   *          The distinguished name for this entry.  It must not be
   *          <CODE>null</CODE>.
   * @param attributes
   *          The entry attributes for this operation.
   *          The entry attributes for this operation.  It must not be
   *          <CODE>null</CODE>.
   */
  public AddChangeRecordEntry(DN dn,
      Map<AttributeType,List<Attribute>> attributes)
@@ -79,6 +82,8 @@
    assert debugConstructor(CLASS_NAME, String.valueOf(dn),
                            String.valueOf(attributes));
    ensureNotNull(attributes);
    this.attributes = new ArrayList<Attribute>(attributes.size());
    for (List<Attribute> list : attributes.values())
opendj-sdk/opends/src/server/org/opends/server/util/Base64.java
@@ -31,6 +31,7 @@
import static org.opends.server.loggers.Debug.debugEnter;
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.UtilityMessages.*;
import static org.opends.server.util.Validator.*;
import java.nio.ByteBuffer;
import java.text.ParseException;
@@ -69,7 +70,7 @@
  /**
   * Encodes the provided raw data using base64.
   *
   * @param  rawData  The raw data to encode.
   * @param  rawData  The raw data to encode.  It must not be <CODE>null</CODE>.
   *
   * @return  The base64-encoded representation of the provided raw data.
   */
@@ -77,6 +78,8 @@
  {
    assert debugEnter(CLASS_NAME, "encode", String.valueOf(rawData));
    ensureNotNull(rawData);
    StringBuilder buffer = new StringBuilder(4 * rawData.length / 3);
@@ -118,7 +121,8 @@
  /**
   * Decodes the provided set of base64-encoded data.
   *
   * @param  encodedData  The base64-encoded data to decode.
   * @param  encodedData  The base64-encoded data to decode.  It must not be
   *                      <CODE>null</CODE>.
   *
   * @return  The decoded raw data.
   *
@@ -130,6 +134,8 @@
  {
    assert debugEnter(CLASS_NAME, "decode", String.valueOf(encodedData));
    ensureNotNull(encodedData);
    // The encoded value must have  length that is a multiple of four bytes.
    int length = encodedData.length();
opendj-sdk/opends/src/server/org/opends/server/util/ChangeRecordEntry.java
@@ -30,6 +30,7 @@
import static org.opends.server.loggers.Debug.debugConstructor;
import static org.opends.server.loggers.Debug.debugEnter;
import static org.opends.server.util.Validator.*;
import org.opends.server.types.DN;
@@ -56,20 +57,15 @@
  /**
   * Creates a new change record entry with the provided information.
   *
   * @param  dn  The distinguished name for this change record entry.
   * @param  dn  The distinguished name for this change record entry.  It must
   *             not be <CODE>null</CODE>.
   */
  protected ChangeRecordEntry(DN dn)
  {
    assert debugConstructor(CLASS_NAME, String.valueOf(dn));
    if (dn == null)
    {
      this.dn = new DN();
    }
    else
    {
      this.dn = dn;
    }
    ensureNotNull(dn);
    this.dn = dn;
  }
opendj-sdk/opends/src/server/org/opends/server/util/DeleteChangeRecordEntry.java
@@ -53,7 +53,8 @@
  /**
   * Creates a new entry with the provided information.
   *
   * @param  dn      The distinguished name for this entry.
   * @param  dn  The distinguished name for this entry.  It must not be
   *             <CODE>null</CODE>.
   */
  public DeleteChangeRecordEntry(DN dn)
  {
opendj-sdk/opends/src/server/org/opends/server/util/LDIFException.java
@@ -36,7 +36,7 @@
 * This class defines an exception that may be thrown while attempting to parse
 * LDIF content.
 */
public class LDIFException
public final class LDIFException
       extends Exception
{
  /**
@@ -60,13 +60,13 @@
  // Indicates whether this exception is severe enough that it is no longer
  // possible to keep reading.
  private boolean canContinueReading;
  private final boolean canContinueReading;
  // The line number of the last line read from the LDIF source.
  private long lineNumber;
  private final long lineNumber;
  // The unique message ID for the associated message.
  private int messageID;
  private final int messageID;
opendj-sdk/opends/src/server/org/opends/server/util/LDIFReader.java
@@ -33,6 +33,7 @@
import static org.opends.server.messages.MessageHandler.getMessage;
import static org.opends.server.messages.UtilityMessages.*;
import static org.opends.server.util.StaticUtils.toLowerCase;
import static org.opends.server.util.Validator.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
@@ -127,7 +128,8 @@
   * Creates a new LDIF reader that will read information from the specified
   * file.
   *
   * @param  importConfig  The import configuration for this LDIF reader.
   * @param  importConfig  The import configuration for this LDIF reader.  It
   *                       must not be <CODE>null</CODE>.
   *
   * @throws  IOException  If a problem occurs while opening the LDIF file for
   *                       reading.
@@ -137,6 +139,7 @@
  {
    assert debugConstructor(CLASS_NAME, String.valueOf(importConfig));
    ensureNotNull(importConfig);
    this.importConfig = importConfig;
    reader               = importConfig.getReader();
@@ -1058,9 +1061,12 @@
    {
      try
      {
        rejectWriter.write("# ");
        rejectWriter.write(message);
        rejectWriter.newLine();
        if ((message != null) && (message.length() > 0))
        {
          rejectWriter.write("# ");
          rejectWriter.write(message);
          rejectWriter.newLine();
        }
        for (StringBuilder sb : lastEntryHeaderLines)
        {
@@ -1308,8 +1314,8 @@
      }
    }
    return new ModifyDNChangeRecordEntry(entryDN, newSuperiorDN,
        newRDN, deleteOldRDN);
    return new ModifyDNChangeRecordEntry(entryDN, newRDN, deleteOldRDN,
                                         newSuperiorDN);
  }
opendj-sdk/opends/src/server/org/opends/server/util/LDIFWriter.java
@@ -45,6 +45,7 @@
import static org.opends.server.loggers.Debug.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.util.Validator.*;
@@ -79,7 +80,8 @@
  /**
   * Creates a new LDIF writer with the provided configuration.
   *
   * @param  exportConfig  The configuration to use for the export.
   * @param  exportConfig  The configuration to use for the export.  It must not
   *                       be <CODE>null</CODE>.
   *
   * @throws  IOException  If a problem occurs while opening the writer.
   */
@@ -88,6 +90,7 @@
  {
    assert debugConstructor(CLASS_NAME, String.valueOf(exportConfig));
    ensureNotNull(exportConfig);
    this.exportConfig = exportConfig;
    writer = exportConfig.getWriter();
@@ -109,7 +112,8 @@
   *
   * @param  comment     The comment to be written.  Any line breaks that it
   *                     contains will be honored, and potentially new line
   *                     breaks may be introduced by the wrapping process.
   *                     breaks may be introduced by the wrapping process.  It
   *                     must not be <CODE>null</CODE>.
   * @param  wrapColumn  The column at which long lines should be wrapped, or
   *                     -1 to indicate that no additional wrapping should be
   *                     added.  This will override the wrap column setting
@@ -124,6 +128,8 @@
    assert debugEnter(CLASS_NAME, "writeComment", String.valueOf(comment),
                      String.valueOf(wrapColumn));
    ensureNotNull(comment);
    // First, break up the comment into multiple lines to preserve the original
    // spacing that it contained.
@@ -203,7 +209,7 @@
  /**
   * Writes the provided entry to LDIF.
   *
   * @param  entry  The entry to be written.
   * @param  entry  The entry to be written.  It must not be <CODE>null</CODE>.
   *
   * @return  <CODE>true</CODE> if the entry was actually written, or
   *          <CODE>false</CODE> if it was not because of the export
@@ -219,6 +225,7 @@
  {
    assert debugEnter(CLASS_NAME, "writeEntry", String.valueOf(entry));
    ensureNotNull(entry);
    return entry.toLDIF(exportConfig);
  }
@@ -229,7 +236,8 @@
   * performed for this entry, nor will any export plugins be invoked.  Further,
   * only the user attributes will be included.
   *
   * @param  entry  The entry to include in the add change record.
   * @param  entry  The entry to include in the add change record.  It must not
   *                be <CODE>null</CODE>.
   *
   * @throws  IOException  If a problem occurs while writing the add record.
   */
@@ -239,6 +247,9 @@
    assert debugEnter(CLASS_NAME, "writeAddChangeRecord",
                      String.valueOf(entry));
    ensureNotNull(entry);
    // Get the information necessary to write the LDIF.
    BufferedWriter writer     = exportConfig.getWriter();
    int            wrapColumn = exportConfig.getWrapColumn();
@@ -303,7 +314,8 @@
   * this entry, nor will any export plugins be invoked.  Further, only the user
   * attributes will be included.
   *
   * @param  entry         The entry to include in the delete change record.
   * @param  entry         The entry to include in the delete change record.  It
   *                       must not be <CODE>null</CODE>.
   * @param  commentEntry  Indicates whether to include a comment with the
   *                       contents of the entry.
   *
@@ -315,6 +327,8 @@
    assert debugEnter(CLASS_NAME, "writeDeleteChangeRecord",
                      String.valueOf(entry), String.valueOf(commentEntry));
    ensureNotNull(entry);
    // Get the information necessary to write the LDIF.
    BufferedWriter writer     = exportConfig.getWriter();
    int            wrapColumn = exportConfig.getWrapColumn();
@@ -381,9 +395,10 @@
   * Writes a modify change record with the provided information.  No filtering
   * will be performed, nor will any export plugins be invoked.
   *
   * @param  dn             The DN of the entry being modified.
   * @param  dn             The DN of the entry being modified.  It must not be
   *                        <CODE>null</CODE>.
   * @param  modifications  The set of modifications to include in the change
   *                        record.
   *                        record.  It must not be <CODE>null</CODE>.
   *
   * @throws  IOException  If a problem occurs while writing the modify record.
   */
@@ -393,6 +408,8 @@
    assert debugEnter(CLASS_NAME, "writeModifyChangeRecord", String.valueOf(dn),
                      String.valueOf(modifications));
    ensureNotNull(dn, modifications);
    // If there aren't any modifications, then there's nothing to do.
    if (modifications.isEmpty())
    {
@@ -485,8 +502,10 @@
   * Writes a modify DN change record with the provided information.  No
   * filtering will be performed, nor will any export plugins be invoked.
   *
   * @param  dn            The DN of the entry before the rename.
   * @param  newRDN        The new RDN for the entry.
   * @param  dn            The DN of the entry before the rename.  It must not
   *                       be <CODE>null</CODE>.
   * @param  newRDN        The new RDN for the entry.  It must not be
   *                       <CODE>null</CODE>.
   * @param  deleteOldRDN  Indicates whether the old RDN value should be removed
   *                       from the entry.
   * @param  newSuperior   The new superior DN for the entry, or
@@ -504,6 +523,8 @@
                      String.valueOf(deleteOldRDN),
                      String.valueOf(newSuperior));
    ensureNotNull(dn, newRDN);
    // Get the information necessary to write the LDIF.
    BufferedWriter writer     = exportConfig.getWriter();
@@ -601,8 +622,9 @@
   * space, and a base64-encoded form of the value will be appended.
   *
   * @param  buffer      The buffer to which the information should be
   *                     appended.
   * @param  valueBytes  The value to append to the buffer.
   *                     appended.  It must not be <CODE>null</CODE>.
   * @param  valueBytes  The value to append to the buffer.  It must not be
   *                     <CODE>null</CODE>.
   */
  public static void appendLDIFSeparatorAndValue(StringBuilder buffer,
                                                 byte[] valueBytes)
@@ -611,6 +633,8 @@
                      "java.lang.StringBuilder",
                      String.valueOf(valueBytes));
    ensureNotNull(buffer, valueBytes);
    // If the value is empty, then just append a single colon and a single
    // space.
@@ -648,8 +672,10 @@
  /**
   * Writes the provided line to LDIF using the provided information.
   *
   * @param  line        The line of information to write.
   * @param  writer      The writer to which the data should be written.
   * @param  line        The line of information to write.  It must not be
   *                     <CODE>null</CODE>.
   * @param  writer      The writer to which the data should be written.  It
   *                     must not be <CODE>null</CODE>.
   * @param  wrapLines   Indicates whether to wrap long lines.
   * @param  wrapColumn  The column at which long lines should be wrapped.
   *
@@ -663,6 +689,8 @@
                      String.valueOf(writer), String.valueOf(wrapLines),
                      String.valueOf(wrapColumn));
    ensureNotNull(line, writer);
    int length = line.length();
    if (wrapLines && (length > wrapColumn))
    {
opendj-sdk/opends/src/server/org/opends/server/util/ModifyChangeRecordEntry.java
@@ -30,6 +30,7 @@
import static org.opends.server.loggers.Debug.debugConstructor;
import static org.opends.server.loggers.Debug.debugEnter;
import static org.opends.server.util.Validator.*;
import java.util.ArrayList;
import java.util.Collection;
@@ -65,8 +66,10 @@
  /**
   * Creates a new entry with the provided information.
   *
   * @param  dn      The distinguished name for this entry.
   * @param modifications The modifications for this change record.
   * @param  dn             The distinguished name for this entry.  It must not
   *                        be  <CODE>null</CODE>.
   * @param  modifications  The modifications for this change record.  It must
   *                        not be <CODE>null</CODE>.
   */
  public ModifyChangeRecordEntry(DN dn,
      Collection<LDAPModification> modifications)
@@ -76,6 +79,8 @@
    assert debugConstructor(CLASS_NAME, String.valueOf(dn),
        String.valueOf(modifications));
    ensureNotNull(modifications);
    this.modifications = new ArrayList<LDAPModification>(modifications);
  }
opendj-sdk/opends/src/server/org/opends/server/util/ModifyDNChangeRecordEntry.java
@@ -30,6 +30,7 @@
import static org.opends.server.loggers.Debug.debugConstructor;
import static org.opends.server.loggers.Debug.debugEnter;
import static org.opends.server.util.Validator.*;
import org.opends.server.types.DN;
import org.opends.server.types.RDN;
@@ -63,16 +64,18 @@
   * Creates a new entry with the provided information.
   *
   * @param dn
   *          The distinguished name for this entry.
   * @param newSuperiorDN
   *          The new superior DN.
   *          The distinguished name for this entry.  It must not be
   *          <CODE>null</CODE>.
   * @param newRDN
   *          The new RDN.
   *          The new RDN.  It must not be <CODE>null</CODE>.
   * @param deleteOldRDN
   *          Delete the old RDN?
   * @param newSuperiorDN
   *          The new superior DN.  It may be <CODE>null</CODE> if the entry is
   *          not to be moved below a new parent.
   */
  public ModifyDNChangeRecordEntry(DN dn, DN newSuperiorDN,
      RDN newRDN, boolean deleteOldRDN)
  public ModifyDNChangeRecordEntry(DN dn, RDN newRDN, boolean deleteOldRDN,
                                   DN newSuperiorDN)
  {
    super(dn);
    assert debugConstructor(CLASS_NAME, String.valueOf(dn),
@@ -80,6 +83,8 @@
                            String.valueOf(newRDN),
                            String.valueOf(deleteOldRDN));
    ensureNotNull(newRDN);
    this.newSuperiorDN = newSuperiorDN;
    this.newRDN = newRDN;
    this.deleteOldRDN = deleteOldRDN;
@@ -102,7 +107,7 @@
  /**
   * Get the new superior DN for the requested modify DN operation.
   *
   * @return the new superior DN.
   * @return the new superior DN, or <CODE>null</CODE> if there is none.
   *
   */
  public DN getNewSuperiorDN()
opendj-sdk/opends/src/server/org/opends/server/util/TimeThread.java
@@ -50,7 +50,7 @@
 * debugging will be performed in this class due to the frequency with which it
 * will be called.
 */
public class TimeThread
public final class TimeThread
       extends DirectoryThread
{
  /**
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestAddChangeRecordEntry.java
@@ -57,7 +57,7 @@
  /**
   * Once-only initialization.
   *
   *
   * @throws Exception
   *           If an unexpected error occurred.
   */
@@ -76,20 +76,19 @@
  /**
   * Tests the constructor with null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  @Test(expectedExceptions = { NullPointerException.class,
                               AssertionError.class })
  public void testConstructorNullDN() throws Exception {
    AddChangeRecordEntry entry = new AddChangeRecordEntry(null, attributes);
    Assert.assertEquals(entry.getDN(), new DN());
  }
  /**
   * Tests the constructor with empty DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
@@ -103,7 +102,7 @@
  /**
   * Tests the constructor with non-null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
@@ -120,13 +119,13 @@
  /**
   * Tests the change operation type is correct.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testChangeOperationType() throws Exception {
    AddChangeRecordEntry entry = new AddChangeRecordEntry(null, attributes);
    AddChangeRecordEntry entry = new AddChangeRecordEntry(new DN(), attributes);
    Assert.assertEquals(entry.getChangeOperationType(),
        ChangeOperationType.ADD);
@@ -134,14 +133,14 @@
  /**
   * Tests getAttributes method for empty modifications.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testGetAttributesEmpty() throws Exception {
    Map<AttributeType, List<Attribute>> empty = Collections.emptyMap();
    AddChangeRecordEntry entry = new AddChangeRecordEntry(null, empty);
    AddChangeRecordEntry entry = new AddChangeRecordEntry(new DN(), empty);
    List<Attribute> attrs = entry.getAttributes();
    Assert.assertEquals(attrs.size(), 0);
@@ -149,13 +148,13 @@
  /**
   * Tests getAttributes method for non-empty modifications.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testGetAttributesNonEmpty() throws Exception {
    AddChangeRecordEntry entry = new AddChangeRecordEntry(null, attributes);
    AddChangeRecordEntry entry = new AddChangeRecordEntry(new DN(), attributes);
    List<Attribute> attrs = entry.getAttributes();
    Assert.assertEquals(attrs.size(), 1);
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestChangeRecordEntry.java
@@ -47,7 +47,7 @@
    /**
     * Create a new test record.
     *
     *
     * @param dn
     *          The test record's DN.
     */
@@ -67,7 +67,7 @@
  /**
   * Once-only initialization.
   *
   *
   * @throws Exception
   *           If an unexpected error occurred.
   */
@@ -80,20 +80,20 @@
  /**
   * Tests the constructor with null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  @Test(expectedExceptions = { NullPointerException.class,
                               AssertionError.class })
  public void testConstructorNullDN() throws Exception {
    MyChangeRecordEntry entry = new MyChangeRecordEntry(null);
    Assert.assertEquals(entry.getDN(), new DN());
  }
  /**
   * Tests the constructor with empty DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
@@ -106,7 +106,7 @@
  /**
   * Tests the constructor with non-null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestDeleteChangeRecordEntry.java
@@ -43,7 +43,7 @@
public final class TestDeleteChangeRecordEntry extends UtilTestCase {
  /**
   * Once-only initialization.
   *
   *
   * @throws Exception
   *           If an unexpected error occurred.
   */
@@ -56,20 +56,19 @@
  /**
   * Tests the constructor with null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  @Test(expectedExceptions = { NullPointerException.class,
                               AssertionError.class })
  public void testConstructorNullDN() throws Exception {
    DeleteChangeRecordEntry entry = new DeleteChangeRecordEntry(null);
    Assert.assertEquals(entry.getDN(), new DN());
  }
  /**
   * Tests the constructor with empty DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
@@ -82,7 +81,7 @@
  /**
   * Tests the constructor with non-null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
@@ -98,13 +97,13 @@
  /**
   * Tests the change operation type is correct.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testChangeOperationType() throws Exception {
    DeleteChangeRecordEntry entry = new DeleteChangeRecordEntry(null);
    DeleteChangeRecordEntry entry = new DeleteChangeRecordEntry(new DN());
    Assert.assertEquals(entry.getChangeOperationType(),
        ChangeOperationType.DELETE);
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestModifyChangeRecordEntry.java
@@ -57,7 +57,7 @@
  /**
   * Once-only initialization.
   *
   *
   * @throws Exception
   *           If an unexpected error occurred.
   */
@@ -78,21 +78,20 @@
  /**
   * Tests the constructor with null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  @Test(expectedExceptions = { NullPointerException.class,
                               AssertionError.class })
  public void testConstructorNullDN() throws Exception {
    ModifyChangeRecordEntry entry = new ModifyChangeRecordEntry(null,
        modifications);
    Assert.assertEquals(entry.getDN(), new DN());
  }
  /**
   * Tests the constructor with empty DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
@@ -106,7 +105,7 @@
  /**
   * Tests the constructor with non-null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
@@ -123,13 +122,13 @@
  /**
   * Tests the change operation type is correct.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testChangeOperationType() throws Exception {
    ModifyChangeRecordEntry entry = new ModifyChangeRecordEntry(null,
    ModifyChangeRecordEntry entry = new ModifyChangeRecordEntry(new DN(),
        modifications);
    Assert.assertEquals(entry.getChangeOperationType(),
@@ -138,14 +137,15 @@
  /**
   * Tests getModifications method for empty modifications.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testGetModificationsEmpty() throws Exception {
    List<LDAPModification> empty = Collections.emptyList();
    ModifyChangeRecordEntry entry = new ModifyChangeRecordEntry(null, empty);
    ModifyChangeRecordEntry entry = new ModifyChangeRecordEntry(new DN(),
                                                                empty);
    List<LDAPModification> mods = entry.getModifications();
    Assert.assertEquals(mods.size(), 0);
@@ -153,13 +153,13 @@
  /**
   * Tests getModifications method for non-empty modifications.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testGetModificationsNonEmpty() throws Exception {
    ModifyChangeRecordEntry entry = new ModifyChangeRecordEntry(null,
    ModifyChangeRecordEntry entry = new ModifyChangeRecordEntry(new DN(),
        modifications);
    List<LDAPModification> mods = entry.getModifications();
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/util/TestModifyDNChangeRecordEntry.java
@@ -48,7 +48,7 @@
  /**
   * Once-only initialization.
   *
   *
   * @throws Exception
   *           If an unexpected error occurred.
   */
@@ -64,35 +64,34 @@
  /**
   * Tests the constructor with null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  @Test(expectedExceptions = { NullPointerException.class,
                               AssertionError.class })
  public void testConstructorNullDN() throws Exception {
    ModifyDNChangeRecordEntry entry = new ModifyDNChangeRecordEntry(null,
        newSuperiorDN, newRDN, false);
    Assert.assertEquals(entry.getDN(), new DN());
    ModifyDNChangeRecordEntry entry =
         new ModifyDNChangeRecordEntry(null, newRDN, false, newSuperiorDN);
  }
  /**
   * Tests the constructor with empty DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testConstructorEmptyDN() throws Exception {
    ModifyDNChangeRecordEntry entry = new ModifyDNChangeRecordEntry(
        new DN(), newSuperiorDN, newRDN, false);
        new DN(), newRDN, false, newSuperiorDN);
    Assert.assertEquals(entry.getDN(), new DN());
  }
  /**
   * Tests the constructor with non-null DN.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
@@ -102,21 +101,21 @@
    DN testDN2 = DN.decode("dc=hello, dc=world");
    ModifyDNChangeRecordEntry entry = new ModifyDNChangeRecordEntry(
        testDN1, newSuperiorDN, newRDN, false);
        testDN1, newRDN, false, newSuperiorDN);
    Assert.assertEquals(entry.getDN(), testDN2);
  }
  /**
   * Tests the change operation type is correct.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testChangeOperationType() throws Exception {
    ModifyDNChangeRecordEntry entry = new ModifyDNChangeRecordEntry(null,
        newSuperiorDN, newRDN, false);
    ModifyDNChangeRecordEntry entry =
         new ModifyDNChangeRecordEntry(new DN(), newRDN, false, newSuperiorDN);
    Assert.assertEquals(entry.getChangeOperationType(),
        ChangeOperationType.MODIFY_DN);
@@ -124,28 +123,28 @@
  /**
   * Tests getNewRDN method.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testGetNewRDN() throws Exception {
    ModifyDNChangeRecordEntry entry = new ModifyDNChangeRecordEntry(null,
        newSuperiorDN, newRDN, false);
    ModifyDNChangeRecordEntry entry =
         new ModifyDNChangeRecordEntry(new DN(), newRDN, false, newSuperiorDN);
    Assert.assertEquals(entry.getNewRDN(), newRDN.duplicate());
  }
  /**
   * Tests getNewSuperiorDN method.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testGetNewSuperiorDN() throws Exception {
    ModifyDNChangeRecordEntry entry = new ModifyDNChangeRecordEntry(null,
        newSuperiorDN, newRDN, false);
    ModifyDNChangeRecordEntry entry =
         new ModifyDNChangeRecordEntry(new DN(), newRDN, false, newSuperiorDN);
    Assert
        .assertEquals(entry.getNewSuperiorDN(), newSuperiorDN.duplicate());
@@ -153,28 +152,28 @@
  /**
   * Tests deleteOldRDN method when false.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testDeleteOldRDNFalse() throws Exception {
    ModifyDNChangeRecordEntry entry = new ModifyDNChangeRecordEntry(null,
        newSuperiorDN, newRDN, false);
    ModifyDNChangeRecordEntry entry =
         new ModifyDNChangeRecordEntry(new DN(), newRDN, false, newSuperiorDN);
    Assert.assertEquals(entry.deleteOldRDN(), false);
  }
  /**
   * Tests deleteOldRDN method.
   *
   *
   * @throws Exception
   *           If the test failed unexpectedly.
   */
  @Test
  public void testDeleteOldRDNTrue() throws Exception {
    ModifyDNChangeRecordEntry entry = new ModifyDNChangeRecordEntry(null,
        newSuperiorDN, newRDN, true);
    ModifyDNChangeRecordEntry entry =
         new ModifyDNChangeRecordEntry(new DN(), newRDN, true, newSuperiorDN);
    Assert.assertEquals(entry.deleteOldRDN(), true);
  }