public final class EmbeddedOpenDJ extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_WORKING_DIR_NAME
A default value for the working dir
|
static String |
PROPERTY_WORKING_DIR
The of the system property that specifies the target working directory, where OpenDJ do its business (db datas,
locks, logs, etc)
|
static boolean |
SERVER_STARTED |
Modifier and Type | Method and Description |
---|---|
static void |
addEntries(List<org.opends.server.types.Entry> entries)
Adds the provided set of entries to the Directory Server using internal operations.
|
static void |
addEntries(String... lines)
Adds the provided set of entries to the Directory Server using internal operations.
|
static org.opends.server.types.ResultCode |
addEntry(org.opends.server.types.Entry entry)
Adds the provided entry to the Directory Server using an internal operation.
|
static List<org.opends.server.types.Entry> |
entriesFromLdifString(String ldif)
Returns a modifiable List of entries parsed from the provided LDIF.
|
static org.opends.server.types.Entry |
entryFromLdifString(String ldif)
This is used as a convenience when and LDIF string only includes a single entry.
|
static String |
getPathToConfigFile(String fileName)
Search for a file in the possible configuration locations:
As a resource on the classpath (historical method)
As a file in the configuration directory
This method first looks on the classpath, then if that fails,
looks in the configuration directory.
|
static void |
importLdif(String ldif) |
static void |
initializeTestBackend(boolean createBaseEntry,
String dn) |
static void |
main(String[] args)
Test main class
|
static List<org.opends.server.types.Entry> |
makeEntries(String... lines)
This is a convience method that constructs an List of EntryS from the specified lines of LDIF.
|
static org.opends.server.types.Entry |
makeEntry(String... lines)
This is a convience method that constructs an Entry from the specified lines of LDIF.
|
static String |
makeLdif(String... lines)
This method provides the minor convenience of not having to specify the newline character at the end of every
line of LDIF in test code.
|
static void |
shutdownServer(String reason)
Sets the system context root to null.
|
static void |
startServer()
Initialize the server.
|
public static final String PROPERTY_WORKING_DIR
public static final String DEFAULT_WORKING_DIR_NAME
public static boolean SERVER_STARTED
public static void startServer() throws IOException, org.opends.server.types.InitializationException, URISyntaxException
IOException
org.opends.server.types.InitializationException
URISyntaxException
public static void shutdownServer(String reason)
reason
- Message to log when shutting downpublic static void main(String[] args)
args
- public static List<org.opends.server.types.Entry> entriesFromLdifString(String ldif) throws IOException, org.opends.server.util.LDIFException
Also take a look at the makeLdif method below since this makes expressing LDIF a little bit cleaner.
ldif
- of the entries to parse.IOException
org.opends.server.util.LDIFException
makeLdif(java.lang.String...)
public static org.opends.server.types.Entry entryFromLdifString(String ldif) throws Exception
Also take a look at the makeLdif method below since this makes expressing LDIF a little bit cleaner.
ldif
- Line of LDIFException
- If an unexpected problem occurs.makeLdif(java.lang.String...)
public static String makeLdif(String... lines)
private static final String JOHN_SMITH_LDIF = TestCaseUtils.makeLdif("dn: cn=John Smith,dc=example,dc=com", "objectclass: inetorgperson", "cn: John Smith", "sn: Smith", "givenname: John");is a
private static final String JOHN_SMITH_LDIF = "dn: cn=John Smith,dc=example,dc=com\n" + "objectclass: inetorgperson\n" + "cn: John Smith\n" + "sn: Smith\n" + "givenname: John\n";
lines
- Lines of LDIF without newline characterspublic static org.opends.server.types.Entry makeEntry(String... lines) throws Exception
Entry john = TestCaseUtils.makeEntry("dn: cn=John Smith,dc=example,dc=com", "objectclass: inetorgperson", "cn: John Smith", "sn: Smith", "givenname: John");
lines
- Lines of LDIFException
makeLdif(java.lang.String...)
public static List<org.opends.server.types.Entry> makeEntries(String... lines) throws org.opends.server.util.LDIFException, IOException
List<Entry> smiths = TestCaseUtils.makeEntries("dn: cn=John Smith,dc=example,dc=com", "objectclass: inetorgperson", "cn: John Smith", "sn: Smith", "givenname: John", "", "dn: cn=Jane Smith,dc=example,dc=com", "objectclass: inetorgperson", "cn: Jane Smith", "sn: Smith", "givenname: Jane");
lines
- Lines of LDIFIOException
org.opends.server.util.LDIFException
makeLdif(java.lang.String...)
public static org.opends.server.types.ResultCode addEntry(org.opends.server.types.Entry entry)
entry
- The entry to be added.public static void addEntries(List<org.opends.server.types.Entry> entries)
entries
- The entries to be added.public static void addEntries(String... lines) throws org.opends.server.util.LDIFException, IOException
lines
- The lines defining the entries to add. If there are multiple entries, then they should be separated
by blank lines.IOException
org.opends.server.util.LDIFException
public static void initializeTestBackend(boolean createBaseEntry, String dn) throws Exception
Exception
public static void importLdif(String ldif) throws IOException, org.opends.server.util.LDIFException
IOException
org.opends.server.util.LDIFException
public static String getPathToConfigFile(String fileName)
Search for a file in the possible configuration locations:
This method first looks on the classpath, then if that fails, looks in the configuration directory. Finally, it returns the absolute path name to the file.
.fileName
- Name of the file or directory to locate.Copyright © 2010-2022. All Rights Reserved.