directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r895939 - in /directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ: AbstractLdapTestUnit.java FrameworkRunner.java
Date Tue, 05 Jan 2010 08:27:59 GMT
Author: kayyagari
Date: Tue Jan  5 08:27:55 2010
New Revision: 895939

URL: http://svn.apache.org/viewvc?rev=895939&view=rev
Log:
o added kdcServer field in AbstractLdapTestUnit
o added support for initializing and stopping of KdcServer in the FrameworkRunner

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

Modified: directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/AbstractLdapTestUnit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/AbstractLdapTestUnit.java?rev=895939&r1=895938&r2=895939&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/AbstractLdapTestUnit.java
(original)
+++ directory/apacheds/branches/apacheds-schema/test-framework/src/main/java/org/apache/directory/server/core/integ/AbstractLdapTestUnit.java
Tue Jan  5 08:27:55 2010
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.integ;
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.kerberos.kdc.KdcServer;
 import org.apache.directory.server.ldap.LdapServer;
 
 
@@ -37,6 +38,8 @@
     /** The used LdapServer instance */
     public static LdapServer ldapServer;
 
+    /** The used KdcServer instance */
+    public static KdcServer kdcServer;
     
     /** A flag set if the test is run in a suite */
     public static boolean isRunInSuite;

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=895939&r1=895938&r2=895939&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 Jan  5 08:27:55 2010
@@ -30,6 +30,7 @@
 import org.apache.directory.server.core.factory.DefaultDirectoryServiceFactory;
 import org.apache.directory.server.core.factory.DirectoryServiceFactory;
 import org.apache.directory.server.factory.ServerAnnotationProcessor;
+import org.apache.directory.server.kerberos.kdc.KdcServer;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.protocol.shared.transport.Transport;
 import org.junit.Ignore;
@@ -60,6 +61,9 @@
     /** The 'ldapServer' field in the run tests */
     private static final String LDAP_SERVER_FIELD_NAME = "ldapServer";
     
+    /** The 'kdcServer' field in the run tests */
+    private static final String KDC_SERVER_FIELD_NAME = "kdcServer";
+
     /** The filed used to tell the test that it is run in a suite */
     private static final String IS_RUN_IN_SUITE_FIELD_NAME = "isRunInSuite";
 
@@ -72,6 +76,10 @@
     /** The LdapServer for this class, if any */
     private LdapServer classLdapServer;
 
+    /** The KdcServer for this class, if any */
+    private KdcServer classKdcServer;
+    
+    
     /**
      * Creates a new instance of FrameworkRunner.
      */
@@ -197,6 +205,15 @@
                 // if ApplyLdifs is present
             }
 
+            if( classKdcServer == null )
+            {
+                classKdcServer = ServerAnnotationProcessor.getKdcServer( getDescription(),
directoryService, 0 );
+            }
+            else if( suite != null )
+            {
+                // TODO add suite level KdcServer support
+            }
+            
             // Now run the class
             super.run( notifier );
 
@@ -208,6 +225,11 @@
                 }
             }
             
+            if( classKdcServer != null )
+            {
+                classKdcServer.stop();
+            }
+            
             // cleanup classService if it is not the same as suite service or
             // it is not null (this second case happens in the absence of a suite)
             if ( classDS != null )
@@ -278,6 +300,14 @@
                 
                 DSAnnotationProcessor.applyLdifs( methodDescription, directoryService );
             }
+            else if( classKdcServer != null )
+            {
+                directoryService = classKdcServer.getDirectoryService();
+                
+                revision = getCurrentRevision( directoryService );
+                
+                DSAnnotationProcessor.applyLdifs( methodDescription, directoryService );
+            }
             else if ( methodDS != null )
             {
                 // Apply all the LDIFs
@@ -309,22 +339,27 @@
             
             // At this point, we know which service to use.
             // Inject it into the class
-            Field field = getTestClass().getJavaClass().getField( DIRECTORY_SERVICE_FIELD_NAME
);
-            field.set( getTestClass().getJavaClass(), directoryService );
+            Field dirServiceField = getTestClass().getJavaClass().getField( DIRECTORY_SERVICE_FIELD_NAME
);
+            dirServiceField.set( getTestClass().getJavaClass(), directoryService );
             
             // if we run this class in a suite, tell it to the test
-            field = getTestClass().getJavaClass().getField( IS_RUN_IN_SUITE_FIELD_NAME );
-            field.set( getTestClass().getJavaClass(), suite != null );
+            Field runInSuiteField = getTestClass().getJavaClass().getField( IS_RUN_IN_SUITE_FIELD_NAME
);
+            runInSuiteField.set( getTestClass().getJavaClass(), suite != null );
             
+            Field ldapServerField = getTestClass().getJavaClass().getField( LDAP_SERVER_FIELD_NAME
);
+
             if( classLdapServer != null )
             {
-                field = getTestClass().getJavaClass().getField( DIRECTORY_SERVICE_FIELD_NAME
);
-                field.set( getTestClass().getJavaClass(), classLdapServer.getDirectoryService()
);
+                dirServiceField.set( getTestClass().getJavaClass(), classLdapServer.getDirectoryService()
);
+                ldapServerField.set( getTestClass().getJavaClass(), classLdapServer );
+            }
+            else if( classKdcServer != null )
+            {
+                dirServiceField.set( getTestClass().getJavaClass(), classKdcServer.getDirectoryService()
);
                 
-                field = getTestClass().getJavaClass().getField( LDAP_SERVER_FIELD_NAME );
-                field.set( getTestClass().getJavaClass(), classLdapServer );
+                Field kdcServerField = getTestClass().getJavaClass().getField( KDC_SERVER_FIELD_NAME
);
+                kdcServerField.set( getTestClass().getJavaClass(), classKdcServer );
             }
-            
 
             // Run the test
             super.runChild( method, notifier );



Mime
View raw message