Drop deprecated dependencies on Log4j, JRuby, JExcel, Burlap, Commons Pool/DBCP

This commit also removes outdated support classes for Oracle, GlassFish, JBoss.

Issue: SPR-14429
This commit is contained in:
Juergen Hoeller
2016-07-05 15:46:53 +02:00
parent fb5a096ca2
commit 0fc0ce78ae
46 changed files with 24 additions and 4916 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -19,6 +19,8 @@ package org.springframework.remoting.caucho;
import java.io.IOException;
import java.net.InetSocketAddress;
import com.caucho.hessian.client.HessianProxyFactory;
import com.sun.net.httpserver.HttpServer;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -29,11 +31,6 @@ import org.springframework.tests.sample.beans.ITestBean;
import org.springframework.tests.sample.beans.TestBean;
import org.springframework.util.SocketUtils;
import com.caucho.burlap.client.BurlapProxyFactory;
import com.caucho.hessian.client.HessianProxyFactory;
import com.sun.net.httpserver.HttpServer;
import static org.junit.Assert.*;
/**
@@ -111,63 +108,6 @@ public class CauchoRemotingTests {
bean.setName("test");
}
@Test
public void burlapProxyFactoryBeanWithAccessError() throws Exception {
BurlapProxyFactoryBean factory = new BurlapProxyFactoryBean();
factory.setServiceInterface(ITestBean.class);
factory.setServiceUrl("http://localhosta/testbean");
factory.afterPropertiesSet();
assertTrue("Correct singleton value", factory.isSingleton());
assertTrue(factory.getObject() instanceof ITestBean);
ITestBean bean = (ITestBean) factory.getObject();
exception.expect(RemoteAccessException.class);
bean.setName("test");
}
@Test
public void burlapProxyFactoryBeanWithAuthenticationAndAccessError() throws Exception {
BurlapProxyFactoryBean factory = new BurlapProxyFactoryBean();
factory.setServiceInterface(ITestBean.class);
factory.setServiceUrl("http://localhosta/testbean");
factory.setUsername("test");
factory.setPassword("bean");
factory.setOverloadEnabled(true);
factory.afterPropertiesSet();
assertTrue("Correct singleton value", factory.isSingleton());
assertTrue(factory.getObject() instanceof ITestBean);
ITestBean bean = (ITestBean) factory.getObject();
exception.expect(RemoteAccessException.class);
bean.setName("test");
}
@Test
public void burlapProxyFactoryBeanWithCustomProxyFactory() throws Exception {
TestBurlapProxyFactory proxyFactory = new TestBurlapProxyFactory();
BurlapProxyFactoryBean factory = new BurlapProxyFactoryBean();
factory.setServiceInterface(ITestBean.class);
factory.setServiceUrl("http://localhosta/testbean");
factory.setProxyFactory(proxyFactory);
factory.setUsername("test");
factory.setPassword("bean");
factory.setOverloadEnabled(true);
factory.afterPropertiesSet();
assertTrue("Correct singleton value", factory.isSingleton());
assertTrue(factory.getObject() instanceof ITestBean);
ITestBean bean = (ITestBean) factory.getObject();
assertEquals(proxyFactory.user, "test");
assertEquals(proxyFactory.password, "bean");
assertTrue(proxyFactory.overloadEnabled);
exception.expect(RemoteAccessException.class);
bean.setName("test");
}
@Test
public void simpleHessianServiceExporter() throws IOException {
final int port = SocketUtils.findAvailableTcpPort();
@@ -221,27 +161,4 @@ public class CauchoRemotingTests {
}
}
private static class TestBurlapProxyFactory extends BurlapProxyFactory {
private String user;
private String password;
private boolean overloadEnabled;
@Override
public void setUser(String user) {
this.user = user;
}
@Override
public void setPassword(String password) {
this.password = password;
}
@Override
public void setOverloadEnabled(boolean overloadEnabled) {
this.overloadEnabled = overloadEnabled;
}
}
}

View File

@@ -1,143 +0,0 @@
/*
* Copyright 2002-2015 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.net.URL;
import javax.servlet.ServletContextEvent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.springframework.core.io.FileSystemResourceLoader;
import org.springframework.mock.web.test.MockServletContext;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.junit.Assume.*;
/**
* @author Juergen Hoeller
* @author Sam Brannen
* @since 21.02.2005
*/
@SuppressWarnings("deprecation")
public class Log4jWebConfigurerTests {
private static final String TESTLOG4J_PROPERTIES = "testlog4j.properties";
private static final String PROPERTIES_LOCATION = "org/springframework/web/util/testlog4j.properties";
private static final String CLASSPATH_RESOURCE = "classpath:" + PROPERTIES_LOCATION;
private static final String RELATIVE_PATH = "src/test/resources/" + PROPERTIES_LOCATION;
@Test
public void initLoggingWithClasspathResource() {
initLogging(CLASSPATH_RESOURCE, false);
}
@Test
public void initLoggingWithClasspathResourceAndRefreshInterval() {
initLogging(CLASSPATH_RESOURCE, true);
}
@Test
public void initLoggingWithRelativeFilePath() {
initLogging(RELATIVE_PATH, false);
}
@Test
public void initLoggingWithRelativeFilePathAndRefreshInterval() {
initLogging(RELATIVE_PATH, true);
}
@Test // See SPR-9417
public void initLoggingWithPlaceholderResolvingToValidUrl() {
initLogging("${some.prop.name:classpath:}" + PROPERTIES_LOCATION, true);
}
@Test
public void initLoggingWithUrl() {
URL url = Log4jWebConfigurerTests.class.getResource(TESTLOG4J_PROPERTIES);
initLogging(url.toString(), false);
}
@Test
public void initLoggingWithUrlAndRefreshInterval() {
URL url = Log4jWebConfigurerTests.class.getResource(TESTLOG4J_PROPERTIES);
initLogging(url.toString(), true);
}
@Test
public void initLoggingWithAbsoluteFilePathAndRefreshInterval() {
// Only works on MS Windows
assumeThat(System.getProperty("os.name"), containsString("Windows"));
URL url = Log4jWebConfigurerTests.class.getResource(TESTLOG4J_PROPERTIES);
initLogging(url.getFile(), true);
}
private void initLogging(String location, boolean refreshInterval) {
MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, location);
if (refreshInterval) {
sc.addInitParameter(Log4jWebConfigurer.REFRESH_INTERVAL_PARAM, "10");
}
Log4jWebConfigurer.initLogging(sc);
try {
assertLogOutput();
}
finally {
Log4jWebConfigurer.shutdownLogging(sc);
}
assertTrue(MockLog4jAppender.closeCalled);
}
private void assertLogOutput() {
Log log = LogFactory.getLog(this.getClass());
log.debug("debug");
log.info("info");
log.warn("warn");
log.error("error");
log.fatal("fatal");
assertTrue(MockLog4jAppender.loggingStrings.contains("debug"));
assertTrue(MockLog4jAppender.loggingStrings.contains("info"));
assertTrue(MockLog4jAppender.loggingStrings.contains("warn"));
assertTrue(MockLog4jAppender.loggingStrings.contains("error"));
assertTrue(MockLog4jAppender.loggingStrings.contains("fatal"));
}
@Test
public void testLog4jConfigListener() {
Log4jConfigListener listener = new Log4jConfigListener();
MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, RELATIVE_PATH);
listener.contextInitialized(new ServletContextEvent(sc));
try {
assertLogOutput();
}
finally {
listener.contextDestroyed(new ServletContextEvent(sc));
}
assertTrue(MockLog4jAppender.closeCalled);
}
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright 2002-2014 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<Object> loggingStrings = new ArrayList<Object>();
public static boolean closeCalled = false;
/* (non-Javadoc)
* @see org.apache.log4j.AppenderSkeleton#append(org.apache.log4j.spi.LoggingEvent)
*/
@Override
protected void append(LoggingEvent evt) {
//System.out.println("Adding " + evt.getMessage());
loggingStrings.add(evt.getMessage());
}
/* (non-Javadoc)
* @see org.apache.log4j.Appender#close()
*/
@Override
public void close() {
closeCalled = true;
}
/* (non-Javadoc)
* @see org.apache.log4j.Appender#requiresLayout()
*/
@Override
public boolean requiresLayout() {
return false;
}
}