Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 17171 invoked from network); 20 Jan 2006 05:54:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Jan 2006 05:54:56 -0000 Received: (qmail 44060 invoked by uid 500); 20 Jan 2006 05:54:53 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 43998 invoked by uid 500); 20 Jan 2006 05:54:52 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 43987 invoked by uid 500); 20 Jan 2006 05:54:52 -0000 Received: (qmail 43984 invoked by uid 99); 20 Jan 2006 05:54:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jan 2006 21:54:52 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 19 Jan 2006 21:54:52 -0800 Received: (qmail 16850 invoked by uid 65534); 20 Jan 2006 05:54:31 -0000 Message-ID: <20060120055431.16849.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r370739 - in /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet: ./ BasicServletTestCase.java Date: Fri, 20 Jan 2006 05:54:31 -0000 To: commons-cvs@jakarta.apache.org From: skitching@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: skitching Date: Thu Jan 19 21:54:27 2006 New Revision: 370739 URL: http://svn.apache.org/viewcvs?rev=370739&view=rev Log: Add unit tests for ServletContextCleaner class. Added: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java (with props) Added: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java?rev=370739&view=auto ============================================================================== --- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java (added) +++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java Thu Jan 19 21:54:27 2006 @@ -0,0 +1,71 @@ +/* + * 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.commons.logging.log4j.log4j12; + +import junit.framework.Test; +import junit.framework.TestCase; + +import org.apache.commons.logging.PathableClassLoader; +import org.apache.commons.logging.PathableTestSuite; +import org.apache.commons.logging.impl.ServletContextCleaner; + + +/** + * Tests for ServletContextCleaner utility class. + */ + +public class BasicServletTestCase extends TestCase { + + /** + * Return the tests included in this test suite. + */ + public static Test suite() throws Exception { + // LogFactory in parent + // LogFactory in child (loads test) + // LogFactory in tccl + // + // Having the test loaded via a loader above the tccl emulates the situation + // where a web.xml file specifies ServletContextCleaner as a listener, and + // that class is deployed via a shared classloader. + + PathableClassLoader parent = new PathableClassLoader(null); + parent.useSystemLoader("junit."); + parent.addLogicalLib("commons-logging"); + parent.addLogicalLib("servletapi"); + + PathableClassLoader child = new PathableClassLoader(parent); + child.setParentFirst(false); + child.addLogicalLib("commons-logging"); + child.addLogicalLib("testclasses"); + + PathableClassLoader tccl = new PathableClassLoader(child); + tccl.setParentFirst(false); + tccl.addLogicalLib("commons-logging"); + + Class testClass = child.loadClass(BasicServletTestCase.class.getName()); + return new PathableTestSuite(testClass, tccl); + } + + /** + * Test that calling ServletContextCleaner.contextDestroyed doesn't crash. + * Testing anything else is rather difficult... + */ + public void testBasics() { + ServletContextCleaner scc = new ServletContextCleaner(); + scc.contextDestroyed(null); + } +} Propchange: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/servlet/BasicServletTestCase.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org