directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r600229 - in /directory/apacheds/branches/bigbang: core-integ/ core-integ/src/main/java/org/apache/directory/server/core/integ/ core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ core-integ/src/main/java/org/apache...
Date Sun, 02 Dec 2007 03:13:31 GMT
Author: akarasulu
Date: Sat Dec  1 19:13:28 2007
New Revision: 600229

URL: http://svn.apache.org/viewvc?rev=600229&view=rev
Log:
check pointing some partial work on the core testing framework: using state pattern to reduce complexity and clarify code

Added:
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/ServiceScope.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifFiles.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifs.java
      - copied, changed from r599753, directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/Factory.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/
    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
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java   (contents, props changed)
      - copied, changed from r599754, directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java   (contents, props changed)
      - copied, changed from r599753, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
Removed:
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java
    directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
Modified:
    directory/apacheds/branches/bigbang/core-integ/pom.xml
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiSuite.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/SetupMode.java
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/integ/SampleITest.java

Modified: directory/apacheds/branches/bigbang/core-integ/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/pom.xml?rev=600229&r1=600228&r2=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/pom.xml (original)
+++ directory/apacheds/branches/bigbang/core-integ/pom.xml Sat Dec  1 19:13:28 2007
@@ -70,6 +70,19 @@
       <activation>
         <activeByDefault>true</activeByDefault>
       </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <includes>
+                <include>**/*ISuite.java</include>
+                <include>**/*ITest.java</include>
+              </includes>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
     </profile>
     
     <profile>

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java?rev=600229&r1=600228&r2=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiRunner.java Sat Dec  1 19:13:28 2007
@@ -50,7 +50,53 @@
  */
 public class CiRunner extends JUnit4ClassRunner
 {
-    public static final SetupMode DEFAULT_MODE = SetupMode.NOSERVICE;
+    /**
+     * The default setup mode to use is ROLLBACK.  Why you might ask
+     * is it not NOSERVICE?  The user shown us their intentions and has
+     * made a conscious decision to conduct tests with a running core
+     * service by selecting this Runner in the first place via the
+     * \@RunWith JUnit annotation.  So by default it makes sense to
+     * just give them that if they decide to use it in any of the tests
+     * contained which is most likely the case otherwise why would
+     * they bother to use this runner.  The thing is some tests may
+     * need the service and some might not even use it.  If the ROLLBACK
+     * mode is used then there is no cost incurred for having a running
+     * server in the background.  The server will be used anyway at some
+     * point by some tests.  When not used by some tests there are no
+     * rollbacks and so the service just sits waiting for tests to use
+     * it.
+     *
+     * <ul>
+     *   <li>
+     *     If the default was NOSERVICE the user would have to do more
+     *     work specify a mode on each test method that needs the core
+     *     service running.
+     *   </li>
+     *   <li>
+     *     If the default was PRISTINE then those tests not needing a
+     *     service up would shutdown existing servers, clean up,
+     *     create a new one and start the new service.  This process
+     *     costs about 2-3 seconds churns the disk and costs memory.
+     *     Turning off this default would require more effort on the
+     *     user when we already know their intensions.
+     *   </li>
+     *   <li>
+     *     If the default was RESTART then the impact would be similar
+     *     to the pristine case with perhaps much less waste but still
+     *     it would be very inefficient.
+     *   </li>
+     *   <li>
+     *     If the default was CUMULATIVE then some test that may delete
+     *     and create the same entries, often not worrying about cleanup
+     *     would collide causing false negatives.
+     *   </li>
+     * </ul>
+     *
+     * As you can see the best option for the default is the ROLLBACK mode.
+     * When a suite is present however mode inheritance can be utilized to
+     * override this default.
+     */
+    public static final SetupMode DEFAULT_MODE = SetupMode.ROLLBACK;
 
     private Class<?> clazz;
     private CiSuite suite;

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiSuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiSuite.java?rev=600229&r1=600228&r2=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiSuite.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/CiSuite.java Sat Dec  1 19:13:28 2007
@@ -24,7 +24,6 @@
 import static org.apache.directory.server.core.integ.AnnotationUtils.newFactory;
 import static org.apache.directory.server.core.integ.IntegrationUtils.doDelete;
 import org.apache.directory.server.core.integ.annotations.Factory;
-import org.apache.directory.server.core.integ.annotations.ForceCleanup;
 import org.apache.directory.server.core.integ.annotations.Mode;
 import org.junit.internal.runners.InitializationError;
 import org.junit.runner.Runner;
@@ -32,6 +31,10 @@
 import org.junit.runner.notification.RunNotifier;
 import org.junit.runners.Suite;
 
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+
 
 /**
  * A replacement for standard JUnit 4 suites. Note that this test suite
@@ -43,7 +46,12 @@
  */
 public class CiSuite extends Suite
 {
-    public static final SetupMode DEFAULT_MODE = SetupMode.NOSERVICE;
+    /**
+     * Must be ROLLBACK to not through inheritence impact the
+     * reasoning for these decisions that are made clear in
+     * {@Link CiRunner#DEFAULT_MODE}.
+     */
+    public static final SetupMode DEFAULT_MODE = SetupMode.ROLLBACK;
 
     /**
      * The suite level setup mode.  This is the mode that is inherited
@@ -68,6 +76,12 @@
      * model and on the lifecycle of the tested service.
      */
     private DirectoryService service;
+
+    /**
+     * List of ldifFiles to be loaded before conducting a test at
+     * various stages and based on the mode of the setup.    
+      */
+    private List<File> ldifFiles = Collections.emptyList();
 
 
     public CiSuite( Class<?> clazz ) throws InitializationError

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java?rev=600229&r1=600228&r2=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java Sat Dec  1 19:13:28 2007
@@ -20,6 +20,9 @@
 
 
 import org.apache.commons.io.FileUtils;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.ldif.ChangeType;
 import org.apache.directory.shared.ldap.ldif.Entry;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -76,6 +79,38 @@
         return getUserAddLdif( "uid=akarasulu,ou=users,ou=system", "test".getBytes(), "Alex Karasulu", "Karasulu" );
     }
 
+
+    public static LdapContext getContext( String principalDn, DirectoryService service, String dn )
+            throws NamingException
+    {
+        if ( principalDn == null )
+        {
+            principalDn = "";
+        }
+
+        LdapDN userDn = new LdapDN( principalDn );
+        userDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
+        LdapPrincipal principal = new LdapPrincipal( userDn, AuthenticationLevel.SIMPLE );
+
+        if ( dn == null )
+        {
+            dn = "";
+        }
+
+        return service.getJndiContext( principal, dn );
+    }
+
+
+    public static LdapContext getSystemContext( DirectoryService service ) throws NamingException
+    {
+        return getContext( "uid=admin,ou=system", service, "ou=system" );
+    }
+
+
+    public static LdapContext getRootContext( DirectoryService service ) throws NamingException
+    {
+        return getContext( "uid=admin,ou=system", service, "" );
+    }
 
 
     public static void apply( LdapContext root, Entry entry ) throws NamingException

Added: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/ServiceScope.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/ServiceScope.java?rev=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/ServiceScope.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/ServiceScope.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,49 @@
+/*
+ * 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;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public enum ServiceScope
+{
+    TESTSUITE( 0, "service has test suite level scope" ),
+    TESTCLASS( 1, "service has test class level scope" ),
+    TESTMETHOD( 2, "service has test method level scope" ),
+    TESTSYSTEM( 3, "service has test system level scope" );
+
+    public final int ordinal;
+    public final String description;
+
+    public static final int TESTSUITE_ORDINAL = 0;
+    public static final int TESTCLASS_ORDINAL = 1;
+    public static final int TESTMETHOD_ORDINAL = 2;
+    public static final int TESTSYSTEM_ORDINAL = 3;
+
+
+    ServiceScope( int ordinal, String description )
+    {
+        this.ordinal = ordinal;
+        this.description = description;
+    }
+}

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/SetupMode.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/SetupMode.java?rev=600229&r1=600228&r2=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/SetupMode.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/SetupMode.java Sat Dec  1 19:13:28 2007
@@ -102,4 +102,24 @@
         this.ordinal = ordinal;
         this.description = description;
     }
+
+
+    public boolean isStartedDirtyTestable()
+    {
+        switch( ordinal )
+        {
+            case( PRISTINE_ORDINAL ):
+                return false;
+            case( ROLLBACK_ORDINAL ):
+                return false;
+            case( NOSERVICE_ORDINAL ):
+                return true;
+            case( RESTART_ORDINAL ):
+                return true;
+            case( CUMULATIVE_ORDINAL ):
+                return true;
+            default:
+                throw new IllegalStateException( "Unidentified ordinal value: " + ordinal );
+        }
+    }
 }

Added: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifFiles.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifFiles.java?rev=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifFiles.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifFiles.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,40 @@
+/*
+ *  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.annotations;
+
+
+import java.lang.annotation.*;
+
+
+/**
+ * A annotation used to specify an array of ldif files to load and apply
+ * on the instance used for integration testing.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+@Documented
+@Inherited
+@Retention ( RetentionPolicy.RUNTIME )
+@Target ( { ElementType.METHOD, ElementType.TYPE } )
+public @interface ApplyLdifFiles
+{
+     String[] value();
+}
\ No newline at end of file

Copied: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifs.java (from r599753, directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/Factory.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifs.java?p2=directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifs.java&p1=directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/Factory.java&r1=599753&r2=600229&rev=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/Factory.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/annotations/ApplyLdifs.java Sat Dec  1 19:13:28 2007
@@ -24,8 +24,8 @@
 
 
 /**
- * A annotation used to specify a factory which builds a DirectoryService
- * instance for integration testing.
+ * A annotation used to specify an sequence of LDIF's to be applied to
+ * the instance for integration testing.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -34,7 +34,7 @@
 @Inherited
 @Retention ( RetentionPolicy.RUNTIME )
 @Target ( { ElementType.METHOD, ElementType.TYPE } )
-public @interface Factory
+public @interface ApplyLdifs
 {
-     Class value();
-}
+     String[] value();
+}
\ No newline at end of file

Added: 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=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/NonExistentState.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.state;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NonExistentState implements TestServiceState
+{
+    private final TestServiceContext context;
+
+
+    public NonExistentState( TestServiceContext context )
+    {
+        this.context = context;
+    }
+
+
+    public void create()
+    {
+        context.setState( context.getStartedDirtyState() );
+    }
+
+
+    public void destroy()
+    {
+        // do nothing!
+    }
+
+
+    public void cleanup()
+    {
+        // do nothing
+    }
+
+
+    public void startup()
+    {
+        throw new IllegalStateException( "Attempting to start up a test service that does not exist." );
+    }
+
+
+    public void shutdown()
+    {
+        throw new IllegalStateException( "Attempting to shut down a test service that does not exist." );
+    }
+
+
+    public void test()
+    {
+        throw new IllegalStateException( "Attempting to run integration tests on a service that does not exist." );
+    }
+
+
+    public void revert()
+    {
+        throw new IllegalStateException( "Attempting to revert a test service that does not exist." );
+    }
+}

Added: 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=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedDirtyState.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,97 @@
+/*
+ * 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.state;
+
+import org.apache.directory.server.core.integ.SetupMode;
+import org.junit.runner.notification.Failure;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.NamingException;
+
+
+/**
+ * The state of the service where it has been started and is dirty.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class StartedDirtyState implements TestServiceState
+{
+    private static final Logger LOG = LoggerFactory.getLogger( StartedDirtyState.class );
+    private final TestServiceContext context;
+
+
+    public StartedDirtyState( TestServiceContext context )
+    {
+        this.context = context;
+    }
+
+
+    public void create()
+    {
+        throw new IllegalStateException( "The running service must be shutdown before creating a new one." );
+    }
+
+
+    public void destroy()
+    {
+        throw new IllegalStateException( "The running service must be shutdown before destroying it." );
+    }
+
+
+    public void cleanup()
+    {
+        throw new IllegalStateException( "The running service must be shutdown before cleaning it." );
+    }
+
+
+    public void startup()
+    {
+        throw new IllegalStateException( "The running service must be shutdown before starting it." );
+    }
+
+
+    public void shutdown()
+    {
+        try
+        {
+            context.getService().shutdown();
+        }
+        catch ( NamingException e )
+        {
+            context.getNotifier().fireTestFailure( new Failure( context.getDescription(), e ) );
+        }
+    }
+
+
+    public void test()
+    {
+        if ( context.getMode().isStartedDirtyTestable() )
+        {
+            // run the test
+        }
+    }
+
+
+    public void revert()
+    {
+
+    }
+}
\ No newline at end of file

Added: 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=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedPristineState.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.state;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class StartedPristineState implements TestServiceState
+{
+    private final TestServiceContext context;
+
+
+    public StartedPristineState( TestServiceContext context )
+    {
+        this.context = context;
+    }
+
+
+    public void create()
+    {
+        // context.setState( context.gettCreatedDirtyState() );
+    }
+
+
+    public void destroy()
+    {
+
+    }
+
+
+    public void cleanup()
+    {
+
+    }
+
+
+    public void startup()
+    {
+
+    }
+
+
+    public void shutdown()
+    {
+
+    }
+
+
+    public void test()
+    {
+
+    }
+
+
+    public void revert()
+    {
+
+    }
+}
\ No newline at end of file

Added: 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=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StartedRevertedState.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.state;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class StartedRevertedState implements TestServiceState
+{
+    private final TestServiceContext context;
+
+
+    public StartedRevertedState( TestServiceContext context )
+    {
+        this.context = context;
+    }
+
+
+    public void create()
+    {
+        // context.setState( context.gettCreatedDirtyState() );
+    }
+
+
+    public void destroy()
+    {
+
+    }
+
+
+    public void cleanup()
+    {
+
+    }
+
+
+    public void startup()
+    {
+
+    }
+
+
+    public void shutdown()
+    {
+
+    }
+
+
+    public void test()
+    {
+
+    }
+
+
+    public void revert()
+    {
+
+    }
+}
\ No newline at end of file

Added: 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=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedDirtyState.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.state;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class StoppedDirtyState implements TestServiceState
+{
+    private final TestServiceContext context;
+
+
+    public StoppedDirtyState( TestServiceContext context )
+    {
+        this.context = context;
+    }
+
+
+    public void create()
+    {
+        // context.setState( context.gettCreatedDirtyState() );
+    }
+
+
+    public void destroy()
+    {
+
+    }
+
+
+    public void cleanup()
+    {
+
+    }
+
+
+    public void startup()
+    {
+
+    }
+
+
+    public void shutdown()
+    {
+
+    }
+
+
+    public void test()
+    {
+
+    }
+
+
+    public void revert()
+    {
+
+    }
+}
\ No newline at end of file

Added: 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=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/StoppedPristineState.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.state;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class StoppedPristineState implements TestServiceState
+{
+    private final TestServiceContext context;
+
+
+    public StoppedPristineState( TestServiceContext context )
+    {
+        this.context = context;
+    }
+
+
+    public void create()
+    {
+        // context.setState( context.gettCreatedDirtyState() );
+    }
+
+
+    public void destroy()
+    {
+
+    }
+
+
+    public void cleanup()
+    {
+
+    }
+
+
+    public void startup()
+    {
+
+    }
+
+
+    public void shutdown()
+    {
+
+    }
+
+
+    public void test()
+    {
+
+    }
+
+
+    public void revert()
+    {
+
+    }
+}
\ No newline at end of file

Added: 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=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/state/TestServiceContext.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,279 @@
+/*
+ * 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.state;
+
+
+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.junit.runner.notification.RunNotifier;
+
+
+/**
+ * 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.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class TestServiceContext
+{
+    private static final ThreadLocal<TestServiceContext> CONTEXTS = new ThreadLocal<TestServiceContext>();
+
+    private final TestServiceState nonExistentState = new NonExistentState( this );
+    private final TestServiceState startedDirtyState = new StartedDirtyState( this );
+    private final TestServiceState startedPristineState = new StartedPristineState( this );
+    private final TestServiceState startedRevertedState = new StartedRevertedState( this );
+    private final TestServiceState stoppedDirtyState = new StoppedDirtyState( this );
+    private final TestServiceState stoppedPristineState = new StoppedPristineState( this );
+
+
+    /** current service state with respect to the testing life cycle */
+    private TestServiceState state;
+    private ServiceScope scope;
+    private SetupMode mode;
+    private DirectoryService service;
+    private DirectoryServiceFactory factory;
+    private RunNotifier notifier;
+    private Description description;
+
+
+    /**
+     * Gets the TestServiceContext associated with the current thread of execution.
+     *
+     * @return the context associated with the calling thread
+     */
+    public static TestServiceContext get()
+    {
+        TestServiceContext context = CONTEXTS.get();
+
+        if ( context == null )
+        {
+            context = new TestServiceContext();
+            CONTEXTS.set( context );
+        }
+
+        return context;
+    }
+    
+
+    /**
+     * Sets the TestServiceContext for this current thread
+     *
+     * @param context the context associated with the calling thread
+     */
+    public static void set( TestServiceContext context )
+    {
+        CONTEXTS.set( context );
+    }
+
+
+    /**
+     * 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.
+     */
+    public void create()
+    {
+        state.create();
+    }
+
+
+    /**
+     * Action where an attempt is made to destroy the service.  This
+     * entails nulling out reference to it and triggering garbage
+     * collection.
+     */
+    public void destroy()
+    {
+        state.destroy();
+    }
+
+
+    /**
+     * 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.
+     */
+    public void cleanup()
+    {
+        state.cleanup();
+    }
+
+
+    /**
+     * Action where an attempt is made to start up the service.
+     */
+    public void startup()
+    {
+        state.startup();
+    }
+
+
+    /**
+     * Action where an attempt is made to shutdown the service.
+     */
+    public void shutdown()
+    {
+        state.shutdown();
+    }
+
+
+    /**
+     * Action where an attempt is made to run a test against the service.
+     */
+    public void test()
+    {
+        state.test();
+    }
+
+
+    /**
+     * Action where an attempt is made to revert the service to it's
+     * initial start up state by using a previous snapshot.
+     */
+    public void revert()
+    {
+        state.revert();
+    }
+
+
+    void setState( TestServiceState state )
+    {
+        this.state = state;
+    }
+
+
+    public TestServiceState getState()
+    {
+        return state;
+    }
+
+
+    public TestServiceState getNonExistentState()
+    {
+        return nonExistentState;
+    }
+
+
+    public TestServiceState getStartedDirtyState()
+    {
+        return startedDirtyState;
+    }
+
+
+    public TestServiceState getStartedPristineState()
+    {
+        return startedPristineState;
+    }
+
+
+    public TestServiceState getStartedRevertedState()
+    {
+        return startedRevertedState;
+    }
+
+
+    public TestServiceState getStoppedDirtyState()
+    {
+        return stoppedDirtyState;
+    }
+
+
+    public TestServiceState getStoppedPristineState()
+    {
+        return stoppedPristineState;
+    }
+
+
+    public ServiceScope getScope()
+    {
+        return scope;
+    }
+
+
+    public void setScope( ServiceScope scope )
+    {
+        this.scope = scope;
+    }
+
+
+    public DirectoryService getService()
+    {
+        return service;
+    }
+
+
+    public 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;
+    }
+}

Added: 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=600229&view=auto
==============================================================================
--- 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/state/TestServiceState.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.state;
+
+
+/**
+ * The interface representing a state in the lifecycle of a service
+ * during integration testing.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface TestServiceState
+{
+    /**
+     * 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.
+     */
+    void create();
+
+
+    /**
+     * Action where an attempt is made to destroy the service.  This
+     * entails nulling out reference to it and triggering garbage
+     * collection.
+     */
+    void destroy();
+
+
+    /**
+     * 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 cleanup();
+
+
+    /**
+     * Action where an attempt is made to start up the service.
+     */
+    void startup();
+
+
+    /**
+     * Action where an attempt is made to shutdown the service.
+     */
+    void shutdown();
+
+
+    /**
+     * Action where an attempt is made to run a test against the service.
+     */
+    void test();
+
+
+    /**
+     * Action where an attempt is made to revert the service to it's
+     * initial start up state by using a previous snapshot.
+     */
+    void revert();
+}

Added: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java?rev=600229&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java (added)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/StockCoreISuite.java Sat Dec  1 19:13:28 2007
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+import org.apache.directory.server.core.authn.SimpleAuthenticationIT;
+import org.apache.directory.server.core.collective.CollectiveAttributeServiceIT;
+import org.apache.directory.server.core.integ.CiSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+@RunWith ( CiSuite.class )
+@Suite.SuiteClasses ( {
+        SimpleAuthenticationIT.class,
+        CollectiveAttributeServiceIT.class
+        } )
+public class StockCoreISuite
+{
+}

Copied: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java (from r599754, directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java?p2=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java&p1=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java&r1=599754&r2=600229&rev=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java Sat Dec  1 19:13:28 2007
@@ -21,22 +21,20 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.integ.CiRunner;
+import static org.apache.directory.server.core.integ.IntegrationUtils.apply;
+import static org.apache.directory.server.core.integ.IntegrationUtils.getUserAddLdif;
+import org.apache.directory.server.core.integ.SetupMode;
+import org.apache.directory.server.core.integ.annotations.ForceCleanup;
+import org.apache.directory.server.core.integ.annotations.Mode;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.ArrayUtils;
-
-import org.apache.directory.server.core.integ.CiRunner;
-import org.apache.directory.server.core.integ.SetupMode;
-import org.apache.directory.server.core.integ.annotations.Mode;
-
-import static org.apache.directory.server.core.integ.IntegrationUtils.*;
-
-import org.junit.*;
-import org.junit.runner.RunWith;
-
 import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -54,7 +52,8 @@
  */
 @RunWith( CiRunner.class )
 @Mode ( SetupMode.ROLLBACK )
-public class SimpleAuthenticationITest
+@ForceCleanup
+public class SimpleAuthenticationIT
 {
     public static DirectoryService service;
 

Propchange: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationIT.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Dec  1 19:13:28 2007
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Copied: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java (from r599753, directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java?p2=directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java&p1=directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java&r1=599753&r2=600229&rev=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java Sat Dec  1 19:13:28 2007
@@ -20,21 +20,22 @@
 package org.apache.directory.server.core.collective;
 
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.integ.CiRunner;
+import org.apache.directory.server.core.integ.annotations.ForceCleanup;
+import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.util.HashMap;
+import java.util.Map;
 
 
 /**
@@ -43,8 +44,13 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class CollectiveAttributeServiceITest extends AbstractAdminTestCase
+@RunWith ( CiRunner.class )
+@ForceCleanup
+public class CollectiveAttributeServiceIT
 {
+    public static DirectoryService service;
+
+
     public Attributes getTestEntry( String cn )
     {
         Attributes subentry = new AttributesImpl();
@@ -108,8 +114,7 @@
         Attribute attribute = new AttributeImpl( "administrativeRole" );
         attribute.add( role );
         ModificationItemImpl item = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE, attribute );
-        super.sysRoot.modifyAttributes( "", new ModificationItemImpl[]
-            { item } );
+        getSystemContext( service ).modifyAttributes( "", new ModificationItemImpl[] { item } );
     }
 
 
@@ -120,7 +125,7 @@
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setReturningAttributes( new String[]
             { "+", "*" } );
-        NamingEnumeration results = super.sysRoot.search( "", "(objectClass=*)", controls );
+        NamingEnumeration results = getSystemContext( service ).search( "", "(objectClass=*)", controls );
         while ( results.hasMore() )
         {
             SearchResult result = ( SearchResult ) results.next();
@@ -137,12 +142,11 @@
         controls.setReturningAttributes( new String[]
             { "+", "*" } );
         
-        NamingEnumeration<SearchResult> results = sysRoot.search( name, "(objectClass=*)", controls );
+        NamingEnumeration<SearchResult> results = getSystemContext( service ).search( name, "(objectClass=*)", controls );
         
-        while ( results.hasMore() )
+        if ( results.hasMore() )
         {
-            SearchResult result = results.next();
-            return result;
+            return results.next();
         }
         
         return null;
@@ -156,7 +160,7 @@
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setReturningAttributes( new String[]
             { "cn" } );
-        NamingEnumeration results = super.sysRoot.search( "", "(objectClass=*)", controls );
+        NamingEnumeration results = getSystemContext( service ).search( "", "(objectClass=*)", controls );
         while ( results.hasMore() )
         {
             SearchResult result = ( SearchResult ) results.next();
@@ -173,7 +177,7 @@
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
         controls.setReturningAttributes( new String[]
                                                     { "c-ou", "c-st" } );
-        NamingEnumeration results = super.sysRoot.search( "", "(objectClass=*)", controls );
+        NamingEnumeration results = getSystemContext( service ).search( "", "(objectClass=*)", controls );
         while ( results.hasMore() )
         {
             SearchResult result = ( SearchResult ) results.next();
@@ -183,6 +187,7 @@
     }
     
 
+    @Test
     public void testLookup() throws Exception
     {
         // -------------------------------------------------------------------
@@ -190,16 +195,13 @@
         // -------------------------------------------------------------------
 
         addAdministrativeRole( "collectiveAttributeSpecificArea" );
-        
-        SearchResult result = getEntry( "" );
-        
-        super.sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
+        getSystemContext( service ).createSubcontext( "cn=testsubentry", getTestSubentry() );
 
         // -------------------------------------------------------------------
         // test an entry that should show the collective attribute c-ou
         // -------------------------------------------------------------------
 
-        Attributes attributes = super.sysRoot.getAttributes( "ou=services,ou=configuration" );
+        Attributes attributes = getSystemContext( service ).getAttributes( "ou=services,ou=configuration" );
         Attribute c_ou = attributes.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertEquals( "configuration", c_ou.get() );
@@ -208,7 +210,7 @@
         // test an entry that should not show the collective attribute
         // -------------------------------------------------------------------
 
-        attributes = super.sysRoot.getAttributes( "ou=users" );
+        attributes = getSystemContext( service ).getAttributes( "ou=users" );
         c_ou = attributes.get( "c-ou" );
         assertNull( "the c-ou collective attribute should not be present", c_ou );
 
@@ -219,10 +221,10 @@
         ModificationItemImpl[] items = new ModificationItemImpl[]
             { new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
                 new AttributeImpl( "collectiveExclusions", "c-ou" ) ) };
-        super.sysRoot.modifyAttributes( "ou=services,ou=configuration", items );
+        getSystemContext( service ).modifyAttributes( "ou=services,ou=configuration", items );
 
         // entry should not show the c-ou collective attribute anymore
-        attributes = super.sysRoot.getAttributes( "ou=services,ou=configuration" );
+        attributes = getSystemContext( service ).getAttributes( "ou=services,ou=configuration" );
         c_ou = attributes.get( "c-ou" );
         if ( c_ou != null )
         {
@@ -230,9 +232,9 @@
         }
 
         // now add more collective subentries - the c-ou should still not show due to exclusions
-        super.sysRoot.createSubcontext( "cn=testsubentry2", getTestSubentry2() );
+        getSystemContext( service ).createSubcontext( "cn=testsubentry2", getTestSubentry2() );
 
-        attributes = super.sysRoot.getAttributes( "ou=services,ou=configuration" );
+        attributes = getSystemContext( service ).getAttributes( "ou=services,ou=configuration" );
         c_ou = attributes.get( "c-ou" );
         if ( c_ou != null )
         {
@@ -240,7 +242,7 @@
         }
 
         // entries without the collectiveExclusion should still show both values of c-ou
-        attributes = super.sysRoot.getAttributes( "ou=interceptors,ou=configuration" );
+        attributes = getSystemContext( service ).getAttributes( "ou=interceptors,ou=configuration" );
         c_ou = attributes.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
@@ -248,7 +250,8 @@
 
         // request the collective attribute specifically
         
-        attributes = super.sysRoot.getAttributes( "ou=interceptors,ou=configuration", new String[] { "c-ou" } );
+        attributes = getSystemContext( service ).getAttributes(
+                "ou=interceptors,ou=configuration", new String[] { "c-ou" } );
         c_ou = attributes.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
@@ -256,7 +259,8 @@
         
         // unspecify the collective attribute in the returning attribute list
 
-        attributes = super.sysRoot.getAttributes( "ou=interceptors,ou=configuration", new String[] { "objectClass" } );
+        attributes = getSystemContext( service ).getAttributes(
+                "ou=interceptors,ou=configuration", new String[] { "objectClass" } );
         c_ou = attributes.get( "c-ou" );
         assertNull( "a collective c-ou attribute should not be present", c_ou );
         
@@ -264,16 +268,16 @@
         // now add the subentry for the c-st collective attribute
         // -------------------------------------------------------------------
 
-        super.sysRoot.createSubcontext( "cn=testsubentry3", getTestSubentry3() );
+        getSystemContext( service ).createSubcontext( "cn=testsubentry3", getTestSubentry3() );
 
         // the new attribute c-st should appear in the node with the c-ou exclusion
-        attributes = super.sysRoot.getAttributes( "ou=services,ou=configuration" );
+        attributes = getSystemContext( service ).getAttributes( "ou=services,ou=configuration" );
         Attribute c_st = attributes.get( "c-st" );
         assertNotNull( "a collective c-st attribute should be present", c_st );
         assertTrue( c_st.contains( "FL" ) );
 
         // in node without exclusions both values of c-ou should appear with c-st value
-        attributes = super.sysRoot.getAttributes( "ou=interceptors,ou=configuration" );
+        attributes = getSystemContext( service ).getAttributes( "ou=interceptors,ou=configuration" );
         c_ou = attributes.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );
         assertTrue( c_ou.contains( "configuration" ) );
@@ -289,10 +293,10 @@
         items = new ModificationItemImpl[]
             { new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl( "collectiveExclusions",
                 "excludeAllCollectiveAttributes" ) ) };
-        super.sysRoot.modifyAttributes( "ou=interceptors,ou=configuration", items );
+        getSystemContext( service ).modifyAttributes( "ou=interceptors,ou=configuration", items );
 
         // none of the attributes should appear any longer
-        attributes = super.sysRoot.getAttributes( "ou=interceptors,ou=configuration" );
+        attributes = getSystemContext( service ).getAttributes( "ou=interceptors,ou=configuration" );
         c_ou = attributes.get( "c-ou" );
         if ( c_ou != null )
         {
@@ -306,6 +310,7 @@
     }
 
 
+    @Test
     public void testSearch() throws Exception
     {
         // -------------------------------------------------------------------
@@ -313,7 +318,7 @@
         // -------------------------------------------------------------------
 
         addAdministrativeRole( "collectiveAttributeSpecificArea" );
-        super.sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
+        getSystemContext( service ).createSubcontext( "cn=testsubentry", getTestSubentry() );
 
         // -------------------------------------------------------------------
         // test an entry that should show the collective attribute c-ou
@@ -353,7 +358,7 @@
         ModificationItemImpl[] items = new ModificationItemImpl[]
             { new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
                 new AttributeImpl( "collectiveExclusions", "c-ou" ) ) };
-        super.sysRoot.modifyAttributes( "ou=services,ou=configuration", items );
+        getSystemContext( service ).modifyAttributes( "ou=services,ou=configuration", items );
         entries = getAllEntries();
 
         // entry should not show the c-ou collective attribute anymore
@@ -365,7 +370,7 @@
         }
 
         // now add more collective subentries - the c-ou should still not show due to exclusions
-        super.sysRoot.createSubcontext( "cn=testsubentry2", getTestSubentry2() );
+        getSystemContext( service ).createSubcontext( "cn=testsubentry2", getTestSubentry2() );
         entries = getAllEntries();
 
         attributes = entries.get( "ou=services,ou=configuration,ou=system" );
@@ -386,7 +391,7 @@
         // now add the subentry for the c-st collective attribute
         // -------------------------------------------------------------------
 
-        super.sysRoot.createSubcontext( "cn=testsubentry3", getTestSubentry3() );
+        getSystemContext( service ).createSubcontext( "cn=testsubentry3", getTestSubentry3() );
         entries = getAllEntries();
 
         // the new attribute c-st should appear in the node with the c-ou exclusion
@@ -412,7 +417,7 @@
         items = new ModificationItemImpl[]
             { new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl( "collectiveExclusions",
                 "excludeAllCollectiveAttributes" ) ) };
-        super.sysRoot.modifyAttributes( "ou=interceptors,ou=configuration", items );
+        getSystemContext( service ).modifyAttributes( "ou=interceptors,ou=configuration", items );
         entries = getAllEntries();
 
         // none of the attributes should appear any longer
@@ -447,13 +452,14 @@
     }
     
     
+    @Test
     public void testAddRegularEntryWithCollectiveAttribute()
     {
         Attributes entry = getTestEntry( "Ersin Er" );
         entry.put( "c-l", "Turkiye" );
         try
         {
-            super.sysRoot.createSubcontext( "cn=Ersin Er", entry );
+            getSystemContext( service ).createSubcontext( "cn=Ersin Er", entry );
             fail( "Entry addition with collective attribute should have failed." );
         }
         catch ( NamingException e )
@@ -463,15 +469,16 @@
     }
     
     
+    @Test
     public void testModifyRegularEntryAddingCollectiveAttribute() throws NamingException
     {
         Attributes entry = getTestEntry( "Ersin Er" );
-        super.sysRoot.createSubcontext( "cn=Ersin Er", entry );
+        getSystemContext( service ).createSubcontext( "cn=Ersin Er", entry );
         Attributes changeSet = new AttributesImpl( "c-l", "Turkiye", true );
         try
         {
             
-            super.sysRoot.modifyAttributes( "cn=Ersin Er", DirContext.ADD_ATTRIBUTE, changeSet );
+            getSystemContext( service ).modifyAttributes( "cn=Ersin Er", DirContext.ADD_ATTRIBUTE, changeSet );
             fail( "Collective attribute addition to non-collectiveAttributeSubentry should have failed." );
         }
         catch ( NamingException e )
@@ -481,15 +488,16 @@
     }
     
     
+    @Test
     public void testModifyRegularEntryAddingCollectiveAttribute2() throws NamingException
     {
         Attributes entry = getTestEntry( "Ersin Er" );
-        super.sysRoot.createSubcontext( "cn=Ersin Er", entry );
+        getSystemContext( service ).createSubcontext( "cn=Ersin Er", entry );
         Attribute change = new AttributeImpl( "c-l", "Turkiye");
         ModificationItemImpl mod = new ModificationItemImpl(DirContext.ADD_ATTRIBUTE, change);
         try
         {
-            super.sysRoot.modifyAttributes( "cn=Ersin Er", new ModificationItemImpl[] { mod } );
+            getSystemContext( service ).modifyAttributes( "cn=Ersin Er", new ModificationItemImpl[] { mod } );
             fail( "Collective attribute addition to non-collectiveAttributeSubentry should have failed." );
         }
         catch ( NamingException e )
@@ -499,6 +507,7 @@
     }
     
     
+    @Test
     public void testPolymorphicReturnAttrLookup() throws Exception
     {
         // -------------------------------------------------------------------
@@ -506,10 +515,10 @@
         // -------------------------------------------------------------------
     
         addAdministrativeRole( "collectiveAttributeSpecificArea" );
-        super.sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
+        getSystemContext( service ).createSubcontext( "cn=testsubentry", getTestSubentry() );
     
         // request the collective attribute's super type specifically
-        Attributes attributes = super.sysRoot.getAttributes( "ou=interceptors,ou=configuration",
+        Attributes attributes = getSystemContext( service ).getAttributes( "ou=interceptors,ou=configuration",
             new String[] { "ou" } );
         Attribute c_ou = attributes.get( "c-ou" );
         assertNotNull( "a collective c-ou attribute should be present", c_ou );

Propchange: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceIT.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Dec  1 19:13:28 2007
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id

Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/integ/SampleITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/integ/SampleITest.java?rev=600229&r1=600228&r2=600229&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/integ/SampleITest.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/integ/SampleITest.java Sat Dec  1 19:13:28 2007
@@ -19,21 +19,19 @@
 package org.apache.directory.server.core.integ;
 
 
-import javax.naming.directory.Attributes;
-import javax.naming.ldap.LdapContext;
-
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.integ.annotations.Mode;
+import org.apache.directory.server.core.integ.annotations.ForceCleanup;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
-
+import static org.junit.Assert.assertNotNull;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-
-import static org.junit.Assert.assertNotNull;
+import javax.naming.directory.Attributes;
+import javax.naming.ldap.LdapContext;
 
 
 /**
@@ -44,6 +42,7 @@
  */
 @RunWith( CiRunner.class)
 @Mode ( SetupMode.ROLLBACK )
+@ForceCleanup
 public class SampleITest
 {
     static DirectoryService service;
@@ -60,7 +59,7 @@
         attrs.put( "ou", "test" );
         root.createSubcontext( "ou=test,ou=system", attrs );
     }
-    
+        
 
     @Test public void checkService0() throws Exception
     {



Mime
View raw message