org.apache.directory.server.integ.state
Class TestServerContext

java.lang.Object
  extended by org.apache.directory.server.integ.state.TestServerContext

public class TestServerContext
extends java.lang.Object

The context for managing the state of an integration test service. Each thread of execution driving tests manages it's own service context. Hence parallelism can be achieved while running integration tests.

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

Method Summary
static void cleanup()
          Action where an attempt is made to erase the contents of the working directory used by the service for various files including partition database files.
static void create(InheritableServerSettings settings)
          Action where an attempt is made to create the service.
static void destroy()
          Action where an attempt is made to destroy the service.
static TestServerContext get()
          Gets the TestServerContext associated with the current thread of execution.
static void revert()
          Action where an attempt is made to revert the service to it's initial start up state by using a previous snapshot.
static void set(TestServerContext context)
          Sets the TestServerContext for this current thread
static void shutdown()
          Action where an attempt is made to shutdown the service.
static void startup()
          Action where an attempt is made to start up the service.
static void test(org.junit.internal.runners.TestClass testClass, org.junit.internal.runners.TestMethod testMethod, org.junit.runner.notification.RunNotifier notifier, InheritableServerSettings settings)
          Action where an attempt is made to run a test against the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static TestServerContext get()
Gets the TestServerContext associated with the current thread of execution. If one does not yet exist it will be created.

Returns:
the context associated with the calling thread

set

public static void set(TestServerContext context)
Sets the TestServerContext for this current thread

Parameters:
context - the context associated with the calling thread

create

public static void create(InheritableServerSettings settings)
                   throws javax.naming.NamingException
Action where an attempt is made to create the service. Service creation in this system is the combined instantiation and configuration which takes place when the factory is used to get a new instance of the service.

Parameters:
settings - the settings for this test
Throws:
javax.naming.NamingException - if we can't create the service

destroy

public static void destroy()
Action where an attempt is made to destroy the service. This entails nulling out reference to it and triggering garbage collection.


cleanup

public static void cleanup()
                    throws java.io.IOException
Action where an attempt is made to erase the contents of the working directory used by the service for various files including partition database files.

Throws:
java.io.IOException - on errors while deleting the working directory

startup

public static void startup()
                    throws java.lang.Exception
Action where an attempt is made to start up the service.

Throws:
java.lang.Exception - on failures to start the core directory service

shutdown

public static void shutdown()
                     throws java.lang.Exception
Action where an attempt is made to shutdown the service.

Throws:
java.lang.Exception - on failures to stop the core directory service

test

public static void test(org.junit.internal.runners.TestClass testClass,
                        org.junit.internal.runners.TestMethod testMethod,
                        org.junit.runner.notification.RunNotifier notifier,
                        InheritableServerSettings settings)
Action where an attempt is made to run a test against the service.

Parameters:
testClass - the class whose test method is to be run
testMethod - the test method which is to be run
notifier - a notifier to report failures to
settings - the inherited settings and annotations associated with the test method

revert

public static void revert()
                   throws java.lang.Exception
Action where an attempt is made to revert the service to it's initial start up state by using a previous snapshot.

Throws:
java.lang.Exception - on failures to revert the state of the core directory service


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