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

Jean-Noël Rouvignac
30.51.2016 02304e8e7f7ceaea59ffb338330d661dcc558568
Prep work for OPENDJ-2803 Migrate Attribute

Getting rid of calls to AttributeDescription.getNameOrOID().
5 files modified
72 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java 18 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java 20 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java 26 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java
@@ -33,8 +33,18 @@
import org.forgerock.opendj.ldap.DN;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.FileBasedAuditLogPublisherCfg;
import org.opends.server.core.*;
import org.opends.server.types.*;
import org.opends.server.core.AddOperation;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.ServerContext;
import org.opends.server.types.Attribute;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.FilePermission;
import org.opends.server.types.InitializationException;
import org.opends.server.types.Modification;
import org.opends.server.types.Operation;
import org.opends.server.util.Base64;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.TimeThread;
@@ -415,7 +425,7 @@
      }
      Attribute a = mod.getAttribute();
      buffer.append(a.getAttributeDescription().getNameOrOID());
      buffer.append(a.getAttributeDescription());
      buffer.append(EOL);
      append(buffer, a);
@@ -428,7 +438,7 @@
  {
    for (ByteString v : a)
    {
      buffer.append(a.getAttributeDescription().getNameOrOID());
      buffer.append(a.getAttributeDescription());
      buffer.append(":");
      encodeValue(v, buffer);
      buffer.append(EOL);
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
@@ -805,7 +805,7 @@
   */
  public AttributeBuilder(AttributeType attributeType)
  {
    this(attributeType, attributeType.getNameOrOID());
    this(AttributeDescription.create(attributeType));
  }
opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java
@@ -24,9 +24,9 @@
import java.util.List;
import java.util.Map;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.Attribute;
@@ -76,20 +76,12 @@
    }
  }
  /**
   * Retrieves the name of the change operation type.
   *
   * @return  The name of the change operation type.
   */
  @Override
  public ChangeOperationType getChangeOperationType()
  {
    return ChangeOperationType.ADD;
  }
  /**
   * Retrieves the entire set of attributes for this entry.
   * <p>
@@ -102,9 +94,6 @@
    return Collections.unmodifiableList(attributes);
  }
  /** {@inheritDoc} */
  @Override
  public String toString()
  {
@@ -116,7 +105,7 @@
    Iterator<Attribute> iterator = attributes.iterator();
    while (iterator.hasNext())
    {
      buffer.append(iterator.next().getAttributeDescription().getNameOrOID());
      buffer.append(iterator.next().getAttributeDescription());
      if (iterator.hasNext())
      {
        buffer.append(", ");
@@ -127,4 +116,3 @@
    return buffer.toString();
  }
}
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
@@ -23,18 +23,30 @@
import java.util.List;
import java.util.Set;
import org.assertj.core.api.Assertions;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.assertj.core.api.Assertions;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.core.AddOperationBasis;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyDNOperationBasis;
import org.opends.server.core.ModifyOperationBasis;
import org.opends.server.replication.ReplicationTestCase;
import org.opends.server.replication.common.*;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
import org.opends.server.replication.common.AssuredMode;
import org.opends.server.replication.common.CSN;
import org.opends.server.replication.common.DSInfo;
import org.opends.server.replication.common.RSInfo;
import org.opends.server.replication.common.ServerState;
import org.opends.server.replication.common.ServerStatus;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.opends.server.types.Attributes;
import org.opends.server.types.LDAPException;
import org.opends.server.types.Modification;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.Operation;
import org.opends.server.types.RawAttribute;
import org.opends.server.util.TimeThread;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
@@ -315,10 +327,8 @@
      {
        final Attribute expectedAttr = expectedAttrs.get(i);
        final Attribute actualAttr = actualAttrs.get(i).toAttribute();
        assertTrue(expectedAttr.getAttributeDescription().getNameOrOID().equalsIgnoreCase(actualAttr.getAttributeDescription().getNameOrOID()));
        assertTrue(expectedAttr.toString().equalsIgnoreCase(actualAttr.toString()),
            "Comparing: " + expectedAttr + " and " + actualAttr);
        assertThat(expectedAttr.getAttributeDescription()).isEqualTo(actualAttr.getAttributeDescription());
        assertThat(expectedAttr.toString()).isEqualToIgnoringCase(actualAttr.toString());
      }
    }
  }
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
@@ -554,10 +554,8 @@
    {
      final Attribute expectedAttr = expectedAttrs.get(i);
      final Attribute actualAttr = actualAttrs.get(i).toAttribute();
      assertTrue(expectedAttr.getAttributeDescription().getNameOrOID().equalsIgnoreCase(actualAttr.getAttributeDescription().getNameOrOID()));
      assertTrue(expectedAttr.toString().equalsIgnoreCase(actualAttr.toString()),
          "Comparing: " + expectedAttr + " and " + actualAttr);
      Assertions.assertThat(expectedAttr.getAttributeDescription()).isEqualTo(actualAttr.getAttributeDescription());
      Assertions.assertThat(expectedAttr.toString()).isEqualToIgnoringCase(actualAttr.toString());
    }
  }