org.apache.directory.server.core.integ
Class IntegrationUtils

java.lang.Object
  extended by org.apache.directory.server.core.integ.IntegrationUtils
Direct Known Subclasses:
ServerIntegrationUtils

public class IntegrationUtils
extends java.lang.Object

Integration test utility methods.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
IntegrationUtils()
           
 
Method Summary
static void apply(DirectoryService service, org.apache.directory.shared.ldap.ldif.LdifEntry entry)
           
static void closeConections()
           
static void disableSchema(DirectoryService service, java.lang.String schemaName)
           
static void doDelete(java.io.File wkdir)
          Deletes the working directory.
static void enableSchema(DirectoryService service, java.lang.String schemaName)
           
static org.apache.directory.ldap.client.api.LdapConnection getAdminConnection(LdapServer ldapServer)
          gets a LdapConnection bound using the default admin DN uid=admin,ou=system and password "secret"
static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(LdapServer ldapServer, org.apache.directory.shared.ldap.name.DN dn, java.lang.String password)
           
static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(LdapServer ldapServer, java.lang.String dn, java.lang.String password)
           
static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(java.lang.String host, int port, java.lang.String dn, java.lang.String password)
           
static javax.naming.ldap.LdapContext getContext(java.lang.String principalDn, DirectoryService service, java.lang.String dn)
           
static CoreSession getCoreSession(java.lang.String principalDn, DirectoryService service, java.lang.String dn)
           
static javax.naming.ldap.LdapContext getRootContext(DirectoryService service)
           
static javax.naming.ldap.LdapContext getSchemaContext(DirectoryService service)
           
static javax.naming.ldap.LdapContext getSystemContext(DirectoryService service)
           
static org.apache.directory.shared.ldap.ldif.LdifEntry getUserAddLdif()
           
static org.apache.directory.shared.ldap.ldif.LdifEntry getUserAddLdif(java.lang.String dnstr, byte[] password, java.lang.String cn, java.lang.String sn)
           
static void injectEntries(DirectoryService service, java.lang.String ldif)
          Inject an ldif String into the server.
static boolean isDisabled(DirectoryService service, java.lang.String schemaName)
          A helper method which tells if a schema is disabled.
static boolean isEnabled(DirectoryService service, java.lang.String schemaName)
          A helper method which tells if a schema is enabled.
static boolean isLoaded(DirectoryService service, java.lang.String schemaName)
          A helper method which tells if a schema is loaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegrationUtils

public IntegrationUtils()
Method Detail

doDelete

public static void doDelete(java.io.File wkdir)
                     throws java.io.IOException
Deletes the working directory.

Parameters:
wkdir - the working directory to delete
Throws:
java.io.IOException - if the working directory cannot be deleted

injectEntries

public static void injectEntries(DirectoryService service,
                                 java.lang.String ldif)
                          throws java.lang.Exception
Inject an ldif String into the server. DN must be relative to the root.

Parameters:
service - the directory service to use
ldif - the ldif containing entries to add to the server.
Throws:
javax.naming.NamingException - if there is a problem adding the entries from the LDIF
java.lang.Exception

getUserAddLdif

public static org.apache.directory.shared.ldap.ldif.LdifEntry getUserAddLdif()
                                                                      throws org.apache.directory.shared.ldap.exception.LdapException
Throws:
org.apache.directory.shared.ldap.exception.LdapException

getContext

public static javax.naming.ldap.LdapContext getContext(java.lang.String principalDn,
                                                       DirectoryService service,
                                                       java.lang.String dn)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getCoreSession

public static CoreSession getCoreSession(java.lang.String principalDn,
                                         DirectoryService service,
                                         java.lang.String dn)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getSystemContext

public static javax.naming.ldap.LdapContext getSystemContext(DirectoryService service)
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

getSchemaContext

public static javax.naming.ldap.LdapContext getSchemaContext(DirectoryService service)
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

getRootContext

public static javax.naming.ldap.LdapContext getRootContext(DirectoryService service)
                                                    throws java.lang.Exception
Throws:
java.lang.Exception

apply

public static void apply(DirectoryService service,
                         org.apache.directory.shared.ldap.ldif.LdifEntry entry)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getUserAddLdif

public static org.apache.directory.shared.ldap.ldif.LdifEntry getUserAddLdif(java.lang.String dnstr,
                                                                             byte[] password,
                                                                             java.lang.String cn,
                                                                             java.lang.String sn)
                                                                      throws org.apache.directory.shared.ldap.exception.LdapException
Throws:
org.apache.directory.shared.ldap.exception.LdapException

enableSchema

public static void enableSchema(DirectoryService service,
                                java.lang.String schemaName)
                         throws java.lang.Exception
Throws:
java.lang.Exception

disableSchema

public static void disableSchema(DirectoryService service,
                                 java.lang.String schemaName)
                          throws java.lang.Exception
Throws:
java.lang.Exception

isDisabled

public static boolean isDisabled(DirectoryService service,
                                 java.lang.String schemaName)
A helper method which tells if a schema is disabled.


isLoaded

public static boolean isLoaded(DirectoryService service,
                               java.lang.String schemaName)
A helper method which tells if a schema is loaded.


isEnabled

public static boolean isEnabled(DirectoryService service,
                                java.lang.String schemaName)
A helper method which tells if a schema is enabled. A shema must be loaded and enabled.


getAdminConnection

public static org.apache.directory.ldap.client.api.LdapConnection getAdminConnection(LdapServer ldapServer)
                                                                              throws java.lang.Exception
gets a LdapConnection bound using the default admin DN uid=admin,ou=system and password "secret"

Throws:
java.lang.Exception

getConnectionAs

public static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(LdapServer ldapServer,
                                                                                  java.lang.String dn,
                                                                                  java.lang.String password)
                                                                           throws java.lang.Exception
Throws:
java.lang.Exception

getConnectionAs

public static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(LdapServer ldapServer,
                                                                                  org.apache.directory.shared.ldap.name.DN dn,
                                                                                  java.lang.String password)
                                                                           throws java.lang.Exception
Throws:
java.lang.Exception

getConnectionAs

public static org.apache.directory.ldap.client.api.LdapConnection getConnectionAs(java.lang.String host,
                                                                                  int port,
                                                                                  java.lang.String dn,
                                                                                  java.lang.String password)
                                                                           throws java.lang.Exception
Throws:
java.lang.Exception

closeConections

public static void closeConections()


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.