directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r894284 - in /directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ: FrameworkRunner.java FrameworkSuite.java
Date Tue, 29 Dec 2009 00:32:09 GMT
Author: elecharny
Date: Tue Dec 29 00:32:09 2009
New Revision: 894284

URL: http://svn.apache.org/viewvc?rev=894284&view=rev
Log:
o Added some Javadoc
o Removed useless code
o Reorganized the runner

Modified:
    directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
    directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java

Modified: directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java?rev=894284&r1=894283&r2=894284&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
(original)
+++ directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
Tue Dec 29 00:32:09 2009
@@ -21,13 +21,11 @@
 
 import java.lang.reflect.Field;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.DefaultLdapServerFactory;
 import org.apache.directory.server.annotations.LdapServerBuilder;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.annotations.DSBuilder;
 import org.apache.directory.server.core.factory.DSBuilderAnnotationProcessor;
 import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
 import org.apache.directory.server.core.factory.DirectoryServiceFactory;
@@ -68,12 +66,6 @@
     /** The DirectoryService for this class, if any */
     private DirectoryService classDS;
 
-    /** A flag set to true when the class has been started */
-    private boolean classStarted = false;
-
-    /** Is it usefull ? */
-    private static AtomicInteger testCount = new AtomicInteger();
-
 
     /**
      * Creates a new instance of FrameworkRunner.
@@ -83,19 +75,7 @@
         super( clazz );
     }
 
-
-    /**
-     * Instantiate the DirectoryService we found in an annotation
-     */
-    private DirectoryService getDirectoryServer( DSBuilder factory ) throws Exception
-    {
-        DirectoryServiceFactory dsf = ( DirectoryServiceFactory ) factory.factory().newInstance();
-        dsf.init( factory.name() );
-        
-        return dsf.getDirectoryService();
-    }
-
-
+    
     /**
      * {@inheritDoc}
      */
@@ -214,8 +194,6 @@
     @Override
     protected void runChild( FrameworkMethod method, RunNotifier notifier )
     {
-        testCount.incrementAndGet();
-
         // Don't run the test if the @Ignored annotation is used
         if ( method.getAnnotation( Ignore.class ) != null )
         {
@@ -294,6 +272,7 @@
                 ldapServerFactory.setDirectoryService( directoryService );
             }
 
+            // Run the test
             super.runChild( method, notifier );
 
             // Cleanup the methodDS if it has been created
@@ -315,17 +294,23 @@
             LOG.error( "", e );
             e.printStackTrace();
         }
-
-        classStarted = true;
     }
 
 
+    /**
+     * Set the Suite reference into this class
+     *
+     * @param suite The suite this classd is contained into
+     */
     public void setSuite( FrameworkSuite suite )
     {
         this.suite = suite;
     }
 
 
+    /**
+     * @return The Suite this class is contained nto, if any
+     */
     public FrameworkSuite getSuite()
     {
         return suite;

Modified: directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java?rev=894284&r1=894283&r2=894284&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java
(original)
+++ directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java
Tue Dec 29 00:32:09 2009
@@ -22,7 +22,6 @@
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.annotations.LdapServerBuilder;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.annotations.ApplyLdifs;
 import org.apache.directory.server.core.factory.DSBuilderAnnotationProcessor;
 import org.apache.directory.server.ldap.LdapServer;
 import org.junit.runner.Runner;
@@ -55,10 +54,6 @@
     /** The LdapServer for this class, if any */
     private LdapServer suiteLdapServer;
 
-    
-    /** The LDIFs entries for this suite */
-    private ApplyLdifs suiteLdifs;
-
     /**
      * Creates a new instance of FrameworkSuite.
      */
@@ -66,15 +61,10 @@
     {
         super( clazz, builder );
     }
-
     
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void run( final RunNotifier notifier )
+    
+    private void startSuiteDS()
     {
-        suiteLdifs = getDescription().getAnnotation( ApplyLdifs.class );
         suiteLdapServerBuilder = getDescription().getAnnotation( LdapServerBuilder.class
);
 
         // Initialize and start the DS before running any test, if we have a DS annotation
@@ -92,10 +82,11 @@
                 return;
             }
         }
-        
-        super.run( notifier );
-        
-        // last, stop the DS if we have one
+    }
+    
+    
+    private void stopSuiteDS()
+    {
         if ( directoryService != null )
         {
             try
@@ -111,6 +102,23 @@
         }
     }
 
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void run( final RunNotifier notifier )
+    {
+        // Create and initialize the Suite DS
+        startSuiteDS();
+        
+        // Run the suite
+        super.run( notifier );
+        
+        // last, stop the DS if we have one
+        stopSuiteDS();
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -126,15 +134,6 @@
 
 
     /**
-     * @return the suiteLdifs
-     */
-    public ApplyLdifs getSuiteLdifs()
-    {
-        return suiteLdifs;
-    }
-
-
-    /**
      * @return the DirectoryService instance
      */
     public DirectoryService getDirectoryService()



Mime
View raw message