@@ -0,0 +1,2473 @@
+/*%0A * Copyright 2006 The Apache Software Foundation.%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %0A *      http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */ %0A%0Apackage org.apache.commons.logging.log4j.log4j12;%0A%0Aimport junit.framework.Test;%0Aimport junit.framework.TestCase;%0A%0Aimport org.apache.commons.logging.PathableClassLoader;%0Aimport org.apache.commons.logging.PathableTestSuite;%0Aimport org.apache.commons.logging.impl.ServletContextCleaner;%0A%0A%0A/**%0A * Tests for ServletContextCleaner utility class.%0A */%0A%0Apublic class BasicServletTestCase extends TestCase %7B%0A%0A    /**%0A     * Return the tests included in this test suite.%0A     */%0A    public static Test suite() throws Exception %7B%0A        // LogFactory in parent%0A        // LogFactory in child (loads test)%0A        // LogFactory in tccl%0A        //%0A        // Having the test loaded via a loader above the tccl emulates the situation%0A        // where a web.xml file specifies ServletContextCleaner as a listener, and%0A        // that class is deployed via a shared classloader.%0A%0A        PathableClassLoader parent = new PathableClassLoader(null);%0A        parent.useSystemLoader(%22junit.%22);%0A        parent.addLogicalLib(%22commons-logging%22);%0A        parent.addLogicalLib(%22servletapi%22);%0A%0A        PathableClassLoader child = new PathableClassLoader(parent);%0A        child.setParentFirst(false);%0A        child.addLogicalLib(%22commons-logging%22);%0A        child.addLogicalLib(%22testclasses%22);%0A%0A        PathableClassLoader tccl = new PathableClassLoader(child);%0A        tccl.setParentFirst(false);%0A        tccl.addLogicalLib(%22commons-logging%22);%0A%0A        Class testClass = child.loadClass(BasicServletTestCase.class.getName());%0A        return new PathableTestSuite(testClass, tccl);%0A    %7D%0A    %0A    /**%0A     * Test that calling ServletContextCleaner.contextDestroyed doesn't crash.%0A     * Testing anything else is rather difficult...%0A     */%0A    public void testBasics() %7B%0A        ServletContextCleaner scc = new ServletContextCleaner();%0A        scc.contextDestroyed(null);%0A    %7D%0A%7D%0A

Add unit tests for ServletContextCleaner class.