From df74a87bcaca4a4f605b40222b045ddafab9f6b0 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 29 Oct 2008 12:17:13 +0000 Subject: [PATCH] Moved tests over from testsuite to core git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@179 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../util/MethodInvokerTests.java | 0 .../web/util/Log4jWebConfigurerTests.java | 6 +- .../web/util/MockLog4jAppender.java | 59 +++++++++++++++++++ 3 files changed, 61 insertions(+), 4 deletions(-) rename {org.springframework.core => org.springframework.testsuite}/src/test/java/org/springframework/util/MethodInvokerTests.java (100%) create mode 100644 org.springframework.testsuite/src/test/java/org/springframework/web/util/MockLog4jAppender.java diff --git a/org.springframework.core/src/test/java/org/springframework/util/MethodInvokerTests.java b/org.springframework.testsuite/src/test/java/org/springframework/util/MethodInvokerTests.java similarity index 100% rename from org.springframework.core/src/test/java/org/springframework/util/MethodInvokerTests.java rename to org.springframework.testsuite/src/test/java/org/springframework/util/MethodInvokerTests.java diff --git a/org.springframework.testsuite/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java b/org.springframework.testsuite/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java index c6c3ead847d..aebe9edc148 100644 --- a/org.springframework.testsuite/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java +++ b/org.springframework.testsuite/src/test/java/org/springframework/web/util/Log4jWebConfigurerTests.java @@ -29,8 +29,6 @@ import org.apache.commons.logging.LogFactory; import org.springframework.core.io.FileSystemResourceLoader; import org.springframework.mock.web.MockServletConfig; import org.springframework.mock.web.MockServletContext; -import org.springframework.util.Log4jConfigurerTests; -import org.springframework.util.MockLog4jAppender; /** * @author Juergen Hoeller @@ -47,7 +45,7 @@ public class Log4jWebConfigurerTests extends TestCase { } public void testInitLoggingWithAbsoluteFilePath() throws FileNotFoundException { - URL url = Log4jConfigurerTests.class.getResource("testlog4j.properties"); + URL url = Log4jWebConfigurerTests.class.getResource("testlog4j.properties"); doTestInitLogging(url.toString(), false); } @@ -67,7 +65,7 @@ public class Log4jWebConfigurerTests extends TestCase { */ public void testInitLoggingWithFileUrlAndRefreshInterval() throws FileNotFoundException { - URL url = Log4jConfigurerTests.class.getResource("testlog4j.properties"); + URL url = Log4jWebConfigurerTests.class.getResource("testlog4j.properties"); doTestInitLogging(url.toString(), true); } diff --git a/org.springframework.testsuite/src/test/java/org/springframework/web/util/MockLog4jAppender.java b/org.springframework.testsuite/src/test/java/org/springframework/web/util/MockLog4jAppender.java new file mode 100644 index 00000000000..83963b8c06b --- /dev/null +++ b/org.springframework.testsuite/src/test/java/org/springframework/web/util/MockLog4jAppender.java @@ -0,0 +1,59 @@ +/* + * Copyright 2002-2005 the original author or authors. + * + * 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.springframework.web.util; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.AppenderSkeleton; +import org.apache.log4j.spi.LoggingEvent; + +/** + * @author Alef Arendsen + */ +public class MockLog4jAppender extends AppenderSkeleton { + + public static final List loggingStrings = new ArrayList(); + + public static boolean closeCalled = false; + + /* (non-Javadoc) + * @see org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent) + */ + protected void append(LoggingEvent evt) { + //System.out.println("Adding " + evt.getMessage()); + loggingStrings.add(evt.getMessage()); + } + + /* (non-Javadoc) + * @see org.apache.log4j.Appender#close() + */ + public void close() { + closeCalled = true; + } + + /* (non-Javadoc) + * @see org.apache.log4j.Appender#requiresLayout() + */ + public boolean requiresLayout() { + return false; + } + + + + +} \ No newline at end of file