From 801602d7fa0aba9e5987683d26725daf91885c18 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 10 Jul 2015 08:26:35 +0000
Subject: [PATCH] Code cleanup
---
opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java | 37 +++++++++----------------------------
1 files changed, 9 insertions(+), 28 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
index 950fc4a..9fb3100 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
@@ -737,17 +737,9 @@
getRootConnection().processModify(dn, mods);
}
-
-
- private void
- replaceAttrInEntry(DN dn, String attrTypeString, String... attrValStrings) {
+ private void replaceAttrInEntry(DN dn, String attrName, String... attrValStrings) {
LinkedList<Modification> mods = new LinkedList<>();
- AttributeType attrType = getAttrType(attrTypeString);
- AttributeBuilder builder = new AttributeBuilder(attrType, attrTypeString);
- for(String valString : attrValStrings) {
- builder.add(valString);
- }
- mods.add(new Modification(ModificationType.REPLACE, builder.toAttribute()));
+ mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrName, attrValStrings)));
getRootConnection().processModify(dn, mods);
}
@@ -800,17 +792,11 @@
* Add an attribute to an entry with specified values.
*
* @param entry The entry to add the attribute to.
- * @param attrTypeString The attribute type string name.
+ * @param attrName The attribute type string name.
* @param attrValues The values use in building the attribute.
*/
- private void
- addAttribute(Entry entry, String attrTypeString, String... attrValues) {
- AttributeType attrType=getAttrType(attrTypeString);
- AttributeBuilder builder = new AttributeBuilder(attrType, attrTypeString);
- for(String attrValue : attrValues) {
- builder.add(attrValue);
- }
- entry.addAttribute(builder.toAttribute(), null);
+ private void addAttribute(Entry entry, String attrName, String... attrValues) {
+ entry.addAttribute(Attributes.create(attrName, attrValues), null);
}
/**
@@ -818,20 +804,15 @@
* type to a list of modifications.
*
* @param mods The modification list to add to.
- * @param attrTypeString The attribute type string name.
+ * @param attrName The attribute type string name.
* @param modificationType The modification type.
* @param attrValues The values to build the modification from.
*/
private void
- addMods(LinkedList<Modification> mods, String attrTypeString,
+ addMods(LinkedList<Modification> mods, String attrName,
ModificationType modificationType, String... attrValues) {
- AttributeType attrType=getAttrType(attrTypeString);
- AttributeBuilder builder = new AttributeBuilder(attrType, attrTypeString);
- for(String attrValue : attrValues) {
- builder.add(attrValue);
- }
mods.add(new Modification(modificationType,
- builder.toAttribute()));
+ Attributes.create(attrName, attrValues)));
}
/**
@@ -867,7 +848,7 @@
/**
* Perform modify DN operation. Expect return value of rc.
*
- * @param dn The DN to renmame or move.
+ * @param dn The DN to rename or move.
* @param rdn RDN value.
* @param delOld Delete old flag.
* @param newSuperior New superior to move to.
--
Gitblit v1.10.0