diff --git a/src/test/org/apache/commons/logging/BasicOperationsTest.java b/src/test/org/apache/commons/logging/BasicOperationsTestCase.java similarity index 83% rename from src/test/org/apache/commons/logging/BasicOperationsTest.java rename to src/test/org/apache/commons/logging/BasicOperationsTestCase.java index ac70250..d64fc72 100644 --- a/src/test/org/apache/commons/logging/BasicOperationsTest.java +++ b/src/test/org/apache/commons/logging/BasicOperationsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2004 The Apache Software Foundation. + * Copyright 2004,2005 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. @@ -25,22 +25,17 @@ import junit.framework.TestCase; * This is the minimum requirement for any well behaved logger * and so this test should be run for each kind. */ -public class BasicOperationsTest extends TestCase +public class BasicOperationsTestCase extends TestCase { - public BasicOperationsTest(String testName) - { - super(testName); - } - public void testIsEnabledClassLog() { - Log log = LogFactory.getLog(BasicOperationsTest.class); + Log log = LogFactory.getLog(BasicOperationsTestCase.class); executeIsEnabledTest(log); } public void testIsEnabledNamedLog() { - Log log = LogFactory.getLog(BasicOperationsTest.class.getName()); + Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName()); executeIsEnabledTest(log); } @@ -65,13 +60,13 @@ public class BasicOperationsTest extends TestCase public void testMessageWithoutExceptionClassLog() { - Log log = LogFactory.getLog(BasicOperationsTest.class); + Log log = LogFactory.getLog(BasicOperationsTestCase.class); executeMessageWithoutExceptionTest(log); } public void testMessageWithoutExceptionNamedLog() { - Log log = LogFactory.getLog(BasicOperationsTest.class.getName()); + Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName()); executeMessageWithoutExceptionTest(log); } @@ -95,13 +90,13 @@ public class BasicOperationsTest extends TestCase public void testMessageWithExceptionClassLog() { - Log log = LogFactory.getLog(BasicOperationsTest.class); + Log log = LogFactory.getLog(BasicOperationsTestCase.class); executeMessageWithExceptionTest(log); } public void testMessageWithExceptionNamedLog() { - Log log = LogFactory.getLog(BasicOperationsTest.class.getName()); + Log log = LogFactory.getLog(BasicOperationsTestCase.class.getName()); executeMessageWithExceptionTest(log); } diff --git a/src/test/org/apache/commons/logging/LoadTest.java b/src/test/org/apache/commons/logging/LoadTestCase.java similarity index 94% rename from src/test/org/apache/commons/logging/LoadTest.java rename to src/test/org/apache/commons/logging/LoadTestCase.java index d84c916..ac4fb9a 100644 --- a/src/test/org/apache/commons/logging/LoadTest.java +++ b/src/test/org/apache/commons/logging/LoadTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation. + * Copyright 2001-2005 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. @@ -24,7 +24,7 @@ import junit.framework.TestSuite; * @author baliuka * @version $Id$ */ -public class LoadTest extends TestCase{ +public class LoadTestCase extends TestCase{ //TODO: need some way to add service provider packages static private String LOG_PCKG[] = {"org.apache.commons.logging", "org.apache.commons.logging.impl"}; @@ -213,28 +213,11 @@ public class LoadTest extends TestCase{ } - - /** Creates a new instance of LoadTest */ - public LoadTest(String testName) { - super(testName); - } - - - - public static void main(String[] args){ - String[] testCaseName = { LoadTest.class.getName() }; + String[] testCaseName = { LoadTestCase.class.getName() }; junit.textui.TestRunner.main(testCaseName); } - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(LoadTest.class); - - return suite; - } - public void setUp() { // save state before test starts so we can restore it when test ends origContextClassLoader = Thread.currentThread().getContextClassLoader(); diff --git a/src/test/org/apache/commons/logging/NoOpLogTest.java b/src/test/org/apache/commons/logging/NoOpLogTestCase.java similarity index 73% rename from src/test/org/apache/commons/logging/NoOpLogTest.java rename to src/test/org/apache/commons/logging/NoOpLogTestCase.java index 58e2d07..efeb4c7 100644 --- a/src/test/org/apache/commons/logging/NoOpLogTest.java +++ b/src/test/org/apache/commons/logging/NoOpLogTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation. + * Copyright 2001-2005 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. @@ -27,7 +27,7 @@ import junit.framework.*; * * */ -public class NoOpLogTest extends AbstractLogTest +public class NoOpLogTestCase extends AbstractLogTest { /** @@ -42,16 +42,7 @@ public class NoOpLogTest extends AbstractLogTest public static void main(String[] args) { - String[] testCaseName = { NoOpLogTest.class.getName() }; + String[] testCaseName = { NoOpLogTestCase.class.getName() }; junit.textui.TestRunner.main(testCaseName); } - - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(NoOpLogTest.class); - - return suite; - } - } diff --git a/src/test/org/apache/commons/logging/NullClassLoaderTest.java b/src/test/org/apache/commons/logging/NullClassLoaderTestCase.java similarity index 74% rename from src/test/org/apache/commons/logging/NullClassLoaderTest.java rename to src/test/org/apache/commons/logging/NullClassLoaderTestCase.java index 8c78aa6..886461e 100644 --- a/src/test/org/apache/commons/logging/NullClassLoaderTest.java +++ b/src/test/org/apache/commons/logging/NullClassLoaderTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation. + * Copyright 2001-2005 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. @@ -25,7 +25,7 @@ import junit.framework.TestSuite; * JCL is deployed via the bootclassloader - something that could be done when * using java in embedded systems. */ -public class NullClassLoaderTest extends TestCase{ +public class NullClassLoaderTestCase extends TestCase { //---------------------- Main --------------------------------- @@ -33,25 +33,10 @@ public class NullClassLoaderTest extends TestCase{ * Main method so this test case can be run direct from the command line. */ public static void main(String[] args){ - String[] testCaseName = { NullClassLoaderTest.class.getName() }; + String[] testCaseName = { NullClassLoaderTestCase.class.getName() }; junit.textui.TestRunner.main(testCaseName); } - //---------------------- Constructors --------------------------------- - - /** Creates a new instance of LoadTest */ - public NullClassLoaderTest(String testName) { - super(testName); - } - - //---------------------- JUnit methods --------------------------------- - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTestSuite(NullClassLoaderTest.class); - return suite; - } - //---------------------- unit tests --------------------------------- /** diff --git a/src/test/org/apache/commons/logging/SimpleLogTest.java b/src/test/org/apache/commons/logging/SimpleLogTestCase.java similarity index 63% rename from src/test/org/apache/commons/logging/SimpleLogTest.java rename to src/test/org/apache/commons/logging/SimpleLogTestCase.java index 614c943..e5c1ede 100644 --- a/src/test/org/apache/commons/logging/SimpleLogTest.java +++ b/src/test/org/apache/commons/logging/SimpleLogTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation. + * Copyright 2001-2005 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. @@ -27,30 +27,20 @@ import junit.framework.*; * * */ -public class SimpleLogTest extends AbstractLogTest +public class SimpleLogTestCase extends AbstractLogTest { /** * * * */ - public Log getLogObject() - { - return (Log) new SimpleLog(this.getClass().getName()); - } + public Log getLogObject() + { + return (Log) new SimpleLog(this.getClass().getName()); + } - public static void main(String[] args) - { - String[] testCaseName = { SimpleLogTest.class.getName() }; + public static void main(String[] args) { + String[] testCaseName = { SimpleLogTestCase.class.getName() }; junit.textui.TestRunner.main(testCaseName); } - - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(SimpleLogTest.class); - - return suite; - } - } diff --git a/src/test/org/apache/commons/logging/TestAll.java b/src/test/org/apache/commons/logging/TestAll.java deleted file mode 100644 index 3784612..0000000 --- a/src/test/org/apache/commons/logging/TestAll.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2001-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.*; - - -/** - *
The build script calls just one TestSuite - this one!
- * All tests should be written into separate TestSuite's
- * and added to this. Don't clutter this class with implementations.
This class is based on org.apache.commons.betwixt.TestAll
- * coded by James Strachan.
Wrapper around test cases that need to have a custom class loader - * hierarchy assembled. The wrapper is configured by the following - * system properties:
- *commons-logging-api.jar and child class loader
- * contains commons-logging.jar. This is like the
- * default configuration for Tomcat 4.1.commons-logging.jar. This is what would happen
- * if you replaced commons-logging-api.jar with
- * commons-logging.jar so that you did not need to
- * include the latter with your application.commons-logging-tests.jar.commons-logging.jar is placed in, if specified.commons-logging.jar,
- * commons-logging-api.jar, and
- * commons-logging-tests.jar files resulting from the
- * execution of the compile.tests target.commons-logging-tests.jar file.When executed, the system classpath for the wrapper should include - * only the wrapper class itself.
- * - * @author Craig R. McClanahan - * @version $Revision$ $Date$ - */ - -public class Wrapper { - - - public static void main(String args[]) { - - try { - - // Create variables we will need - List parentList = new ArrayList(); - List childList = new ArrayList(); - URL urls[] = null; - - // Construct URLs for the various JAR files - File target = new File(System.getProperty("wrapper.target")); - - // the test invoker is required to set these system properties - // to point to the appropriate jar files - String jcljar = System.getProperty("commons.logging.jar"); - String jclapijar = System.getProperty("commons.logging.api.jar"); - String jclappjar = System.getProperty("commons.logging.appenders.jar"); - if ((jcljar==null) || (jclapijar==null) || (jclappjar==null)) { - throw new Exception( - "Required system property for test is missing. " - + "One or more of the following is not defined: " - + "commons.logging.jar, commons.logging.api.jar, " - + "commons.logging.appenders.jar"); - } - - URL commonsLogging = (new File(target, jcljar)).toURL(); - URL commonsLoggingApi = (new File(target, jclapijar)).toURL(); - URL commonsLoggingTests = - (new File(target, "commons-logging-tests.jar")).toURL(); - URL junit = - (new File(System.getProperty("wrapper.junit"))).toURL(); - URL appender = null; - URL log4j = null; - if (System.getProperty("wrapper.log4j") != null) { - log4j = - (new File(System.getProperty("wrapper.log4j"))).toURL(); - appender = - (new File(target, jclappjar)).toURL(); - } - - System.out.println("commonsLogging lib is at [" + commonsLogging + "]"); - System.out.println("commonsLoggingApi lib is at [" + commonsLoggingApi + "]"); - - // Construct class loader repository lists for supported scenarios - if ("API".equals(System.getProperty("wrapper.hierarchy"))) { - parentList.add(commonsLoggingApi); - childList.add(commonsLogging); - if (log4j != null) { - childList.add(log4j); - childList.add(appender); - } - } else { // Assumes "FULL" - parentList.add(commonsLogging); - if (log4j != null) { - parentList.add(log4j); - childList.add(appender); - } - } - childList.add(commonsLoggingTests); - childList.add(junit); - - // Construt the parent and child class loaders - urls = (URL[]) parentList.toArray(new URL[parentList.size()]); - ClassLoader parent = - new URLClassLoader(urls, - ClassLoader.getSystemClassLoader()); - urls = (URL[]) childList.toArray(new URL[childList.size()]); - ClassLoader child = new URLClassLoader(urls, parent); - - // Execute the test runner for this TestCase - ClassLoader old = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(child); - Class clazz = child.loadClass("junit.textui.TestRunner"); - String params[] = new String[1]; - params[0] = System.getProperty("wrapper.testcase"); - Method method = clazz.getMethod("main", - new Class[] { params.getClass() }); - method.invoke(null, new Object[] { params }); - Thread.currentThread().setContextClassLoader(old); - - } catch (Exception e) { - - System.out.println("Wrapper Exception Occurred: " + e); - e.printStackTrace(System.out); - System.exit(1); - - } - - } - - - -}