org.apache.directory.server.unit
Class AbstractServerTest

java.lang.Object
  extended byTestCase
      extended byorg.apache.directory.server.unit.AbstractServerTest

public abstract class AbstractServerTest
extends TestCase

A simple testcase for testing JNDI provider functionality.

Version:
$Rev: 434418 $
Author:
Apache Directory Project
See Also:
Serialized Form

Field Summary
protected  MutableServerStartupConfiguration configuration
           
protected  boolean doDelete
          flag whether to delete database files for each test or not
protected  int port
           
protected  javax.naming.ldap.LdapContext sysRoot
          the context root for the system partition
 
Constructor Summary
AbstractServerTest()
           
 
Method Summary
protected  void doDelete(java.io.File wkdir)
          Deletes the Eve working directory.
protected  void importLdif(java.io.InputStream in)
          Imports the LDIF entries packaged with the Eve JNDI provider jar into the newly created system partition to prime it up for operation.
protected  javax.naming.ldap.LdapContext setSysRoot(java.util.Hashtable env)
          Sets the system root taking into account the extras and overrides properties.
protected  javax.naming.ldap.LdapContext setSysRoot(java.lang.String user, java.lang.String passwd)
          Sets and returns the system root.
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
 

Field Detail

sysRoot

protected javax.naming.ldap.LdapContext sysRoot
the context root for the system partition


doDelete

protected boolean doDelete
flag whether to delete database files for each test or not


configuration

protected MutableServerStartupConfiguration configuration

port

protected int port
Constructor Detail

AbstractServerTest

public AbstractServerTest()
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Get's the initial context factory for the provider's ou=system context root.

Throws:
java.lang.Exception
See Also:
junit.framework.TestCase#setUp()

doDelete

protected void doDelete(java.io.File wkdir)
                 throws java.io.IOException
Deletes the Eve working directory.

Throws:
java.io.IOException

setSysRoot

protected javax.naming.ldap.LdapContext setSysRoot(java.lang.String user,
                                                   java.lang.String passwd)
                                            throws javax.naming.NamingException
Sets and returns the system root. Values of user and password used to set the respective JNDI properties. These values can be overriden by the overrides properties.

Parameters:
user - the username for authenticating as this user
passwd - the password of the user
Returns:
the sysRoot context which is also set
Throws:
javax.naming.NamingException - if there is a failure of any kind

setSysRoot

protected javax.naming.ldap.LdapContext setSysRoot(java.util.Hashtable env)
                                            throws javax.naming.NamingException
Sets the system root taking into account the extras and overrides properties. In between these it sets the properties for the working directory, the provider URL and the JNDI InitialContexFactory to use.

Parameters:
env - an environment to use while setting up the system root.
Returns:
the sysRoot context which is also set
Throws:
javax.naming.NamingException - if there is a failure of any kind

tearDown

protected void tearDown()
                 throws java.lang.Exception
Sets the system context root to null.

Throws:
java.lang.Exception
See Also:
junit.framework.TestCase#tearDown()

importLdif

protected void importLdif(java.io.InputStream in)
                   throws javax.naming.NamingException
Imports the LDIF entries packaged with the Eve JNDI provider jar into the newly created system partition to prime it up for operation. Note that only ou=system entries will be added - entries for other partitions cannot be imported and will blow chunks.

Throws:
javax.naming.NamingException - if there are problems reading the ldif file and adding those entries to the system partition