From cb3c4e8dc4d6096355110d252cadcf0b1cc63ace Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 16 Apr 2007 21:18:16 +0000
Subject: [PATCH] Update the TestCaseUtils class to change the return types of the getServerLdapPort, getServerLdapsPort, and getServerJmxPort methods to be int instead of long, and eliminate lots of now-unnecessary casts.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
index e7a4565..9c39954 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -61,12 +61,18 @@
import org.opends.server.loggers.debug.DebugLogger;
import org.opends.server.plugins.InvocationCounterPlugin;
import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.tools.LDAPModify;
import org.opends.server.types.DN;
import org.opends.server.types.FilePermission;
import org.opends.server.types.InitializationException;
import org.opends.server.types.OperatingSystem;
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.ResultCode;
+import org.opends.server.util.ChangeRecordEntry;
+import org.opends.server.util.AddChangeRecordEntry;
+import org.opends.server.util.DeleteChangeRecordEntry;
+import org.opends.server.util.ModifyChangeRecordEntry;
+import org.opends.server.util.ModifyDNChangeRecordEntry;
import static org.testng.Assert.*;
@@ -551,7 +557,7 @@
*
* @return The port number.
*/
- public static long getServerLdapPort()
+ public static int getServerLdapPort()
{
return serverLdapPort;
}
@@ -562,7 +568,7 @@
*
* @return The port number.
*/
- public static long getServerJmxPort()
+ public static int getServerJmxPort()
{
return serverJmxPort;
}
@@ -573,7 +579,7 @@
*
* @return The port number.
*/
- public static long getServerLdapsPort()
+ public static int getServerLdapsPort()
{
return serverLdapsPort;
}
@@ -823,6 +829,43 @@
/**
+ * Applies a set of modifications to the server as described in the provided
+ * set of lines (using LDIF change form). The changes will be applied over
+ * LDAP using the ldapmodify tool using the "cn=Directory Manager" account.
+ *
+ * @param lines The set of lines including the changes to make to the
+ * server.
+ *
+ * @return The result code from applying the set of modifications. if it is
+ * nonzero, then there was a failure of some kind.
+ *
+ * @throws Exception If an unexpected problem occurs.
+ */
+ public static int applyModifications(String... lines)
+ throws Exception
+ {
+ if (! SERVER_STARTED)
+ {
+ startServer();
+ }
+
+ String path = createTempFile(lines);
+ String[] args =
+ {
+ "-h", "127.0.0.1",
+ "-p", String.valueOf(serverLdapPort),
+ "-D", "cn=Directory Manager",
+ "-w", "password",
+ "-a",
+ "-f", path
+ };
+
+ return LDAPModify.mainModify(args, false, null, null);
+ }
+
+
+
+ /**
* Creates a temporary text file with the specified contents. It will be
* marked for automatic deletion when the JVM exits.
*
--
Gitblit v1.10.0