|
Spring LDAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.ldap.test.LdapTestUtils
public class LdapTestUtils
Utilities for starting, stopping and populating an in-process Apache Directory Server to use for integration testing purposes.
Field Summary | |
---|---|
static String |
DEFAULT_PASSWORD
|
static String |
DEFAULT_PRINCIPAL
|
Method Summary | |
---|---|
static void |
cleanAndSetup(ContextSource contextSource,
DistinguishedName rootNode,
Resource ldifFile)
|
static void |
clearSubContexts(ContextSource contextSource,
Name name)
Clear the directory sub-tree starting with the node represented by the supplied distinguished name. |
static void |
clearSubContexts(DirContext ctx,
Name name)
Clear the directory sub-tree starting with the node represented by the supplied distinguished name. |
static void |
destroyApacheDirectoryServer(String principal,
String credentials)
Deprecated. use shutdownEmbeddedServer() instead. |
static void |
loadLdif(ContextSource contextSource,
Resource ldifFile)
Load an Ldif file into an LDAP server. |
static void |
loadLdif(org.apache.directory.server.core.DefaultDirectoryService directoryService,
Resource ldifFile)
|
static void |
shutdownEmbeddedServer()
Shuts down the embedded server, if there is one. |
static DirContext |
startApacheDirectoryServer(int port,
String defaultPartitionSuffix,
String defaultPartitionName,
String principal,
String credentials)
Deprecated. use startEmbeddedServer(int, String, String) instead. |
static DirContext |
startApacheDirectoryServer(int port,
String defaultPartitionSuffix,
String defaultPartitionName,
String principal,
String credentials,
Set extraSchemas)
Deprecated. use startEmbeddedServer(int, String, String) instead. |
static void |
startEmbeddedServer(int port,
String defaultPartitionSuffix,
String defaultPartitionName)
Start an embedded Apache Directory Server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_PRINCIPAL
public static final String DEFAULT_PASSWORD
Method Detail |
---|
public static DirContext startApacheDirectoryServer(int port, String defaultPartitionSuffix, String defaultPartitionName, String principal, String credentials, Set extraSchemas) throws NamingException
startEmbeddedServer(int, String, String)
instead.
port
- the port on which the server will be listening.defaultPartitionSuffix
- The default base suffix that will be used
for the LDAP server.defaultPartitionName
- The name to use in the directory server
configuration for the default base suffix.principal
- The principal to use when starting the directory server.credentials
- The credentials to use when starting the directory
server.extraSchemas
- Set of extra schemas to add to the bootstrap schemas
of ApacheDS. May be null
.
NamingException
- If anything goes wrong when starting the server.public static void startEmbeddedServer(int port, String defaultPartitionSuffix, String defaultPartitionName)
port
- the port on which the server will be listening.defaultPartitionSuffix
- The default base suffix that will be used
for the LDAP server.defaultPartitionName
- The name to use in the directory server
configuration for the default base suffix.
IllegalStateException
- if an embedded server is already started.public static DirContext startApacheDirectoryServer(int port, String defaultPartitionSuffix, String defaultPartitionName, String principal, String credentials) throws NamingException
startEmbeddedServer(int, String, String)
instead.
NamingException
public static void shutdownEmbeddedServer() throws Exception
Exception
public static void destroyApacheDirectoryServer(String principal, String credentials) throws Exception
shutdownEmbeddedServer()
instead.
principal
- the principal to be used for authentication.credentials
- the credentials to be used for authentication.
Exception
- If anything goes wrong when shutting down the server.public static void clearSubContexts(ContextSource contextSource, Name name) throws NamingException
contextSource
- the ContextSource to use for getting a DirContext.name
- the distinguished name of the root node.
NamingException
- if anything goes wrong removing the sub-tree.public static void clearSubContexts(DirContext ctx, Name name) throws NamingException
ctx
- The DirContext to use for cleaning the tree.name
- the distinguished name of the root node.
NamingException
- if anything goes wrong removing the sub-tree.public static void loadLdif(ContextSource contextSource, Resource ldifFile) throws IOException
contextSource
- ContextSource to use for getting a DirContext to
interact with the LDAP server.ldifFile
- a Resource representing a valid LDIF file.
IOException
- if the Resource cannot be read.public static void cleanAndSetup(ContextSource contextSource, DistinguishedName rootNode, Resource ldifFile) throws NamingException, IOException
NamingException
IOException
public static void loadLdif(org.apache.directory.server.core.DefaultDirectoryService directoryService, Resource ldifFile) throws IOException
IOException
|
Spring LDAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |