[prev in list] [next in list] [prev in thread] [next in thread] 

List:       forgerock-opendj-dev
Subject:    [Opendj-dev] [10976] trunk/opends: OPENDJ-1206 (CR-4368) Create a new ReplicationBackend /ChangelogB
From:       noreply () forgerock ! org
Date:       2014-08-27 8:29:16
Message-ID: 20140827082916.CBCDA422A4 () sources ! internal ! forgerock ! com
[Download RAW message or body]

[Attachment #2 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[10976] trunk/opends: OPENDJ-1206 (CR-4368) Create a new \
ReplicationBackend/ChangelogBackend to support cn=changelog</title> </head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt;  } #msg dl a { font-weight: \
bold} #msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
 #patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
                .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a \
href="http://sources.forgerock.org/changelog/opendj/?cs=10976">10976</a></dd> \
<dt>Author</dt> <dd>JnRouvignac</dd> <dt>Date</dt> <dd>2014-08-27 09:29:16 +0100 \
(Wed, 27 Aug 2014)</dd> </dl>

<h3>Log Message</h3>
<pre><a href="https://bugster.forgerock.org/jira/browse/OPENDJ-1206">OPENDJ-1206</a> \
(CR-4368) Create a new ReplicationBackend/ChangelogBackend to support cn=changelog

Preparation work: ChangeNotificationListener interface only cover a subset of its \
DirectoryServerPlugin superclass capabilities, so it is redundant. So I removed \
ChangeNotificationListener to ease moving persistent searches to the backend. The two \
ChangeNotificationListener implementations are now subclasses of \
InternalDirectoryServerPlugin. Updated all code after removing \
ChangeNotificationListener.



ChangeNotificationListener.java: REMOVED



AuthenticatedUsers.java:
Now extends InternalDirectoryServerPlugin instead of implementing \
ChangeNotificationListener. Extracted method getNewAuthNDN() + toDN().

CryptoManagerSync.java:
Now extends InternalDirectoryServerPlugin instead of implementing \
ChangeNotificationListener. Extracted method getNewAuthNDN() + toDN().



DirectoryServer.java:
Removed references to removed type ChangeNotificationListener.
Be careful with when AuthenticatedUsers is initialized.

DirectoryConfig.java, LocalBackend*Operation.java:
Removed references to removed type ChangeNotificationListener.



CollectionUtils.java: ADDED

TestChangeNotificationListener.java:
Now extends InternalDirectoryServerPlugin instead of implementing \
ChangeNotificationListener.

AddOperationTestCase.java:
Extracted methods newRawAttributes(), byteStrings(), addSuccess(), addDisconnect(), \
bind(), writeAddRequest() + used CollectionUtils. Consequence of the changes to \
TestChangeNotificationListener.

DeleteOperationTestCase.java:
Consequence of the changes to TestChangeNotificationListener.

ModifyOperationTestCase.java:
Extracted methods newModifications(), newRawModifications() + used CollectionUtils.
Consequence of the changes to TestChangeNotificationListener.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkopendssrcserverorgopendsservercoreAuthenticatedUsersjava">trunk/opends/src/server/org/opends/server/core/AuthenticatedUsers.java</a></li>
 <li><a href="#trunkopendssrcserverorgopendsservercoreDirectoryServerjava">trunk/opends/src/server/org/opends/server/core/DirectoryServer.java</a></li>
 <li><a href="#trunkopendssrcserverorgopendsservercryptoCryptoManagerSyncjava">trunk/opends/src/server/org/opends/server/crypto/CryptoManagerSync.java</a></li>
 <li><a href="#trunkopendssrcserverorgopendsservertypesDirectoryConfigjava">trunk/opends/src/server/org/opends/server/types/DirectoryConfig.java</a></li>
 <li><a href="#trunkopendssrcserverorgopendsserverworkflowelementlocalbackendLocalBack \
endAddOperationjava">trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java</a></li>
 <li><a href="#trunkopendssrcserverorgopendsserverworkflowelementlocalbackendLocalBack \
endDeleteOperationjava">trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendDeleteOperation.java</a></li>
 <li><a href="#trunkopendssrcserverorgopendsserverworkflowelementlocalbackendLocalBack \
endModifyDNOperationjava">trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java</a></li>
 <li><a href="#trunkopendssrcserverorgopendsserverworkflowelementlocalbackendLocalBack \
endModifyOperationjava">trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java</a></li>
 <li><a href="#trunkopendstestsunitteststestngsrcserverorgopendsservercoreAddOperation \
TestCasejava">trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java</a></li>
 <li><a href="#trunkopendstestsunitteststestngsrcserverorgopendsservercoreDeleteOperat \
ionTestCasejava">trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java</a></li>
 <li><a href="#trunkopendstestsunitteststestngsrcserverorgopendsservercoreModifyOperat \
ionTestCasejava">trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java</a></li>
 <li><a href="#trunkopendstestsunitteststestngsrcserverorgopendsservercoreTestChangeNo \
tificationListenerjava">trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestChangeNotificationListener.java</a></li>
 </ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkopendssrcserverorgopendsserverutilCollectionUtilsjava">trunk/opends/src/server/org/opends/server/util/CollectionUtils.java</a></li>
 </ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkopendssrcserverorgopendsserverapiChangeNotificationListenerjava">tr \
unk/opends/src/server/org/opends/server/api/ChangeNotificationListener.java</a></li> \
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkopendssrcserverorgopendsserverapiChangeNotificationListenerjava"></a>
<div class="delfile"><h4>Deleted: \
trunk/opends/src/server/org/opends/server/api/ChangeNotificationListener.java (10975 \
=> 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/api/ChangeNotificationListener.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/api/ChangeNotificationListener.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -1,134 +0,0 @@
</span><del>-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the &quot;License&quot;).  You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets &quot;[]&quot; replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2006-2008 Sun Microsystems, Inc.
- */
-package org.opends.server.api;
-
-
-
-import org.opends.server.types.Entry;
-import org.opends.server.types.operation.PostResponseAddOperation;
-import org.opends.server.types.operation.PostResponseDeleteOperation;
-import org.opends.server.types.operation.PostResponseModifyOperation;
-import org.opends.server.types.operation.
-            PostResponseModifyDNOperation;
-
-
-
-/**
- * This interface defines a mechanism that Directory Server components
- * may use if they need to be notified of changes that are made in the
- * Directory Server.  Similar functionality can be achieved using
- * post-response plugins, but this interface is better suited to core
- * functionality that should not be considered optional, since plugins
- * may be disabled.  Further, change notification listeners will only
- * be invoked for successful operations.
- * &lt;BR&gt;&lt;BR&gt;
- * Each change notification listener will be notified whenever an
- * update is made in the server (just before the response is sent to
- * the client), so the listener should use a very efficient mechanism
- * for determining whether or not any action is required for the
- * associated operation and quickly return for cases in which the
- * update is not applicable.  Also note that even though the listener
- * will be invoked before the response is sent to the client, it may
- * not alter that response in any way and therefore the listener will
- * be given what is essentially a read-only view of the associated
- * operation.
- * &lt;BR&gt;&lt;BR&gt;
- * Note that while this interface can be used by clients to be
- * notified of changes to the configuration data just as easily as it
- * can be used for any other entry anywhere in the server, components
- * that are only interested in being notified of changes to the server
- * configuration should use the {@code ConfigAddListener},
- * {@code ConfigDeleteListener}, and/or the
- * {@code ConfigChangeListener} interfaces instead.  They will be more
- * efficient overall because they will only be invoked for operations
- * in the server configuration, and then only for the specific entries
- * with which the component has registered.
- */
-@org.opends.server.types.PublicAPI(
-     stability=org.opends.server.types.StabilityLevel.VOLATILE,
-     mayInstantiate=false,
-     mayExtend=true,
-     mayInvoke=false)
-public interface ChangeNotificationListener
-{
-  /**
-   * Performs any processing that may be required after an add
-   * operation.
-   *
-   * @param  addOperation  The add operation that was performed in the
-   *                       server.
-   * @param  entry         The entry that was added to the server.
-   */
-  public void handleAddOperation(
-                   PostResponseAddOperation addOperation,
-                   Entry entry);
-
-
-
-  /**
-   * Performs any processing that may be required after a delete
-   * operation.
-   *
-   * @param  deleteOperation  The delete operation that was performed
-   *                          in the server.
-   * @param  entry            The entry that was removed from the
-   *                          server.
-   */
-  public void handleDeleteOperation(
-                   PostResponseDeleteOperation deleteOperation,
-                   Entry entry);
-
-
-
-  /**
-   * Performs any processing that may be required after a modify
-   * operation.
-   *
-   * @param  modifyOperation  The modify operation that was performed
-   *                          in the server.
-   * @param  oldEntry         The entry before it was updated.
-   * @param  newEntry         The entry after it was updated.
-   */
-  public void handleModifyOperation(
-                   PostResponseModifyOperation modifyOperation,
-                   Entry oldEntry, Entry newEntry);
-
-
-
-  /**
-   * Performs any processing that may be required after a modify DN
-   * operation.
-   *
-   * @param  modifyDNOperation  The modify DN operation that was
-   *                            performed in the server.
-   * @param  oldEntry           The entry before it was updated.
-   * @param  newEntry           The entry after it was updated.
-   */
-  public void handleModifyDNOperation(
-                   PostResponseModifyDNOperation modifyDNOperation,
-                   Entry oldEntry, Entry newEntry);
-}
-
</del></span></pre></div>
<a id="trunkopendssrcserverorgopendsservercoreAuthenticatedUsersjava"></a>
<div class="modfile"><h4>Modified: \
trunk/opends/src/server/org/opends/server/core/AuthenticatedUsers.java (10975 => \
10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/core/AuthenticatedUsers.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/core/AuthenticatedUsers.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -22,32 +22,29 @@
</span><span class="cx">  *
</span><span class="cx">  *
</span><span class="cx">  *      Copyright 2008-2010 Sun Microsystems, Inc.
</span><del>- *      Portions copyright 2011 ForgeRock AS
</del><ins>+ *      Portions copyright 2011-2014 ForgeRock AS
</ins><span class="cx">  */
</span><span class="cx"> package org.opends.server.core;
</span><ins>+
+import java.util.EnumSet;
</ins><span class="cx"> import java.util.HashSet;
</span><span class="cx"> import java.util.Set;
</span><del>-import org.opends.messages.Message;
-
-
-
</del><span class="cx"> import java.util.concurrent.CopyOnWriteArraySet;
</span><span class="cx"> import java.util.concurrent.locks.ReentrantReadWriteLock;
</span><span class="cx"> 
</span><del>-import org.opends.server.api.ChangeNotificationListener;
</del><ins>+import org.opends.messages.Message;
</ins><span class="cx"> import org.opends.server.api.ClientConnection;
</span><span class="cx"> import org.opends.server.api.DITCacheMap;
</span><ins>+import org.opends.server.api.plugin.InternalDirectoryServerPlugin;
+import org.opends.server.api.plugin.PluginResult.PostResponse;
</ins><span class="cx"> import org.opends.server.loggers.debug.DebugTracer;
</span><del>-import org.opends.server.types.DisconnectReason;
-import org.opends.server.types.DN;
-import org.opends.server.types.DebugLogLevel;
-import org.opends.server.types.Entry;
-import org.opends.server.types.operation.PostResponseAddOperation;
</del><ins>+import org.opends.server.types.*;
</ins><span class="cx"> import \
org.opends.server.types.operation.PostResponseDeleteOperation; </span><del>-import \
org.opends.server.types.operation.PostResponseModifyOperation; </del><span \
class="cx"> import org.opends.server.types.operation.PostResponseModifyDNOperation; \
</span><ins>+import org.opends.server.types.operation.PostResponseModifyOperation; \
</ins><span class="cx">  </span><span class="cx"> import static \
org.opends.messages.CoreMessages.*; </span><ins>+import static \
org.opends.server.api.plugin.PluginType.*; </ins><span class="cx"> import static \
org.opends.server.loggers.debug.DebugLogger.*; </span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -60,35 +57,53 @@
</span><span class="cx">  * user entries and notifying the corresponding client \
connections so that they </span><span class="cx">  * can update their cached \
versions. </span><span class="cx">  */
</span><del>-public class AuthenticatedUsers
-       implements ChangeNotificationListener
</del><ins>+public class AuthenticatedUsers extends InternalDirectoryServerPlugin
</ins><span class="cx"> {
</span><span class="cx">   /**
</span><span class="cx">    * The tracer object for the debug logger.
</span><span class="cx">    */
</span><span class="cx">   private static final DebugTracer TRACER = getTracer();
</span><span class="cx"> 
</span><del>-  // The mapping between authenticated user DNs and the associated \
                client
-  // connection objects.
-  private DITCacheMap&lt;CopyOnWriteArraySet&lt;ClientConnection&gt;&gt; userMap;
</del><ins>+  /**
+   * The mapping between authenticated user DNs and the associated client
+   * connection objects.
+   */
+  private final DITCacheMap&lt;CopyOnWriteArraySet&lt;ClientConnection&gt;&gt; \
userMap; </ins><span class="cx"> 
</span><del>-  // Lock to protect internal data structures.
</del><ins>+  /** Lock to protect internal data structures. */
</ins><span class="cx">   private final ReentrantReadWriteLock lock;
</span><span class="cx"> 
</span><ins>+  /** Dummy configuration DN. */
+  private static final String CONFIG_DN = &quot;cn=Authenticated \
Users,cn=config&quot;; </ins><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Creates a new instance of this authenticated users \
object. </span><span class="cx">    */
</span><span class="cx">   public AuthenticatedUsers()
</span><span class="cx">   {
</span><ins>+    super(toDN(CONFIG_DN), EnumSet.of(
+        // No implementation is required for add operations, since a connection
+        // can not be authenticated as a user that does not exist yet.
+        POST_RESPONSE_MODIFY, POST_RESPONSE_MODIFY_DN, POST_RESPONSE_DELETE),
+        true);
</ins><span class="cx">     userMap = new \
DITCacheMap&lt;CopyOnWriteArraySet&lt;ClientConnection&gt;&gt;(); </span><span \
class="cx">     lock = new ReentrantReadWriteLock(); </span><span class="cx"> 
</span><del>-    DirectoryServer.registerChangeNotificationListener(this);
</del><ins>+    DirectoryServer.registerInternalPlugin(this);
</ins><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  private static DN toDN(String dn)
+  {
+    try
+    {
+      return DN.decode(dn);
+    }
+    catch (DirectoryException e)
+    {
+      throw new RuntimeException(e);
+    }
+  }
</ins><span class="cx"> 
</span><del>-
</del><span class="cx">   /**
</span><span class="cx">    * Registers the provided user DN and client connection \
with this object. </span><span class="cx">    *
</span><span class="lines">@@ -102,8 +117,7 @@
</span><span class="cx">     lock.writeLock().lock();
</span><span class="cx">     try
</span><span class="cx">     {
</span><del>-      CopyOnWriteArraySet&lt;ClientConnection&gt; connectionSet =
-              userMap.get(userDN);
</del><ins>+      CopyOnWriteArraySet&lt;ClientConnection&gt; connectionSet = \
userMap.get(userDN); </ins><span class="cx">       if (connectionSet == null)
</span><span class="cx">       {
</span><span class="cx">         connectionSet = new \
CopyOnWriteArraySet&lt;ClientConnection&gt;(); </span><span class="lines">@@ -136,8 \
+150,7 @@ </span><span class="cx">     lock.writeLock().lock();
</span><span class="cx">     try
</span><span class="cx">     {
</span><del>-      CopyOnWriteArraySet&lt;ClientConnection&gt; connectionSet =
-              userMap.get(userDN);
</del><ins>+      CopyOnWriteArraySet&lt;ClientConnection&gt; connectionSet = \
userMap.get(userDN); </ins><span class="cx">       if (connectionSet != null)
</span><span class="cx">       {
</span><span class="cx">         connectionSet.remove(clientConnection);
</span><span class="lines">@@ -179,89 +192,59 @@
</span><span class="cx">     }
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
-  /**
-   * Performs any processing that may be required after an add
-   * operation.
-   *
-   * @param  addOperation  The add operation that was performed in the
-   *                       server.
-   * @param  entry         The entry that was added to the server.
-   */
-  public void handleAddOperation(
-                   PostResponseAddOperation addOperation,
-                   Entry entry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseDeleteOperation op)
</ins><span class="cx">   {
</span><del>-    // No implementation is required for add operations, since a \
                connection
-    // can't be authenticated as a user that doesn't exist yet.
-  }
</del><ins>+    if (op.getResultCode() != ResultCode.SUCCESS) {
+      return PostResponse.continueOperationProcessing();
+    }
</ins><span class="cx"> 
</span><del>-
-
-  /**
-   * Performs any processing that may be required after a delete
-   * operation.
-   *
-   * @param  deleteOperation  The delete operation that was performed
-   *                          in the server.
-   * @param  entry            The entry that was removed from the
-   *                          server.
-   */
-  public void handleDeleteOperation(
-                   PostResponseDeleteOperation deleteOperation,
-                   Entry entry)
-  {
</del><ins>+    final DN entryDN = op.getEntryDN();
</ins><span class="cx">     // Identify any client connections that may be \
authenticated </span><del>-    // or authorized as the user whose entry has been \
                deleted and
-    // terminate them.
</del><ins>+    // or authorized as the user whose entry has been deleted and \
terminate them </ins><span class="cx">     \
Set&lt;CopyOnWriteArraySet&lt;ClientConnection&gt;&gt; arraySet = </span><span \
class="cx">             new \
HashSet&lt;CopyOnWriteArraySet&lt;ClientConnection&gt;&gt;(); </span><span \
class="cx">     lock.writeLock().lock(); </span><span class="cx">     try
</span><span class="cx">     {
</span><del>-      userMap.removeSubtree(entry.getDN(), arraySet);
</del><ins>+      userMap.removeSubtree(entryDN, arraySet);
</ins><span class="cx">     }
</span><span class="cx">     finally
</span><span class="cx">     {
</span><span class="cx">       lock.writeLock().unlock();
</span><span class="cx">     }
</span><del>-    for (CopyOnWriteArraySet&lt;ClientConnection&gt;
-            connectionSet : arraySet)
</del><ins>+
+    for (CopyOnWriteArraySet&lt;ClientConnection&gt; connectionSet : arraySet)
</ins><span class="cx">     {
</span><span class="cx">       for (ClientConnection conn : connectionSet)
</span><span class="cx">       {
</span><span class="cx">         Message message = \
WARN_CLIENTCONNECTION_DISCONNECT_DUE_TO_DELETE.get( </span><del>-                \
String.valueOf(entry.getDN())); </del><ins>+                String.valueOf(entryDN));
</ins><span class="cx"> 
</span><span class="cx">         \
conn.disconnect(DisconnectReason.INVALID_CREDENTIALS, true, message); </span><span \
class="cx">       } </span><span class="cx">     }
</span><ins>+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
-  /**
-   * Performs any processing that may be required after a modify
-   * operation.
-   *
-   * @param  modifyOperation  The modify operation that was performed
-   *                          in the server.
-   * @param  oldEntry         The entry before it was updated.
-   * @param  newEntry         The entry after it was updated.
-   */
-  public void handleModifyOperation(
-                   PostResponseModifyOperation modifyOperation,
-                   Entry oldEntry, Entry newEntry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseModifyOperation op)
</ins><span class="cx">   {
</span><ins>+    if (op.getResultCode() != ResultCode.SUCCESS) {
+      return PostResponse.continueOperationProcessing();
+    }
+
+    final Entry oldEntry = op.getCurrentEntry();
+    final Entry newEntry = op.getModifiedEntry();
</ins><span class="cx">     // Identify any client connections that may be \
authenticated </span><span class="cx">     // or authorized as the user whose entry \
has been modified </span><span class="cx">     // and update them with the latest \
version of the entry. </span><span class="cx">     lock.writeLock().lock();
</span><span class="cx">     try
</span><span class="cx">     {
</span><del>-      CopyOnWriteArraySet&lt;ClientConnection&gt; connectionSet =
-           userMap.get(oldEntry.getDN());
</del><ins>+      CopyOnWriteArraySet&lt;ClientConnection&gt; connectionSet = \
userMap.get(oldEntry.getDN()); </ins><span class="cx">       if (connectionSet != \
null) </span><span class="cx">       {
</span><span class="cx">         for (ClientConnection conn : connectionSet)
</span><span class="lines">@@ -274,23 +257,19 @@
</span><span class="cx">     {
</span><span class="cx">       lock.writeLock().unlock();
</span><span class="cx">     }
</span><ins>+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
-  /**
-   * Performs any processing that may be required after a modify DN
-   * operation.
-   *
-   * @param  modifyDNOperation  The modify DN operation that was
-   *                            performed in the server.
-   * @param  oldEntry           The entry before it was updated.
-   * @param  newEntry           The entry after it was updated.
-   */
-  public void handleModifyDNOperation(
-                   PostResponseModifyDNOperation modifyDNOperation,
-                   Entry oldEntry, Entry newEntry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseModifyDNOperation op)
</ins><span class="cx">   {
</span><ins>+    if (op.getResultCode() != ResultCode.SUCCESS) {
+      return PostResponse.continueOperationProcessing();
+    }
+
+    Entry oldEntry = op.getOriginalEntry();
+    Entry newEntry = op.getUpdatedEntry();
</ins><span class="cx">     String oldDNString = \
oldEntry.getDN().toNormalizedString(); </span><span class="cx">     String \
newDNString = newEntry.getDN().toNormalizedString(); </span><span class="cx"> 
</span><span class="lines">@@ -303,8 +282,7 @@
</span><span class="cx">       Set&lt;CopyOnWriteArraySet&lt;ClientConnection&gt;&gt; \
arraySet = </span><span class="cx">         new \
HashSet&lt;CopyOnWriteArraySet&lt;ClientConnection&gt;&gt;(); </span><span \
class="cx">       userMap.removeSubtree(oldEntry.getDN(), arraySet); </span><del>-    \
                for (CopyOnWriteArraySet&lt;ClientConnection&gt;
-              connectionSet : arraySet)
</del><ins>+      for (CopyOnWriteArraySet&lt;ClientConnection&gt; connectionSet : \
arraySet) </ins><span class="cx">       {
</span><span class="cx">         DN authNDN = null;
</span><span class="cx">         DN authZDN = null;
</span><span class="lines">@@ -319,17 +297,11 @@
</span><span class="cx">             authNDN = \
conn.getAuthenticationInfo().getAuthenticationDN(); </span><span class="cx">          \
try </span><span class="cx">             {
</span><del>-              StringBuilder builder = new StringBuilder(
-                  authNDN.toNormalizedString());
-              int oldDNIndex = builder.lastIndexOf(oldDNString);
-              builder.replace(oldDNIndex, builder.length(),
-                      newDNString);
-              String newAuthNDNString = builder.toString();
-              newAuthNDN = DN.decode(newAuthNDNString);
</del><ins>+              newAuthNDN = getNewAuthDN(authNDN, oldDNString, \
newDNString); </ins><span class="cx">             }
</span><span class="cx">             catch (Exception e)
</span><span class="cx">             {
</span><del>-              // Shouldnt happen.
</del><ins>+              // Should not happen.
</ins><span class="cx">               if (debugEnabled())
</span><span class="cx">               {
</span><span class="cx">                 TRACER.debugCaught(DebugLogLevel.ERROR, e);
</span><span class="lines">@@ -341,24 +313,18 @@
</span><span class="cx">             authZDN = \
conn.getAuthenticationInfo().getAuthorizationDN(); </span><span class="cx">           \
try </span><span class="cx">             {
</span><del>-              StringBuilder builder = new StringBuilder(
-                  authZDN.toNormalizedString());
-              int oldDNIndex = builder.lastIndexOf(oldDNString);
-              builder.replace(oldDNIndex, builder.length(),
-                      newDNString);
-              String newAuthZDNString = builder.toString();
-              newAuthZDN = DN.decode(newAuthZDNString);
</del><ins>+              newAuthZDN = getNewAuthDN(authZDN, oldDNString, \
newDNString); </ins><span class="cx">             }
</span><span class="cx">             catch (Exception e)
</span><span class="cx">             {
</span><del>-              // Shouldnt happen.
</del><ins>+              // Should not happen.
</ins><span class="cx">               if (debugEnabled())
</span><span class="cx">               {
</span><span class="cx">                 TRACER.debugCaught(DebugLogLevel.ERROR, e);
</span><span class="cx">               }
</span><span class="cx">             }
</span><span class="cx">           }
</span><del>-          if ((newAuthNDN != null) &amp;&amp; (authNDN != null) \
&amp;&amp; </del><ins>+          if (newAuthNDN != null &amp;&amp; authNDN != null \
&amp;&amp; </ins><span class="cx">                \
authNDN.isDescendantOf(oldEntry.getDN())) </span><span class="cx">           {
</span><span class="cx">             if (newAuthNSet == null)
</span><span class="lines">@@ -368,7 +334,7 @@
</span><span class="cx">             \
conn.getAuthenticationInfo().setAuthenticationDN(newAuthNDN); </span><span \
class="cx">             newAuthNSet.add(conn); </span><span class="cx">           }
</span><del>-          if ((newAuthZDN != null) &amp;&amp; (authZDN != null) \
&amp;&amp; </del><ins>+          if (newAuthZDN != null &amp;&amp; authZDN != null \
&amp;&amp; </ins><span class="cx">                \
authZDN.isDescendantOf(oldEntry.getDN())) </span><span class="cx">           {
</span><span class="cx">             if (newAuthZSet == null)
</span><span class="lines">@@ -379,11 +345,11 @@
</span><span class="cx">             newAuthZSet.add(conn);
</span><span class="cx">           }
</span><span class="cx">         }
</span><del>-        if ((newAuthNDN != null) &amp;&amp; (newAuthNSet != null))
</del><ins>+        if (newAuthNDN != null &amp;&amp; newAuthNSet != null)
</ins><span class="cx">         {
</span><span class="cx">           userMap.put(newAuthNDN, newAuthNSet);
</span><span class="cx">         }
</span><del>-        if ((newAuthZDN != null) &amp;&amp; (newAuthZSet != null))
</del><ins>+        if (newAuthZDN != null &amp;&amp; newAuthZSet != null)
</ins><span class="cx">         {
</span><span class="cx">           userMap.put(newAuthZDN, newAuthZSet);
</span><span class="cx">         }
</span><span class="lines">@@ -393,6 +359,18 @@
</span><span class="cx">     {
</span><span class="cx">       lock.writeLock().unlock();
</span><span class="cx">     }
</span><ins>+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><ins>+
+  private DN getNewAuthDN(DN authDN, String oldDNString, String newDNString) throws \
DirectoryException +  {
+    // FIXME once we move to the SDK:
+    // Matt suggests we should be using the following code here:
+    // return authDN.rename(oldDNString, newDNString);
+    final StringBuilder builder = new StringBuilder(authDN.toNormalizedString());
+    final int oldDNIndex = builder.lastIndexOf(oldDNString);
+    builder.replace(oldDNIndex, builder.length(), newDNString);
+    return DN.decode(builder.toString());
+  }
</ins><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkopendssrcserverorgopendsservercoreDirectoryServerjava"></a>
<div class="modfile"><h4>Modified: \
trunk/opends/src/server/org/opends/server/core/DirectoryServer.java (10975 => \
10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/core/DirectoryServer.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/core/DirectoryServer.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -26,19 +26,6 @@
</span><span class="cx">  */
</span><span class="cx"> package org.opends.server.core;
</span><span class="cx"> 
</span><del>-import static org.opends.messages.ConfigMessages.*;
-import static org.opends.messages.CoreMessages.*;
-import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.loggers.AccessLogger.*;
-import static org.opends.server.loggers.ErrorLogger.*;
-import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.DynamicConstants.*;
-import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
-
</del><span class="cx"> import java.io.*;
</span><span class="cx"> import java.lang.management.ManagementFactory;
</span><span class="cx"> import java.net.InetAddress;
</span><span class="lines">@@ -94,6 +81,19 @@
</span><span class="cx"> import \
org.opends.server.workflowelement.WorkflowElementConfigManager; </span><span \
class="cx"> import org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement;
 </span><span class="cx"> 
</span><ins>+import static org.opends.messages.ConfigMessages.*;
+import static org.opends.messages.CoreMessages.*;
+import static org.opends.messages.ToolMessages.*;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.loggers.AccessLogger.*;
+import static org.opends.server.loggers.ErrorLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.schema.SchemaConstants.*;
+import static org.opends.server.util.DynamicConstants.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.opends.server.util.StaticUtils.*;
+import static org.opends.server.util.Validator.*;
+
</ins><span class="cx"> /**
</span><span class="cx">  * This class defines the core of the Directory Server.  It \
manages the startup </span><span class="cx">  * and shutdown processes and \
coordinates activities between all other </span><span class="lines">@@ -405,13 +405,6 \
@@ </span><span class="cx">   /** The set of backup task listeners registered with \
the Directory Server. */ </span><span class="cx">   private \
CopyOnWriteArrayList&lt;BackupTaskListener&gt; backupTaskListeners; </span><span \
class="cx">  </span><del>-  /**
-   * The set of change notification listeners registered with the Directory
-   * Server.
-   */
-  private List&lt;ChangeNotificationListener&gt;
-               changeNotificationListeners;
-
</del><span class="cx">   /** The set of connection handlers registered with the \
Directory Server. */ </span><span class="cx">   private List&lt;ConnectionHandler&gt; \
connectionHandlers; </span><span class="cx"> 
</span><span class="lines">@@ -922,8 +915,6 @@
</span><span class="cx">       directoryServer.backendInitializationListeners =
</span><span class="cx">            new \
CopyOnWriteArraySet&lt;BackendInitializationListener&gt;(); </span><span class="cx">  \
directoryServer.baseDnRegistry = new BaseDnRegistry(); </span><del>-      \
                directoryServer.changeNotificationListeners =
-           new CopyOnWriteArrayList&lt;ChangeNotificationListener&gt;();
</del><span class="cx">       directoryServer.initializationCompletedListeners =
</span><span class="cx">            new \
CopyOnWriteArrayList&lt;InitializationCompletedListener&gt;(); </span><span \
class="cx">       directoryServer.shutdownListeners = </span><span class="lines">@@ \
-941,7 +932,6 @@ </span><span class="cx">            new \
ConcurrentHashMap&lt;String,ExtendedOperationHandler&gt;(); </span><span class="cx">  \
directoryServer.saslMechanismHandlers = </span><span class="cx">            new \
ConcurrentHashMap&lt;String,SASLMechanismHandler&gt;(); </span><del>-      \
directoryServer.authenticatedUsers = new AuthenticatedUsers(); </del><span \
class="cx">       directoryServer.offlineSchemaChanges = new \
LinkedList&lt;Modification&gt;(); </span><span class="cx">       \
directoryServer.backupTaskListeners = </span><span class="cx">            new \
CopyOnWriteArrayList&lt;BackupTaskListener&gt;(); </span><span class="lines">@@ \
-1378,23 +1368,15 @@ </span><span class="cx">       \
certificateMapperConfigManager.initializeCertificateMappers(); </span><span \
class="cx">  </span><span class="cx"> 
</span><del>-      // Initialize the identity mappers.
</del><span class="cx">       initializeIdentityMappers();
</span><span class="cx"> 
</span><del>-
-      // Initialize the root DNs.
</del><span class="cx">       rootDNConfigManager = new RootDNConfigManager();
</span><span class="cx">       rootDNConfigManager.initializeRootDNs();
</span><span class="cx"> 
</span><del>-
-      // Initialize the subentry manager.
</del><ins>+      directoryServer.authenticatedUsers = new AuthenticatedUsers();
+      // initialize both subentry manager and group manager for this backend.
</ins><span class="cx">       initializeSubentryManager();
</span><del>-
-      // Initialize the group manager.
</del><span class="cx">       initializeGroupManager();
</span><del>-
-      // Now we can initialize both subentry manager and group manager
-      // for this backend.
</del><span class="cx">       \
subentryManager.performBackendInitializationProcessing(configHandler); </span><span \
class="cx">       groupManager.performBackendInitializationProcessing(configHandler); \
</span><span class="cx">  </span><span class="lines">@@ -1424,14 +1406,9 @@
</span><span class="cx">       // Reset the map as we can no longer guarantee offline \
state. </span><span class="cx">       \
directoryServer.offlineBackendsStateIDs.clear(); </span><span class="cx"> 
</span><del>-      // Initialize all the extended operation handlers.
</del><span class="cx">       initializeExtendedOperations();
</span><del>-
-
-      // Initialize all the SASL mechanism handlers.
</del><span class="cx">       initializeSASLMechanisms();
</span><span class="cx"> 
</span><del>-
</del><span class="cx">       // Initialize all the connection handlers
</span><span class="cx">       // (including the administration connector).
</span><span class="cx">       if (startConnectionHandlers)
</span><span class="lines">@@ -1439,13 +1416,9 @@
</span><span class="cx">         initializeConnectionHandlers();
</span><span class="cx">       }
</span><span class="cx"> 
</span><del>-
-      // Initialize all the monitor providers.
</del><span class="cx">       monitorConfigManager = new MonitorConfigManager();
</span><span class="cx">       monitorConfigManager.initializeMonitorProviders();
</span><span class="cx"> 
</span><del>-
-      // Initialize all the authentication policy components.
</del><span class="cx">       initializeAuthenticationPolicyComponents();
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -7155,55 +7128,7 @@
</span><span class="cx">     return \
directoryServer.workQueue.trySubmitOperation(operation); </span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
</del><span class="cx">   /**
</span><del>-   * Retrieves the set of change notification listeners registered with \
                the
-   * Directory Server.
-   *
-   * @return  The set of change notification listeners registered with the
-   *          Directory Server.
-   */
-  public static List&lt;ChangeNotificationListener&gt;
-                     getChangeNotificationListeners()
-  {
-    return directoryServer.changeNotificationListeners;
-  }
-
-
-
-  /**
-   * Registers the provided change notification listener with the Directory
-   * Server so that it will be notified of any add, delete, modify, or modify DN
-   * operations that are performed.
-   *
-   * @param  changeListener  The change notification listener to register with
-   *                         the Directory Server.
-   */
-  public static void registerChangeNotificationListener(
-                          ChangeNotificationListener changeListener)
-  {
-    directoryServer.changeNotificationListeners.add(changeListener);
-  }
-
-
-
-  /**
-   * Deregisters the provided change notification listener with the Directory
-   * Server so that it will no longer be notified of any add, delete, modify, or
-   * modify DN operations that are performed.
-   *
-   * @param  changeListener  The change notification listener to deregister with
-   *                         the Directory Server.
-   */
-  public static void deregisterChangeNotificationListener(
-                          ChangeNotificationListener changeListener)
-  {
-    directoryServer.changeNotificationListeners.remove(changeListener);
-  }
-
-
-
-  /**
</del><span class="cx">    * Retrieves the set of synchronization providers that have \
been registered </span><span class="cx">    * with the Directory Server.
</span><span class="cx">    *
</span></span></pre></div>
<a id="trunkopendssrcserverorgopendsservercryptoCryptoManagerSyncjava"></a>
<div class="modfile"><h4>Modified: \
trunk/opends/src/server/org/opends/server/crypto/CryptoManagerSync.java (10975 => \
10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/crypto/CryptoManagerSync.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/crypto/CryptoManagerSync.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -22,126 +22,112 @@
</span><span class="cx">  *
</span><span class="cx">  *
</span><span class="cx">  *      Copyright 2008-2010 Sun Microsystems, Inc.
</span><ins>+ *      Portions Copyright 2014 ForgeRock AS
</ins><span class="cx">  */
</span><del>-
</del><span class="cx"> package org.opends.server.crypto;
</span><span class="cx"> 
</span><ins>+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import org.opends.admin.ads.ADSContext;
+import org.opends.messages.Message;
</ins><span class="cx"> import org.opends.server.api.Backend;
</span><span class="cx"> import org.opends.server.api.BackendInitializationListener;
</span><del>-import org.opends.server.api.ChangeNotificationListener;
-import org.opends.server.loggers.debug.DebugTracer;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.debug.DebugLogger.getTracer;
</del><ins>+import org.opends.server.api.plugin.InternalDirectoryServerPlugin;
+import org.opends.server.api.plugin.PluginResult.PostResponse;
+import org.opends.server.config.ConfigConstants;
+import org.opends.server.controls.EntryChangeNotificationControl;
+import org.opends.server.controls.PersistentSearchChangeType;
+import org.opends.server.core.AddOperation;
+import org.opends.server.core.DeleteOperation;
+import org.opends.server.core.DirectoryServer;
</ins><span class="cx"> import org.opends.server.loggers.ErrorLogger;
</span><ins>+import org.opends.server.loggers.debug.DebugTracer;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.protocols.internal.InternalSearchOperation;
+import org.opends.server.protocols.ldap.LDAPControl;
</ins><span class="cx"> import org.opends.server.types.*;
</span><span class="cx"> import \
org.opends.server.types.operation.PostResponseAddOperation; </span><span class="cx"> \
import org.opends.server.types.operation.PostResponseDeleteOperation; </span><span \
class="cx"> import org.opends.server.types.operation.PostResponseModifyOperation; \
                </span><del>-import \
                org.opends.server.types.operation.PostResponseModifyDNOperation;
-import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
-import static org.opends.server.util.ServerConstants.OC_TOP;
-import static org.opends.server.util.ServerConstants.
-     OID_ENTRY_CHANGE_NOTIFICATION;
-import org.opends.server.config.ConfigConstants;
-import static org.opends.server.config.ConfigConstants.OC_CRYPTO_INSTANCE_KEY;
-import static org.opends.server.config.ConfigConstants.OC_CRYPTO_CIPHER_KEY;
-import static org.opends.server.config.ConfigConstants.OC_CRYPTO_MAC_KEY;
-import org.opends.server.protocols.internal.InternalClientConnection;
-import org.opends.server.protocols.internal.InternalSearchOperation;
-import org.opends.server.protocols.ldap.LDAPControl;
-import org.opends.server.controls.PersistentSearchChangeType;
-import org.opends.server.controls.EntryChangeNotificationControl;
-import org.opends.server.core.DirectoryServer;
-import org.opends.server.core.DeleteOperation;
-import org.opends.server.core.AddOperation;
</del><ins>+
</ins><span class="cx"> import static org.opends.messages.CoreMessages.*;
</span><del>-import org.opends.messages.Message;
-import org.opends.admin.ads.ADSContext;
</del><ins>+import static org.opends.server.api.plugin.PluginType.*;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.protocols.internal.InternalClientConnection.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.opends.server.util.StaticUtils.*;
</ins><span class="cx"> 
</span><del>-import java.util.LinkedHashSet;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.HashMap;
-
</del><span class="cx"> /**
</span><span class="cx">  * This class defines an object that synchronizes \
certificates from the admin </span><span class="cx">  * data branch into the trust \
store backend, and synchronizes secret-key entries </span><span class="cx">  * from \
the admin data branch to the crypto manager secret-key cache. </span><span \
class="cx">  */ </span><del>-public class CryptoManagerSync
-     implements BackendInitializationListener, ChangeNotificationListener
</del><ins>+public class CryptoManagerSync extends InternalDirectoryServerPlugin
+     implements BackendInitializationListener
</ins><span class="cx"> {
</span><del>-  /**
-   * The debug log tracer for this object.
-   */
</del><ins>+  /** The debug log tracer for this object. */
</ins><span class="cx">   private static final DebugTracer TRACER = getTracer();
</span><span class="cx"> 
</span><del>-
-
-  // The DN of the administration suffix.
</del><ins>+  /** The DN of the administration suffix. */
</ins><span class="cx">   private DN adminSuffixDN;
</span><span class="cx"> 
</span><del>-  // The DN of the instance keys container within the admin suffix.
</del><ins>+  /** The DN of the instance keys container within the admin suffix. */
</ins><span class="cx">   private DN instanceKeysDN;
</span><span class="cx"> 
</span><del>-  // The DN of the secret keys container within the admin suffix.
</del><ins>+  /** The DN of the secret keys container within the admin suffix. */
</ins><span class="cx">   private DN secretKeysDN;
</span><span class="cx"> 
</span><del>-  // The DN of the trust store root.
</del><ins>+  /** The DN of the trust store root. */
</ins><span class="cx">   private DN trustStoreRootDN;
</span><span class="cx"> 
</span><del>-  // The attribute type that is used to specify a server instance \
                certificate.
-  AttributeType attrCert;
</del><ins>+  /** The attribute type that is used to specify a server instance \
certificate. */ +  private final AttributeType attrCert;
</ins><span class="cx"> 
</span><del>-  // The attribute type that holds a server certificate identifier.
-  AttributeType attrAlias;
</del><ins>+  /** The attribute type that holds a server certificate identifier. */
+  private final AttributeType attrAlias;
</ins><span class="cx"> 
</span><del>-  // The attribute type that holds the time a key was compromised.
-  AttributeType attrCompromisedTime;
</del><ins>+  /** The attribute type that holds the time a key was compromised. */
+  private final AttributeType attrCompromisedTime;
</ins><span class="cx"> 
</span><del>-  // A filter on object class to select key entries.
</del><ins>+  /** A filter on object class to select key entries. */
</ins><span class="cx">   private SearchFilter keySearchFilter;
</span><span class="cx"> 
</span><del>-  // The instance key objectclass.
-  private ObjectClass ocInstanceKey;
</del><ins>+  /** The instance key objectclass. */
+  private final ObjectClass ocInstanceKey;
</ins><span class="cx"> 
</span><del>-  // The cipher key objectclass.
-  private ObjectClass ocCipherKey;
</del><ins>+  /** The cipher key objectclass. */
+  private final ObjectClass ocCipherKey;
</ins><span class="cx"> 
</span><del>-  // The mac key objectclass.
-  private ObjectClass ocMacKey;
</del><ins>+  /** The mac key objectclass. */
+  private final ObjectClass ocMacKey;
</ins><span class="cx"> 
</span><del>-  /**
-   * Creates a new instance of this trust store synchronization thread.
-   *
-   * @throws InitializationException in case an exception occurs during
-   * initialization, such as a failure to publish the instance-key-pair
-   * public-key-certificate in ADS.
-   */
-  public CryptoManagerSync()
-          throws InitializationException
-  {
-    this(true);
-  }
</del><ins>+  /** Dummy configuration DN. */
+  private static final String CONFIG_DN = &quot;cn=Crypto Manager \
Sync,cn=config&quot;; </ins><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Creates a new instance of this trust store \
synchronization thread. </span><span class="cx">    *
</span><del>-   * @param publishInstanceKey whether the instance key must be \
                published in
-   * the ADS or not.
</del><span class="cx">    * @throws InitializationException in case an exception \
occurs during </span><span class="cx">    * initialization, such as a failure to \
publish the instance-key-pair </span><span class="cx">    * public-key-certificate in \
ADS. </span><span class="cx">    */
</span><del>-  public CryptoManagerSync(boolean publishInstanceKey)
-  throws InitializationException
</del><ins>+  public CryptoManagerSync() throws InitializationException
</ins><span class="cx">   {
</span><ins>+    super(toDN(CONFIG_DN), EnumSet.of(
+        // No implementation required for modify_dn operations
+        // FIXME: Technically it is possible to perform a subtree modDN
+        // in this case however such subtree modDN would essentially be
+        // moving configuration branches which should not happen.
+        POST_RESPONSE_ADD, POST_RESPONSE_MODIFY, POST_RESPONSE_DELETE),
+        true);
</ins><span class="cx">     try {
</span><del>-      if (publishInstanceKey)
-      {
-        CryptoManagerImpl.publishInstanceKeyEntryInADS();
-      }
</del><ins>+      CryptoManagerImpl.publishInstanceKeyEntryInADS();
</ins><span class="cx">     }
</span><span class="cx">     catch (CryptoManagerException ex) {
</span><span class="cx">       throw new \
InitializationException(ex.getMessageObject()); </span><span class="lines">@@ -163,15 \
+149,11 @@ </span><span class="cx">     }
</span><span class="cx">     catch (DirectoryException e)
</span><span class="cx">     {
</span><del>-      //
</del><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ocInstanceKey = DirectoryServer.getObjectClass(
-         OC_CRYPTO_INSTANCE_KEY, true);
-    ocCipherKey = DirectoryServer.getObjectClass(
-         OC_CRYPTO_CIPHER_KEY, true);
-    ocMacKey = DirectoryServer.getObjectClass(
-         OC_CRYPTO_MAC_KEY, true);
</del><ins>+    ocInstanceKey = \
DirectoryServer.getObjectClass(OC_CRYPTO_INSTANCE_KEY, true); +    ocCipherKey = \
DirectoryServer.getObjectClass(OC_CRYPTO_CIPHER_KEY, true); +    ocMacKey = \
DirectoryServer.getObjectClass(OC_CRYPTO_MAC_KEY, true); </ins><span class="cx"> 
</span><span class="cx">     attrCert = DirectoryServer.getAttributeType(
</span><span class="cx">          ConfigConstants.ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE, \
true); </span><span class="lines">@@ -185,22 +167,32 @@
</span><span class="cx">       searchAdminSuffix();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    DirectoryServer.registerChangeNotificationListener(this);
</del><ins>+    DirectoryServer.registerInternalPlugin(this);
</ins><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  private static DN toDN(final String dn) throws InitializationException
+  {
+    try
+    {
+      return DN.decode(dn);
+    }
+    catch (DirectoryException e)
+    {
+      throw new RuntimeException(e);
+    }
+  }
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">   private void searchAdminSuffix()
</span><span class="cx">   {
</span><del>-    InternalClientConnection conn =
-         InternalClientConnection.getRootConnection();
</del><span class="cx">     LinkedHashSet&lt;String&gt; attributes = new \
LinkedHashSet&lt;String&gt;(0); </span><span class="cx"> 
</span><span class="cx">     ArrayList&lt;Control&gt; controls = new \
ArrayList&lt;Control&gt;(0); </span><span class="cx"> 
</span><span class="cx">     InternalSearchOperation searchOperation =
</span><del>-         new InternalSearchOperation(conn,
-                                     InternalClientConnection.nextOperationID(),
-                                     InternalClientConnection.nextMessageID(),
</del><ins>+         new InternalSearchOperation(getRootConnection(),
+                                     nextOperationID(),
+                                     nextMessageID(),
</ins><span class="cx">                                      controls,
</span><span class="cx">                                      adminSuffixDN, \
SearchScope.WHOLE_SUBTREE, </span><span class="cx">                                   \
DereferencePolicy.NEVER_DEREF_ALIASES, </span><span class="lines">@@ -242,9 +234,8 @@
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-  /**
-   * {@inheritDoc}
-   */
</del><ins>+  /** {@inheritDoc} */
+  @Override
</ins><span class="cx">   public void performBackendInitializationProcessing(Backend \
backend) </span><span class="cx">   {
</span><span class="cx">     DN[] baseDNs = backend.getBaseDNs();
</span><span class="lines">@@ -260,9 +251,8 @@
</span><span class="cx">     }
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-  /**
-   * {@inheritDoc}
-   */
</del><ins>+  /** {@inheritDoc} */
+  @Override
</ins><span class="cx">   public void performBackendFinalizationProcessing(Backend \
backend) </span><span class="cx">   {
</span><span class="cx">     // No implementation required.
</span><span class="lines">@@ -315,7 +305,7 @@
</span><span class="cx">       {
</span><span class="cx">         for (Control c : controls)
</span><span class="cx">         {
</span><del>-          if (c.getOID().equals(OID_ENTRY_CHANGE_NOTIFICATION))
</del><ins>+          if (OID_ENTRY_CHANGE_NOTIFICATION.equals(c.getOID()))
</ins><span class="cx">           {
</span><span class="cx">             if (c instanceof LDAPControl)
</span><span class="cx">             {
</span><span class="lines">@@ -340,8 +330,7 @@
</span><span class="cx">       if (ecn != null &amp;&amp;
</span><span class="cx">            ecn.getChangeType() == \
PersistentSearchChangeType.DELETE) </span><span class="cx">       {
</span><del>-        // The entry was deleted so we should remove it from the local \
                trust
-        // store.
</del><ins>+        // entry was deleted so remove it from the local trust store
</ins><span class="cx">         if (dstEntry != null)
</span><span class="cx">         {
</span><span class="cx">           deleteEntry(dstDN);
</span><span class="lines">@@ -349,24 +338,21 @@
</span><span class="cx">       }
</span><span class="cx">       else if \
(searchEntry.hasAttribute(attrCompromisedTime)) </span><span class="cx">       {
</span><del>-        // The key was compromised so we should remove it from the local
-        // trust store.
</del><ins>+        // key was compromised so remove it from the local trust store
</ins><span class="cx">         if (dstEntry != null)
</span><span class="cx">         {
</span><span class="cx">           deleteEntry(dstDN);
</span><span class="cx">         }
</span><span class="cx">       }
</span><ins>+      else if (dstEntry == null)
+      {
+        // The entry was added
+        addEntry(searchEntry, dstDN);
+      }
</ins><span class="cx">       else
</span><span class="cx">       {
</span><del>-        // The entry was added or modified.
-        if (dstEntry == null)
-        {
-          addEntry(searchEntry, dstDN);
-        }
-        else
-        {
-          modifyEntry(searchEntry, dstEntry);
-        }
</del><ins>+        // The entry was modified
+        modifyEntry(searchEntry, dstEntry);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">   }
</span><span class="lines">@@ -380,12 +366,9 @@
</span><span class="cx">    */
</span><span class="cx">   private void modifyEntry(Entry srcEntry, Entry dstEntry)
</span><span class="cx">   {
</span><del>-    List&lt;Attribute&gt; srcList;
-    srcList = srcEntry.getAttribute(attrCert);
</del><ins>+    List&lt;Attribute&gt; srcList = srcEntry.getAttribute(attrCert);
+    List&lt;Attribute&gt; dstList = dstEntry.getAttribute(attrCert);
</ins><span class="cx"> 
</span><del>-    List&lt;Attribute&gt; dstList;
-    dstList = dstEntry.getAttribute(attrCert);
-
</del><span class="cx">     // Check for changes to the certificate value.
</span><span class="cx">     boolean differ = false;
</span><span class="cx">     if (srcList == null)
</span><span class="lines">@@ -395,21 +378,12 @@
</span><span class="cx">         differ = true;
</span><span class="cx">       }
</span><span class="cx">     }
</span><del>-    else if (dstList == null)
</del><ins>+    else if (dstList == null
+        || srcList.size() != dstList.size()
+        || !srcList.equals(dstList))
</ins><span class="cx">     {
</span><span class="cx">       differ = true;
</span><span class="cx">     }
</span><del>-    else if (srcList.size() != dstList.size())
-    {
-      differ = true;
-    }
-    else
-    {
-      if (!srcList.equals(dstList))
-      {
-        differ = true;
-      }
-    }
</del><span class="cx"> 
</span><span class="cx">     if (differ)
</span><span class="cx">     {
</span><span class="lines">@@ -485,18 +459,22 @@
</span><span class="cx">     }
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-  /**
-   * {@inheritDoc}
-   */
-  public void handleAddOperation(PostResponseAddOperation addOperation,
-                                 Entry entry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseAddOperation op)
</ins><span class="cx">   {
</span><del>-    if (addOperation.getEntryDN().isDescendantOf(instanceKeysDN))
</del><ins>+    if (op.getResultCode() != ResultCode.SUCCESS)
</ins><span class="cx">     {
</span><ins>+      return PostResponse.continueOperationProcessing();
+    }
+
+    final Entry entry = op.getEntryToAdd();
+    final DN entryDN = op.getEntryDN();
+    if (entryDN.isDescendantOf(instanceKeysDN))
+    {
</ins><span class="cx">       handleInstanceKeyAddOperation(entry);
</span><span class="cx">     }
</span><del>-    else if (addOperation.getEntryDN().isDescendantOf(secretKeysDN))
</del><ins>+    else if (entryDN.isDescendantOf(secretKeysDN))
</ins><span class="cx">     {
</span><span class="cx">       try
</span><span class="cx">       {
</span><span class="lines">@@ -511,11 +489,11 @@
</span><span class="cx">       }
</span><span class="cx">       catch (CryptoManagerException e)
</span><span class="cx">       {
</span><del>-        Message message = Message.raw(&quot;Failed to import key entry: \
                %s&quot;,
-                                      e.getMessage());
-        ErrorLogger.logError(message);
</del><ins>+        ErrorLogger.logError(
+            Message.raw(&quot;Failed to import key entry: %s&quot;, \
e.getMessage())); </ins><span class="cx">       }
</span><span class="cx">     }
</span><ins>+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -536,18 +514,17 @@
</span><span class="cx">     }
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-  /**
-   * {@inheritDoc}
-   */
-  public void handleDeleteOperation(PostResponseDeleteOperation deleteOperation,
-                                    Entry entry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseDeleteOperation op)
</ins><span class="cx">   {
</span><del>-    if (!deleteOperation.getEntryDN().isDescendantOf(instanceKeysDN))
</del><ins>+    if (op.getResultCode() != ResultCode.SUCCESS
+        || !op.getEntryDN().isDescendantOf(instanceKeysDN))
</ins><span class="cx">     {
</span><del>-      return;
</del><ins>+      return PostResponse.continueOperationProcessing();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RDN srcRDN = entry.getDN().getRDN();
</del><ins>+    RDN srcRDN = op.getEntryToDelete().getDN().getRDN();
</ins><span class="cx"> 
</span><span class="cx">     // Only process the entry if it has the expected form of \
RDN. </span><span class="cx">     // FIXME: Technically it is possible to perform a \
subtree in </span><span class="lines">@@ -556,23 +533,28 @@
</span><span class="cx">     if (!srcRDN.isMultiValued() &amp;&amp;
</span><span class="cx">          srcRDN.getAttributeType(0).equals(attrAlias))
</span><span class="cx">     {
</span><del>-      DN dstDN = trustStoreRootDN.concat(srcRDN);
-
-      deleteEntry(dstDN);
</del><ins>+      DN destDN = trustStoreRootDN.concat(srcRDN);
+      deleteEntry(destDN);
</ins><span class="cx">     }
</span><ins>+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-  /**
-   * {@inheritDoc}
-   */
-  public void handleModifyOperation(PostResponseModifyOperation modifyOperation,
-                                    Entry oldEntry, Entry newEntry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseModifyOperation op)
</ins><span class="cx">   {
</span><del>-    if (modifyOperation.getEntryDN().isDescendantOf(instanceKeysDN))
</del><ins>+    if (op.getResultCode() != ResultCode.SUCCESS)
</ins><span class="cx">     {
</span><ins>+      return PostResponse.continueOperationProcessing();
+    }
+
+    final Entry newEntry = op.getModifiedEntry();
+    final DN entryDN = op.getEntryDN();
+    if (entryDN.isDescendantOf(instanceKeysDN))
+    {
</ins><span class="cx">       handleInstanceKeyModifyOperation(newEntry);
</span><span class="cx">     }
</span><del>-    else if (modifyOperation.getEntryDN().isDescendantOf(secretKeysDN))
</del><ins>+    else if (entryDN.isDescendantOf(secretKeysDN))
</ins><span class="cx">     {
</span><span class="cx">       try
</span><span class="cx">       {
</span><span class="lines">@@ -592,6 +574,7 @@
</span><span class="cx">         ErrorLogger.logError(message);
</span><span class="cx">       }
</span><span class="cx">     }
</span><ins>+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   private void handleInstanceKeyModifyOperation(Entry \
newEntry) </span><span class="lines">@@ -624,30 +607,14 @@
</span><span class="cx">           deleteEntry(dstDN);
</span><span class="cx">         }
</span><span class="cx">       }
</span><ins>+      else if (dstEntry == null)
+      {
+        addEntry(newEntry, dstDN);
+      }
</ins><span class="cx">       else
</span><span class="cx">       {
</span><del>-        if (dstEntry == null)
-        {
-          addEntry(newEntry, dstDN);
-        }
-        else
-        {
-          modifyEntry(newEntry, dstEntry);
-        }
</del><ins>+        modifyEntry(newEntry, dstEntry);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">   }
</span><del>-
-  /**
-   * {@inheritDoc}
-   */
-  public void handleModifyDNOperation(
-       PostResponseModifyDNOperation modifyDNOperation, Entry oldEntry,
-       Entry newEntry)
-  {
-    // No implementation required.
-    // FIXME: Technically it is possible to perform a subtree modDN
-    // in this case however such subtree modDN would essentially be
-    // moving configuration branches which should not happen.
-  }
</del><span class="cx"> }
</span></span></pre></div>
<a id="trunkopendssrcserverorgopendsservertypesDirectoryConfigjava"></a>
<div class="modfile"><h4>Modified: \
trunk/opends/src/server/org/opends/server/types/DirectoryConfig.java (10975 => \
10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/types/DirectoryConfig.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/types/DirectoryConfig.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -22,21 +22,17 @@
</span><span class="cx">  *
</span><span class="cx">  *
</span><span class="cx">  *      Copyright 2006-2009 Sun Microsystems, Inc.
</span><del>- *      Portions copyright 2013 ForgeRock AS.
</del><ins>+ *      Portions copyright 2013-2014 ForgeRock AS.
</ins><span class="cx">  */
</span><span class="cx"> package org.opends.server.types;
</span><span class="cx"> import java.util.List;
</span><del>-import org.opends.messages.Message;
-
-
-
</del><span class="cx"> import java.util.Map;
</span><span class="cx"> import java.util.Set;
</span><span class="cx"> 
</span><ins>+import org.opends.messages.Message;
</ins><span class="cx"> import org.opends.server.api.AlertGenerator;
</span><span class="cx"> import org.opends.server.api.ApproximateMatchingRule;
</span><span class="cx"> import org.opends.server.api.AttributeSyntax;
</span><del>-import org.opends.server.api.ChangeNotificationListener;
</del><span class="cx"> import org.opends.server.api.ConfigHandler;
</span><span class="cx"> import org.opends.server.api.EqualityMatchingRule;
</span><span class="cx"> import org.opends.server.api.ExtendedOperationHandler;
</span><span class="lines">@@ -50,10 +46,9 @@
</span><span class="cx"> import org.opends.server.config.ConfigException;
</span><span class="cx"> import org.opends.server.core.DirectoryServer;
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * This interface defines a set of methods that may be used \
by </span><del>- * third-party code to obtatin information about the core Directory
</del><ins>+ * third-party code to obtain information about the core Directory
</ins><span class="cx">  * Server configuration and the instances of various kinds of
</span><span class="cx">  * components that have registered themselves with the \
server. </span><span class="cx">  * &lt;BR&gt;&lt;BR&gt;
</span><span class="lines">@@ -1089,44 +1084,7 @@
</span><span class="cx">     DirectoryServer.deregisterSASLMechanismHandler(name);
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><del>-   * Registers the provided change notification listener with the
-   * Directory Server so that it will be notified of any add, delete,
-   * modify, or modify DN operations that are performed.
-   *
-   * @param  changeListener  The change notification listener to
-   *                         register with the Directory Server.
-   */
-  public static void
-       registerChangeNotificationListener(
-            ChangeNotificationListener changeListener)
-  {
-    DirectoryServer.registerChangeNotificationListener(
-                         changeListener);
-  }
-
-
-
-  /**
-   * Deregisters the provided change notification listener with the
-   * Directory Server so that it will no longer be notified of any
-   * add, delete, modify, or modify DN operations that are performed.
-   *
-   * @param  changeListener  The change notification listener to
-   *                         deregister with the Directory Server.
-   */
-  public static void deregisterChangeNotificationListener(
-                          ChangeNotificationListener changeListener)
-  {
-    DirectoryServer.deregisterChangeNotificationListener(
-                         changeListener);
-  }
-
-
-
-  /**
</del><span class="cx">    * Registers the provided shutdown listener with the \
Directory </span><span class="cx">    * Server so that it will be notified when the \
server shuts down. </span><span class="cx">    *
</span></span></pre></div>
<a id="trunkopendssrcserverorgopendsserverutilCollectionUtilsjava"></a>
<div class="addfile"><h4>Added: \
trunk/opends/src/server/org/opends/server/util/CollectionUtils.java (0 => 10976)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/opends/src/server/org/opends/server/util/CollectionUtils.java	                  \
                (rev 0)
+++ trunk/opends/src/server/org/opends/server/util/CollectionUtils.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the &quot;License&quot;).  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at legal-notices/CDDLv1_0.txt.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets &quot;[]&quot; replaced with your own identifying
+ * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *      Copyright 2014 ForgeRock AS
+ */
+package org.opends.server.util;
+
+import java.util.*;
+
+/**
+ * Utility class for {@link Collection}s.
+ */
+public final class CollectionUtils
+{
+
+  private CollectionUtils()
+  {
+    // private for utility classes
+  }
+
+  /**
+   * Creates a new {@link ArrayList} with the provided elements.
+   *
+   * @param &lt;E&gt;
+   *          the elements' type
+   * @param elements
+   *          the elements to add to the new ArrayList
+   * @return a new ArrayList with the provided elements
+   */
+  public static &lt;E&gt; ArrayList&lt;E&gt; newArrayList(E... elements)
+  {
+    return new ArrayList&lt;E&gt;(Arrays.asList(elements));
+  }
+
+  /**
+   * Creates a new {@link LinkedList} with the provided elements.
+   *
+   * @param &lt;E&gt;
+   *          the elements' type
+   * @param elements
+   *          the elements to add to the new LinkedList
+   * @return a new LinkedList with the provided elements
+   */
+  public static &lt;E&gt; LinkedList&lt;E&gt; newLinkedList(E... elements)
+  {
+    return new LinkedList&lt;E&gt;(Arrays.asList(elements));
+  }
+
+  /**
+   * Creates a new {@link HashSet} with the provided elements.
+   *
+   * @param &lt;E&gt;
+   *          the elements' type
+   * @param elements
+   *          the elements to add to the new HashSet
+   * @return a new HashSet with the provided elements
+   */
+  public static &lt;E&gt; HashSet&lt;E&gt; newHashSet(E... elements)
+  {
+    return new HashSet&lt;E&gt;(Arrays.asList(elements));
+  }
+
+  /**
+   * Creates a new {@link LinkedHashSet} with the provided elements.
+   *
+   * @param &lt;E&gt;
+   *          the elements' type
+   * @param elements
+   *          the elements to add to the new LinkedHashSet
+   * @return a new LinkedHashSet with the provided elements
+   */
+  public static &lt;E&gt; LinkedHashSet&lt;E&gt; newLinkedHashSet(E... elements)
+  {
+    return new LinkedHashSet&lt;E&gt;(Arrays.asList(elements));
+  }
+
+  /**
+   * Creates a new {@link TreeSet} with the provided elements.
+   *
+   * @param &lt;E&gt;
+   *          the elements' type
+   * @param elements
+   *          the elements to add to the new TreeSet
+   * @return a new TreeSet with the provided elements
+   */
+  public static &lt;E&gt; TreeSet&lt;E&gt; newTreeSet(E... elements)
+  {
+    return new TreeSet&lt;E&gt;(Arrays.asList(elements));
+  }
+}
</ins><span class="cx">Property changes on: \
trunk/opends/src/server/org/opends/server/util/CollectionUtils.java </span><span \
class="cx">___________________________________________________________________ \
</span></span></pre></div> <a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkopendssrcserverorgopendsserverworkflowelementlocalbackendLocalBackendAddOperationjava"></a>
 <div class="modfile"><h4>Modified: \
trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java \
(10975 => 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -184,31 +184,10 @@
</span><span class="cx">         @Override
</span><span class="cx">         public void run()
</span><span class="cx">         {
</span><del>-          // Notify persistent searches.
</del><span class="cx">           for (PersistentSearch psearch : \
wfe.getPersistentSearches()) </span><span class="cx">           {
</span><span class="cx">             psearch.processAdd(entry);
</span><span class="cx">           }
</span><del>-
-          // Notify change listeners.
-          for (ChangeNotificationListener changeListener : DirectoryServer
-              .getChangeNotificationListeners())
-          {
-            try
-            {
-              changeListener.handleAddOperation(LocalBackendAddOperation.this, \
                entry);
-            }
-            catch (Exception e)
-            {
-              if (debugEnabled())
-              {
-                TRACER.debugCaught(DebugLogLevel.ERROR, e);
-              }
-
-              logError(ERR_ADD_ERROR_NOTIFYING_CHANGE_LISTENER
-                  .get(getExceptionMessage(e)));
-            }
-          }
</del><span class="cx">         }
</span><span class="cx">       });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkopendssrcserverorgopendsserverworkflowelementlocalbackendLocalBackendDeleteOperationjava"></a>
 <div class="modfile"><h4>Modified: \
trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendDeleteOperation.java \
(10975 => 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendDeleteOperation.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendDeleteOperation.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> 
</span><span class="cx"> import org.opends.messages.Message;
</span><span class="cx"> import org.opends.server.api.Backend;
</span><del>-import org.opends.server.api.ChangeNotificationListener;
</del><span class="cx"> import org.opends.server.api.ClientConnection;
</span><span class="cx"> import org.opends.server.api.SynchronizationProvider;
</span><span class="cx"> import org.opends.server.api.plugin.PluginResult;
</span><span class="lines">@@ -176,31 +175,10 @@
</span><span class="cx">         @Override
</span><span class="cx">         public void run()
</span><span class="cx">         {
</span><del>-          // Notify persistent searches.
</del><span class="cx">           for (PersistentSearch psearch : \
wfe.getPersistentSearches()) </span><span class="cx">           {
</span><span class="cx">             psearch.processDelete(entry);
</span><span class="cx">           }
</span><del>-
-          // Notify change listeners.
-          for (ChangeNotificationListener changeListener : DirectoryServer
-              .getChangeNotificationListeners())
-          {
-            try
-            {
-              changeListener.handleDeleteOperation(LocalBackendDeleteOperation.this, \
                entry);
-            }
-            catch (Exception e)
-            {
-              if (debugEnabled())
-              {
-                TRACER.debugCaught(DebugLogLevel.ERROR, e);
-              }
-
-              logError(ERR_DELETE_ERROR_NOTIFYING_CHANGE_LISTENER
-                  .get(getExceptionMessage(e)));
-            }
-          }
</del><span class="cx">         }
</span><span class="cx">       });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkopendssrcserverorgopendsserverworkflowelementlocalbackendLocalBackendModifyDNOperationjava"></a>
 <div class="modfile"><h4>Modified: \
trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java \
(10975 => 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -34,7 +34,6 @@
</span><span class="cx"> import org.opends.messages.Message;
</span><span class="cx"> import org.opends.messages.MessageBuilder;
</span><span class="cx"> import org.opends.server.api.Backend;
</span><del>-import org.opends.server.api.ChangeNotificationListener;
</del><span class="cx"> import org.opends.server.api.ClientConnection;
</span><span class="cx"> import org.opends.server.api.SynchronizationProvider;
</span><span class="cx"> import org.opends.server.api.plugin.PluginResult;
</span><span class="lines">@@ -204,32 +203,10 @@
</span><span class="cx">         @Override
</span><span class="cx">         public void run()
</span><span class="cx">         {
</span><del>-          // Notify persistent searches.
</del><span class="cx">           for (PersistentSearch psearch : \
wfe.getPersistentSearches()) </span><span class="cx">           {
</span><span class="cx">             psearch.processModifyDN(newEntry, \
currentEntry.getDN()); </span><span class="cx">           }
</span><del>-
-          // Notify change listeners.
-          for (ChangeNotificationListener changeListener : DirectoryServer
-              .getChangeNotificationListeners())
-          {
-            try
-            {
-              changeListener.handleModifyDNOperation(
-                  LocalBackendModifyDNOperation.this, currentEntry, newEntry);
-            }
-            catch (Exception e)
-            {
-              if (debugEnabled())
-              {
-                TRACER.debugCaught(DebugLogLevel.ERROR, e);
-              }
-
-              logError(ERR_MODDN_ERROR_NOTIFYING_CHANGE_LISTENER
-                  .get(getExceptionMessage(e)));
-            }
-          }
</del><span class="cx">         }
</span><span class="cx">       });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkopendssrcserverorgopendsserverworkflowelementlocalbackendLocalBackendModifyOperationjava"></a>
 <div class="modfile"><h4>Modified: \
trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java \
(10975 => 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -317,33 +317,10 @@
</span><span class="cx">         @Override
</span><span class="cx">         public void run()
</span><span class="cx">         {
</span><del>-          // Notify persistent searches.
</del><span class="cx">           for (PersistentSearch psearch : \
wfe.getPersistentSearches()) </span><span class="cx">           {
</span><span class="cx">             psearch.processModify(modifiedEntry, \
currentEntry); </span><span class="cx">           }
</span><del>-
-          // Notify change listeners.
-          for (ChangeNotificationListener changeListener : DirectoryServer
-              .getChangeNotificationListeners())
-          {
-            try
-            {
-              changeListener
-                  .handleModifyOperation(LocalBackendModifyOperation.this,
-                      currentEntry, modifiedEntry);
-            }
-            catch (Exception e)
-            {
-              if (debugEnabled())
-              {
-                TRACER.debugCaught(DebugLogLevel.ERROR, e);
-              }
-
-              logError(ERR_MODIFY_ERROR_NOTIFYING_CHANGE_LISTENER
-                  .get(getExceptionMessage(e)));
-            }
-          }
</del><span class="cx">         }
</span><span class="cx">       });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkopendstestsunitteststestngsrcserverorgopendsservercoreAddOperationTestCasejava"></a>
 <div class="modfile"><h4>Modified: \
trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java \
(10975 => 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/AddOperationTestCase.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -26,8 +26,10 @@
</span><span class="cx">  */
</span><span class="cx"> package org.opends.server.core;
</span><span class="cx"> 
</span><ins>+import java.io.IOException;
</ins><span class="cx"> import java.net.Socket;
</span><span class="cx"> import java.util.ArrayList;
</span><ins>+import java.util.Arrays;
</ins><span class="cx"> import java.util.List;
</span><span class="cx"> import java.util.Map;
</span><span class="cx"> import java.util.concurrent.locks.Lock;
</span><span class="lines">@@ -51,6 +53,7 @@
</span><span class="cx"> 
</span><span class="cx"> import static \
org.opends.server.protocols.internal.InternalClientConnection.*; </span><span \
class="cx"> import static org.opends.server.protocols.ldap.LDAPConstants.*; \
</span><ins>+import static org.opends.server.util.CollectionUtils.*; </ins><span \
class="cx"> import static org.testng.Assert.*; </span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -76,22 +79,14 @@
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @DataProvider(name = &quot;addOperations&quot;)
</span><del>-  public Object[][] getAddOperations()
-         throws Exception
</del><ins>+  public Object[][] getAddOperations() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     ArrayList&lt;Control&gt; noControls = new \
ArrayList&lt;Control&gt;(); </span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; ldapAttrList = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; \
ldapAttrList = newRawAttributes( +        new LDAPAttribute(&quot;objectclass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    ldapAttrList.add(new LDAPAttribute(&quot;objectclass&quot;, values));
-
-    values.clear();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    ldapAttrList.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     Entry entry = TestCaseUtils.makeEntry(
</span><span class="cx">          &quot;dn: ou=People,o=test&quot;,
</span><span class="cx">          &quot;objectClass: top&quot;,
</span><span class="lines">@@ -129,9 +124,8 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">   /** {@inheritDoc} */
</span><del>-  @Override()
-  protected Operation[] createTestOperations()
-         throws Exception
</del><ins>+  @Override
+  protected Operation[] createTestOperations() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     Object[][]  objs = getAddOperations();
</span><span class="cx">     Operation[] ops  = new Operation[objs.length];
</span><span class="lines">@@ -173,20 +167,13 @@
</span><span class="cx">    * Tests the &lt;CODE&gt;getEntryDN&lt;/CODE&gt; method \
for the case in which we expect </span><span class="cx">    * the rawEntryDN to be \
decoded. </span><span class="cx">    */
</span><del>-  @Test()
</del><ins>+  @Test
</ins><span class="cx">   public void testGetEntryDNInitiallyNull()
</span><span class="cx">   {
</span><del>-    ArrayList&lt;RawAttribute&gt; ldapAttrList = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; \
ldapAttrList = newRawAttributes( +        new LDAPAttribute(&quot;objectclass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    ldapAttrList.add(new LDAPAttribute(&quot;objectclass&quot;, values));
-
-    values.clear();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    ldapAttrList.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     AddOperationBasis addOperation =
</span><span class="cx">          new AddOperationBasis(getRootConnection(), \
nextOperationID(), nextMessageID(), </span><span class="cx">                          \
null, ByteString.valueOf(&quot;ou=People,o=test&quot;), </span><span class="lines">@@ \
-194,7 +181,20 @@ </span><span class="cx">     \
assertNotNull(addOperation.getEntryDN()); </span><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  private ArrayList&lt;RawAttribute&gt; newRawAttributes(RawAttribute... \
attributes) +  {
+    return new ArrayList&lt;RawAttribute&gt;(Arrays.asList(attributes));
+  }
</ins><span class="cx"> 
</span><ins>+  private ArrayList&lt;ByteString&gt; byteStrings(final String... v)
+  {
+    ArrayList&lt;ByteString&gt; values = new ArrayList&lt;ByteString&gt;();
+    for (String s : v)
+    {
+      values.add(ByteString.valueOf(s));
+    }
+    return values;
+  }
</ins><span class="cx"> 
</span><span class="cx">   /**
</span><span class="cx">    * Tests the &lt;CODE&gt;getEntryDN&lt;/CODE&gt; method \
for the case in which we expect </span><span class="lines">@@ -202,9 +202,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetEntryDNInitiallyNonNull()
-         throws Exception
</del><ins>+  @Test
+  public void testGetEntryDNInitiallyNonNull() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     Entry entry = TestCaseUtils.makeEntry(
</span><span class="cx">          &quot;dn: ou=People,o=test&quot;,
</span><span class="lines">@@ -229,9 +228,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetEntryDNNonNullChangedToNull()
-         throws Exception
</del><ins>+  @Test
+  public void testGetEntryDNNonNullChangedToNull() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     Entry entry = TestCaseUtils.makeEntry(
</span><span class="cx">          &quot;dn: ou=People,o=test&quot;,
</span><span class="lines">@@ -265,32 +263,27 @@
</span><span class="cx">     assertNotNull(rawAttrs);
</span><span class="cx">     assertFalse(rawAttrs.isEmpty());
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; copiedAttrs =
-      new ArrayList&lt;RawAttribute&gt;(rawAttrs);
</del><ins>+    ArrayList&lt;RawAttribute&gt; copiedAttrs = new \
ArrayList&lt;RawAttribute&gt;(rawAttrs); +    copiedAttrs.add(new \
LDAPAttribute(&quot;description&quot;, byteStrings(&quot;foo&quot;))); </ins><span \
class="cx">     addOperation.setRawAttributes(copiedAttrs); </span><span class="cx"> 
</span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;foo&quot;));
-    addOperation.addRawAttribute(new LDAPAttribute(&quot;description&quot;, \
values)); </del><ins>+    assertTrue(find(addOperation, &quot;description&quot;));
</ins><span class="cx"> 
</span><del>-    assertTrue(find(addOperation));
-
</del><span class="cx">     addOperation.setRawAttributes(rawAttrs);
</span><span class="cx"> 
</span><del>-    assertFalse(find(addOperation));
</del><ins>+    assertFalse(find(addOperation, &quot;description&quot;));
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-  private boolean find(AddOperation addOperation)
</del><ins>+  private boolean find(AddOperation addOperation, final String attrName)
</ins><span class="cx">   {
</span><del>-    boolean found = false;
</del><span class="cx">     for (RawAttribute a : addOperation.getRawAttributes())
</span><span class="cx">     {
</span><del>-      if \
(&quot;description&quot;.equalsIgnoreCase(a.getAttributeType())) </del><ins>+      if \
(attrName.equalsIgnoreCase(a.getAttributeType())) </ins><span class="cx">       {
</span><span class="cx">         return true;
</span><span class="cx">       }
</span><span class="cx">     }
</span><del>-    return found;
</del><ins>+    return false;
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -300,9 +293,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testAddObjectClass()
-         throws Exception
</del><ins>+  @Test
+  public void testAddObjectClass() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -334,9 +326,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testRemoveObjectClass()
-         throws Exception
</del><ins>+  @Test
+  public void testRemoveObjectClass() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -370,9 +361,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testSetAttributeOverwrite()
-         throws Exception
</del><ins>+  @Test
+  public void testSetAttributeOverwrite() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -428,9 +418,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testSetAttributeAdd()
-         throws Exception
</del><ins>+  @Test
+  public void testSetAttributeAdd() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -464,9 +453,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testSetAttributeRemove()
-         throws Exception
</del><ins>+  @Test
+  public void testSetAttributeRemove() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -519,40 +507,29 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessRaw()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessRaw() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     AddOperation addOperation =
</span><span class="cx">          \
getRootConnection().processAdd(ByteString.valueOf(&quot;ou=People,o=test&quot;), \
attrs); </span><span class="cx">     assertEquals(addOperation.getResultCode(), \
ResultCode.SUCCESS); </span><span class="cx">     \
retrieveCompletedOperationElements(addOperation); </span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests an internal add operation that should be \
successful using processed </span><span class="cx">    * arguments.
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessProcessed()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessProcessed() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -575,23 +552,15 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureMalformedDN()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureMalformedDN() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     AddOperation addOperation =
</span><span class="cx">          \
getRootConnection().processAdd(ByteString.valueOf(&quot;invalid&quot;), attrs); \
</span><span class="cx">     assertFalse(addOperation.getResultCode() == \
ResultCode.SUCCESS); </span><span class="lines">@@ -605,23 +574,15 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureAlreadyExists()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureAlreadyExists() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organization&quot;)), +        new \
LDAPAttribute(&quot;o&quot;, byteStrings(&quot;test&quot;))); </ins><span class="cx"> \
 </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organization&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;test&quot;));
-    attrs.add(new LDAPAttribute(&quot;o&quot;, values));
-
</del><span class="cx">     AddOperation addOperation =
</span><span class="cx">          \
getRootConnection().processAdd(ByteString.valueOf(&quot;o=test&quot;), attrs); \
</span><span class="cx">     assertFalse(addOperation.getResultCode() == \
ResultCode.SUCCESS); </span><span class="lines">@@ -635,23 +596,15 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureNoSuchSuffix()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureNoSuchSuffix() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organization&quot;)), +        new \
LDAPAttribute(&quot;o&quot;, byteStrings(&quot;undefined&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organization&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;undefined&quot;));
-    attrs.add(new LDAPAttribute(&quot;o&quot;, values));
-
</del><span class="cx">     AddOperation addOperation =
</span><span class="cx">          \
getRootConnection().processAdd(ByteString.valueOf(&quot;o=undefined&quot;), attrs); \
</span><span class="cx">     assertFalse(addOperation.getResultCode() == \
ResultCode.SUCCESS); </span><span class="lines">@@ -665,23 +618,15 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureNoSuchSuffixParent()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureNoSuchSuffixParent() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     InternalClientConnection conn = getRootConnection();
</span><span class="cx"> 
</span><span class="cx">     AddOperation addOperation =
</span><span class="lines">@@ -697,23 +642,15 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureNoSuchParent()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureNoSuchParent() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     InternalClientConnection conn = getRootConnection();
</span><span class="cx"> 
</span><span class="cx">     AddOperation addOperation =
</span><span class="lines">@@ -730,9 +667,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testExternalAddFailureNoUserModification()
-         throws Exception
</del><ins>+  @Test
+  public void testExternalAddFailureNoUserModification() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -741,81 +677,40 @@
</span><span class="cx">     LDAPWriter w = new LDAPWriter(s);
</span><span class="cx">     TestCaseUtils.configureSocket(s);
</span><span class="cx"> 
</span><del>-    BindRequestProtocolOp bindRequest =
-         new BindRequestProtocolOp(ByteString.valueOf(&quot;cn=Directory \
                Manager&quot;),
-                                   3, ByteString.valueOf(&quot;password&quot;));
-    LDAPMessage message = new LDAPMessage(1, bindRequest);
-    w.writeMessage(message);
</del><ins>+    bind(r, w);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    BindResponseProtocolOp bindResponse =
-         message.getBindResponseProtocolOp();
-    assertEquals(bindResponse.getResultCode(), 0);
</del><ins>+    ArrayList&lt;RawAttribute&gt; attrs = newRawAttributes(
+        new LDAPAttribute(&quot;objectClass&quot;, byteStrings(&quot;top&quot;, \
&quot;organizationalUnit&quot;)), +        new LDAPAttribute(&quot;ou&quot;, \
byteStrings(&quot;People&quot;)), +        new \
LDAPAttribute(&quot;creatorsName&quot;, byteStrings(&quot;cn=Directory \
Manager&quot;)), +        new LDAPAttribute(&quot;createTimestamp&quot;, \
byteStrings(&quot;20060101000000Z&quot;))); </ins><span class="cx"> 
</span><del>-
-    ArrayList&lt;RawAttribute&gt; attrs = new ArrayList&lt;RawAttribute&gt;();
-    ArrayList&lt;ByteString&gt; values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;cn=Directory Manager&quot;));
-    attrs.add(new LDAPAttribute(&quot;creatorsName&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;20060101000000Z&quot;));
-    attrs.add(new LDAPAttribute(&quot;createTimestamp&quot;, values));
-
</del><span class="cx">     long addRequests  = ldapStatistics.getAddRequests();
</span><span class="cx">     long addResponses = ldapStatistics.getAddResponses();
</span><span class="cx"> 
</span><del>-    AddRequestProtocolOp addRequest =
-         new AddRequestProtocolOp(ByteString.valueOf(&quot;ou=People,o=test&quot;),
-                                  attrs);
-    message = new LDAPMessage(2, addRequest);
-    w.writeMessage(message);
</del><ins>+    addSuccess(r, w, attrs);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    AddResponseProtocolOp addResponse =
-         message.getAddResponseProtocolOp();
-    assertFalse(addResponse.getResultCode() == 0);
-
</del><span class="cx">     assertEquals(ldapStatistics.getAddRequests(), \
addRequests+1); </span><span class="cx">     waitForAddResponsesStat(addResponses+1);
</span><span class="cx"> 
</span><span class="cx">     StaticUtils.close(s);
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests an internal add operation that fails because it \
has an undefined </span><span class="cx">    * objectclass.
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureUndefinedObjectClass()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureUndefinedObjectClass() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;undefined&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;undefined&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     InternalClientConnection conn = getRootConnection();
</span><span class="cx"> 
</span><span class="cx">     AddOperation addOperation =
</span><span class="lines">@@ -824,17 +719,14 @@
</span><span class="cx">     assertFalse(addOperation.getResultCode() == \
ResultCode.SUCCESS); </span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests a successful internal add operation that contains \
a user-modifiable </span><span class="cx">    * operational attribute.
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessfulWithOperationalAttribute()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessfulWithOperationalAttribute() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -865,31 +757,17 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessfulDisjointAttribute()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessfulDisjointAttribute() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;description&quot;, byteStrings(&quot;foo&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;)), +        new \
LDAPAttribute(&quot;description&quot;, byteStrings(&quot;bar&quot;))); </ins><span \
class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;foo&quot;));
-    attrs.add(new LDAPAttribute(&quot;description&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;bar&quot;));
-    attrs.add(new LDAPAttribute(&quot;description&quot;, values));
-
</del><span class="cx">     InternalClientConnection conn = getRootConnection();
</span><span class="cx"> 
</span><span class="cx">     AddOperation addOperation =
</span><span class="lines">@@ -898,39 +776,23 @@
</span><span class="cx">     assertEquals(addOperation.getResultCode(), \
ResultCode.SUCCESS); </span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests a successful internal add operation that contains \
raw attributes with </span><span class="cx">    * options.
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessfulWithRawAttributeOptions()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessfulWithRawAttributeOptions() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;description&quot;, byteStrings(&quot;foo&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;)), +        new \
LDAPAttribute(&quot;description;lang-en-us&quot;, byteStrings(&quot;foo&quot;))); \
</ins><span class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;foo&quot;));
-    attrs.add(new LDAPAttribute(&quot;description&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;foo&quot;));
-    attrs.add(new LDAPAttribute(&quot;description;lang-en-us&quot;, values));
-
</del><span class="cx">     InternalClientConnection conn = getRootConnection();
</span><span class="cx"> 
</span><span class="cx">     AddOperation addOperation =
</span><span class="lines">@@ -947,27 +809,16 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessfulWithRawAttributeOptionsOnlyOptions()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessfulWithRawAttributeOptionsOnlyOptions() throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;organizationalUnit&quot;)), +        new \
LDAPAttribute(&quot;ou&quot;, byteStrings(&quot;People&quot;)), +        new \
LDAPAttribute(&quot;description;lang-en-us&quot;, byteStrings(&quot;foo&quot;))); \
</ins><span class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;foo&quot;));
-    attrs.add(new LDAPAttribute(&quot;description;lang-en-us&quot;, values));
-
</del><span class="cx">     InternalClientConnection conn = getRootConnection();
</span><span class="cx"> 
</span><span class="cx">     AddOperation addOperation =
</span><span class="lines">@@ -976,17 +827,14 @@
</span><span class="cx">     assertEquals(addOperation.getResultCode(), \
ResultCode.SUCCESS); </span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests a successful internal add operation that contains \
attributes with </span><span class="cx">    * options.
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessfulWithAttributeOptions()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessfulWithAttributeOptions() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1019,24 +867,15 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureRootDSE()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureRootDSE() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
ArrayList&lt;RawAttribute&gt;(); </del><ins>+    ArrayList&lt;RawAttribute&gt; attrs \
= newRawAttributes( +        new LDAPAttribute(&quot;objectClass&quot;, \
byteStrings(&quot;top&quot;, &quot;ds-root-dse&quot;, &quot;extensibleObject&quot;)), \
+        new LDAPAttribute(&quot;cn&quot;, byteStrings(&quot;Root DSE&quot;))); \
</ins><span class="cx">  </span><del>-    ArrayList&lt;ByteString&gt; values = new \
                ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;ds-root-dse&quot;));
-    values.add(ByteString.valueOf(&quot;extensibleObject&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;Root DSE&quot;));
-    attrs.add(new LDAPAttribute(&quot;cn&quot;, values));
-
</del><span class="cx">     InternalClientConnection conn = getRootConnection();
</span><span class="cx"> 
</span><span class="cx">     AddOperation addOperation =
</span><span class="lines">@@ -1044,16 +883,13 @@
</span><span class="cx">     assertFalse(addOperation.getResultCode() == \
ResultCode.SUCCESS); </span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests a successful internal add operation that is \
missing RDN attributes. </span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessfulWithMissingRDNAttributes()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessfulWithMissingRDNAttributes() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1078,9 +914,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureWithMissingRDNAttributes()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureWithMissingRDNAttributes() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1105,9 +940,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessfulWithMissingParentObjectClass()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessfulWithMissingParentObjectClass() throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1151,9 +985,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureNoObjectClasses()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureNoObjectClasses() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1173,9 +1006,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureOnlyAbstractObjectClass()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureOnlyAbstractObjectClass() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1196,9 +1028,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureNoStructuralObjectClass()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureNoStructuralObjectClass() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1220,9 +1051,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureMultipleStructuralObjectClasses()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureMultipleStructuralObjectClasses() throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1246,9 +1076,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureMissingRequiredAttribute()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureMissingRequiredAttribute() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1275,9 +1104,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureMissingRequiredAttributeExtensibleObject()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureMissingRequiredAttributeExtensibleObject() \
throws Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1305,9 +1133,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureDisallowedAttribute()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureDisallowedAttribute() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1337,9 +1164,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessfulDisallowedAttributeExtensibleObject()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessfulDisallowedAttributeExtensibleObject() throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1370,9 +1196,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureEmptyAttribute()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureEmptyAttribute() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(false);
</span><span class="cx"> 
</span><span class="lines">@@ -1382,14 +1207,10 @@
</span><span class="cx">          &quot;objectClass: organization&quot;,
</span><span class="cx">          &quot;o: test&quot;);
</span><span class="cx"> 
</span><ins>+    AttributeType attrType = \
DirectoryServer.getAttributeType(&quot;description&quot;); </ins><span class="cx">    \
Map&lt;AttributeType,List&lt;Attribute&gt;&gt; userAttrs = entry.getUserAttributes(); \
</span><ins>+    userAttrs.put(attrType, newArrayList(Attributes.empty(attrType))); \
</ins><span class="cx">  </span><del>-    AttributeType attrType = \
                DirectoryServer.getAttributeType(&quot;description&quot;);
-    ArrayList&lt;Attribute&gt; attrList = new ArrayList&lt;Attribute&gt;();
-    attrList.add(Attributes.empty(attrType));
-    userAttrs.put(attrType, attrList);
-
-
</del><span class="cx">     InternalClientConnection conn = getRootConnection();
</span><span class="cx"> 
</span><span class="cx">     AddOperation addOperation =
</span><span class="lines">@@ -1406,9 +1227,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureServerCompletelyReadOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureServerCompletelyReadOnly() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1440,9 +1260,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessServerExternallyReadOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessServerExternallyReadOnly() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1475,9 +1294,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testExternalAddFailureServerExternallyReadOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testExternalAddFailureServerExternallyReadOnly() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1486,44 +1304,19 @@
</span><span class="cx">     LDAPWriter w = new LDAPWriter(s);
</span><span class="cx">     TestCaseUtils.configureSocket(s);
</span><span class="cx"> 
</span><del>-    BindRequestProtocolOp bindRequest =
-         new BindRequestProtocolOp(ByteString.valueOf(&quot;cn=Directory \
                Manager&quot;),
-                                   3, ByteString.valueOf(&quot;password&quot;));
-    LDAPMessage message = new LDAPMessage(1, bindRequest);
-    w.writeMessage(message);
</del><ins>+    bind(r, w);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    BindResponseProtocolOp bindResponse =
-         message.getBindResponseProtocolOp();
-    assertEquals(bindResponse.getResultCode(), 0);
</del><ins>+    ArrayList&lt;RawAttribute&gt; attrs = newRawAttributes(
+        new LDAPAttribute(&quot;objectClass&quot;, byteStrings(&quot;top&quot;, \
&quot;organizationalUnit&quot;)), +        new LDAPAttribute(&quot;ou&quot;, \
byteStrings(&quot;People&quot;))); </ins><span class="cx"> 
</span><del>-
-    ArrayList&lt;RawAttribute&gt; attrs = new ArrayList&lt;RawAttribute&gt;();
-    ArrayList&lt;ByteString&gt; values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     \
DirectoryServer.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); </span><span \
class="cx">  </span><span class="cx">     long addRequests  = \
ldapStatistics.getAddRequests(); </span><span class="cx">     long addResponses = \
ldapStatistics.getAddResponses(); </span><span class="cx"> 
</span><del>-    AddRequestProtocolOp addRequest =
-         new AddRequestProtocolOp(ByteString.valueOf(&quot;ou=People,o=test&quot;),
-                                  attrs);
-    message = new LDAPMessage(2, addRequest);
-    w.writeMessage(message);
</del><ins>+    addSuccess(r, w, attrs);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    AddResponseProtocolOp addResponse =
-         message.getAddResponseProtocolOp();
-    assertFalse(addResponse.getResultCode() == 0);
-
</del><span class="cx">     assertEquals(ldapStatistics.getAddRequests(), \
addRequests+1); </span><span class="cx">     waitForAddResponsesStat(addResponses+1);
</span><span class="cx"> 
</span><span class="lines">@@ -1532,17 +1325,35 @@
</span><span class="cx">     \
DirectoryServer.setWritabilityMode(WritabilityMode.ENABLED); </span><span class="cx"> \
} </span><span class="cx"> 
</span><ins>+  private void bind(LDAPReader r, LDAPWriter w) throws Exception
+  {
+    final BindRequestProtocolOp bindRequest = new BindRequestProtocolOp(
+        ByteString.valueOf(&quot;cn=Directory Manager&quot;), 3, \
ByteString.valueOf(&quot;password&quot;)); +    w.writeMessage(new LDAPMessage(1, \
bindRequest)); </ins><span class="cx"> 
</span><ins>+    final LDAPMessage message = r.readMessage();
+    final BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
+    assertEquals(bindResponse.getResultCode(), 0);
+  }
</ins><span class="cx"> 
</span><ins>+  private void addSuccess(LDAPReader r, LDAPWriter w,
+      ArrayList&lt;RawAttribute&gt; attrs) throws Exception
+  {
+    writeAddRequest(w, attrs, null);
+
+    LDAPMessage message = r.readMessage();
+    AddResponseProtocolOp addResponse = message.getAddResponseProtocolOp();
+    assertFalse(addResponse.getResultCode() == 0);
+  }
+
</ins><span class="cx">   /**
</span><span class="cx">    * Tests a failed internal add operation with the backend \
in complete </span><span class="cx">    * read-only mode.
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddFailureBackendCompletelyReadOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddFailureBackendCompletelyReadOnly() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1575,9 +1386,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalAddSuccessBackendExternallyReadOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalAddSuccessBackendExternallyReadOnly() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1611,9 +1421,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testExternalAddFailureBackendExternallyReadOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testExternalAddFailureBackendExternallyReadOnly() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1622,45 +1431,20 @@
</span><span class="cx">     LDAPWriter w = new LDAPWriter(s);
</span><span class="cx">     TestCaseUtils.configureSocket(s);
</span><span class="cx"> 
</span><del>-    BindRequestProtocolOp bindRequest =
-         new BindRequestProtocolOp(ByteString.valueOf(&quot;cn=Directory \
                Manager&quot;),
-                                   3, ByteString.valueOf(&quot;password&quot;));
-    LDAPMessage message = new LDAPMessage(1, bindRequest);
-    w.writeMessage(message);
</del><ins>+    bind(r, w);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    BindResponseProtocolOp bindResponse =
-         message.getBindResponseProtocolOp();
-    assertEquals(bindResponse.getResultCode(), 0);
</del><ins>+    ArrayList&lt;RawAttribute&gt; attrs = newRawAttributes(
+        new LDAPAttribute(&quot;objectClass&quot;, byteStrings(&quot;top&quot;, \
&quot;organizationalUnit&quot;)), +        new LDAPAttribute(&quot;ou&quot;, \
byteStrings(&quot;People&quot;))); </ins><span class="cx"> 
</span><del>-
-    ArrayList&lt;RawAttribute&gt; attrs = new ArrayList&lt;RawAttribute&gt;();
-    ArrayList&lt;ByteString&gt; values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
</del><span class="cx">     Backend&lt;?&gt; b = \
DirectoryServer.getBackend(DN.decode(&quot;o=test&quot;)); </span><span class="cx">   \
b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); </span><span class="cx"> 
</span><span class="cx">     long addRequests  = ldapStatistics.getAddRequests();
</span><span class="cx">     long addResponses = ldapStatistics.getAddResponses();
</span><span class="cx"> 
</span><del>-    AddRequestProtocolOp addRequest =
-         new AddRequestProtocolOp(ByteString.valueOf(&quot;ou=People,o=test&quot;),
-                                  attrs);
-    message = new LDAPMessage(2, addRequest);
-    w.writeMessage(message);
</del><ins>+    addSuccess(r, w, attrs);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    AddResponseProtocolOp addResponse =
-         message.getAddResponseProtocolOp();
-    assertFalse(addResponse.getResultCode() == 0);
-
</del><span class="cx">     assertEquals(ldapStatistics.getAddRequests(), \
addRequests+1); </span><span class="cx">     waitForAddResponsesStat(addResponses+1);
</span><span class="cx"> 
</span><span class="lines">@@ -1677,29 +1461,31 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testSuccessWithNotificationListener()
-         throws Exception
</del><ins>+  @Test
+  public void testSuccessWithNotificationListener() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="cx">     TestChangeNotificationListener changeListener =
</span><span class="cx">          new TestChangeNotificationListener();
</span><del>-    DirectoryServer.registerChangeNotificationListener(changeListener);
-    assertEquals(changeListener.getAddCount(), 0);
</del><ins>+    DirectoryServer.registerInternalPlugin(changeListener);
+    try{
+      assertEquals(changeListener.getAddCount(), 0);
</ins><span class="cx"> 
</span><del>-    Entry entry = TestCaseUtils.makeEntry(
-         &quot;dn: ou=People,o=test&quot;,
-         &quot;objectClass: top&quot;,
-         &quot;objectClass: organizationalUnit&quot;,
-         &quot;ou: People&quot;);
</del><ins>+      Entry entry = TestCaseUtils.makeEntry(
+          &quot;dn: ou=People,o=test&quot;,
+          &quot;objectClass: top&quot;,
+          &quot;objectClass: organizationalUnit&quot;,
+          &quot;ou: People&quot;);
</ins><span class="cx"> 
</span><del>-    AddOperation addOperation = getRootConnection().processAdd(entry);
-    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
-    retrieveCompletedOperationElements(addOperation);
</del><ins>+      AddOperation addOperation = getRootConnection().processAdd(entry);
+      assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+      retrieveCompletedOperationElements(addOperation);
</ins><span class="cx"> 
</span><del>-    assertEquals(changeListener.getAddCount(), 1);
-    DirectoryServer.deregisterChangeNotificationListener(changeListener);
</del><ins>+      assertEquals(changeListener.getAddCount(), 1);
+    }finally {
+      DirectoryServer.deregisterInternalPlugin(changeListener);
+    }
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1710,28 +1496,30 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testFailureWithNotificationListener()
-         throws Exception
</del><ins>+  @Test
+  public void testFailureWithNotificationListener() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="cx">     TestChangeNotificationListener changeListener =
</span><span class="cx">          new TestChangeNotificationListener();
</span><del>-    DirectoryServer.registerChangeNotificationListener(changeListener);
-    assertEquals(changeListener.getAddCount(), 0);
</del><ins>+    DirectoryServer.registerInternalPlugin(changeListener);
+    try{
+      assertEquals(changeListener.getAddCount(), 0);
</ins><span class="cx"> 
</span><del>-    Entry entry = TestCaseUtils.makeEntry(
-         &quot;dn: ou=People,ou=nonexistent,o=test&quot;,
-         &quot;objectClass: top&quot;,
-         &quot;objectClass: organizationalUnit&quot;,
-         &quot;ou: People&quot;);
</del><ins>+      Entry entry = TestCaseUtils.makeEntry(
+          &quot;dn: ou=People,ou=nonexistent,o=test&quot;,
+          &quot;objectClass: top&quot;,
+          &quot;objectClass: organizationalUnit&quot;,
+          &quot;ou: People&quot;);
</ins><span class="cx"> 
</span><del>-    AddOperation addOperation = getRootConnection().processAdd(entry);
-    assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS);
</del><ins>+      AddOperation addOperation = getRootConnection().processAdd(entry);
+      assertFalse(addOperation.getResultCode() == ResultCode.SUCCESS);
</ins><span class="cx"> 
</span><del>-    assertEquals(changeListener.getAddCount(), 0);
-    DirectoryServer.deregisterChangeNotificationListener(changeListener);
</del><ins>+      assertEquals(changeListener.getAddCount(), 0);
+    }finally {
+      DirectoryServer.deregisterInternalPlugin(changeListener);
+    }
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1741,9 +1529,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected probem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testCancelBeforeStartup()
-         throws Exception
</del><ins>+  @Test
+  public void testCancelBeforeStartup() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1771,9 +1558,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected probem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testCancelAfterOperation()
-         throws Exception
</del><ins>+  @Test
+  public void testCancelAfterOperation() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1808,8 +1594,7 @@
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @Test(groups = { &quot;slow&quot; })
</span><del>-  public void testCannotLockEntry()
-         throws Exception
</del><ins>+  public void testCannotLockEntry() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1839,9 +1624,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPreParseAdd()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPreParseAdd() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1850,44 +1634,39 @@
</span><span class="cx">     LDAPWriter w = new LDAPWriter(s);
</span><span class="cx">     TestCaseUtils.configureSocket(s);
</span><span class="cx"> 
</span><del>-    BindRequestProtocolOp bindRequest =
-         new BindRequestProtocolOp(ByteString.valueOf(&quot;cn=Directory \
                Manager&quot;),
-                                   3, ByteString.valueOf(&quot;password&quot;));
-    LDAPMessage message = new LDAPMessage(1, bindRequest);
-    w.writeMessage(message);
</del><ins>+    bind(r, w);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    BindResponseProtocolOp bindResponse =
-         message.getBindResponseProtocolOp();
-    assertEquals(bindResponse.getResultCode(), 0);
</del><ins>+    ArrayList&lt;RawAttribute&gt; attrs = newRawAttributes(
+        new LDAPAttribute(&quot;objectClass&quot;, byteStrings(&quot;top&quot;, \
&quot;organizationalUnit&quot;)), +        new LDAPAttribute(&quot;ou&quot;, \
byteStrings(&quot;People&quot;))); </ins><span class="cx"> 
</span><ins>+    addDisconnect(r, w, attrs, &quot;PreParse&quot;);
</ins><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
                ArrayList&lt;RawAttribute&gt;();
-    ArrayList&lt;ByteString&gt; values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
</del><ins>+    StaticUtils.close(s);
+  }
</ins><span class="cx"> 
</span><del>-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
</del><ins>+  private void addDisconnect(LDAPReader r, LDAPWriter w,
+      ArrayList&lt;RawAttribute&gt; attrs, String section) throws Exception
+  {
+    writeAddRequest(w, attrs, section);
</ins><span class="cx"> 
</span><del>-    AddRequestProtocolOp addRequest =
-         new AddRequestProtocolOp(ByteString.valueOf(&quot;ou=People,o=test&quot;),
-                                  attrs);
-    message = new LDAPMessage(2, addRequest,
-         DisconnectClientPlugin.createDisconnectControlList(&quot;PreParse&quot;));
-    w.writeMessage(message);
-
-    message = r.readMessage();
</del><ins>+    LDAPMessage message = r.readMessage();
</ins><span class="cx">     if (message != null)
</span><span class="cx">     {
</span><span class="cx">       // If we got an element back, then it must be a notice \
of disconnect </span><span class="cx">       // unsolicited notification.
</span><span class="cx">       assertEquals(message.getProtocolOpType(), \
OP_TYPE_EXTENDED_RESPONSE); </span><span class="cx">     }
</span><ins>+  }
</ins><span class="cx"> 
</span><del>-    StaticUtils.close(s);
</del><ins>+  private void writeAddRequest(LDAPWriter w, \
ArrayList&lt;RawAttribute&gt; attrs, +      String section) throws IOException
+  {
+    AddRequestProtocolOp addRequest = new \
AddRequestProtocolOp(ByteString.valueOf(&quot;ou=People,o=test&quot;), attrs); +    \
List&lt;Control&gt; controls = section != null +        ? \
DisconnectClientPlugin.createDisconnectControlList(section) +        : null;
+    w.writeMessage(new LDAPMessage(2, addRequest, controls));
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1898,9 +1677,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPreOperationAdd()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPreOperationAdd() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1909,58 +1687,25 @@
</span><span class="cx">     LDAPWriter w = new LDAPWriter(s);
</span><span class="cx">     TestCaseUtils.configureSocket(s);
</span><span class="cx"> 
</span><del>-    BindRequestProtocolOp bindRequest =
-         new BindRequestProtocolOp(ByteString.valueOf(&quot;cn=Directory \
                Manager&quot;),
-                                   3, ByteString.valueOf(&quot;password&quot;));
-    LDAPMessage message = new LDAPMessage(1, bindRequest);
-    w.writeMessage(message);
</del><ins>+    bind(r, w);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    BindResponseProtocolOp bindResponse =
-         message.getBindResponseProtocolOp();
-    assertEquals(bindResponse.getResultCode(), 0);
</del><ins>+    ArrayList&lt;RawAttribute&gt; attrs = newRawAttributes(
+        new LDAPAttribute(&quot;objectClass&quot;, byteStrings(&quot;top&quot;, \
&quot;organizationalUnit&quot;)), +        new LDAPAttribute(&quot;ou&quot;, \
byteStrings(&quot;People&quot;))); </ins><span class="cx"> 
</span><ins>+    addDisconnect(r, w, attrs, &quot;PreOperation&quot;);
</ins><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
                ArrayList&lt;RawAttribute&gt;();
-    ArrayList&lt;ByteString&gt; values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
-    AddRequestProtocolOp addRequest =
-         new AddRequestProtocolOp(ByteString.valueOf(&quot;ou=People,o=test&quot;),
-                                  attrs);
-    message = new LDAPMessage(2, addRequest,
-         DisconnectClientPlugin.createDisconnectControlList(
-              &quot;PreOperation&quot;));
-    w.writeMessage(message);
-
-    message = r.readMessage();
-    if (message != null)
-    {
-      // If we got an element back, then it must be a notice of disconnect
-      // unsolicited notification.
-      assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
-    }
-
</del><span class="cx">     StaticUtils.close(s);
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests an add operation that should be disconnected in a \
post-operation </span><span class="cx">    * plugin.
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPostOperationAdd()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPostOperationAdd() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1969,58 +1714,25 @@
</span><span class="cx">     LDAPWriter w = new LDAPWriter(s);
</span><span class="cx">     TestCaseUtils.configureSocket(s);
</span><span class="cx"> 
</span><del>-    BindRequestProtocolOp bindRequest =
-         new BindRequestProtocolOp(ByteString.valueOf(&quot;cn=Directory \
                Manager&quot;),
-                                   3, ByteString.valueOf(&quot;password&quot;));
-    LDAPMessage message = new LDAPMessage(1, bindRequest);
-    w.writeMessage(message);
</del><ins>+    bind(r, w);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    BindResponseProtocolOp bindResponse =
-         message.getBindResponseProtocolOp();
-    assertEquals(bindResponse.getResultCode(), 0);
</del><ins>+    ArrayList&lt;RawAttribute&gt; attrs = newRawAttributes(
+        new LDAPAttribute(&quot;objectClass&quot;, byteStrings(&quot;top&quot;, \
&quot;organizationalUnit&quot;)), +        new LDAPAttribute(&quot;ou&quot;, \
byteStrings(&quot;People&quot;))); </ins><span class="cx"> 
</span><ins>+    addDisconnect(r, w, attrs, &quot;PostOperation&quot;);
</ins><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
                ArrayList&lt;RawAttribute&gt;();
-    ArrayList&lt;ByteString&gt; values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
-    AddRequestProtocolOp addRequest =
-         new AddRequestProtocolOp(ByteString.valueOf(&quot;ou=People,o=test&quot;),
-                                  attrs);
-    message = new LDAPMessage(2, addRequest,
-         DisconnectClientPlugin.createDisconnectControlList(
-              &quot;PostOperation&quot;));
-    w.writeMessage(message);
-
-    message = r.readMessage();
-    if (message != null)
-    {
-      // If we got an element back, then it must be a notice of disconnect
-      // unsolicited notification.
-      assertEquals(message.getProtocolOpType(), OP_TYPE_EXTENDED_RESPONSE);
-    }
-
</del><span class="cx">     StaticUtils.close(s);
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests an add operation that should be disconnected in a \
post-response </span><span class="cx">    * plugin.
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPostResponseAdd()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPostResponseAdd() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -2029,40 +1741,18 @@
</span><span class="cx">     LDAPWriter w = new LDAPWriter(s);
</span><span class="cx">     //TestCaseUtils.configureSocket(s);
</span><span class="cx"> 
</span><del>-    BindRequestProtocolOp bindRequest =
-         new BindRequestProtocolOp(ByteString.valueOf(&quot;cn=Directory \
                Manager&quot;),
-                                   3, ByteString.valueOf(&quot;password&quot;));
-    LDAPMessage message = new LDAPMessage(1, bindRequest);
-    w.writeMessage(message);
</del><ins>+    bind(r, w);
</ins><span class="cx"> 
</span><del>-    message = r.readMessage();
-    BindResponseProtocolOp bindResponse =
-         message.getBindResponseProtocolOp();
-    assertEquals(bindResponse.getResultCode(), 0);
</del><ins>+    ArrayList&lt;RawAttribute&gt; attrs = newRawAttributes(
+        new LDAPAttribute(&quot;objectClass&quot;, byteStrings(&quot;top&quot;, \
&quot;organizationalUnit&quot;)), +        new LDAPAttribute(&quot;ou&quot;, \
byteStrings(&quot;People&quot;))); </ins><span class="cx"> 
</span><ins>+    writeAddRequest(w, attrs, &quot;PostResponse&quot;);
</ins><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; attrs = new \
                ArrayList&lt;RawAttribute&gt;();
-    ArrayList&lt;ByteString&gt; values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;top&quot;));
-    values.add(ByteString.valueOf(&quot;organizationalUnit&quot;));
-    attrs.add(new LDAPAttribute(&quot;objectClass&quot;, values));
-
-    values = new ArrayList&lt;ByteString&gt;();
-    values.add(ByteString.valueOf(&quot;People&quot;));
-    attrs.add(new LDAPAttribute(&quot;ou&quot;, values));
-
-    AddRequestProtocolOp addRequest =
-         new AddRequestProtocolOp(ByteString.valueOf(&quot;ou=People,o=test&quot;),
-                                  attrs);
-    message = new LDAPMessage(2, addRequest,
-         DisconnectClientPlugin.createDisconnectControlList(
-              &quot;PostResponse&quot;));
-    w.writeMessage(message);
-
</del><span class="cx"> responseLoop:
</span><span class="cx">     while (true)
</span><span class="cx">     {
</span><del>-      message = r.readMessage();
</del><ins>+      LDAPMessage message = r.readMessage();
</ins><span class="cx">       if (message == null)
</span><span class="cx">       {
</span><span class="cx">         // The connection has been closed.
</span><span class="lines">@@ -2092,17 +1782,14 @@
</span><span class="cx">     StaticUtils.close(s);
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Tests an add operation that attempts to add an entry \
with a user attribute </span><span class="cx">    * marked OBSOLETE in the server \
schema. </span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testAddObsoleteUserAttribute()
-         throws Exception
</del><ins>+  @Test
+  public void testAddObsoleteUserAttribute() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(false);
</span><span class="cx"> 
</span><span class="lines">@@ -2159,9 +1846,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testAddObsoleteOperationalAttribute()
-         throws Exception
</del><ins>+  @Test
+  public void testAddObsoleteOperationalAttribute() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(false);
</span><span class="cx"> 
</span><span class="lines">@@ -2218,9 +1904,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testAddObsoleteObjectClass()
-         throws Exception
</del><ins>+  @Test
+  public void testAddObsoleteObjectClass() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(false);
</span><span class="cx"> 
</span><span class="lines">@@ -2275,23 +1960,18 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testShortCircuitInPreParse()
-         throws Exception
</del><ins>+  @Test
+  public void testShortCircuitInPreParse() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(false);
</span><span class="cx"> 
</span><span class="cx">     List&lt;Control&gt; controls =
</span><span class="cx">          ShortCircuitPlugin.createShortCircuitControlList(0, \
&quot;PreParse&quot;); </span><span class="cx"> 
</span><del>-    ArrayList&lt;ByteString&gt; ocValues = new \
                ArrayList&lt;ByteString&gt;();
-    ocValues.add(ByteString.valueOf(&quot;top&quot;));
-    ocValues.add(ByteString.valueOf(&quot;organization&quot;));
</del><ins>+    ArrayList&lt;RawAttribute&gt; rawAttrs = newRawAttributes(
+        RawAttribute.create(&quot;objectClass&quot;, byteStrings(&quot;top&quot;, \
&quot;organization&quot;)), +        RawAttribute.create(&quot;o&quot;, \
&quot;test&quot;)); </ins><span class="cx"> 
</span><del>-    ArrayList&lt;RawAttribute&gt; rawAttrs = new \
                ArrayList&lt;RawAttribute&gt;();
-    rawAttrs.add(RawAttribute.create(&quot;objectClass&quot;, ocValues));
-    rawAttrs.add(RawAttribute.create(&quot;o&quot;, &quot;test&quot;));
-
</del><span class="cx">     AddOperationBasis addOperation =
</span><span class="cx">          new AddOperationBasis(getRootConnection(), \
nextOperationID(), nextMessageID(), </span><span class="cx">                          \
controls, ByteString.valueOf(&quot;o=test&quot;), rawAttrs); </span><span \
class="lines">@@ -2300,4 +1980,3 @@ </span><span class="cx">     \
assertFalse(DirectoryServer.entryExists(DN.decode(&quot;o=test&quot;))); </span><span \
class="cx">   } </span><span class="cx"> }
</span><del>-
</del></span></pre></div>
<a id="trunkopendstestsunitteststestngsrcserverorgopendsservercoreDeleteOperationTestCasejava"></a>
 <div class="modfile"><h4>Modified: \
trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java \
(10975 => 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -68,9 +68,8 @@
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /** {@inheritDoc} */
</span><del>-  @Override()
-  protected Operation[] createTestOperations()
-         throws Exception
</del><ins>+  @Override
+  protected Operation[] createTestOperations() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     List&lt;Control&gt; noControls = new \
ArrayList&lt;Control&gt;(); </span><span class="cx">     return new Operation[]
</span><span class="lines">@@ -130,7 +129,7 @@
</span><span class="cx">    * Tests the &lt;CODE&gt;getEntryDN&lt;/CODE&gt; method \
that should decode the rawEntryDN </span><span class="cx">    * to compute the \
entryDN. </span><span class="cx">    */
</span><del>-  @Test()
</del><ins>+  @Test
</ins><span class="cx">   public void testGetEntryDNNull()
</span><span class="cx">   {
</span><span class="cx">     DeleteOperation deleteOperation =
</span><span class="lines">@@ -145,9 +144,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetEntryDNNotNull()
-         throws Exception
</del><ins>+  @Test
+  public void testGetEntryDNNotNull() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     DeleteOperation deleteOperation =
</span><span class="cx">         newDeleteOperation(null, \
DN.decode(&quot;o=test&quot;)); </span><span class="lines">@@ -165,9 +163,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetEntryDNChangedToNull()
-         throws Exception
</del><ins>+  @Test
+  public void testGetEntryDNChangedToNull() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     DeleteOperation deleteOperation =
</span><span class="cx">         newDeleteOperation(null, \
DN.decode(&quot;o=test&quot;)); </span><span class="lines">@@ -201,9 +198,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetEntryToDeleteExists()
-         throws Exception
</del><ins>+  @Test
+  public void testGetEntryToDeleteExists() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -221,13 +217,13 @@
</span><span class="cx"> 
</span><span class="cx">   private DeleteOperation processDeleteRaw(String entryDN)
</span><span class="cx">   {
</span><del>-    InternalClientConnection conn =getRootConnection();
</del><ins>+    InternalClientConnection conn = getRootConnection();
</ins><span class="cx">     return conn.processDelete(ByteString.valueOf(entryDN));
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   private DeleteOperation processDelete(String entryDN) \
throws DirectoryException </span><span class="cx">   {
</span><del>-    InternalClientConnection conn =getRootConnection();
</del><ins>+    InternalClientConnection conn = getRootConnection();
</ins><span class="cx">     return conn.processDelete(DN.decode(entryDN));
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="lines">@@ -244,9 +240,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetEntryToDeleteNonExistent()
-         throws Exception
</del><ins>+  @Test
+  public void testGetEntryToDeleteNonExistent() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -268,9 +263,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testExternalDelete()
-         throws Exception
</del><ins>+  @Test
+  public void testExternalDelete() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -285,9 +279,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithValidRawDNSuffix()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithValidRawDNSuffix() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -303,9 +296,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithValidProcessedDNSuffix()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithValidProcessedDNSuffix() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -321,9 +313,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithValidRawDNLeaf()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithValidRawDNLeaf() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -344,9 +335,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithValidProcessedDNLeaf()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithValidProcessedDNLeaf() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -367,9 +357,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithMalformedRawDN()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithMalformedRawDN() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -385,9 +374,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithNonExistentSuffixRawDN()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithNonExistentSuffixRawDN() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -403,9 +391,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithNonExistentSuffixProcessedDN()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithNonExistentSuffixProcessedDN() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -420,9 +407,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithRawDNBelowNonExistentSuffix()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithRawDNBelowNonExistentSuffix() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -438,9 +424,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithProcessedDNBelowNonExistentSuffix()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithProcessedDNBelowNonExistentSuffix() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -456,9 +441,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithNonExistentRawDNBelowExistingSuffix()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithNonExistentRawDNBelowExistingSuffix() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -474,9 +458,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithNonExistentProcessedDNBelowExistingSuffix()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithNonExistentProcessedDNBelowExistingSuffix() throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -491,9 +474,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithNonLeafRawDN()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithNonLeafRawDN() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -513,9 +495,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithNonLeafProcessedDN()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithNonLeafProcessedDN() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -536,9 +517,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithServerWritabilityDisabled()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithServerWritabilityDisabled() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -558,9 +538,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalDeleteWithServerWritabilityInternalOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalDeleteWithServerWritabilityInternalOnly() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -580,9 +559,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testExternalDeleteWithServerWritabilityInternalOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testExternalDeleteWithServerWritabilityInternalOnly() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -602,9 +580,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDeleteWithBackendWritabilityDisabled()
-         throws Exception
</del><ins>+  @Test
+  public void testDeleteWithBackendWritabilityDisabled() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -625,9 +602,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testInternalDeleteWithBackendWritabilityInternalOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testInternalDeleteWithBackendWritabilityInternalOnly() throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -648,9 +624,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testExternalDeleteWithBackendWritabilityInternalOnly()
-         throws Exception
</del><ins>+  @Test
+  public void testExternalDeleteWithBackendWritabilityInternalOnly() throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -681,9 +656,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testCancelBeforeStartup()
-         throws Exception
</del><ins>+  @Test
+  public void testCancelBeforeStartup() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -702,9 +676,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testCancelAfterOperation()
-         throws Exception
</del><ins>+  @Test
+  public void testCancelAfterOperation() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -729,8 +702,7 @@
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @Test(groups = { &quot;slow&quot; })
</span><del>-  public void testCannotLockEntry()
-         throws Exception
</del><ins>+  public void testCannotLockEntry() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -754,9 +726,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPreParseDelete()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPreParseDelete() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -802,9 +773,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPreOperationDelete()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPreOperationDelete() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -851,9 +821,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPostOperationDelete()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPostOperationDelete() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -900,9 +869,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPostResponseDelete()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPostResponseDelete() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -970,23 +938,28 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testSuccessWithNotificationListener()
-         throws Exception
</del><ins>+  @Test
+  public void testSuccessWithNotificationListener() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="cx">     TestChangeNotificationListener changeListener =
</span><span class="cx">          new TestChangeNotificationListener();
</span><del>-    DirectoryServer.registerChangeNotificationListener(changeListener);
-    assertEquals(changeListener.getAddCount(), 0);
</del><ins>+    DirectoryServer.registerInternalPlugin(changeListener);
+    try
+    {
+      assertEquals(changeListener.getAddCount(), 0);
</ins><span class="cx"> 
</span><del>-    DeleteOperation deleteOperation = \
                processDeleteRaw(&quot;o=test&quot;);
-    assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS);
-    retrieveCompletedOperationElements(deleteOperation);
</del><ins>+      DeleteOperation deleteOperation = \
processDeleteRaw(&quot;o=test&quot;); +      \
assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); +      \
retrieveCompletedOperationElements(deleteOperation); </ins><span class="cx"> 
</span><del>-    assertEquals(changeListener.getDeleteCount(), 1);
-    DirectoryServer.deregisterChangeNotificationListener(changeListener);
</del><ins>+      assertEquals(changeListener.getDeleteCount(), 1);
+    }
+    finally
+    {
+      DirectoryServer.deregisterInternalPlugin(changeListener);
+    }
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -997,22 +970,27 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testFailureWithNotificationListener()
-         throws Exception
</del><ins>+  @Test
+  public void testFailureWithNotificationListener() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="cx">     TestChangeNotificationListener changeListener =
</span><span class="cx">          new TestChangeNotificationListener();
</span><del>-    DirectoryServer.registerChangeNotificationListener(changeListener);
-    assertEquals(changeListener.getAddCount(), 0);
</del><ins>+    DirectoryServer.registerInternalPlugin(changeListener);
+    try
+    {
+      assertEquals(changeListener.getAddCount(), 0);
</ins><span class="cx"> 
</span><del>-    DeleteOperation deleteOperation = \
                processDeleteRaw(&quot;cn=nonexistent,o=test&quot;);
-    assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS);
</del><ins>+      DeleteOperation deleteOperation = \
processDeleteRaw(&quot;cn=nonexistent,o=test&quot;); +      \
assertFalse(deleteOperation.getResultCode() == ResultCode.SUCCESS); </ins><span \
class="cx">  </span><del>-    assertEquals(changeListener.getDeleteCount(), 0);
-    DirectoryServer.deregisterChangeNotificationListener(changeListener);
</del><ins>+      assertEquals(changeListener.getDeleteCount(), 0);
+    }
+    finally
+    {
+      DirectoryServer.deregisterInternalPlugin(changeListener);
+    }
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1023,9 +1001,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testShortCircuitInPreParse()
-         throws Exception
</del><ins>+  @Test
+  public void testShortCircuitInPreParse() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.initializeTestBackend(true);
</span><span class="cx"> 
</span><span class="lines">@@ -1039,4 +1016,3 @@
</span><span class="cx">     \
assertTrue(DirectoryServer.entryExists(DN.decode(&quot;o=test&quot;))); </span><span \
class="cx">   } </span><span class="cx"> }
</span><del>-
</del></span></pre></div>
<a id="trunkopendstestsunitteststestngsrcserverorgopendsservercoreModifyOperationTestCasejava"></a>
 <div class="modfile"><h4>Modified: \
trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java \
(10975 => 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/ModifyOperationTestCase.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> import static org.opends.server.TestCaseUtils.*;
</span><span class="cx"> import static \
org.opends.server.protocols.internal.InternalClientConnection.*; </span><span \
class="cx"> import static org.opends.server.protocols.ldap.LDAPConstants.*; \
</span><ins>+import static org.opends.server.util.CollectionUtils.*; </ins><span \
class="cx"> import static org.testng.Assert.*; </span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -87,55 +88,45 @@
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @DataProvider(name = &quot;modifyOperations&quot;)
</span><del>-  public Object[][] getModifyOperations()
-         throws Exception
</del><ins>+  public Object[][] getModifyOperations() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     List&lt;ModifyOperation&gt; opList = new \
ArrayList&lt;ModifyOperation&gt;(); </span><span class="cx"> 
</span><span class="cx">     List&lt;Control&gt; noControls = new \
ArrayList&lt;Control&gt;(); </span><span class="cx"> 
</span><del>-
-    List&lt;RawModification&gt; ldapMods = new ArrayList&lt;RawModification&gt;();
</del><span class="cx">     LDAPAttribute ldapAttr = new \
LDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><del>-    \
ldapMods.add(add(ldapAttr)); </del><ins>+    List&lt;RawModification&gt; ldapMods = \
newRawModifications(add(ldapAttr)); </ins><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, ByteString.empty(), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.empty(), ldapMods)); </span><span class="cx">     \
opList.add(newModifyOperation(null, ByteString.valueOf(&quot;o=test&quot;), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.valueOf(&quot;o=test&quot;), ldapMods)); </span><span class="cx"> 
</span><del>-    ldapMods = new ArrayList&lt;RawModification&gt;();
-    ldapMods.add(delete(ldapAttr));
</del><ins>+    ldapMods = newRawModifications(delete(ldapAttr));
</ins><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, ByteString.empty(), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.empty(), ldapMods)); </span><span class="cx">     \
opList.add(newModifyOperation(null, ByteString.valueOf(&quot;o=test&quot;), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.valueOf(&quot;o=test&quot;), ldapMods)); </span><span class="cx"> 
</span><del>-    ldapMods = new ArrayList&lt;RawModification&gt;();
-    ldapMods.add(replace(ldapAttr));
</del><ins>+    ldapMods = newRawModifications(replace(ldapAttr));
</ins><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, ByteString.empty(), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.empty(), ldapMods)); </span><span class="cx">     \
opList.add(newModifyOperation(null, ByteString.valueOf(&quot;o=test&quot;), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.valueOf(&quot;o=test&quot;), ldapMods)); </span><span class="cx"> 
</span><del>-    ldapMods = new ArrayList&lt;RawModification&gt;();
-    ArrayList&lt;ByteString&gt; values2 = new ArrayList&lt;ByteString&gt;();
-    values2.add(ByteString.valueOf(&quot;bar&quot;));
</del><ins>+    ArrayList&lt;ByteString&gt; values2 = \
newArrayList(ByteString.valueOf(&quot;bar&quot;)); </ins><span class="cx">     \
LDAPAttribute ldapAttr2 = new LDAPAttribute(&quot;description&quot;, values2); \
                </span><del>-    ldapMods.add(delete(ldapAttr));
-    ldapMods.add(add(ldapAttr2));
</del><ins>+    ldapMods = newRawModifications(delete(ldapAttr), add(ldapAttr2));
</ins><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, ByteString.empty(), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.empty(), ldapMods)); </span><span class="cx">     \
opList.add(newModifyOperation(null, ByteString.valueOf(&quot;o=test&quot;), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.valueOf(&quot;o=test&quot;), ldapMods)); </span><span class="cx"> 
</span><del>-    ldapMods = new ArrayList&lt;RawModification&gt;();
</del><span class="cx">     ldapAttr2 = new LDAPAttribute(&quot;cn&quot;, values2);
</span><del>-    ldapMods.add(replace(ldapAttr));
-    ldapMods.add(replace(ldapAttr2));
</del><ins>+    ldapMods = newRawModifications(replace(ldapAttr), \
replace(ldapAttr2)); </ins><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, ByteString.empty(), \
ldapMods)); </span><span class="cx">     opList.add(newModifyOperation(noControls, \
ByteString.empty(), ldapMods)); </span><span class="lines">@@ -144,8 +135,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    List&lt;Modification&gt; mods = new ArrayList&lt;Modification&gt;();
-    mods.add(new Modification(ModificationType.ADD,
</del><ins>+    List&lt;Modification&gt; mods = newModifications(new \
Modification(ModificationType.ADD, </ins><span class="cx">         \
Attributes.create(&quot;description&quot;, &quot;foo&quot;))); </span><span \
class="cx">  </span><span class="cx">     opList.add(newModifyOperation(null, \
DN.nullDN(), mods)); </span><span class="lines">@@ -153,8 +143,7 @@
</span><span class="cx">     opList.add(newModifyOperation(null, \
DN.decode(&quot;o=test&quot;), mods)); </span><span class="cx">     \
opList.add(newModifyOperation(noControls, DN.decode(&quot;o=test&quot;), mods)); \
</span><span class="cx">  </span><del>-    mods = new \
                ArrayList&lt;Modification&gt;();
-    mods.add(new Modification(ModificationType.DELETE,
</del><ins>+    mods = newModifications(new Modification(ModificationType.DELETE,
</ins><span class="cx">         Attributes.create(&quot;description&quot;, \
&quot;foo&quot;))); </span><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, DN.nullDN(), mods));
</span><span class="lines">@@ -162,8 +151,7 @@
</span><span class="cx">     opList.add(newModifyOperation(null, \
DN.decode(&quot;o=test&quot;), mods)); </span><span class="cx">     \
opList.add(newModifyOperation(noControls, DN.decode(&quot;o=test&quot;), mods)); \
</span><span class="cx">  </span><del>-    mods = new \
                ArrayList&lt;Modification&gt;();
-    mods.add(new Modification(ModificationType.REPLACE,
</del><ins>+    mods = newModifications(new Modification(ModificationType.REPLACE,
</ins><span class="cx">         Attributes.create(&quot;description&quot;, \
&quot;foo&quot;))); </span><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, DN.nullDN(), mods));
</span><span class="lines">@@ -171,22 +159,22 @@
</span><span class="cx">     opList.add(newModifyOperation(null, \
DN.decode(&quot;o=test&quot;), mods)); </span><span class="cx">     \
opList.add(newModifyOperation(noControls, DN.decode(&quot;o=test&quot;), mods)); \
</span><span class="cx">  </span><del>-    mods = new \
                ArrayList&lt;Modification&gt;();
-    mods.add(new Modification(ModificationType.DELETE,
-        Attributes.create(&quot;description&quot;, &quot;foo&quot;)));
-    mods.add(new Modification(ModificationType.ADD,
-        Attributes.create(&quot;description&quot;, &quot;bar&quot;)));
</del><ins>+    mods = newModifications(
+        new Modification(ModificationType.DELETE,
+            Attributes.create(&quot;description&quot;, &quot;foo&quot;)),
+        new Modification(ModificationType.ADD,
+            Attributes.create(&quot;description&quot;, &quot;bar&quot;)));
</ins><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, DN.nullDN(), mods));
</span><span class="cx">     opList.add(newModifyOperation(noControls, DN.nullDN(), \
mods)); </span><span class="cx">     opList.add(newModifyOperation(null, \
DN.decode(&quot;o=test&quot;), mods)); </span><span class="cx">     \
opList.add(newModifyOperation(noControls, DN.decode(&quot;o=test&quot;), mods)); \
</span><span class="cx">  </span><del>-    mods = new \
                ArrayList&lt;Modification&gt;();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(&quot;description&quot;, &quot;foo&quot;)));
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(&quot;cn&quot;, &quot;bar&quot;)));
</del><ins>+    mods = newModifications(
+        new Modification(ModificationType.REPLACE,
+            Attributes.create(&quot;description&quot;, &quot;foo&quot;)),
+        new Modification(ModificationType.REPLACE,
+            Attributes.create(&quot;cn&quot;, &quot;bar&quot;)));
</ins><span class="cx"> 
</span><span class="cx">     opList.add(newModifyOperation(null, DN.nullDN(), mods));
</span><span class="cx">     opList.add(newModifyOperation(noControls, DN.nullDN(), \
mods)); </span><span class="lines">@@ -236,9 +224,8 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">   /** {@inheritDoc} */
</span><del>-  @Override()
-  protected Operation[] createTestOperations()
-         throws Exception
</del><ins>+  @Override
+  protected Operation[] createTestOperations() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     Object[][]  objs = getModifyOperations();
</span><span class="cx">     Operation[] ops  = new Operation[objs.length];
</span><span class="lines">@@ -280,27 +267,25 @@
</span><span class="cx">    * Tests the &lt;CODE&gt;getEntryDN&lt;/CODE&gt; method \
that should decode </span><span class="cx">    * the raw entry dn and return a \
non-null DN. </span><span class="cx">    */
</span><del>-  @Test()
</del><ins>+  @Test
</ins><span class="cx">   public void testGetEntryDNInitiallyNull()
</span><span class="cx">   {
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><ins>+    \
List&lt;RawModification&gt; mods = newRawModifications(replace(attr)); </ins><span \
class="cx">  </span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(replace(attr));
-
</del><span class="cx">     ModifyOperation modifyOperation = \
newModifyOperation(null, ByteString.empty(), mods); </span><span class="cx">     \
assertNotNull(modifyOperation.getEntryDN()); </span><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-  private LDAPAttribute newLDAPAttribute(String sttributeType, String... \
valueStrings) </del><ins>+  private LDAPAttribute newLDAPAttribute(String \
attributeType, String... valueStrings) </ins><span class="cx">   {
</span><span class="cx">     ArrayList&lt;ByteString&gt; values = new \
ArrayList&lt;ByteString&gt;(); </span><span class="cx">     for (String valueStr : \
valueStrings) </span><span class="cx">     {
</span><span class="cx">       values.add(ByteString.valueOf(valueStr));
</span><span class="cx">     }
</span><del>-    return new LDAPAttribute(sttributeType, values);
</del><ins>+    return new LDAPAttribute(attributeType, values);
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /**
</span><span class="lines">@@ -309,13 +294,12 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetEntryDNInitiallyNonNull()
-         throws Exception
</del><ins>+  @Test
+  public void testGetEntryDNInitiallyNonNull() throws Exception
</ins><span class="cx">   {
</span><del>-    List&lt;Modification&gt; mods = new ArrayList&lt;Modification&gt;();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(&quot;description&quot;, &quot;foo&quot;)));
</del><ins>+    List&lt;Modification&gt; mods = newModifications(
+        new Modification(ModificationType.REPLACE,
+            Attributes.create(&quot;description&quot;, &quot;foo&quot;)));
</ins><span class="cx">     ModifyOperation modifyOperation = \
newModifyOperation(null, DN.nullDN(), mods); </span><span class="cx">     \
assertNotNull(modifyOperation.getEntryDN()); </span><span class="cx">   }
</span><span class="lines">@@ -329,15 +313,13 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetEntryDNNonNullChangedToNull()
-         throws Exception
</del><ins>+  @Test
+  public void testGetEntryDNNonNullChangedToNull() throws Exception
</ins><span class="cx">   {
</span><del>-    List&lt;Modification&gt; mods = new ArrayList&lt;Modification&gt;();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(&quot;description&quot;, &quot;foo&quot;)));
-    ModifyOperation modifyOperation =
-        newModifyOperation(null, DN.nullDN(), mods);
</del><ins>+    List&lt;Modification&gt; mods = newModifications(
+        new Modification(ModificationType.REPLACE,
+            Attributes.create(&quot;description&quot;, &quot;foo&quot;)));
+    ModifyOperation modifyOperation = newModifyOperation(null, DN.nullDN(), mods);
</ins><span class="cx">     assertNotNull(modifyOperation.getEntryDN());
</span><span class="cx"> 
</span><span class="cx">     \
modifyOperation.setRawEntryDN(ByteString.valueOf(&quot;ou=Users,o=test&quot;)); \
</span><span class="lines">@@ -358,9 +340,7 @@ </span><span class="cx">          \
throws Exception </span><span class="cx">   {
</span><span class="cx">     List&lt;RawModification&gt; rawMods = \
modifyOperation.getRawModifications(); </span><del>-
-    List&lt;RawModification&gt; clonedMods =
-         new ArrayList&lt;RawModification&gt;(rawMods);
</del><ins>+    List&lt;RawModification&gt; clonedMods = new \
ArrayList&lt;RawModification&gt;(rawMods); </ins><span class="cx">     \
modifyOperation.setRawModifications(clonedMods); </span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = newLDAPAttribute(&quot;test&quot;, \
&quot;test&quot;); </span><span class="lines">@@ -428,9 +408,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testGetAndAddModifications()
-         throws Exception
</del><ins>+  @Test
+  public void testGetAndAddModifications() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     Entry e = \
DirectoryServer.getEntry(DN.decode(&quot;o=test&quot;)); </span><span class="cx">     \
assertNull(e.getAttribute(DirectoryServer.getAttributeType(&quot;description&quot;, \
true))); </span><span class="lines">@@ -441,9 +420,9 @@
</span><span class="cx">              Attributes.create(&quot;description&quot;, \
&quot;foo&quot;))); </span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    List&lt;Modification&gt; mods = new ArrayList&lt;Modification&gt;();
-    mods.add(new Modification(ModificationType.REPLACE,
-        Attributes.create(&quot;l&quot;, &quot;Austin&quot;)));
</del><ins>+    List&lt;Modification&gt; mods = newModifications(
+        new Modification(ModificationType.REPLACE,
+            Attributes.create(&quot;l&quot;, &quot;Austin&quot;)));
</ins><span class="cx"> 
</span><span class="cx">     ModifyOperation modifyOperation =
</span><span class="cx">         \
getRootConnection().processModify(DN.decode(&quot;o=test&quot;), mods); </span><span \
class="lines">@@ -461,7 +440,7 @@ </span><span class="cx">   /**
</span><span class="cx">    * Tests to ensure that a modify attempt fails if an \
invalid DN is provided. </span><span class="cx">    */
</span><del>-  @Test()
</del><ins>+  @Test
</ins><span class="cx">   public void testFailInvalidDN()
</span><span class="cx">   {
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><span \
class="lines">@@ -476,7 +455,7 @@ </span><span class="cx">    * Tests to ensure that \
a modify attempt fails if the target DN is a suffix </span><span class="cx">    * \
that doesn't exist. </span><span class="cx">    */
</span><del>-  @Test()
</del><ins>+  @Test
</ins><span class="cx">   public void testFailNoSuchSuffix()
</span><span class="cx">   {
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><span \
class="lines">@@ -546,9 +525,8 @@ </span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testSuccessAddAttribute()
-         throws Exception
</del><ins>+  @Test
+  public void testSuccessAddAttribute() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     Entry e = \
DirectoryServer.getEntry(DN.decode(&quot;o=test&quot;)); </span><span class="cx">     \
assertNull(e.getAttribute(DirectoryServer.getAttributeType(&quot;description&quot;, \
true))); </span><span class="lines">@@ -570,9 +548,8 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testSuccessAddAttributeValue()
-         throws Exception
</del><ins>+  @Test
+  public void testSuccessAddAttributeValue() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     Entry e = \
DirectoryServer.getEntry(DN.decode(&quot;o=test&quot;)); </span><span class="cx"> 
</span><span class="lines">@@ -2397,8 +2374,7 @@
</span><span class="cx">     assertEquals(bindResponse.getResultCode(), 0);
</span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;entryUUID&quot;, \
&quot;12345678-1234-1234-1234-1234567890ab&quot;); </span><del>-    \
                List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(replace(attr));
</del><ins>+    List&lt;RawModification&gt; mods = \
newRawModifications(replace(attr)); </ins><span class="cx"> 
</span><span class="cx">     long modifyRequests  = \
ldapStatistics.getModifyRequests(); </span><span class="cx">     long modifyResponses \
= ldapStatistics.getModifyResponses(); </span><span class="lines">@@ -2538,8 +2514,7 \
@@ </span><span class="cx">     assertEquals(bindResponse.getResultCode(), 0);
</span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;objectClass&quot;, &quot;extensibleObject&quot;); \
</span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(add(attr));
</del><ins>+    List&lt;RawModification&gt; mods = newRawModifications(add(attr));
</ins><span class="cx"> 
</span><span class="cx">     long modifyRequests  = \
ldapStatistics.getModifyRequests(); </span><span class="cx">     long modifyResponses \
= ldapStatistics.getModifyResponses(); </span><span class="lines">@@ -2685,8 +2660,7 \
@@ </span><span class="cx">     assertEquals(bindResponse.getResultCode(), 0);
</span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;objectClass&quot;, &quot;extensibleObject&quot;); \
</span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(add(attr));
</del><ins>+    List&lt;RawModification&gt; mods = newRawModifications(add(attr));
</ins><span class="cx"> 
</span><span class="cx">     long modifyRequests  = \
ldapStatistics.getModifyRequests(); </span><span class="cx">     long modifyResponses \
= ldapStatistics.getModifyResponses(); </span><span class="lines">@@ -2716,22 \
+2690,27 @@ </span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testSuccessNotifyChangeListeners()
-         throws Exception
</del><ins>+  @Test
+  public void testSuccessNotifyChangeListeners() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     TestChangeNotificationListener changeListener =
</span><span class="cx">          new TestChangeNotificationListener();
</span><del>-    DirectoryServer.registerChangeNotificationListener(changeListener);
-    assertEquals(changeListener.getModifyCount(), 0);
</del><ins>+    DirectoryServer.registerInternalPlugin(changeListener);
+    try
+    {
+      assertEquals(changeListener.getModifyCount(), 0);
</ins><span class="cx"> 
</span><del>-    LDAPAttribute attr = newLDAPAttribute(&quot;description&quot;, \
                &quot;foo&quot;);
-    ModifyOperation modifyOperation = processModify(&quot;o=test&quot;, \
                replace(attr));
-    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
-    retrieveSuccessfulOperationElements(modifyOperation);
</del><ins>+      LDAPAttribute attr = newLDAPAttribute(&quot;description&quot;, \
&quot;foo&quot;); +      ModifyOperation modifyOperation = \
processModify(&quot;o=test&quot;, replace(attr)); +      \
assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); +      \
retrieveSuccessfulOperationElements(modifyOperation); </ins><span class="cx"> 
</span><del>-    assertEquals(changeListener.getModifyCount(), 1);
-    DirectoryServer.deregisterChangeNotificationListener(changeListener);
</del><ins>+      assertEquals(changeListener.getModifyCount(), 1);
+    }
+    finally
+    {
+      DirectoryServer.deregisterInternalPlugin(changeListener);
+    }
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -2743,21 +2722,26 @@
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @Test(dataProvider = &quot;baseDNs&quot;)
</span><del>-  public void testFailDoNotNotifyChangeListeners(String baseDN)
-         throws Exception
</del><ins>+  public void testFailDoNotNotifyChangeListeners(String baseDN) throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestChangeNotificationListener changeListener =
</span><span class="cx">          new TestChangeNotificationListener();
</span><del>-    DirectoryServer.registerChangeNotificationListener(changeListener);
-    assertEquals(changeListener.getModifyCount(), 0);
</del><ins>+    DirectoryServer.registerInternalPlugin(changeListener);
+    try
+    {
+      assertEquals(changeListener.getModifyCount(), 0);
</ins><span class="cx"> 
</span><del>-    LDAPAttribute attr = newLDAPAttribute(&quot;dc&quot;, \
                &quot;foo&quot;);
-    ModifyOperation modifyOperation = processModify(baseDN, replace(attr));
-    assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS);
-    retrieveFailedOperationElements(modifyOperation);
</del><ins>+      LDAPAttribute attr = newLDAPAttribute(&quot;dc&quot;, \
&quot;foo&quot;); +      ModifyOperation modifyOperation = processModify(baseDN, \
replace(attr)); +      assertFalse(modifyOperation.getResultCode() == \
ResultCode.SUCCESS); +      retrieveFailedOperationElements(modifyOperation);
</ins><span class="cx"> 
</span><del>-    assertEquals(changeListener.getModifyCount(), 0);
-    DirectoryServer.deregisterChangeNotificationListener(changeListener);
</del><ins>+      assertEquals(changeListener.getModifyCount(), 0);
+    }
+    finally
+    {
+      DirectoryServer.deregisterInternalPlugin(changeListener);
+    }
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -2772,10 +2756,8 @@
</span><span class="cx">          throws Exception
</span><span class="cx">   {
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><ins>+    \
List&lt;RawModification&gt; mods = newRawModifications(replace(attr)); </ins><span \
class="cx">  </span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(replace(attr));
-
</del><span class="cx">     ModifyOperation modifyOperation =
</span><span class="cx">         newModifyOperation(null, ByteString.valueOf(baseDN), \
mods); </span><span class="cx"> 
</span><span class="lines">@@ -2798,10 +2780,8 @@
</span><span class="cx">          throws Exception
</span><span class="cx">   {
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><ins>+    \
List&lt;RawModification&gt; mods = newRawModifications(replace(attr)); </ins><span \
class="cx">  </span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(replace(attr));
-
</del><span class="cx">     ModifyOperation modifyOperation =
</span><span class="cx">         newModifyOperation(null, ByteString.valueOf(baseDN), \
mods); </span><span class="cx">     modifyOperation.run();
</span><span class="lines">@@ -2869,8 +2849,7 @@
</span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><span class="cx"> 
</span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(replace(attr));
</del><ins>+    List&lt;RawModification&gt; mods = \
newRawModifications(replace(attr)); </ins><span class="cx"> 
</span><span class="cx">     ModifyRequestProtocolOp modifyRequest =
</span><span class="cx">          new \
ModifyRequestProtocolOp(ByteString.valueOf(baseDN), mods); </span><span \
class="lines">@@ -2897,9 +2876,8 @@ </span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testDisconnectInPreOperationModify()
-         throws Exception
</del><ins>+  @Test
+  public void testDisconnectInPreOperationModify() throws Exception
</ins><span class="cx">   {
</span><span class="cx"> 
</span><span class="cx">     Socket s = new Socket(&quot;127.0.0.1&quot;, \
TestCaseUtils.getServerLdapPort()); </span><span class="lines">@@ -2921,8 +2899,7 @@
</span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><span class="cx"> 
</span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(replace(attr));
</del><ins>+    List&lt;RawModification&gt; mods = \
newRawModifications(replace(attr)); </ins><span class="cx"> 
</span><span class="cx">     ModifyRequestProtocolOp modifyRequest =
</span><span class="cx">          new \
ModifyRequestProtocolOp(ByteString.valueOf(&quot;o=test&quot;), mods); </span><span \
class="lines">@@ -2973,8 +2950,7 @@ </span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><span class="cx"> 
</span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(replace(attr));
</del><ins>+    List&lt;RawModification&gt; mods = \
newRawModifications(replace(attr)); </ins><span class="cx"> 
</span><span class="cx">     ModifyRequestProtocolOp modifyRequest =
</span><span class="cx">          new \
ModifyRequestProtocolOp(ByteString.valueOf(baseDN), mods); </span><span \
class="lines">@@ -3049,10 +3025,8 @@ </span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;description&quot;, &quot;foo&quot;); </span><ins>+    \
List&lt;RawModification&gt; mods = newRawModifications(replace(attr)); </ins><span \
class="cx">  </span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(replace(attr));
-
</del><span class="cx">     ModifyRequestProtocolOp modifyRequest =
</span><span class="cx">          new \
ModifyRequestProtocolOp(ByteString.valueOf(baseDN), mods); </span><span class="cx">   \
message = new LDAPMessage(2, modifyRequest, </span><span class="lines">@@ -3092,10 \
+3066,18 @@ </span><span class="cx">     StaticUtils.close(s);
</span><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  private List&lt;Modification&gt; newModifications(Modification... \
mods) +  {
+    return newArrayList(mods);
+  }
</ins><span class="cx"> 
</span><ins>+  private List&lt;RawModification&gt; \
newRawModifications(RawModification... mods) +  {
+    return newArrayList(mods);
+  }
</ins><span class="cx"> 
</span><span class="cx">   /**
</span><del>-   * Tests a modify operation that attemtps to set a value for an \
attribute type </del><ins>+   * Tests a modify operation that attempts to set a value \
for an attribute type </ins><span class="cx">    * that is marked OBSOLETE in the \
server schema. </span><span class="cx">    *
</span><span class="cx">    * @param  baseDN  The base DN for the test backend.
</span><span class="lines">@@ -3214,16 +3196,14 @@
</span><span class="cx">    *
</span><span class="cx">    * @throws  Exception  If an unexpected problem occurs.
</span><span class="cx">    */
</span><del>-  @Test()
-  public void testShortCircuitInPreParse()
-         throws Exception
</del><ins>+  @Test
+  public void testShortCircuitInPreParse() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     List&lt;Control&gt; controls =
</span><span class="cx">          ShortCircuitPlugin.createShortCircuitControlList(0, \
&quot;PreParse&quot;); </span><span class="cx"> 
</span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(RawModification.create(ModificationType.REPLACE, \
                &quot;description&quot;,
-                                    &quot;foo&quot;));
</del><ins>+    List&lt;RawModification&gt; mods = newRawModifications(
+        RawModification.create(ModificationType.REPLACE, &quot;description&quot;, \
&quot;foo&quot;)); </ins><span class="cx"> 
</span><span class="cx">     ModifyOperation modifyOperation =
</span><span class="cx">         newModifyOperation(controls, \
ByteString.valueOf(&quot;o=test&quot;), mods); </span><span class="lines">@@ -3264,10 \
+3244,8 @@ </span><span class="cx">          &quot;userPassword: password&quot;);
</span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;givenName&quot;, &quot;Test&quot;); </span><ins>+    \
List&lt;RawModification&gt; mods = newRawModifications(add(attr)); </ins><span \
class="cx">  </span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(add(attr));
-
</del><span class="cx">     List&lt;Control&gt; requestControls = new \
ArrayList&lt;Control&gt;(); </span><span class="cx">     requestControls.add(
</span><span class="cx">         new \
LDAPControl(ServerConstants.OID_PERMISSIVE_MODIFY_CONTROL, false)); </span><span \
class="lines">@@ -3303,10 +3281,8 @@ </span><span class="cx">          \
&quot;userPassword: password&quot;); </span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = \
newLDAPAttribute(&quot;givenName&quot;, &quot;Foo&quot;); </span><ins>+    \
List&lt;RawModification&gt; mods = newRawModifications(delete(attr)); </ins><span \
class="cx">  </span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(delete(attr));
-
</del><span class="cx">     List&lt;Control&gt; requestControls = new \
ArrayList&lt;Control&gt;(); </span><span class="cx">     requestControls.add(
</span><span class="cx">         new \
LDAPControl(ServerConstants.OID_PERMISSIVE_MODIFY_CONTROL, false)); </span><span \
class="lines">@@ -3342,8 +3318,7 @@ </span><span class="cx">          \
&quot;userPassword: password&quot;); </span><span class="cx"> 
</span><span class="cx">     LDAPAttribute attr = new \
LDAPAttribute(&quot;description&quot;); </span><del>-    List&lt;RawModification&gt; \
                mods = new ArrayList&lt;RawModification&gt;();
-    mods.add(delete(attr));
</del><ins>+    List&lt;RawModification&gt; mods = newRawModifications(delete(attr));
</ins><span class="cx"> 
</span><span class="cx">     List&lt;Control&gt; requestControls = new \
ArrayList&lt;Control&gt;(); </span><span class="cx">     requestControls.add(
</span><span class="lines">@@ -3518,11 +3493,10 @@
</span><span class="cx">    *           If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @Test
</span><del>-  public void testModifyDelPasswordAttributeWithOption()
-      throws Exception
</del><ins>+  public void testModifyDelPasswordAttributeWithOption() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     // @formatter:off
</span><del>-        Entry e = TestCaseUtils.makeEntry(
</del><ins>+    Entry e = TestCaseUtils.makeEntry(
</ins><span class="cx">         &quot;dn: cn=Test User,o=test&quot;,
</span><span class="cx">         &quot;objectClass: top&quot;,
</span><span class="cx">         &quot;objectClass: person&quot;,
</span><span class="lines">@@ -3560,8 +3534,7 @@
</span><span class="cx">    *           If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @Test
</span><del>-  public void testModifyReplaceEmptyPasswordAttributeWithOption()
-      throws Exception
</del><ins>+  public void testModifyReplaceEmptyPasswordAttributeWithOption() throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     // @formatter:off
</span><span class="cx">         Entry e = TestCaseUtils.makeEntry(
</span><span class="lines">@@ -3600,8 +3573,7 @@
</span><span class="cx">    *           If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @Test
</span><del>-  public void testModifyAddPasswordAttributeWithOption()
-      throws Exception
</del><ins>+  public void testModifyAddPasswordAttributeWithOption() throws Exception
</ins><span class="cx">   {
</span><span class="cx">     // @formatter:off
</span><span class="cx">         TestCaseUtils.addEntry(
</span><span class="lines">@@ -3638,8 +3610,7 @@
</span><span class="cx">    *           If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @Test
</span><del>-  public void testModifyReplaceWithValuesPasswordAttributeWithOption()
-      throws Exception
</del><ins>+  public void testModifyReplaceWithValuesPasswordAttributeWithOption() \
throws Exception </ins><span class="cx">   {
</span><span class="cx">     // @formatter:off
</span><span class="cx">         TestCaseUtils.addEntry(
</span><span class="lines">@@ -3676,8 +3647,7 @@
</span><span class="cx">    *           If an unexpected problem occurs.
</span><span class="cx">    */
</span><span class="cx">   @Test(dataProvider = &quot;baseDNs&quot;)
</span><del>-  public void testAddCertificateWithoutBinaryOption(String baseDN)
-         throws Exception
</del><ins>+  public void testAddCertificateWithoutBinaryOption(String baseDN) throws \
Exception </ins><span class="cx">   {
</span><span class="cx">     TestCaseUtils.addEntry(
</span><span class="cx">          &quot;dn: uid=test.user,&quot; + baseDN,
</span><span class="lines">@@ -3750,8 +3720,8 @@
</span><span class="cx">     // First check that adding &quot;dc&quot; fails because \
it is not allowed by </span><span class="cx">     // inetOrgPerson.
</span><span class="cx">     LDAPAttribute attr = newLDAPAttribute(&quot;dc&quot;, \
&quot;foo&quot;); </span><del>-    List&lt;RawModification&gt; mods = new \
                ArrayList&lt;RawModification&gt;();
-    mods.add(add(attr));
</del><ins>+    List&lt;RawModification&gt; mods = newRawModifications(add(attr));
+
</ins><span class="cx">     ModifyOperation modifyOperation = \
processModify(&quot;cn=Test User,&quot; + baseDN, mods); </span><span class="cx">     \
assertEquals(modifyOperation.getResultCode(), ResultCode.OBJECTCLASS_VIOLATION); \
</span><span class="cx">  </span></span></pre></div>
<a id="trunkopendstestsunitteststestngsrcserverorgopendsservercoreTestChangeNotificationListenerjava"></a>
 <div class="modfile"><h4>Modified: \
trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestChangeNotificationListener.java \
(10975 => 10976)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestChangeNotificationListener.java	2014-08-26 \
                09:19:36 UTC (rev 10975)
+++ trunk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestChangeNotificationListener.java	2014-08-27 \
08:29:16 UTC (rev 10976) </span><span class="lines">@@ -22,105 +22,109 @@
</span><span class="cx">  *
</span><span class="cx">  *
</span><span class="cx">  *      Copyright 2006-2008 Sun Microsystems, Inc.
</span><ins>+ *      Portions Copyright 2014 ForgeRock AS
</ins><span class="cx">  */
</span><span class="cx"> package org.opends.server.core;
</span><span class="cx"> 
</span><del>-
-
</del><ins>+import java.util.EnumSet;
</ins><span class="cx"> import java.util.concurrent.atomic.AtomicInteger;
</span><span class="cx"> 
</span><del>-import org.opends.server.api.ChangeNotificationListener;
-import org.opends.server.types.Entry;
</del><ins>+import org.opends.server.api.plugin.InternalDirectoryServerPlugin;
+import org.opends.server.api.plugin.PluginResult.PostResponse;
+import org.opends.server.types.DN;
+import org.opends.server.types.DirectoryException;
+import org.opends.server.types.ResultCode;
</ins><span class="cx"> import \
org.opends.server.types.operation.PostResponseAddOperation; </span><span class="cx"> \
import org.opends.server.types.operation.PostResponseDeleteOperation; \
</span><del>-import org.opends.server.types.operation.PostResponseModifyOperation; \
</del><span class="cx"> import \
org.opends.server.types.operation.PostResponseModifyDNOperation; </span><ins>+import \
org.opends.server.types.operation.PostResponseModifyOperation; </ins><span \
class="cx">  </span><ins>+import static org.opends.server.api.plugin.PluginType.*;
</ins><span class="cx"> 
</span><del>-
</del><span class="cx"> /**
</span><span class="cx">  * This class provides a simple change notification listener \
that simply counts </span><span class="cx">  * the number of times that it is invoked \
during processing. </span><span class="cx">  */
</span><del>-public class TestChangeNotificationListener
-       implements ChangeNotificationListener
</del><ins>+class TestChangeNotificationListener extends \
InternalDirectoryServerPlugin </ins><span class="cx"> {
</span><del>-  // The number of times that the listener has been invoked for add \
                operations.
-  private AtomicInteger addCount;
</del><ins>+  /** The number of times that the listener has been invoked for add \
operations. */ +  private final AtomicInteger addCount = new AtomicInteger(0);
</ins><span class="cx"> 
</span><del>-  // The number of times that the listener has been invoked for delete
-  // operations.
-  private AtomicInteger deleteCount;
</del><ins>+  /**
+   * The number of times that the listener has been invoked for delete
+   * operations.
+   */
+  private final AtomicInteger deleteCount = new AtomicInteger(0);
</ins><span class="cx"> 
</span><del>-  // The number of times that the listener has been invoked for modify
-  // operations.
-  private AtomicInteger modifyCount;
</del><ins>+  /**
+   * The number of times that the listener has been invoked for modify
+   * operations.
+   */
+  private final AtomicInteger modifyCount = new AtomicInteger(0);
</ins><span class="cx"> 
</span><del>-  // The number of times that the listener has been invoked for modify \
                DN
-  // operations.
-  private AtomicInteger modifyDNCount;
</del><ins>+  /**
+   * The number of times that the listener has been invoked for modify DN
+   * operations.
+   */
+  private final AtomicInteger modifyDNCount = new AtomicInteger(0);
</ins><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Creates a new instance of this change notification \
listener. </span><ins>+   *
+   * @throws DirectoryException
+   *           If a problem occurs while creating an instance of this class
</ins><span class="cx">    */
</span><del>-  public TestChangeNotificationListener()
</del><ins>+  public TestChangeNotificationListener() throws DirectoryException
</ins><span class="cx">   {
</span><del>-    addCount      = new AtomicInteger(0);
-    deleteCount   = new AtomicInteger(0);
-    modifyCount   = new AtomicInteger(0);
-    modifyDNCount = new AtomicInteger(0);
</del><ins>+    super(DN.decode(&quot;cn=TestChangeNotificationListener&quot;),
+        EnumSet.of(POST_RESPONSE_ADD, POST_RESPONSE_MODIFY, POST_RESPONSE_MODIFY_DN, \
POST_RESPONSE_DELETE), +        true);
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void handleAddOperation(PostResponseAddOperation addOperation,
-                                 Entry entry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseAddOperation op)
</ins><span class="cx">   {
</span><del>-    addCount.incrementAndGet();
</del><ins>+    if (op.getResultCode() == ResultCode.SUCCESS)
+    {
+      addCount.incrementAndGet();
+    }
+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void handleDeleteOperation(PostResponseDeleteOperation deleteOperation,
-                                    Entry entry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseDeleteOperation op)
</ins><span class="cx">   {
</span><del>-    deleteCount.incrementAndGet();
</del><ins>+    if (op.getResultCode() == ResultCode.SUCCESS)
+    {
+      deleteCount.incrementAndGet();
+    }
+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void handleModifyOperation(PostResponseModifyOperation modifyOperation,
-                                    Entry oldEntry, Entry newEntry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseModifyOperation op)
</ins><span class="cx">   {
</span><del>-    modifyCount.incrementAndGet();
</del><ins>+    if (op.getResultCode() == ResultCode.SUCCESS)
+    {
+      modifyCount.incrementAndGet();
+    }
+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
-  /**
-   * {@inheritDoc}
-   */
-  public void handleModifyDNOperation(
-                   PostResponseModifyDNOperation modifyDNOperation,
-                   Entry oldEntry, Entry newEntry)
</del><ins>+  /** {@inheritDoc} */
+  @Override
+  public PostResponse doPostResponse(PostResponseModifyDNOperation op)
</ins><span class="cx">   {
</span><del>-    modifyDNCount.incrementAndGet();
</del><ins>+    if (op.getResultCode() == ResultCode.SUCCESS)
+    {
+      modifyDNCount.incrementAndGet();
+    }
+    return PostResponse.continueOperationProcessing();
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Resets all of the counts to zero.
</span><span class="cx">    */
</span><span class="lines">@@ -132,8 +136,6 @@
</span><span class="cx">     modifyDNCount.set(0);
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Retrieves the current invocation count for add \
operations. </span><span class="cx">    *
</span><span class="lines">@@ -144,8 +146,6 @@
</span><span class="cx">     return addCount.get();
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Retrieves the current invocation count for delete \
operations. </span><span class="cx">    *
</span><span class="lines">@@ -156,8 +156,6 @@
</span><span class="cx">     return deleteCount.get();
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Retrieves the current invocation count for modify \
operations. </span><span class="cx">    *
</span><span class="lines">@@ -168,8 +166,6 @@
</span><span class="cx">     return modifyCount.get();
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx">   /**
</span><span class="cx">    * Retrieves the current invocation count for modify DN \
operations. </span><span class="cx">    *
</span></span></pre>
</div>
</div>
<div id="footer">Copyright (c) by ForgeRock. All rights reserved.</div>

</body>
</html>



_______________________________________________
OpenDJ-dev mailing list
OpenDJ-dev@forgerock.org
https://lists.forgerock.org/mailman/listinfo/opendj-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic