directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r600254 - in /directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ: ./ state/
Date Sun, 02 Dec 2007 07:29:06 GMT
Author: akarasulu
Date: Sat Dec  1 23:29:04 2007
New Revision: 600254

URL: http://svn.apache.org/viewvc?rev=600254&view=rev
Log:
added inheritable settings and figured out method signatures for state changes

Added:
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/InheritableSettings.java
Modified:
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceState.java

Added: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/InheritableSettings.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/InheritableSettings.java?rev=600254&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/InheritableSettings.java
(added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/InheritableSettings.java
Sat Dec  1 23:29:04 2007
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.core.integ;
+
+
+import org.apache.directory.server.core.integ.annotations.Mode;
+import org.apache.directory.server.core.integ.annotations.Factory;
+import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
+import org.apache.directory.server.core.integ.annotations.ApplyLdifFiles;
+
+import org.junit.runner.Description;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+/**
+ * Inheritable settings of a test suite, test class, or test method.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class InheritableSettings
+{
+    /** the default setup mode to use if inheritence leads to null value */
+    public static final SetupMode DEFAULT_MODE = SetupMode.ROLLBACK;
+    /** the default factory to use if inheritence leads to a null value */
+    public static final DirectoryServiceFactory DEFAULT_FACTORY = DirectoryServiceFactory.DEFAULT;
+
+    /** parent settings to inherit from */
+    private final InheritableSettings parent;
+    /** junit test description containing all annotations queried */
+    private final Description description;
+
+
+    /**
+     * Creates a new InheritableSettings instance for test suites description.
+     *
+     * @param description junit description for the suite
+     */
+    public InheritableSettings( Description description )
+    {
+        this.description = description;
+        this.parent = null;
+
+        if ( ! description.isSuite() )
+        {
+            throw new IllegalStateException( String.format( "%s is not a suite! It requires
parent settings.",
+                    description.getDisplayName() ) );
+        }
+    }
+
+
+    /**
+     * Creates a new InheritableSettings instance based on a test object's
+     * description and it's parent's settings.
+     *
+     * @param description junit description for the test object
+     * @param parent the parent settings or null if the test entity is a suite
+     */
+    public InheritableSettings( Description description, InheritableSettings parent )
+    {
+        this.description = description;
+        this.parent = parent;
+
+        if ( description.isSuite() && ! isSuiteLevel() )
+        {
+            throw new IllegalStateException( String.format( "The parent must be null for
%s suite",
+                    description.getDisplayName() ) );
+        }
+    }
+
+
+    public Description getDescription()
+    {
+        return description;
+    }
+
+
+    public InheritableSettings getParent()
+    {
+        return parent;
+    }
+
+
+    public boolean isSuiteLevel()
+    {
+        return parent == null;
+    }
+
+
+    public boolean isClassLevel()
+    {
+        return parent != null && parent.getParent() == null;
+    }
+
+
+    public boolean isMethodLevel()
+    {
+        return parent != null && parent.getParent() != null;
+    }
+
+
+    public SetupMode getMode()
+    {
+        SetupMode parentMode = DEFAULT_MODE;
+        if ( parent != null )
+        {
+            parentMode = parent.getMode();
+        }
+
+        Mode annotation = description.getAnnotation( Mode.class );
+        if ( annotation == null )
+        {
+            return parentMode;
+        }
+        else
+        {
+            return annotation.value();
+        }
+    }
+
+
+    public DirectoryServiceFactory getFactory() throws IllegalAccessException, InstantiationException
+    {
+        DirectoryServiceFactory parentFactory = DEFAULT_FACTORY;
+        if ( parent != null )
+        {
+            parentFactory = parent.getFactory();
+        }
+
+        Factory annotation = description.getAnnotation( Factory.class );
+        if ( annotation == null )
+        {
+            return parentFactory;
+        }
+        else
+        {
+            return ( DirectoryServiceFactory ) annotation.value().newInstance();
+        }
+    }
+
+
+    public List<String> getLdifs( List<String> ldifs )
+    {
+        if ( ldifs == null )
+        {
+            ldifs = new ArrayList<String>();
+        }
+
+        if ( parent != null )
+        {
+            parent.getLdifs( ldifs );
+        }
+
+        ApplyLdifs annotation = description.getAnnotation( ApplyLdifs.class );
+        if ( annotation != null && annotation.value() != null )
+        {
+            ldifs.addAll( Arrays.asList( annotation.value() ) );
+        }
+
+        return ldifs;
+    }
+
+
+    public List<String> getLdifFiles( List<String> ldifFiles )
+    {
+        if ( ldifFiles == null )
+        {
+            ldifFiles = new ArrayList<String>();
+        }
+
+        if ( parent != null )
+        {
+            parent.getLdifFiles( ldifFiles );
+        }
+
+        ApplyLdifFiles annotation = description.getAnnotation( ApplyLdifFiles.class );
+        if ( annotation != null && annotation.value() != null )
+        {
+            ldifFiles.addAll( Arrays.asList( annotation.value() ) );
+        }
+
+        return ldifFiles;
+    }
+}

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java?rev=600254&r1=600253&r2=600254&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java
Sat Dec  1 23:29:04 2007
@@ -18,6 +18,12 @@
  */
 package org.apache.directory.server.core.integ.state;
 
+import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.integ.InheritableSettings;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
+import org.junit.runner.notification.RunNotifier;
+
 
 /**
  * Document me!
@@ -36,9 +42,10 @@
     }
 
 
-    public void create()
+    public void create( DirectoryServiceFactory factory )
     {
-        context.setState( context.getStartedDirtyState() );
+        context.setService( factory.newInstance() );
+        context.setState( context.getStoppedDirtyState() );
     }
 
 
@@ -66,7 +73,7 @@
     }
 
 
-    public void test()
+    public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
     {
         throw new IllegalStateException( "Attempting to run integration tests on a service
that does not exist." );
     }

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java?rev=600254&r1=600253&r2=600254&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java
Sat Dec  1 23:29:04 2007
@@ -19,7 +19,12 @@
 package org.apache.directory.server.core.integ.state;
 
 import org.apache.directory.server.core.integ.SetupMode;
+import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.integ.InheritableSettings;
 import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,7 +49,7 @@
     }
 
 
-    public void create()
+    public void create( DirectoryServiceFactory factory )
     {
         throw new IllegalStateException( "The running service must be shutdown before creating
a new one." );
     }
@@ -70,23 +75,17 @@
 
     public void shutdown()
     {
-        try
-        {
-            context.getService().shutdown();
-        }
-        catch ( NamingException e )
-        {
-            context.getNotifier().fireTestFailure( new Failure( context.getDescription(),
e ) );
-        }
+    }
+
+
+    public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
+    {
+
     }
 
 
     public void test()
     {
-        if ( context.getMode().isStartedDirtyTestable() )
-        {
-            // run the test
-        }
     }
 
 

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java?rev=600254&r1=600253&r2=600254&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java
Sat Dec  1 23:29:04 2007
@@ -19,6 +19,16 @@
 package org.apache.directory.server.core.integ.state;
 
 
+import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.integ.InheritableSettings;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
+import org.junit.runner.notification.RunNotifier;
+
+import javax.naming.NamingException;
+import java.io.IOException;
+
+
 /**
  * Document me!
  *
@@ -36,9 +46,9 @@
     }
 
 
-    public void create()
+    public void create( DirectoryServiceFactory factory )
     {
-        // context.setState( context.gettCreatedDirtyState() );
+
     }
 
 
@@ -48,31 +58,31 @@
     }
 
 
-    public void cleanup()
+    public void cleanup() throws IOException
     {
 
     }
 
 
-    public void startup()
+    public void startup() throws NamingException
     {
 
     }
 
 
-    public void shutdown()
+    public void shutdown() throws NamingException
     {
 
     }
 
 
-    public void test()
+    public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
     {
 
     }
 
 
-    public void revert()
+    public void revert() throws NamingException
     {
 
     }

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java?rev=600254&r1=600253&r2=600254&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java
Sat Dec  1 23:29:04 2007
@@ -19,6 +19,16 @@
 package org.apache.directory.server.core.integ.state;
 
 
+import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.integ.InheritableSettings;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
+import org.junit.runner.notification.RunNotifier;
+
+import javax.naming.NamingException;
+import java.io.IOException;
+
+
 /**
  * Document me!
  *
@@ -36,9 +46,9 @@
     }
 
 
-    public void create()
+    public void create( DirectoryServiceFactory factory )
     {
-        // context.setState( context.gettCreatedDirtyState() );
+
     }
 
 
@@ -48,31 +58,31 @@
     }
 
 
-    public void cleanup()
+    public void cleanup() throws IOException
     {
 
     }
 
 
-    public void startup()
+    public void startup() throws NamingException
     {
 
     }
 
 
-    public void shutdown()
+    public void shutdown() throws NamingException
     {
 
     }
 
 
-    public void test()
+    public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
     {
 
     }
 
 
-    public void revert()
+    public void revert() throws NamingException
     {
 
     }

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java?rev=600254&r1=600253&r2=600254&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java
Sat Dec  1 23:29:04 2007
@@ -19,6 +19,16 @@
 package org.apache.directory.server.core.integ.state;
 
 
+import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.integ.InheritableSettings;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
+import org.junit.runner.notification.RunNotifier;
+
+import javax.naming.NamingException;
+import java.io.IOException;
+
+
 /**
  * Document me!
  *
@@ -36,9 +46,9 @@
     }
 
 
-    public void create()
+    public void create( DirectoryServiceFactory factory )
     {
-        // context.setState( context.gettCreatedDirtyState() );
+
     }
 
 
@@ -48,31 +58,31 @@
     }
 
 
-    public void cleanup()
+    public void cleanup() throws IOException
     {
 
     }
 
 
-    public void startup()
+    public void startup() throws NamingException
     {
 
     }
 
 
-    public void shutdown()
+    public void shutdown() throws NamingException
     {
 
     }
 
 
-    public void test()
+    public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
     {
 
     }
 
 
-    public void revert()
+    public void revert() throws NamingException
     {
 
     }

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java?rev=600254&r1=600253&r2=600254&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java
Sat Dec  1 23:29:04 2007
@@ -19,6 +19,16 @@
 package org.apache.directory.server.core.integ.state;
 
 
+import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.integ.InheritableSettings;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
+import org.junit.runner.notification.RunNotifier;
+
+import javax.naming.NamingException;
+import java.io.IOException;
+
+
 /**
  * Document me!
  *
@@ -36,9 +46,9 @@
     }
 
 
-    public void create()
+    public void create( DirectoryServiceFactory factory )
     {
-        // context.setState( context.gettCreatedDirtyState() );
+
     }
 
 
@@ -48,31 +58,31 @@
     }
 
 
-    public void cleanup()
+    public void cleanup() throws IOException
     {
 
     }
 
 
-    public void startup()
+    public void startup() throws NamingException
     {
 
     }
 
 
-    public void shutdown()
+    public void shutdown() throws NamingException
     {
 
     }
 
 
-    public void test()
+    public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
     {
 
     }
 
 
-    public void revert()
+    public void revert() throws NamingException
     {
 
     }

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java?rev=600254&r1=600253&r2=600254&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java
Sat Dec  1 23:29:04 2007
@@ -22,9 +22,13 @@
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.integ.DirectoryServiceFactory;
 import org.apache.directory.server.core.integ.ServiceScope;
-import org.apache.directory.server.core.integ.SetupMode;
-import org.junit.runner.Description;
+import org.apache.directory.server.core.integ.InheritableSettings;
 import org.junit.runner.notification.RunNotifier;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
+
+import javax.naming.NamingException;
+import java.io.IOException;
 
 
 /**
@@ -47,28 +51,41 @@
     private final TestServiceState stoppedPristineState = new StoppedPristineState( this
);
 
 
+    /**
+     * the level at which the service was started and where it will be 
+     * shutdown, cleaned and destroyed if it is still present
+     */
+    private final ServiceScope scope;
+
     /** current service state with respect to the testing life cycle */
     private TestServiceState state;
-    private ServiceScope scope;
-    private SetupMode mode;
+
+    /** the core directory service managed by this context */
     private DirectoryService service;
-    private DirectoryServiceFactory factory;
-    private RunNotifier notifier;
-    private Description description;
+
+
+    public TestServiceContext( ServiceScope scope )
+    {
+        this.scope = scope;
+    }
 
 
     /**
-     * Gets the TestServiceContext associated with the current thread of execution.
+     * Gets the TestServiceContext associated with the current thread of
+     * execution.  If one does not yet exist it will be created using the
+     * provided scope parameter.  If the scope is null a null pointer
+     * exception may result.
      *
+     * @param scope the level at which the service was started
      * @return the context associated with the calling thread
      */
-    public static TestServiceContext get()
+    public static TestServiceContext get( ServiceScope scope )
     {
         TestServiceContext context = CONTEXTS.get();
 
         if ( context == null )
         {
-            context = new TestServiceContext();
+            context = new TestServiceContext( scope );
             CONTEXTS.set( context );
         }
 
@@ -92,10 +109,12 @@
      * 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.
+     *
+     * @param factory the factory to use for creating a configured service
      */
-    public void create()
+    public void create( DirectoryServiceFactory factory )
     {
-        state.create();
+        state.create( factory );
     }
 
 
@@ -114,8 +133,10 @@
      * 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 IOException on errors while deleting the working directory
      */
-    public void cleanup()
+    public void cleanup() throws IOException
     {
         state.cleanup();
     }
@@ -123,8 +144,10 @@
 
     /**
      * Action where an attempt is made to start up the service.
+     *
+     * @throws NamingException on failures to start the core directory service
      */
-    public void startup()
+    public void startup() throws NamingException
     {
         state.startup();
     }
@@ -132,8 +155,10 @@
 
     /**
      * Action where an attempt is made to shutdown the service.
+     *
+     * @throws NamingException on failures to stop the core directory service
      */
-    public void shutdown()
+    public void shutdown() throws NamingException
     {
         state.shutdown();
     }
@@ -141,18 +166,31 @@
 
     /**
      * 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
+     *
+     * @param testClass the class whose test method is to be run
+     * @param testMethod the test method which is to be run
+     * @param notifier a notifier to report failures to
+     * @param settings the inherited settings and annotations associated with
+     * the test method
      */
-    public void test()
+    public void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings )
     {
-        state.test();
+        state.test( testClass, testMethod, notifier, settings );
     }
 
 
     /**
      * Action where an attempt is made to revert the service to it's
      * initial start up state by using a previous snapshot.
+     *
+     * @throws NamingException on failures to revert the state of the core
+     * directory service
      */
-    public void revert()
+    public void revert() throws NamingException
     {
         state.revert();
     }
@@ -164,116 +202,62 @@
     }
 
 
-    public TestServiceState getState()
+    TestServiceState getState()
     {
         return state;
     }
 
 
-    public TestServiceState getNonExistentState()
+    TestServiceState getNonExistentState()
     {
         return nonExistentState;
     }
 
 
-    public TestServiceState getStartedDirtyState()
+    TestServiceState getStartedDirtyState()
     {
         return startedDirtyState;
     }
 
 
-    public TestServiceState getStartedPristineState()
+    TestServiceState getStartedPristineState()
     {
         return startedPristineState;
     }
 
 
-    public TestServiceState getStartedRevertedState()
+    TestServiceState getStartedRevertedState()
     {
         return startedRevertedState;
     }
 
 
-    public TestServiceState getStoppedDirtyState()
+    TestServiceState getStoppedDirtyState()
     {
         return stoppedDirtyState;
     }
 
 
-    public TestServiceState getStoppedPristineState()
+    TestServiceState getStoppedPristineState()
     {
         return stoppedPristineState;
     }
 
 
-    public ServiceScope getScope()
+    ServiceScope getScope()
     {
         return scope;
     }
 
 
-    public void setScope( ServiceScope scope )
-    {
-        this.scope = scope;
-    }
-
-
-    public DirectoryService getService()
+    DirectoryService getService()
     {
         return service;
     }
 
 
-    public void setService( DirectoryService service )
+    void setService( DirectoryService service )
     {
         this.service = service;
-    }
-
-
-    public SetupMode getMode()
-    {
-        return mode;
-    }
-
-
-    public void setMode( SetupMode mode )
-    {
-        this.mode = mode;
-    }
-
-
-    public DirectoryServiceFactory getFactory()
-    {
-        return factory;
-    }
-
-
-    public void setFactory( DirectoryServiceFactory factory )
-    {
-        this.factory = factory;
-    }
-
-
-    public RunNotifier getNotifier()
-    {
-        return notifier;
-    }
-
-
-    public void setNotifier( RunNotifier notifier )
-    {
-        this.notifier = notifier;
-    }
-
-
-    public Description getDescription()
-    {
-        return description;
-    }
-
-
-    public void setDescription( Description description )
-    {
-        this.description = description;
     }
 }

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceState.java?rev=600254&r1=600253&r2=600254&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceState.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceState.java
Sat Dec  1 23:29:04 2007
@@ -18,6 +18,15 @@
  */
 package org.apache.directory.server.core.integ.state;
 
+import org.apache.directory.server.core.integ.DirectoryServiceFactory;
+import org.apache.directory.server.core.integ.InheritableSettings;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
+import org.junit.runner.notification.RunNotifier;
+
+import javax.naming.NamingException;
+import java.io.IOException;
+
 
 /**
  * The interface representing a state in the lifecycle of a service
@@ -33,8 +42,10 @@
      * 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.
+     *
+     * @param factory the factory to use for creating a configured service
      */
-    void create();
+    void create( DirectoryServiceFactory factory );
 
 
     /**
@@ -49,31 +60,50 @@
      * 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 IOException on errors while deleting the working directory
      */
-    void cleanup();
+    void cleanup() throws IOException;
 
 
     /**
      * Action where an attempt is made to start up the service.
+     *
+     * @throws NamingException on failures to start the core directory service
      */
-    void startup();
+    void startup() throws NamingException;
 
 
     /**
      * Action where an attempt is made to shutdown the service.
+     *
+     * @throws NamingException on failures to stop the core directory service
      */
-    void shutdown();
+    void shutdown() throws NamingException;
 
 
     /**
      * 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
+     *
+     * @param testClass the class whose test method is to be run
+     * @param testMethod the test method which is to be run
+     * @param notifier a notifier to report failures to
+     * @param settings the inherited settings and annotations associated with
+     * the test method
      */
-    void test();
+    void test( TestClass testClass, TestMethod testMethod, RunNotifier notifier, InheritableSettings
settings );
 
 
     /**
      * Action where an attempt is made to revert the service to it's
      * initial start up state by using a previous snapshot.
+     *
+     * @throws NamingException on failures to revert the state of the core
+     * directory service
      */
-    void revert();
+    void revert() throws NamingException;
 }



Mime
View raw message