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

java.lang.Object
  extended by org.apache.directory.server.core.integ.state.AbstractState
      extended by org.apache.directory.server.core.integ.state.NonExistentState
All Implemented Interfaces:
TestServiceState

public class NonExistentState
extends AbstractState

The state of a test service when it has not yet been created.

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

Field Summary
 
Fields inherited from class org.apache.directory.server.core.integ.state.AbstractState
context
 
Constructor Summary
NonExistentState(TestServiceContext context)
          Creates a new instance of NonExistentState.
 
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 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)
          This method is a bit different.
 
Methods inherited from class org.apache.directory.server.core.integ.state.AbstractState
destroy, injectLdifs, revert, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonExistentState

public NonExistentState(TestServiceContext context)
Creates a new instance of NonExistentState.

Parameters:
context - the test 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
Overrides:
create in class AbstractState
Parameters:
settings - The inherited settings
Throws:
javax.naming.NamingException - if we can't create the service

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
Overrides:
cleanup in class AbstractState
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
Overrides:
startup in class AbstractState
Throws:
java.lang.Exception - on failures to start 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)
This method is a bit different. Consider this method to hold the logic which is needed to shift the context state from the present state to a started state so we can call test on the current state of the context. Basically if the service is not needed or the test is ignored, then we just invoke the test: if ignored the test is not dealt with by the MethodRoadie run method. In tests not ignored requiring setup modes RESTART and CUMULATIVE we simply create the service and start it up without a cleanup. In the PRISTINE and ROLLBACK modes we do the same but cleanup() before a restart.

Specified by:
test in interface TestServiceState
Overrides:
test in class AbstractState
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
See Also:
TestServiceState.test(TestClass, TestMethod, RunNotifier, InheritableSettings)


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