Make DeveloperSettings a singleton, and other improvements.
By making it a singleton, we do need an explicit Setup operation. However, it means that we can refer to the settings in client code that doesn’t have access to a request or to the ServletContext. Other refactorings to simplify the logic or make it more scalable.
This commit is contained in:
parent
f6bd5804d5
commit
245763e9e7
20 changed files with 387 additions and 421 deletions
|
@ -21,8 +21,6 @@ import javax.servlet.ServletException;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import stubs.edu.cornell.mannlib.vitro.webapp.utils.developer.DeveloperSettingsStub;
|
||||
|
||||
/**
|
||||
* A simple stand-in for the {@link ServletContext}, for use in unit tests.
|
||||
*/
|
||||
|
@ -38,11 +36,6 @@ public class ServletContextStub implements ServletContext {
|
|||
private final Map<String, String> mockResources = new HashMap<String, String>();
|
||||
private final Map<String, String> realPaths = new HashMap<String, String>();
|
||||
|
||||
public ServletContextStub() {
|
||||
// Assume that unit tests won't want to use Developer mode.
|
||||
DeveloperSettingsStub.set(this);
|
||||
}
|
||||
|
||||
public void setContextPath(String contextPath) {
|
||||
if (contextPath == null) {
|
||||
throw new NullPointerException("contextPath may not be null.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue