directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r190856 - /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractTestCase.java
Date Thu, 16 Jun 2005 02:19:54 GMT
Author: trustin
Date: Wed Jun 15 19:19:53 2005
New Revision: 190856

URL: http://svn.apache.org/viewcvs?rev=190856&view=rev
Log:
Resurrected the way to override JNDI properties by adding overrideEnvironment() method.

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractTestCase.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractTestCase.java?rev=190856&r1=190855&r2=190856&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractTestCase.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/AbstractTestCase.java
Wed Jun 15 19:19:53 2005
@@ -77,7 +77,7 @@
 
     /** the context root for the system partition */
     protected LdapContext sysRoot;
-
+    
     /** flag whether to delete database files for each test or not */
     protected boolean doDelete = true;
     
@@ -92,6 +92,8 @@
     /** Load resources relative to this class */
     private Class loadClass;
 
+    private Hashtable overrides = new Hashtable(); 
+
     protected AbstractTestCase( String username, String password )
     {
         if( username == null || password == null )
@@ -268,12 +270,21 @@
         {
             envFinal.put( Context.PROVIDER_URL, "ou=system" );
         }
-
+        
         envFinal.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.ldap.server.jndi.CoreContextFactory"
);
+        envFinal.putAll( overrides );
+
         return sysRoot = new InitialLdapContext( envFinal, null );
     }
 
-
+    /**
+     * Overrides default JNDI environment properties.  Please call this method
+     * to override any JNDI environment properties this test case will set.
+     */
+    protected void overrideEnvironment( String key, Object value )
+    {
+        overrides.put( key, value );
+    }
 
     /**
      * Sets the system context root to null.
@@ -304,6 +315,8 @@
         ldifPath = null;
 
         loadClass = null;
+        
+        overrides.clear();
         
         configuration = new MutableStartupConfiguration();
         



Mime
View raw message