From 203ea8bdd3015b374fcdf633d3c6fe2b4c139279 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 26 Aug 2011 16:55:03 +0000
Subject: [PATCH] Fix unit tests which regularly cause Jenkins builds to fail (see OPENDJ-256).
---
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java | 23 ++++++++++++++++++++---
1 files changed, 20 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 c1c5a4e..a06e1cd 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
@@ -1307,7 +1307,7 @@
Socket s = null;
try {
s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort());
- s.setSoTimeout(3000);
+ TestCaseUtils.configureSocket(s);
ASN1Reader r = ASN1.getReader(s.getInputStream());
ASN1Writer w = ASN1.getWriter(s.getOutputStream());
@@ -1335,6 +1335,23 @@
}
+
+ /**
+ * Configures a socket for use in unit tests. This should only be used if the
+ * socket is not expected to timeout.
+ *
+ * @param s
+ * The socket.
+ * @throws Exception
+ * If an unexpected exception occurred while configuring the socket.
+ */
+ public static void configureSocket(Socket s) throws Exception
+ {
+ s.setSoTimeout(60 * 1000);
+ }
+
+
+
/**
* Adds the provided entry to the Directory Server using an internal
* operation.
@@ -1948,13 +1965,13 @@
return buffer.toString();
}
-
+
public static void enableBackend(String backendID)
{
dsconfig("set-backend-prop", "--backend-name", backendID,
"--set", "enabled:true");
}
-
+
public static void disableBackend(String backendID)
{
dsconfig("set-backend-prop", "--backend-name", backendID,
--
Gitblit v1.10.0