org.apache.directory.server.core.integ.state
Class AbstractState

java.lang.Object
  extended by org.apache.directory.server.core.integ.state.AbstractState
All Implemented Interfaces:
TestServiceState
Direct Known Subclasses:
NonExistentState, StartedNormalState, StartedPristineState

public abstract class AbstractState
extends java.lang.Object
implements TestServiceState

The abstract state of a test service, containing the default state transitions

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

Field Summary
protected  TestServiceContext context
          The context for this test
 
Constructor Summary
protected AbstractState(TestServiceContext context)
          Creates a new instance of AbstractState.
 
Method Summary
 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.
 void create(InheritableSettings settings)
          Action where an attempt is made to create the service.
 void destroy()
          Action where an attempt is made to destroy the service.
protected  void injectLdifs(DirectoryService service, InheritableSettings settings)
          Inject the Ldifs if any
 void revert()
          Action where an attempt is made to revert the service to it's initial start up state by using a previous snapshot.
 void shutdown()
          Action where an attempt is made to shutdown the service.
 void startup()
          Action where an attempt is made to start up the service.
 void test(org.junit.internal.runners.TestClass testClass, org.junit.internal.runners.TestMethod testMethod, org.junit.runner.notification.RunNotifier notifier, InheritableSettings 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
 

Field Detail

context

protected final TestServiceContext context
The context for this test

Constructor Detail

AbstractState

protected AbstractState(TestServiceContext context)
Creates a new instance of AbstractState.

Parameters:
context - The associated context
Method Detail

create

public void create(InheritableSettings 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.

Specified by:
create in interface TestServiceState
Parameters:
settings - The inherited settings
Throws:
javax.naming.NamingException - if we can't create the service

destroy

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

Specified by:
destroy in interface TestServiceState

cleanup

public 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.

Specified by:
cleanup in interface TestServiceState
Throws:
java.io.IOException - on errors while deleting the working directory

startup

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

Specified by:
startup in interface TestServiceState
Throws:
java.lang.Exception - on failures to start the core directory service

shutdown

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

Specified by:
shutdown in interface TestServiceState
Throws:
java.lang.Exception - on failures to stop the core directory service

test

public void test(org.junit.internal.runners.TestClass testClass,
                 org.junit.internal.runners.TestMethod testMethod,
                 org.junit.runner.notification.RunNotifier notifier,
                 InheritableSettings settings)
Action where an attempt is made to run a test against the service. All annotations should have already been processed for InheritableSettings yet they and others can be processed since we have access to the method annotations below

Specified by:
test in interface TestServiceState
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 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.

Specified by:
revert in interface TestServiceState
Throws:
java.lang.Exception - on failures to revert the state of the core directory service

injectLdifs

protected void injectLdifs(DirectoryService service,
                           InheritableSettings settings)
Inject the Ldifs if any

Parameters:
service - the instantiated directory service
settings - the settings containing the ldif


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