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/LDAPModifyTestCase.java | 138 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 138 insertions(+), 0 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java
index 5419bed..8145442 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPModifyTestCase.java
@@ -882,6 +882,33 @@
/**
+ * Tests a simple modify operation using LDAP No-Op control with an alternate
+ * name.
+ *
+ * @throws Exception If an unexpected problem occurs.
+ */
+ @Test()
+ public void testModifyLDAPNoOpAltName()
+ 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",
+ "-f", modifyFilePath
+ };
+
+ assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
+ }
+
+
+
+ /**
* Tests a simple add operation using LDAP No-Op control.
*
* @throws Exception If an unexpected problem occurs.
@@ -915,6 +942,40 @@
/**
+ * Tests a simple add operation using LDAP No-Op control with an alternate
+ * name.
+ *
+ * @throws Exception If an unexpected problem occurs.
+ */
+ @Test()
+ public void testAddLDAPNoOpAltName()
+ throws Exception
+ {
+ TestCaseUtils.initializeTestBackend(true);
+
+ String path = TestCaseUtils.createTempFile(
+ "dn: ou=People,o=test",
+ "changetype: add",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "ou: People");
+
+ String[] args =
+ {
+ "-h", "127.0.0.1",
+ "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+ "-D", "cn=Directory Manager",
+ "-w", "password",
+ "-J", "no-op:true",
+ "-f", path
+ };
+
+ assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
+ }
+
+
+
+ /**
* Tests a simple delete operation using LDAP No-Op control.
*
* @throws Exception If an unexpected problem occurs.
@@ -945,6 +1006,37 @@
/**
+ * Tests a simple delete operation using LDAP No-Op control with an alternate
+ * name.
+ *
+ * @throws Exception If an unexpected problem occurs.
+ */
+ @Test()
+ public void testDeleteLDAPNoOpAltName()
+ throws Exception
+ {
+ TestCaseUtils.initializeTestBackend(true);
+
+ String path = TestCaseUtils.createTempFile(
+ "dn: o=test",
+ "changetype: delete");
+
+ String[] args =
+ {
+ "-h", "127.0.0.1",
+ "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+ "-D", "cn=Directory Manager",
+ "-w", "password",
+ "-J", "no-op:true",
+ "-f", path
+ };
+
+ assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
+ }
+
+
+
+ /**
* Tests a simple modify DN operation using LDAP No-Op control.
*
* @throws Exception If an unexpected problem occurs.
@@ -990,6 +1082,52 @@
/**
+ * Tests a simple modify DN operation using LDAP No-Op control with an
+ * alternate name.
+ *
+ * @throws Exception If an unexpected problem occurs.
+ */
+ @Test()
+ public void testModifyDNLDAPNoOpAltName()
+ throws Exception
+ {
+ TestCaseUtils.initializeTestBackend(true);
+
+ Entry e = TestCaseUtils.makeEntry(
+ "dn: ou=People,o=test",
+ "objectClass: top",
+ "objectClass: organizationalUnit",
+ "ou: People");
+
+ InternalClientConnection conn =
+ InternalClientConnection.getRootConnection();
+ AddOperation addOperation =
+ conn.processAdd(e.getDN(), e.getObjectClasses(),
+ e.getUserAttributes(), e.getOperationalAttributes());
+ assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS);
+
+ String path = TestCaseUtils.createTempFile(
+ "dn: ou=People,o=test",
+ "changetype: moddn",
+ "newRDN: ou=Users",
+ "deleteOldRDN: 1");
+
+ String[] args =
+ {
+ "-h", "127.0.0.1",
+ "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+ "-D", "cn=Directory Manager",
+ "-w", "password",
+ "-J", "no-op:true",
+ "-f", path
+ };
+
+ assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
+ }
+
+
+
+ /**
* Tests a simple modify operation using the LDAP assertion control in which
* the assertion is true.
*
--
Gitblit v1.10.0