From 1fbdf9f1e85c5e2d27ffb50edb2e21b66917dc09 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 12 Sep 2006 03:39:19 +0000
Subject: [PATCH] Add a number of test cases for the server monitor providers.

---
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/MonitorTestCase.java                     |   46 +++
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/GenericMonitorTestCase.java              |  163 +++++++++++++
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/SystemInfoMonitorTestCase.java           |   70 +++++
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/VersionMonitorTestCase.java              |   70 +++++
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/InternalSearchMonitorTestCase.java       |  134 +++++++++++
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/StackTraceMonitorTestCase.java           |   70 +++++
 opendj-sdk/opends/ext/testng/testng.xml                                                                                  |    1 
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/DatabaseEnvironmentMonitorTestCase.java  |   72 ++++++
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/TraditionalWorkQueueMonitorTestCase.java |   70 +++++
 9 files changed, 696 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/ext/testng/testng.xml b/opendj-sdk/opends/ext/testng/testng.xml
index 7305f6c..9e9c977 100644
--- a/opendj-sdk/opends/ext/testng/testng.xml
+++ b/opendj-sdk/opends/ext/testng/testng.xml
@@ -10,6 +10,7 @@
             <package name="org.opends.server.protocols.jmx"/>
             <package name="org.opends.server.util"/>
             <package name="org.opends.server.schema"/>
+            <package name="org.opends.server.monitors"/>
         </packages>
     </test>
 
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/DatabaseEnvironmentMonitorTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/DatabaseEnvironmentMonitorTestCase.java
new file mode 100644
index 0000000..cd78794
--- /dev/null
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/DatabaseEnvironmentMonitorTestCase.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.monitors;
+
+
+
+import org.opends.server.api.MonitorProvider;
+import org.opends.server.core.DirectoryServer;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.monitors.DatabaseEnvironmentMonitor class.
+ */
+public class DatabaseEnvironmentMonitorTestCase
+       extends GenericMonitorTestCase
+{
+  /**
+   * Creates a new instance of this test case class.
+   *
+   * @throws  Exception  If an unexpected problem occurred.
+   */
+  public DatabaseEnvironmentMonitorTestCase()
+         throws Exception
+  {
+    super(null);
+  }
+
+
+
+  /**
+   * Retrieves an initialized instance of the associated monitor provider.
+   *
+   * @return  An initialized instance of the associated monitor provider.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  public MonitorProvider getMonitorInstance()
+         throws Exception
+  {
+    String monitorName = "userroot database environment";
+    MonitorProvider provider = DirectoryServer.getMonitorProvider(monitorName);
+    provider.initializeMonitorProvider(null);
+    return provider;
+  }
+}
+
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/GenericMonitorTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/GenericMonitorTestCase.java
new file mode 100644
index 0000000..98c8538
--- /dev/null
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/GenericMonitorTestCase.java
@@ -0,0 +1,163 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.monitors;
+
+
+
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.DirectoryServerTestCase;
+import org.opends.server.api.MonitorProvider;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.types.DN;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * An abstract base class for all monitor test cases in which most tests are
+ * performed in a generic manner.
+ */
+public abstract class GenericMonitorTestCase
+       extends MonitorTestCase
+{
+  // The configuration entry for this test case.
+  protected ConfigEntry configEntry;
+
+
+
+  /**
+   * 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
+  {
+    super();
+
+    TestCaseUtils.startServer();
+
+    if (dnString != null)
+    {
+      DN dn = DN.decode(dnString);
+      configEntry = DirectoryServer.getConfigEntry(dn);
+      assertNotNull(configEntry);
+    }
+  }
+
+
+
+  /**
+   * Retrieves an initialized instance of the associated monitor provider.
+   *
+   * @return  An initialized instance of the associated monitor provider.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  public abstract MonitorProvider getMonitorInstance()
+         throws Exception;
+
+
+
+  /**
+   * Creates an instance of the stack trace monitor and performs basic
+   * initialization for it.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testInitialization()
+         throws Exception
+  {
+    MonitorProvider monitorProvider = getMonitorInstance();
+    assertNotNull(monitorProvider);
+  }
+
+
+
+  /**
+   * Tests the <CODE>getMonitorInstanceName</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetMonitorInstanceName()
+         throws Exception
+  {
+    getMonitorInstance().getMonitorInstanceName();
+  }
+
+
+
+  /**
+   * Tests the <CODE>getUpdateInterval</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetUpdateInterval()
+         throws Exception
+  {
+    getMonitorInstance().getUpdateInterval();
+  }
+
+
+
+  /**
+   * Tests the <CODE>getUpdateMonitorData</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testUpdateMonitorData()
+         throws Exception
+  {
+    getMonitorInstance().updateMonitorData();
+  }
+
+
+
+  /**
+   * Tests the <CODE>getMonitorData</CODE> method.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testGetMonitorData()
+         throws Exception
+  {
+    getMonitorInstance().getMonitorData();
+  }
+}
+
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/InternalSearchMonitorTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/InternalSearchMonitorTestCase.java
new file mode 100644
index 0000000..9f8c7d6
--- /dev/null
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/InternalSearchMonitorTestCase.java
@@ -0,0 +1,134 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.monitors;
+
+
+
+import java.util.ArrayList;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import org.opends.server.TestCaseUtils;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.protocols.internal.InternalSearchOperation;
+import org.opends.server.types.DN;
+import org.opends.server.types.ResultCode;
+import org.opends.server.types.SearchScope;
+import org.opends.server.types.SearchFilter;
+
+import static org.testng.Assert.*;
+
+
+
+/**
+ * Interacts with the Directory Server monitor providers by retrieving the
+ * monitor entries with internal searches.
+ */
+public class InternalSearchMonitorTestCase
+       extends MonitorTestCase
+{
+  /**
+   * Ensures that the Directory Server is started.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+  }
+
+
+
+  /**
+   * Uses an internal subtree search to retrieve the monitor entries.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  public void testWithSubtreeMonitorSearch()
+         throws Exception
+  {
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    InternalSearchOperation searchOperation =
+         conn.processSearch(DN.decode("cn=monitor"), SearchScope.WHOLE_SUBTREE,
+              SearchFilter.createFilterFromString("(objectClass=*)"));
+    assertEquals(ResultCode.SUCCESS, searchOperation.getResultCode());
+  }
+
+
+
+  /**
+   * Retrieves the names of the monitor providers registered with the server.
+   *
+   * @return  The names of the monitor providers registered with the server.
+   */
+  @DataProvider(name = "monitorNames")
+  public Object[][] getMonitorNames()
+  {
+    ArrayList<String> monitorNames = new ArrayList<String>();
+    for (String name : DirectoryServer.getMonitorProviders().keySet())
+    {
+      monitorNames.add(name);
+    }
+
+    Object[][] nameArray = new Object[monitorNames.size()][1];
+    for (int i=0; i < nameArray.length; i++)
+    {
+      nameArray[i] = new Object[] { monitorNames.get(i) };
+    }
+
+    return nameArray;
+  }
+
+
+
+  /**
+   * Uses a set of internal base-level searches to retrieve the monitor entries.
+   *
+   * @param  monitorName  The name of the monitor entry to retrieve.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test(dataProvider = "monitorNames")
+  public void testWithBaseObjectMonitorSearch(String monitorName)
+         throws Exception
+  {
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+    InternalSearchOperation searchOperation =
+         conn.processSearch(DN.decode("cn=" + monitorName + ",cn=monitor"),
+              SearchScope.BASE_OBJECT,
+              SearchFilter.createFilterFromString("(objectClass=*)"));
+    assertEquals(ResultCode.SUCCESS, searchOperation.getResultCode());
+  }
+}
+
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/MonitorTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/MonitorTestCase.java
new file mode 100644
index 0000000..a2c4499
--- /dev/null
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/MonitorTestCase.java
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.monitors;
+
+
+
+import org.testng.annotations.Test;
+
+import org.opends.server.DirectoryServerTestCase;
+
+
+
+/**
+ * An abstract base class for all monitor test cases.
+ */
+@Test(groups = { "precommit", "monitor" })
+public abstract class MonitorTestCase
+       extends DirectoryServerTestCase
+{
+  // No implementation required.
+}
+
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/StackTraceMonitorTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/StackTraceMonitorTestCase.java
new file mode 100644
index 0000000..7e479c6
--- /dev/null
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/StackTraceMonitorTestCase.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.monitors;
+
+
+
+import org.opends.server.api.MonitorProvider;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.monitors.StackTraceMonitorProvider class.
+ */
+public class StackTraceMonitorTestCase
+       extends GenericMonitorTestCase
+{
+  /**
+   * Creates a new instance of this test case class.
+   *
+   * @throws  Exception  If an unexpected problem occurred.
+   */
+  public StackTraceMonitorTestCase()
+         throws Exception
+  {
+    super("cn=JVM Stack Trace,cn=Monitor Providers,cn=config");
+  }
+
+
+
+  /**
+   * Retrieves an initialized instance of the associated monitor provider.
+   *
+   * @return  An initialized instance of the associated monitor provider.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  public MonitorProvider getMonitorInstance()
+         throws Exception
+  {
+    StackTraceMonitorProvider monitorProvider = new StackTraceMonitorProvider();
+    monitorProvider.initializeMonitorProvider(configEntry);
+    return monitorProvider;
+  }
+}
+
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/SystemInfoMonitorTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/SystemInfoMonitorTestCase.java
new file mode 100644
index 0000000..dbdfe29
--- /dev/null
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/SystemInfoMonitorTestCase.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.monitors;
+
+
+
+import org.opends.server.api.MonitorProvider;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.monitors.SystemInfoMonitorProvider class.
+ */
+public class SystemInfoMonitorTestCase
+       extends GenericMonitorTestCase
+{
+  /**
+   * Creates a new instance of this test case class.
+   *
+   * @throws  Exception  If an unexpected problem occurred.
+   */
+  public SystemInfoMonitorTestCase()
+         throws Exception
+  {
+    super("cn=System Info,cn=Monitor Providers,cn=config");
+  }
+
+
+
+  /**
+   * Retrieves an initialized instance of the associated monitor provider.
+   *
+   * @return  An initialized instance of the associated monitor provider.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  public MonitorProvider getMonitorInstance()
+         throws Exception
+  {
+    SystemInfoMonitorProvider monitorProvider = new SystemInfoMonitorProvider();
+    monitorProvider.initializeMonitorProvider(configEntry);
+    return monitorProvider;
+  }
+}
+
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/TraditionalWorkQueueMonitorTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/TraditionalWorkQueueMonitorTestCase.java
new file mode 100644
index 0000000..da40209
--- /dev/null
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/TraditionalWorkQueueMonitorTestCase.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.monitors;
+
+
+
+import org.opends.server.api.MonitorProvider;
+import org.opends.server.core.DirectoryServer;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.monitors.TraditionalWorkQueueMonitor class.
+ */
+public class TraditionalWorkQueueMonitorTestCase
+       extends GenericMonitorTestCase
+{
+  /**
+   * Creates a new instance of this test case class.
+   *
+   * @throws  Exception  If an unexpected problem occurred.
+   */
+  public TraditionalWorkQueueMonitorTestCase()
+         throws Exception
+  {
+    super(null);
+  }
+
+
+
+  /**
+   * Retrieves an initialized instance of the associated monitor provider.
+   *
+   * @return  An initialized instance of the associated monitor provider.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  public MonitorProvider getMonitorInstance()
+         throws Exception
+  {
+    String monitorName = "work queue";
+    return DirectoryServer.getMonitorProvider(monitorName);
+  }
+}
+
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/VersionMonitorTestCase.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/VersionMonitorTestCase.java
new file mode 100644
index 0000000..1cd999f
--- /dev/null
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/monitors/VersionMonitorTestCase.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.monitors;
+
+
+
+import org.opends.server.api.MonitorProvider;
+
+
+
+/**
+ * This class defines a set of tests for the
+ * org.opends.server.monitors.VersionMonitorProvider class.
+ */
+public class VersionMonitorTestCase
+       extends GenericMonitorTestCase
+{
+  /**
+   * Creates a new instance of this test case class.
+   *
+   * @throws  Exception  If an unexpected problem occurred.
+   */
+  public VersionMonitorTestCase()
+         throws Exception
+  {
+    super("cn=Version,cn=Monitor Providers,cn=config");
+  }
+
+
+
+  /**
+   * Retrieves an initialized instance of the associated monitor provider.
+   *
+   * @return  An initialized instance of the associated monitor provider.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  public MonitorProvider getMonitorInstance()
+         throws Exception
+  {
+    VersionMonitorProvider monitorProvider = new VersionMonitorProvider();
+    monitorProvider.initializeMonitorProvider(configEntry);
+    return monitorProvider;
+  }
+}
+

--
Gitblit v1.10.0