org.apache.directory.server.core.unit
Class AbstractPerformanceTest
java.lang.Object
TestCase
org.apache.directory.server.core.unit.AbstractTestCase
org.apache.directory.server.core.unit.AbstractPerformanceTest
public class AbstractPerformanceTest
- extends AbstractTestCase
A base testcase is used to create test harnesses for running performance
metrics on ApacheDS and other servers. It provides a framework for running
tests and capturing the results of individual operations against the
directory.
This test case does a few things out of the box to make life easier for those
that want to run performance tests against an LDAP server. These are listed
below:
-
Uses the presence of a system property, 'external', to bypass the
creation of an embedded ApacheDS instance. If the external property
is defined, a properties file by the name of the test case with the
.properties extension is searched for on the classpath. If found this
properties file is loaded and those parameters are used to connect to
the LDAP server by feeding those properties into the InitialContext's
environment argument. If the properties file is not found, smart
defaults are used instead to connect to some external LDAP server.
Uses an external.prepare.command system property to execute a command
between test cases. Execution occurs before any test is run. This
command should stop a server if it is running, clean out the database
contents, and restart the server readying it for another run.
-
Automatically searches for an LDIF file with the same name as the current
test case. This file is loaded for each test case after loading a
common.ldif file if it is present on the classpath. The test case can be
told to disable this LDIF file loading for both the common.ldif and the
.ldif file.
-
The performance test reports statistics to the console. Each operation
being perform is logged with timing information. The time for each LDIF
operation is also tracked. The statistics are also compiled into a
output formated file.
-
After LDIF loads, test cases run. These test cases can issue various
additional operations which get logged.
- Version:
- $Rev$
- Author:
- Apache Directory Project
Constructor Summary |
protected |
AbstractPerformanceTest(java.lang.Class subclass)
Initializes the statistics log PrintWriter. |
Method Summary |
protected boolean |
applyEntry(Entry entry)
Only supports add operations at this point. |
protected void |
setUp()
Get's the initial context factory for the provider's ou=system context
root. |
protected void |
tearDown()
Sets the system context root to null. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractPerformanceTest
protected AbstractPerformanceTest(java.lang.Class subclass)
throws java.io.IOException
- Initializes the statistics log PrintWriter.
- Parameters:
subclass
-
- Throws:
java.io.IOException
setUp
protected void setUp()
throws java.lang.Exception
- Description copied from class:
AbstractTestCase
- Get's the initial context factory for the provider's ou=system context
root.
- Overrides:
setUp
in class AbstractTestCase
- Throws:
java.lang.Exception
- See Also:
junit.framework.TestCase#setUp()
tearDown
protected void tearDown()
throws java.lang.Exception
- Description copied from class:
AbstractTestCase
- Sets the system context root to null.
- Overrides:
tearDown
in class AbstractTestCase
- Throws:
java.lang.Exception
- See Also:
junit.framework.TestCase#tearDown()
applyEntry
protected boolean applyEntry(Entry entry)
throws java.lang.Exception
- Only supports add operations at this point.
- Parameters:
entry
- the LDIF entry being applied
- Throws:
java.lang.Exception