consistent copies of mocks

This commit is contained in:
Juergen Hoeller 2009-01-20 18:01:26 +00:00
parent 5585526ad1
commit 76a6527c4c
24 changed files with 28 additions and 49 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,7 +18,6 @@ package org.springframework.mock.web;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import javax.servlet.ServletInputStream; import javax.servlet.ServletInputStream;
import org.springframework.util.Assert; import org.springframework.util.Assert;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,7 +18,6 @@ package org.springframework.mock.web;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import org.springframework.util.Assert; import org.springframework.util.Assert;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,7 +20,6 @@ import java.io.IOException;
import java.io.Reader; import java.io.Reader;
import java.io.StringReader; import java.io.StringReader;
import java.io.Writer; import java.io.Writer;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyContent; import javax.servlet.jsp.tagext.BodyContent;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2006 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,12 +16,10 @@
package org.springframework.mock.web; package org.springframework.mock.web;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Enumeration;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,6 @@ import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashSet; import java.util.HashSet;
import java.util.Hashtable;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -97,7 +96,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
// ServletRequest properties // ServletRequest properties
//--------------------------------------------------------------------- //---------------------------------------------------------------------
private final Hashtable attributes = new Hashtable(); private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
private String characterEncoding; private String characterEncoding;
@ -146,7 +145,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
/** /**
* The key is the lowercase header name; the value is a {@link HeaderValueHolder} object. * The key is the lowercase header name; the value is a {@link HeaderValueHolder} object.
*/ */
private final Map<String, HeaderValueHolder> headers = new Hashtable<String, HeaderValueHolder>(); private final Map<String, HeaderValueHolder> headers = new LinkedHashMap<String, HeaderValueHolder>();
private String method; private String method;
@ -285,7 +284,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
public Enumeration<String> getAttributeNames() { public Enumeration<String> getAttributeNames() {
checkActive(); checkActive();
return this.attributes.keys(); return Collections.enumeration(this.attributes.keySet());
} }
public String getCharacterEncoding() { public String getCharacterEncoding() {
@ -612,7 +611,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
return this.authType; return this.authType;
} }
public void setCookies(Cookie[] cookies) { public void setCookies(Cookie... cookies) {
this.cookies = cookies; this.cookies = cookies;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,12 +26,10 @@ import java.io.Writer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@ package org.springframework.mock.web;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.Writer; import java.io.Writer;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.JspWriter;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2006 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -19,7 +19,7 @@ package org.springframework.mock.web;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import javax.el.ELContext; import javax.el.ELContext;
import javax.servlet.Servlet; import javax.servlet.Servlet;
@ -61,7 +61,7 @@ public class MockPageContext extends PageContext {
private final ServletConfig servletConfig; private final ServletConfig servletConfig;
private final Map<String, Object> attributes = new HashMap<String, Object>(); private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
private JspWriter out; private JspWriter out;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2007 the original author or authors. * Copyright 2002-2009 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@
package org.springframework.mock.web; package org.springframework.mock.web;
import java.io.IOException; import java.io.IOException;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.Servlet; import javax.servlet.Servlet;

View File

@ -17,11 +17,6 @@
package org.springframework.mock.web.portlet; package org.springframework.mock.web.portlet;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import javax.portlet.ActionResponse; import javax.portlet.ActionResponse;
import javax.portlet.PortalContext; import javax.portlet.PortalContext;
@ -29,10 +24,8 @@ import javax.portlet.PortletMode;
import javax.portlet.PortletModeException; import javax.portlet.PortletModeException;
import javax.portlet.WindowState; import javax.portlet.WindowState;
import javax.portlet.WindowStateException; import javax.portlet.WindowStateException;
import javax.xml.namespace.QName;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
/** /**
* Mock implementation of the {@link javax.portlet.ActionResponse} interface. * Mock implementation of the {@link javax.portlet.ActionResponse} interface.

View File

@ -26,7 +26,6 @@ import java.io.UnsupportedEncodingException;
import javax.portlet.ClientDataRequest; import javax.portlet.ClientDataRequest;
import javax.portlet.PortalContext; import javax.portlet.PortalContext;
import javax.portlet.PortletContext; import javax.portlet.PortletContext;
import javax.portlet.PortletMode;
/** /**
* Mock implementation of the {@link javax.portlet.ClientDataRequest} interface. * Mock implementation of the {@link javax.portlet.ClientDataRequest} interface.

View File

@ -16,8 +16,8 @@
package org.springframework.mock.web.portlet; package org.springframework.mock.web.portlet;
import javax.portlet.EventResponse;
import javax.portlet.EventRequest; import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
/** /**
* Mock implementation of the {@link javax.portlet.EventResponse} interface. * Mock implementation of the {@link javax.portlet.EventResponse} interface.

View File

@ -23,7 +23,6 @@ import java.util.HashSet;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.portlet.PortletPreferences; import javax.portlet.PortletPreferences;
import javax.portlet.PreferencesValidator; import javax.portlet.PreferencesValidator;
import javax.portlet.ReadOnlyException; import javax.portlet.ReadOnlyException;

View File

@ -482,7 +482,7 @@ public class MockPortletRequest implements PortletRequest {
return this.windowID; return this.windowID;
} }
public void setCookies(Cookie[] cookies) { public void setCookies(Cookie... cookies) {
this.cookies = cookies; this.cookies = cookies;
} }

View File

@ -16,20 +16,18 @@
package org.springframework.mock.web.portlet; package org.springframework.mock.web.portlet;
import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import javax.portlet.ActionResponse;
import javax.portlet.PortalContext; import javax.portlet.PortalContext;
import javax.portlet.PortletMode; import javax.portlet.PortletMode;
import javax.portlet.PortletModeException; import javax.portlet.PortletModeException;
import javax.portlet.StateAwareResponse;
import javax.portlet.WindowState; import javax.portlet.WindowState;
import javax.portlet.WindowStateException; import javax.portlet.WindowStateException;
import javax.portlet.StateAwareResponse;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import org.springframework.util.Assert; import org.springframework.util.Assert;