[jboss-cvs] apache/commons-logging/src/test/org/apache/commons/logging/log4j/log4j12 ...
Scott Stark
scott.stark at jboss.com
Fri Feb 9 01:57:15 EST 2007
User: starksm
Date: 07/02/09 01:57:15
Added: commons-logging/src/test/org/apache/commons/logging/log4j/log4j12
Log4j12StandardTests.java TestAppender.java
AppClasspathStandardTestCase.java
ApiClasspathStandardTestCase.java
ChildClasspathStandardTestCase.java
ParentClasspathStandardTestCase.java
Log:
Update to the http://apache.ziply.com/jakarta/commons/logging/source/commons-logging-1.1-src.zip release
Revision Changes Path
1.1 date: 2007/02/09 06:57:15; author: starksm; state: Exp;apache/commons-logging/src/test/org/apache/commons/logging/log4j/log4j12/Log4j12StandardTests.java
Index: Log4j12StandardTests.java
===================================================================
/*
* Copyright 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.
* 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 java.util.List;
import org.apache.commons.logging.log4j.StandardTests;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
/**
* A concrete class that runs the standard tests, and is compiled
* specifically against log4j12. The parent class can't call any
* log4j methods at all as that would mean it has to be compiled
* against a particular version of log4j.
*/
public class Log4j12StandardTests extends StandardTests {
public void setUpTestAppender(List logEvents) {
TestAppender appender = new TestAppender(logEvents);
Logger rootLogger = Logger.getRootLogger();
rootLogger.removeAllAppenders();
rootLogger.addAppender(appender);
rootLogger.setLevel(Level.INFO);
}
}
1.1 date: 2007/02/09 06:57:15; author: starksm; state: Exp;apache/commons-logging/src/test/org/apache/commons/logging/log4j/log4j12/TestAppender.java
Index: TestAppender.java
===================================================================
/*
* Copyright 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.
* 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 java.util.List;
import org.apache.commons.logging.log4j.StandardTests;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;
/**
* A custom implementation of <code>org.apache.log4j.Appender</code> which
* converts the log4j-specific log event record into a representation that
* doesn't have a dependency on log4j and stores that new representation into
* an external list.
*/
public class TestAppender extends AppenderSkeleton {
/**
* Constructor.
*/
public TestAppender(List logEvents) {
events = logEvents;
}
// ----------------------------------------------------- Instance Variables
// The set of logged events for this appender
private List events;
// ------------------------------------------------------- Appender Methods
protected void append(LoggingEvent event) {
StandardTests.LogEvent lev = new StandardTests.LogEvent();
lev.level = event.getLevel().toString();
if (event.getMessage() == null)
lev.msg = null;
else
lev.msg = event.getMessage().toString();
if (event.getThrowableInformation() == null)
lev.throwable = null;
else
lev.throwable = event.getThrowableInformation().getThrowable();
events.add(lev);
}
public void close() {
}
public boolean requiresLayout() {
return (false);
}
}
1.1 date: 2007/02/09 06:57:15; author: starksm; state: Exp;apache/commons-logging/src/test/org/apache/commons/logging/log4j/log4j12/AppClasspathStandardTestCase.java
Index: AppClasspathStandardTestCase.java
===================================================================
/*
* Copyright 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.
* 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 org.apache.commons.logging.PathableClassLoader;
import org.apache.commons.logging.PathableTestSuite;
/**
* Tests for Log4J logging when there is only one classloader and everything
* is in it, as would be the situation for a standalone application.
*/
public class AppClasspathStandardTestCase {
/**
* Return the tests included in this test suite.
*/
public static Test suite() throws Exception {
PathableClassLoader loader = new PathableClassLoader(null);
loader.useSystemLoader("junit.");
loader.addLogicalLib("testclasses");
loader.addLogicalLib("log4j12");
loader.addLogicalLib("commons-logging");
Class testClass = loader.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
return new PathableTestSuite(testClass, loader);
}
}
1.1 date: 2007/02/09 06:57:15; author: starksm; state: Exp;apache/commons-logging/src/test/org/apache/commons/logging/log4j/log4j12/ApiClasspathStandardTestCase.java
Index: ApiClasspathStandardTestCase.java
===================================================================
/*
* Copyright 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.
* 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 org.apache.commons.logging.PathableClassLoader;
import org.apache.commons.logging.PathableTestSuite;
/**
* Tests for Log4J logging that emulate a webapp running within
* a container where the commons-logging-api jar file is in
* the parent classpath and commons-logging.jar is in the child.
*/
public class ApiClasspathStandardTestCase {
/**
* Return the tests included in this test suite.
*/
public static Test suite() throws Exception {
PathableClassLoader parent = new PathableClassLoader(null);
parent.useSystemLoader("junit.");
parent.addLogicalLib("commons-logging-api");
PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("log4j12");
child.addLogicalLib("commons-logging");
child.addLogicalLib("testclasses");
Class testClass = child.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
return new PathableTestSuite(testClass, child);
}
}
1.1 date: 2007/02/09 06:57:15; author: starksm; state: Exp;apache/commons-logging/src/test/org/apache/commons/logging/log4j/log4j12/ChildClasspathStandardTestCase.java
Index: ChildClasspathStandardTestCase.java
===================================================================
/*
* Copyright 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.
* 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 org.apache.commons.logging.PathableClassLoader;
import org.apache.commons.logging.PathableTestSuite;
/**
* Tests for Log4J logging that emulate a webapp running within
* a container where all the necessary libs are in the child.
*/
public class ChildClasspathStandardTestCase {
/**
* Return the tests included in this test suite.
*/
public static Test suite() throws Exception {
PathableClassLoader parent = new PathableClassLoader(null);
parent.useSystemLoader("junit.");
PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("testclasses");
child.addLogicalLib("log4j12");
child.addLogicalLib("commons-logging");
Class testClass = child.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
return new PathableTestSuite(testClass, child);
}
}
1.1 date: 2007/02/09 06:57:15; author: starksm; state: Exp;apache/commons-logging/src/test/org/apache/commons/logging/log4j/log4j12/ParentClasspathStandardTestCase.java
Index: ParentClasspathStandardTestCase.java
===================================================================
/*
* Copyright 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.
* 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 org.apache.commons.logging.PathableClassLoader;
import org.apache.commons.logging.PathableTestSuite;
/**
* Tests for Log4J logging that emulate a webapp running within
* a container where all the necessary libs are in the parent.
*/
public class ParentClasspathStandardTestCase {
/**
* Return the tests included in this test suite.
*/
public static Test suite() throws Exception {
PathableClassLoader parent = new PathableClassLoader(null);
parent.useSystemLoader("junit.");
parent.addLogicalLib("commons-logging");
parent.addLogicalLib("log4j12");
PathableClassLoader child = new PathableClassLoader(parent);
child.addLogicalLib("testclasses");
Class testClass = child.loadClass(
"org.apache.commons.logging.log4j.log4j12.Log4j12StandardTests");
return new PathableTestSuite(testClass, child);
}
}
More information about the jboss-cvs-commits
mailing list