/**
 *  Copyright 2006 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.geronimo.testsupport;

import java.io.File;

import junit.framework.TestCase;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Provides support for tests.
 *
 * @version $Rev$ $Date$
 */
public abstract class TestSupport
    extends TestCase
{
    /**
     * The base-directory which tests should be run from.
     *
     * @see #getBaseDir()   This field is initialized from the return of this method on instance construction.
     */
    protected final File BASEDIR = getBaseDir();

    /**
     * Instance logger which tests should use to produce tracing information.
     *
     * <p>
     * Unless you have a really good reason to, do not change this field from your sub-class.
     * And if you do, please document why you have done so.
     */
    protected Log log = LogFactory.getLog(getClass());
    
    protected TestSupport(final String name) {
        super(name);
    }
    
    protected TestSupport() {
        super();
    }
    
    /**
     * Determine the value of <tt>${basedir}</tt>, which should be the base directory of
     * the module which the concreate test class is defined in.
     *
     * <p>
     * If The system property <tt>basedir</tt> is already set, then that value is used,
     * otherwise we determine the value from the codesource of the containing concrete class
     * and set the <tt>basedir</tt> system property to that value.
     *
     * @see #BASEDIR    This field is always initialized to the value which this method returns.
     *
     * @return  The base directory of the module which contains the concreate test class.
     */
    protected final File getBaseDir() {
        File dir;

        // If ${basedir} is set, then honor it
        String tmp = System.getProperty("basedir");
        if (tmp != null) {
            dir = new File(tmp);
        }
        else {
            // Find the directory which this class (or really the sub-class of TestSupport) is defined in.
            String path = getClass().getProtectionDomain().getCodeSource().getLocation().getFile();

            // We expect the file to be in target/test-classes, so go up 2 dirs
            dir = new File(path).getParentFile().getParentFile();

            // Set ${basedir} which is needed by logging to initialize
            System.setProperty("basedir", dir.getPath());
        }

        // System.err.println("Base Directory: " + dir);

        return dir;
    }
}

@@ -1502,127 +1502,427 @@
     
-protected TestSupport(final String name) %7B%0A        super(name);%0A    %7D%0A    %0A    protected TestSupport() %7B%0A        super(
+/**%0A     * Constructor for tests that specify a specific test name.%0A     *%0A     * @see #TestSupport()  This is the prefered constructor for sub-classes to use.%0A     */%0A    protected TestSupport(final String name) %7B%0A        super(name);%0A        %0A        log.info(%22Initialized%22);%0A    %7D%0A    %0A    /**%0A     * Default constructor.%0A     */%0A    protected TestSupport() %7B%0A        super();%0A        %0A        log.info(%22Initialized%22
 );%0A 

Add some info logging to test when initialization happens and what appenders it goes to