From 5097fbda6e7c1b26da60721455eae79e1cf1920e Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 16 Nov 2006 01:32:41 +0000
Subject: [PATCH] Update the ldapsearch tool to provide a --countEntries option that can be used to count the number of matching entries.  The count will be displayed as a comment at the end of the results, and will also be used as the exit code for the tool.  This addresses issue #1013.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java |   75 +++++++++++++++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 1 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java
index 844c7a4..23eb329 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPDeleteTestCase.java
@@ -798,6 +798,52 @@
 
 
   /**
+   * Tests a subtree delete operation using an alternate name for the control.
+   *
+   * @throws  Exception  If an unexpectd problem occurs.
+   */
+  @Test()
+  public void testSubtreeDeleteAltName()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    Entry e = TestCaseUtils.makeEntry(
+         "dn: uid=test.user,o=test",
+         "objectClass: top",
+         "objectClass: person",
+         "objectClass: organizationalPerson",
+         "objectClass: inetOrgPerson",
+         "uid: test.user",
+         "givenName: Test",
+         "sn: User",
+         "cn: Test User",
+         "userPassword: password");
+
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    AddOperation addOperation =
+         conn.processAdd(e.getDN(), e.getObjectClasses(), e.getUserAttributes(),
+                         e.getOperationalAttributes());
+    assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-D", "cn=Directory Manager",
+      "-w", "password",
+      "-J", "subtreedelete:true",
+      "o=test"
+    };
+
+    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
+  }
+
+
+
+  /**
    * Tests a simple delete using the client-side no-op option.
    *
    * @throws  Exception  If an unexpectd problem occurs.
@@ -844,7 +890,34 @@
       "o=test"
     };
 
-    LDAPDelete.mainDelete(args, false, null, null);
+    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
+  }
+
+
+
+  /**
+   * Tests a simple delete using the server-side no-op control with an alternate
+   * name for the no-op control.
+   *
+   * @throws  Exception  If an unexpectd problem occurs.
+   */
+  @Test()
+  public void testDeleteServerSideNoOpAltName()
+         throws Exception
+  {
+    TestCaseUtils.initializeTestBackend(true);
+
+    String[] args =
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-D", "cn=Directory Manager",
+      "-w", "password",
+      "-J", "no-op:true",
+      "o=test"
+    };
+
+    assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0);
   }
 
 

--
Gitblit v1.10.0