From a18241e1d91b5212dc8e4fb9d41d9a2d6c0baa40 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 04 May 2016 14:49:10 +0000
Subject: [PATCH] Fix unit test failures due to ports already in use
---
opendj-server-legacy/src/test/java/org/opends/server/monitors/GenericMonitorTestCase.java | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/monitors/GenericMonitorTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/monitors/GenericMonitorTestCase.java
index 9aad391..1a91fc6 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/monitors/GenericMonitorTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/monitors/GenericMonitorTestCase.java
@@ -18,6 +18,7 @@
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.annotations.AfterClass;
@@ -38,33 +39,25 @@
public abstract class GenericMonitorTestCase
extends MonitorTestCase
{
- /** The configuration entry for this test case. */
+ private final String configEntryName;
protected Entry configEntry;
+ GenericMonitorTestCase(String dnString)
+ {
+ configEntryName = dnString;
+ }
-
- /**
- * Creates a new instance of this monitor test case.
- *
- * @param dnString The DN of the configuration entry for this test case, or
- * <CODE>null</CODE> if there is none.
- *
- * @throws Exception If an unexpected problem occurs.
- */
- protected GenericMonitorTestCase(String dnString)
- throws Exception
+ @BeforeClass
+ public void beforeClass() throws Exception
{
TestCaseUtils.startServer();
-
- if (dnString != null)
+ if (configEntryName != null)
{
- configEntry = DirectoryServer.getEntry(DN.valueOf(dnString));
+ configEntry = DirectoryServer.getEntry(DN.valueOf(configEntryName));
assertNotNull(configEntry);
}
}
-
-
/**
* Retrieves an initialized instance of the associated monitor provider.
*
--
Gitblit v1.10.0