directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r995714 - in /directory/apacheds/trunk: server-annotations/src/main/java/org/apache/directory/server/factory/ server-annotations/src/test/java/org/apache/directory/server/factory/ test-framework/src/main/java/org/apache/directory/server/cor...
Date Fri, 10 Sep 2010 09:26:16 GMT
Author: elecharny
Date: Fri Sep 10 09:26:14 2010
New Revision: 995714

URL: http://svn.apache.org/viewvc?rev=995714&view=rev
Log:
o Added an instance of LdapServer into the annotationProcessor
o Renamed the getLdapServer() methods to createLdapServer()
o Added a getLdapServer returning the created instance
o Fixed the code accordingly

Modified:
    directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
    directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
    directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
    directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java

Modified: directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java?rev=995714&r1=995713&r2=995714&view=diff
==============================================================================
--- directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
(original)
+++ directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
Fri Sep 10 09:26:14 2010
@@ -48,6 +48,10 @@ import org.junit.runner.Description;
  */
 public class ServerAnnotationProcessor
 {
+    /** The created LDAP Server */
+    private static LdapServer ldapServer;
+
+
     private static void createTransports( LdapServer ldapServer, CreateTransport[] transportBuilders,
int startPort )
     {
         if ( transportBuilders.length != 0 )
@@ -180,22 +184,53 @@ public class ServerAnnotationProcessor
         }
     }
 
+
+    /**
+     * @return The created instance of LdapServer, if any
+     */
+    public static LdapServer getLdapServer()
+    {
+        return ldapServer;
+    }
+
     
-    public static LdapServer getLdapServer( DirectoryService directoryService, int startPort
) throws Exception
+    /**
+     * Create a new instance of LdapServer
+     *
+     * @param directoryService The associated DirectoryService
+     * @param startPort The port used by the server
+     * @return An LdapServer instance 
+     * @throws Exception If the server cannot be started
+     */
+    public static LdapServer createLdapServer( DirectoryService directoryService, int startPort
) throws Exception
     {
         CreateLdapServer createLdapServer = ( CreateLdapServer ) getAnnotation( CreateLdapServer.class
);
         
         // Ok, we have found a CreateLdapServer annotation. Process it now.
-        return createLdapServer( createLdapServer, directoryService, startPort );
+        ldapServer = createLdapServer( createLdapServer, directoryService, startPort );
+
+        return ldapServer;
     }
 
 
-    public static LdapServer getLdapServer( Description description, DirectoryService directoryService,
int startPort ) throws Exception
+    /**
+     * Create a new instance of LdapServer
+     *
+     * @param description A description for the created LdapServer
+     * @param directoryService The associated DirectoryService
+     * @param startPort The port used by the server
+     * @return An LdapServer instance 
+     * @throws Exception If the server cannot be started
+     */
+    public static LdapServer createLdapServer( Description description, DirectoryService
directoryService, int startPort )
+        throws Exception
     {
         CreateLdapServer createLdapServer = description.getAnnotation( CreateLdapServer.class
);
 
         // Ok, we have found a CreateLdapServer annotation. Process it now.
-        return createLdapServer( createLdapServer, directoryService, startPort );
+        ldapServer = createLdapServer( createLdapServer, directoryService, startPort );
+
+        return ldapServer;
     }
 
     @SuppressWarnings("unchecked")

Modified: directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java?rev=995714&r1=995713&r2=995714&view=diff
==============================================================================
--- directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
(original)
+++ directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
Fri Sep 10 09:26:14 2010
@@ -230,7 +230,8 @@ public class DirectoryServiceAnnotationT
         assertTrue( service.getAdminSession().exists( new DN( "dc=example,dc=com" ) ) );
 
         // Now, get the server
-        LdapServer ldapServer = ServerAnnotationProcessor.getLdapServer( service, AvailablePortFinder.getNextAvailable(
1024 ) );
+        LdapServer ldapServer = ServerAnnotationProcessor.createLdapServer( service, AvailablePortFinder
+            .getNextAvailable( 1024 ) );
 
         // Check that the server is running
         assertTrue( ldapServer.isStarted() );

Modified: directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java?rev=995714&r1=995713&r2=995714&view=diff
==============================================================================
--- directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
(original)
+++ directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
Fri Sep 10 09:26:14 2010
@@ -200,7 +200,7 @@ public class FrameworkRunner extends Blo
                     }
                 }
 
-                classLdapServer = ServerAnnotationProcessor.getLdapServer( getDescription(),
directoryService,
+                classLdapServer = ServerAnnotationProcessor.createLdapServer( getDescription(),
directoryService,
                     minPort + 1 );
             }
             else if ( ( suite != null ) && ( suite.getLdapServer() != null ) )

Modified: directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java?rev=995714&r1=995713&r2=995714&view=diff
==============================================================================
--- directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java
(original)
+++ directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java
Fri Sep 10 09:26:14 2010
@@ -120,7 +120,7 @@ public class FrameworkSuite extends Suit
     
     private void startLdapServer( Description description ) throws Exception
     {
-        ldapServer = ServerAnnotationProcessor.getLdapServer( description, directoryService,
1024 );
+        ldapServer = ServerAnnotationProcessor.createLdapServer( description, directoryService,
1024 );
     }
     
     



Mime
View raw message