Moved tests over from testsuite to core
This commit is contained in:
parent
da8b1c73ab
commit
4ddebb083e
|
@ -29,8 +29,6 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.core.io.FileSystemResourceLoader;
|
import org.springframework.core.io.FileSystemResourceLoader;
|
||||||
import org.springframework.mock.web.MockServletConfig;
|
import org.springframework.mock.web.MockServletConfig;
|
||||||
import org.springframework.mock.web.MockServletContext;
|
import org.springframework.mock.web.MockServletContext;
|
||||||
import org.springframework.util.Log4jConfigurerTests;
|
|
||||||
import org.springframework.util.MockLog4jAppender;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
|
@ -47,7 +45,7 @@ public class Log4jWebConfigurerTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInitLoggingWithAbsoluteFilePath() throws FileNotFoundException {
|
public void testInitLoggingWithAbsoluteFilePath() throws FileNotFoundException {
|
||||||
URL url = Log4jConfigurerTests.class.getResource("testlog4j.properties");
|
URL url = Log4jWebConfigurerTests.class.getResource("testlog4j.properties");
|
||||||
doTestInitLogging(url.toString(), false);
|
doTestInitLogging(url.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +65,7 @@ public class Log4jWebConfigurerTests extends TestCase {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void testInitLoggingWithFileUrlAndRefreshInterval() throws FileNotFoundException {
|
public void testInitLoggingWithFileUrlAndRefreshInterval() throws FileNotFoundException {
|
||||||
URL url = Log4jConfigurerTests.class.getResource("testlog4j.properties");
|
URL url = Log4jWebConfigurerTests.class.getResource("testlog4j.properties");
|
||||||
doTestInitLogging(url.toString(), true);
|
doTestInitLogging(url.toString(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue