From 380904cfd09fcad9b2aeceeeeeade7a788fdd61c Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 20 Mar 2014 20:16:50 +0000
Subject: [PATCH] OPENDJ-1368 Remove AttributeValue OPENDJ-1379 NoClassDefFoundError while doing REST read operation on the http connection handler
---
opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java | 11 +++--------
opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java | 9 ++++-----
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java b/opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
index b0f9f00..862edc2 100644
--- a/opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
+++ b/opendj-server3x-adapter/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
@@ -59,7 +59,6 @@
import org.opends.server.protocols.ldap.LDAPFilter;
import org.opends.server.protocols.ldap.LDAPModification;
import org.opends.server.types.AttributeBuilder;
-import org.opends.server.types.AttributeValue;
import org.opends.server.types.LDAPException;
import org.opends.server.types.Operation;
@@ -86,7 +85,7 @@
if (sdkEntry != null) {
org.opends.server.types.Entry entry =
new org.opends.server.types.Entry(to(sdkEntry.getName()), null, null, null);
- List<AttributeValue> duplicateValues = new ArrayList<AttributeValue>();
+ List<ByteString> duplicateValues = new ArrayList<ByteString>();
for (org.opends.server.types.Attribute attribute : toAttributes(sdkEntry.getAllAttributes())) {
entry.addAttribute(attribute, duplicateValues);
}
@@ -110,7 +109,7 @@
new org.opends.server.types.Entry(to(value.getName()), null, null, null);
org.opends.server.types.SearchResultEntry searchResultEntry =
new org.opends.server.types.SearchResultEntry(entry, to(value.getControls()));
- List<AttributeValue> duplicateValues = new ArrayList<AttributeValue>();
+ List<ByteString> duplicateValues = new ArrayList<ByteString>();
for (org.opends.server.types.Attribute attribute : toAttributes(value.getAllAttributes())) {
searchResultEntry.addAttribute(attribute, duplicateValues);
}
@@ -503,8 +502,8 @@
public static org.forgerock.opendj.ldap.Attribute from(
final org.opends.server.types.Attribute attribute) {
Attribute sdkAttribute = new LinkedAttribute(attribute.getNameWithOptions());
- for (AttributeValue value : attribute) {
- sdkAttribute.add(value.getValue());
+ for (ByteString value : attribute) {
+ sdkAttribute.add(value);
}
return sdkAttribute;
}
diff --git a/opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java b/opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
index 4c0bef6..6ed26f5 100644
--- a/opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
+++ b/opendj-server3x-adapter/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
@@ -66,8 +66,6 @@
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.protocols.ldap.LDAPFilter;
import org.opends.server.types.Attribute;
-import org.opends.server.types.AttributeValue;
-import org.opends.server.types.AttributeValues;
import org.opends.server.types.Attributes;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.FilterType;
@@ -185,7 +183,6 @@
*/
@Test()
public final void testToControl() throws DirectoryException {
-
final PersistentSearchRequestControl control =
PersistentSearchRequestControl.newControl(false, true,
true, // isCritical, changesOnly, returnECs
@@ -335,7 +332,7 @@
assertThat(srvAttribute.getAttributeType().getNameOrOID().toString())
.isEqualTo("testMultiValuedAttribute");
assertThat(srvAttribute.size()).isEqualTo(2);
- Iterator<AttributeValue> iter = srvAttribute.iterator();
+ Iterator<ByteString> iter = srvAttribute.iterator();
assertThat(iter.next().toString()).isEqualTo("value1");
assertThat(iter.next().toString()).isEqualTo("value2");
@@ -436,7 +433,6 @@
*/
@Test(groups = { "needRunningServer" })
public final void testFromAttribute() throws DirectoryException {
-
final org.opends.server.types.Attribute srvAttribute = Attributes.create("CN", "JOHN DOE");
final org.forgerock.opendj.ldap.Attribute sdkAttribute = from(srvAttribute);
@@ -450,11 +446,10 @@
*/
@Test(groups = { "needRunningServer" })
public final void testFromAttributeUsingBinary() throws DirectoryException {
-
byte[] data = { 0x00, 0x01, 0x02, (byte) 0xff };
- AttributeValue value = AttributeValues.create(ByteString.wrap(data), ByteString.wrap(data));
- Attribute attribute = Attributes.create(DirectoryServer.getAttributeType("cn"), value);
+ ByteString attrValue = ByteString.wrap(data);
+ Attribute attribute = Attributes.create(DirectoryServer.getAttributeType("cn"), attrValue);
assertThat(from(attribute).firstValue().toByteArray()).isEqualTo(data);
}
--
Gitblit v1.10.0