org.apache.commons.logging.jdk14
Class CustomConfigTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.commons.logging.jdk14.DefaultConfigTestCase
              extended by org.apache.commons.logging.jdk14.CustomConfigTestCase
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
CustomConfigAPITestCase, CustomConfigFullTestCase

public class CustomConfigTestCase
extends DefaultConfigTestCase

TestCase for JDK 1.4 logging when running on a JDK 1.4 system with custom configuration, so that JDK 1.4 should be selected and an appropriate logger configured per the configuration properties.

Version:
$Revision: 568760 $ $Date: 2007-08-23 00:19:45 +0200 (to, 23 aug 2007) $
Author:
Craig R. McClanahan

Field Summary
protected  TestHandler handler
          The customized Handler we will be using.
protected static String HANDLER_NAME
           
protected  Handler[] handlers
          The underlying Handlers we will be using.
protected  Logger logger
          The underlying Logger we will be using.
protected  LogManager manager
          The underlying LogManager we will be using.
protected  Level[] testLevels
          The message levels that should have been logged.
protected  String[] testMessages
          The message strings that should have been logged.
 
Fields inherited from class org.apache.commons.logging.jdk14.DefaultConfigTestCase
factory, log
 
Constructor Summary
CustomConfigTestCase(String name)
          Construct a new instance of this test case.
 
Method Summary
protected  void checkLog()
           
protected  void checkLogRecords(boolean thrown)
           
protected static void loadTestHandler(String className, ClassLoader targetCL)
          Make a class available in the system classloader even when its classfile is not present in the classpath configured for that classloader.
protected  void logExceptionMessages()
           
protected  void logPlainMessages()
           
protected static byte[] readClass(String name, ClassLoader srcCL)
          Given the name of a class that is somewhere in the classpath of the provided classloader, return the contents of the corresponding .class file.
 void setUp()
          Set up instance variables required by this test case.
protected  void setUpHandlers()
           
protected  void setUpLogger(String name)
           
protected  void setUpManager(String config)
           
static junit.framework.Test suite()
          Return the tests included in this test suite.
 void tearDown()
          Tear down instance variables required by this test case.
 void testExceptionMessages()
           
 void testPlainMessages()
           
 void testPristineHandlers()
           
 void testPristineLogger()
           
 void testSerializable()
           
 
Methods inherited from class org.apache.commons.logging.jdk14.DefaultConfigTestCase
setUpFactory, setUpLog, testPristineFactory, testPristineLog
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HANDLER_NAME

protected static final String HANDLER_NAME
See Also:
Constant Field Values

handler

protected TestHandler handler

The customized Handler we will be using.


handlers

protected Handler[] handlers

The underlying Handlers we will be using.


logger

protected Logger logger

The underlying Logger we will be using.


manager

protected LogManager manager

The underlying LogManager we will be using.


testLevels

protected Level[] testLevels

The message levels that should have been logged.


testMessages

protected String[] testMessages

The message strings that should have been logged.

Constructor Detail

CustomConfigTestCase

public CustomConfigTestCase(String name)

Construct a new instance of this test case.

Parameters:
name - Name of the test case
Method Detail

readClass

protected static byte[] readClass(String name,
                                  ClassLoader srcCL)
                           throws Exception
Given the name of a class that is somewhere in the classpath of the provided classloader, return the contents of the corresponding .class file.

Throws:
Exception

loadTestHandler

protected static void loadTestHandler(String className,
                                      ClassLoader targetCL)
Make a class available in the system classloader even when its classfile is not present in the classpath configured for that classloader. This only works for classes for which all dependencies are already loaded in that classloader.


setUp

public void setUp()
           throws Exception
Set up instance variables required by this test case.

Overrides:
setUp in class DefaultConfigTestCase
Throws:
Exception

suite

public static junit.framework.Test suite()
                                  throws Exception
Return the tests included in this test suite.

Throws:
Exception

tearDown

public void tearDown()
Tear down instance variables required by this test case.

Overrides:
tearDown in class DefaultConfigTestCase

testExceptionMessages

public void testExceptionMessages()
                           throws Exception
Throws:
Exception

testPlainMessages

public void testPlainMessages()
                       throws Exception
Throws:
Exception

testPristineHandlers

public void testPristineHandlers()

testPristineLogger

public void testPristineLogger()

testSerializable

public void testSerializable()
                      throws Exception
Overrides:
testSerializable in class DefaultConfigTestCase
Throws:
Exception

checkLog

protected void checkLog()
Overrides:
checkLog in class DefaultConfigTestCase

checkLogRecords

protected void checkLogRecords(boolean thrown)

logExceptionMessages

protected void logExceptionMessages()

logPlainMessages

protected void logPlainMessages()

setUpHandlers

protected void setUpHandlers()
                      throws Exception
Throws:
Exception

setUpLogger

protected void setUpLogger(String name)
                    throws Exception
Throws:
Exception

setUpManager

protected void setUpManager(String config)
                     throws Exception
Throws:
Exception


Copyright © 2001-2009 Apache Software Foundation. All Rights Reserved.