From 02304e8e7f7ceaea59ffb338330d661dcc558568 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 30 Mar 2016 08:51:45 +0000
Subject: [PATCH] Prep work for OPENDJ-2803 Migrate Attribute
---
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java | 26 +++++++++----
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java | 2
opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java | 18 +++++++--
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java | 6 +--
opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java | 20 ++--------
5 files changed, 39 insertions(+), 33 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java
index b6f8638..f673152 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java
+++ b/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);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
index 8d312b9..8cf8df3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
+++ b/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));
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java b/opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java
index 0a29e11..3ae4995 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/AddChangeRecordEntry.java
+++ b/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();
}
}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
index b4b3ce1..35d3d1a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
+++ b/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());
}
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
index 602b626..6ca8020 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
+++ b/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());
}
}
--
Gitblit v1.10.0