public abstract class AbstractLDAPTest extends Object
| Modifier and Type | Field and Description |
|---|---|
protected DirectoryService |
directoryService |
protected LdapServer |
ldapServer |
protected CoreSession |
rootDSE
the context root for the rootDSE
|
protected LdapContext |
schemaRoot
the context root for the schema
|
protected LdapContext |
sysRoot
the context root for the system partition
|
| Constructor and Description |
|---|
AbstractLDAPTest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addIndex(Partition partition,
String... attrs)
Add a new set of index on the given attributes
|
protected void |
configureLdapData()
configure here test specific data ,load LDIF files
|
protected void |
configureLdapServer(LdapServer ldapServer)
register some dynamic mappings
|
protected abstract Partition |
configurePartition()
prepare partition , be aware at this method
DirectoryService is not started yet so no session will be
available |
protected Partition |
createPartition(String partitionId,
String partitionDn)
creates new
JdbmPartition partition and registers for it defeault set of mappings using current directory
service e.g. |
protected void |
doDelete(File wkdir)
Deletes the Eve working directory.
|
protected String |
getAuthenticationType() |
protected String |
getLDAPCredenetial() |
protected abstract String |
getLDAPHost()
ldap host domain name/IP
|
protected String |
getLDAPPassword() |
protected abstract int |
getLDAPPort()
port to listen ldap for either embedded or external
|
protected LdapContext |
getWiredContext()
Common code to get an initial context via a simple bind to the server over the wire using the SUN JNDI LDAP
provider.
|
protected LdapContext |
getWiredContext(String bindPrincipalDn,
String password)
Common code to get an initial context via a simple bind to the server over the wire using the SUN JNDI LDAP
provider.
|
protected File |
getWorkingDirectory()
configure custom working directory here
|
protected void |
importLdif(InputStream inputStream)
Imports the LDIF entries packaged with the Eve JNDI provider jar into the newly created system partition to prime
it up for operation.
|
protected void |
injectEntries(String ldif)
Inject an ldif String into the server.
|
protected boolean |
isDeleteLDAPServer()
flag whether to delete database files for each test or not
|
protected boolean |
isEmbeddedLdap() |
protected List<LdifEntry> |
loadLdif(InputStream inputStream,
boolean verifyEntries)
Loads an LDIF from an input stream and adds the entries it congtains to the server.
|
protected List<LdifEntry> |
loadTestLdif(boolean verifyEntries)
If there is an LDIF file with the same name as the test class but with the .ldif extension then it is read and the
entries it contains are added to the server.
|
protected void |
setContexts(Hashtable<String,Object> env)
Sets the contexts of this class taking into account the extras and overrides properties.
|
protected void |
setContexts(String user,
String passwd)
Sets the contexts for this base class.
|
void |
setUp()
Get's the initial context factory for the provider's ou=system context root.
|
void |
tearDown()
Sets the system context root to null.
|
static void |
tearDownLogger() |
protected void |
verify(LdifEntry entry)
Verifies that an entry exists in the directory with the specified attributes.
|
protected LdapContext sysRoot
protected CoreSession rootDSE
protected LdapContext schemaRoot
protected DirectoryService directoryService
protected LdapServer ldapServer
protected abstract int getLDAPPort()
protected abstract String getLDAPHost()
protected boolean isDeleteLDAPServer()
protected boolean isEmbeddedLdap()
protected String getLDAPCredenetial()
protected String getLDAPPassword()
protected String getAuthenticationType()
protected List<LdifEntry> loadTestLdif(boolean verifyEntries) throws Exception
verifyEntries - whether or not all entry additions are checked to see if they were in fact correctly added to the serverNamingException - of the load failsExceptionprotected List<LdifEntry> loadLdif(InputStream inputStream, boolean verifyEntries) throws Exception
inputStream - the input stream containing the LDIF entries to loadverifyEntries - whether or not all entry additions are checked to see if they were in fact correctly added to the serverNamingException - of the load failsExceptionprotected void verify(LdifEntry entry)
throws Exception
entry - the entry to verifyNamingException - if there are problems accessing the entryExceptionprotected LdapContext getWiredContext() throws Exception
NamingException - if the server cannot be contactedExceptionprotected LdapContext getWiredContext(String bindPrincipalDn, String password) throws Exception
bindPrincipalDn - the DN of the principal to bind aspassword - the password of the bind principalNamingException - if the server cannot be contactedExceptionpublic void setUp()
throws Exception
Exceptionjunit.framework.TestCase#setUp()protected File getWorkingDirectory()
protected abstract Partition configurePartition()
throws Exception
DirectoryService is not started yet so no session will be
availableExceptionprotected void configureLdapServer(LdapServer ldapServer)
throws Exception
Exceptionprotected void configureLdapData()
throws Exception
Exceptionprotected void doDelete(File wkdir) throws IOException
wkdir - the directory to deleteIOException - if the directory cannot be deletedprotected void setContexts(String user, String passwd) throws Exception
user - the username for authenticating as this userpasswd - the password of the userNamingException - if there is a failure of any kindExceptionprotected void setContexts(Hashtable<String,Object> env) throws Exception
env - an environment to use while setting up the system root.NamingException - if there is a failure of any kindExceptionpublic void tearDown()
throws Exception
Exceptionjunit.framework.TestCase#tearDown()protected void importLdif(InputStream inputStream) throws NamingException
NamingException - if there are problems reading the ldif file and adding those entries to the system partition in
attribute the input stream with the ldifprotected void injectEntries(String ldif) throws Exception
ldif - the entries to injectNamingException - if the entries cannot be addedExceptionprotected Partition createPartition(String partitionId, String partitionDn) throws Exception
JdbmPartition partition and registers for it defeault set of mappings using current directory
service e.g. : addPartition("hybris", "dc=hybris,dc=de"); with optional indexed attributes values e.g. :
addPartition("hybris", "dc=hybris,dc=de","objectClass", "dc");Exceptionprotected void addIndex(Partition partition,
String... attrs)
partition - The partition on which we want to add indexattrs - The list of attributes to indexpublic static void tearDownLogger()
Copyright © 2017 SAP SE. All Rights Reserved.