public abstract class AbstractLDAPTest
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected DirectoryService |
directoryService |
protected LdapServer |
ldapServer |
protected CoreSession |
rootDSE
the context root for the rootDSE
|
protected javax.naming.ldap.LdapContext |
schemaRoot
the context root for the schema
|
protected javax.naming.ldap.LdapContext |
sysRoot
the context root for the system partition
|
| Constructor and Description |
|---|
AbstractLDAPTest() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addIndex(Partition partition,
java.lang.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(java.lang.String partitionId,
java.lang.String partitionDn)
creates new
JdbmPartition partition and registers for it defeault set of mappings using current directory
service e.g. |
protected void |
doDelete(java.io.File wkdir)
Deletes the Eve working directory.
|
protected java.lang.String |
getAuthenticationType() |
protected java.lang.String |
getLDAPCredenetial() |
protected abstract java.lang.String |
getLDAPHost()
ldap host domain name/IP
|
protected java.lang.String |
getLDAPPassword() |
protected abstract int |
getLDAPPort()
port to listen ldap for either embedded or external
|
protected javax.naming.ldap.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 javax.naming.ldap.LdapContext |
getWiredContext(java.lang.String bindPrincipalDn,
java.lang.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 java.io.File |
getWorkingDirectory()
configure custom working directory here
|
protected void |
importLdif(java.io.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(java.lang.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 java.util.List<LdifEntry> |
loadLdif(java.io.InputStream inputStream,
boolean verifyEntries)
Loads an LDIF from an input stream and adds the entries it congtains to the server.
|
protected java.util.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(java.util.Hashtable<java.lang.String,java.lang.Object> env)
Sets the contexts of this class taking into account the extras and overrides properties.
|
protected void |
setContexts(java.lang.String user,
java.lang.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 javax.naming.ldap.LdapContext sysRoot
protected CoreSession rootDSE
protected javax.naming.ldap.LdapContext schemaRoot
protected DirectoryService directoryService
protected LdapServer ldapServer
protected abstract int getLDAPPort()
protected abstract java.lang.String getLDAPHost()
protected boolean isDeleteLDAPServer()
protected boolean isEmbeddedLdap()
protected java.lang.String getLDAPCredenetial()
protected java.lang.String getLDAPPassword()
protected java.lang.String getAuthenticationType()
protected java.util.List<LdifEntry> loadTestLdif(boolean verifyEntries)
throws java.lang.Exception
verifyEntries - whether or not all entry additions are checked to see if they were in fact correctly added to the serverjavax.naming.NamingException - of the load failsjava.lang.Exceptionprotected java.util.List<LdifEntry> loadLdif(java.io.InputStream inputStream,
boolean verifyEntries)
throws java.lang.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 serverjavax.naming.NamingException - of the load failsjava.lang.Exceptionprotected void verify(LdifEntry entry)
throws java.lang.Exception
entry - the entry to verifyjavax.naming.NamingException - if there are problems accessing the entryjava.lang.Exceptionprotected javax.naming.ldap.LdapContext getWiredContext()
throws java.lang.Exception
javax.naming.NamingException - if the server cannot be contactedjava.lang.Exceptionprotected javax.naming.ldap.LdapContext getWiredContext(java.lang.String bindPrincipalDn,
java.lang.String password)
throws java.lang.Exception
bindPrincipalDn - the DN of the principal to bind aspassword - the password of the bind principaljavax.naming.NamingException - if the server cannot be contactedjava.lang.Exceptionpublic void setUp()
throws java.lang.Exception
java.lang.Exceptionjunit.framework.TestCase#setUp()protected java.io.File getWorkingDirectory()
protected abstract Partition configurePartition()
throws java.lang.Exception
DirectoryService is not started yet so no session will be
availablejava.lang.Exceptionprotected void configureLdapServer(LdapServer ldapServer)
throws java.lang.Exception
java.lang.Exceptionprotected void configureLdapData()
throws java.lang.Exception
java.lang.Exceptionprotected void doDelete(java.io.File wkdir)
throws java.io.IOException
wkdir - the directory to deletejava.io.IOException - if the directory cannot be deletedprotected void setContexts(java.lang.String user,
java.lang.String passwd)
throws java.lang.Exception
user - the username for authenticating as this userpasswd - the password of the userjavax.naming.NamingException - if there is a failure of any kindjava.lang.Exceptionprotected void setContexts(java.util.Hashtable<java.lang.String,java.lang.Object> env)
throws java.lang.Exception
env - an environment to use while setting up the system root.javax.naming.NamingException - if there is a failure of any kindjava.lang.Exceptionpublic void tearDown()
throws java.lang.Exception
java.lang.Exceptionjunit.framework.TestCase#tearDown()protected void importLdif(java.io.InputStream inputStream)
throws javax.naming.NamingException
javax.naming.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(java.lang.String ldif)
throws java.lang.Exception
ldif - the entries to injectjavax.naming.NamingException - if the entries cannot be addedjava.lang.Exceptionprotected Partition createPartition(java.lang.String partitionId,
java.lang.String partitionDn)
throws java.lang.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");java.lang.Exceptionprotected void addIndex(Partition partition,
java.lang.String... attrs)
partition - The partition on which we want to add indexattrs - The list of attributes to indexpublic static void tearDownLogger()
Copyright © 2018 SAP SE. All Rights Reserved.