/*
 * Copyright 2004 The Apache Software Foundation.
 * 
 * Licensed 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.commons.logging;

import junit.framework.*;

public class AltHashtableTestCase extends TestCase {

    public void testType() {
        assertTrue(LogFactory.factories instanceof AltHashtable);
    }
    
    public void testPutCalled() throws Exception {
    
        AltHashtable.lastKey = null;
        AltHashtable.lastValue = null;
        ClassLoader classLoader = new ClassLoader() {};
        Thread thread = new Thread(
            new Runnable() {
                public void run() {
                    LogFactory.getLog(AltHashtableTestCase.class);
                }
            }   
        );
        thread.setContextClassLoader(classLoader);
 
        thread.start();
        thread.join();
        
        assertEquals(classLoader, AltHashtable.lastKey);
        assertNotNull(AltHashtable.lastValue);
    }
}

@@ -682,167 +682,2685 @@
 *;%0A%0A
-public class AltHashtableTestCase extends TestCase %7B%0A%0A    public void testType() %7B%0A        assertTrue(LogFactory.factories instanceof AltHashtable);%0A    %7D%0A    
+/**%0A * Test the ability to force the LogFactory class to use some%0A * arbitrary Hashtable implementation to store its mapping from%0A * context-classloader -%3E LogFactory object.%0A * %3Cp%3E%0A * This is done by %0A */%0Apublic class AltHashtableTestCase extends TestCase %7B%0A%0A    public static Test suite() throws Exception %7B%0A        Class thisClass = AltHashtableTestCase.class;%0A        ClassLoader thisClassLoader = thisClass.getClassLoader();%0A%0A        PathableClassLoader loader = new PathableClassLoader(null);%0A        loader.useExplicitLoader(%22junit.%22, thisClassLoader);%0A        loader.addLogicalLib(%22testclasses%22);%0A        loader.addLogicalLib(%22commons-logging%22);%0A%0A        Class testClass = loader.loadClass(thisClass.getName());%0A        return new PathableTestSuite(testClass, loader);%0A    %7D%0A%0A    /**%0A     * Set up before each test.%0A     * %3Cp%3E%0A     * This method ensures that the appropriate system property is defined%0A     * to force the LogFactory class to use the AltHashtable class as its%0A     * Hashtable implementation for storing factories in. %0A     * %3Cp%3E%0A     * This does make the assumption that whatever JVM we are running in%0A     * doesn't initialise classes until they are actually referenced (ie the%0A     * LogFactory class hasn't been initialised before this method is called).%0A     * This is true of all JVMs I know of; and if it isn't then this test will%0A     * fail and someone will tell us. %0A     */%0A    public void setUp() %7B%0A        System.setProperty(%0A                %22org.apache.commons.logging.LogFactory.HashtableImpl%22,%0A                AltHashtable.class.getName());%0A    %7D%0A    %0A    /**%0A     * Verify that initialising the LogFactory class will cause it%0A     * to instantiate an object of type specified in system property%0A     * %22org.apache.commons.logging.LogFactory.HashtableImpl%22.%0A     */%0A    public void testType() %7B%0A        // Here, the reference to the LogFactory class should cause the%0A        // class to be loaded and initialised. It will see the property%0A        // set and use the AltHashtable class. If other tests in this%0A        // class have already been run within the same classloader then%0A        // LogFactory will already have been initialised, but that%0A        // doesn't change the effectiveness of this test.%0A        assertTrue(LogFactory.factories instanceof AltHashtable);%0A    %7D%0A    %0A    /**%0A     * Verify that when LogFactory sees a context-classloader for the%0A     * first time that it creates a new entry in the LogFactory.factories%0A     * hashmap. In particular, this checks that this process works ok when%0A     * a system property has been used to specify an alternative Hashtable%0A     * implementation for LogFactory to use.%0A     */
 %0A   
@@ -3407,21 +3407,16 @@
 ption %7B%0A
-    %0A
         
@@ -3495,379 +3495,148 @@
     
-ClassLoader classLoader = new ClassLoader() %7B%7D;%0A        Thread thread = new Thread(%0A            new Runnable() %7B%0A                public void run() %7B%0A                    LogFactory.getLog(AltHashtableTestCase.class);%0A                %7D%0A            %7D   %0A        );%0A        thread.setContextClassLoader(classLoader);%0A %0A        thread.start();%0A        thread.join
+%0A        LogFactory.getLog(AltHashtableTestCase.class);%0A        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader
 ();%0A
-        %0A
     
@@ -3653,20 +3653,22 @@
 Equals(c
-lass
+ontext
 Loader, 

Change to using PathableTestSuite - this permits the test to be significantly simplified.