org.apache.directory.server.core.factory
Class DSAnnotationProcessor

java.lang.Object
  extended by org.apache.directory.server.core.factory.DSAnnotationProcessor

public class DSAnnotationProcessor
extends java.lang.Object

A Helper class used to create a DS from the annotations

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

Constructor Summary
DSAnnotationProcessor()
           
 
Method Summary
static void applyLdifs(org.junit.runner.Description desc, DirectoryService service)
          Apply the LDIF entries to the given service
static DirectoryService getDirectoryService()
          Create a DirectoryService from an annotation.
static DirectoryService getDirectoryService(org.junit.runner.Description description)
          Create a DirectoryService from a Unit test annotation
static void injectEntries(DirectoryService service, java.lang.String ldif)
          Inject an ldif String into the server.
static void injectLdifFiles(java.lang.Class<?> clazz, DirectoryService service, java.lang.String[] ldifFiles)
          injects the LDIF entries present in a LDIF file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSAnnotationProcessor

public DSAnnotationProcessor()
Method Detail

getDirectoryService

public static DirectoryService getDirectoryService(org.junit.runner.Description description)
                                            throws java.lang.Exception
Create a DirectoryService from a Unit test annotation

Parameters:
description - The annotations containing the info from which we will create the DS
Returns:
A valid DS
Throws:
java.lang.Exception

getDirectoryService

public static DirectoryService getDirectoryService()
                                            throws java.lang.Exception
Create a DirectoryService from an annotation. The @CreateDS annotation must be associated with either the method or the encapsulating class. We will first try to get the annotation from the method, and if there is none, then we try at the class level.

Returns:
A valid DS
Throws:
java.lang.Exception

injectLdifFiles

public static void injectLdifFiles(java.lang.Class<?> clazz,
                                   DirectoryService service,
                                   java.lang.String[] ldifFiles)
                            throws java.lang.Exception
injects the LDIF entries present in a LDIF file

Parameters:
service - the DirectoryService
ldifFiles - the array of LDIF file names (only )
Throws:
java.lang.Exception

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

applyLdifs

public static void applyLdifs(org.junit.runner.Description desc,
                              DirectoryService service)
                       throws java.lang.Exception
Apply the LDIF entries to the given service

Throws:
java.lang.Exception


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