Revert "Merge branch 'SPR-10130' into cleanup-master"
This reverts commit45fa50821a, reversing changes made toa312d900f8.
This commit is contained in:
@@ -45,12 +45,10 @@ public class MockHttpInputMessage implements HttpInputMessage {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpHeaders getHeaders() {
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getBody() throws IOException {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ public class MockHttpOutputMessage implements HttpOutputMessage {
|
||||
/**
|
||||
* Return the headers.
|
||||
*/
|
||||
@Override
|
||||
public HttpHeaders getHeaders() {
|
||||
return this.headers;
|
||||
}
|
||||
@@ -50,7 +49,6 @@ public class MockHttpOutputMessage implements HttpOutputMessage {
|
||||
/**
|
||||
* Return the body content.
|
||||
*/
|
||||
@Override
|
||||
public OutputStream getBody() throws IOException {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,6 @@ public class MockClientHttpRequest extends MockHttpOutputMessage implements Clie
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URI getURI() {
|
||||
return this.uri;
|
||||
}
|
||||
@@ -65,7 +64,6 @@ public class MockClientHttpRequest extends MockHttpOutputMessage implements Clie
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpMethod getMethod() {
|
||||
return this.httpMethod;
|
||||
}
|
||||
@@ -87,7 +85,6 @@ public class MockClientHttpRequest extends MockHttpOutputMessage implements Clie
|
||||
* configured {@link #setResponse(ClientHttpResponse) response}.
|
||||
* @see #executeInternal()
|
||||
*/
|
||||
@Override
|
||||
public final ClientHttpResponse execute() throws IOException {
|
||||
this.executed = true;
|
||||
return executeInternal();
|
||||
|
||||
@@ -52,22 +52,18 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
|
||||
this.status = statusCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpStatus getStatusCode() throws IOException {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRawStatusCode() throws IOException {
|
||||
return this.status.value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusText() throws IOException {
|
||||
return this.status.getReasonPhrase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ public class ExpectedLookupTemplate extends JndiTemplate {
|
||||
* object provided in the constructor. If the name is unexpected, a
|
||||
* respective NamingException gets thrown.
|
||||
*/
|
||||
@Override
|
||||
public Object lookup(String name) throws NamingException {
|
||||
Object object = this.jndiObjects.get(name);
|
||||
if (object == null) {
|
||||
|
||||
@@ -91,7 +91,6 @@ public class SimpleNamingContext implements Context {
|
||||
|
||||
// Actual implementations of Context methods follow
|
||||
|
||||
@Override
|
||||
public NamingEnumeration<NameClassPair> list(String root) throws NamingException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Listing name/class pairs under [" + root + "]");
|
||||
@@ -99,7 +98,6 @@ public class SimpleNamingContext implements Context {
|
||||
return new NameClassPairEnumeration(this, root);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamingEnumeration<Binding> listBindings(String root) throws NamingException {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Listing bindings under [" + root + "]");
|
||||
@@ -113,7 +111,6 @@ public class SimpleNamingContext implements Context {
|
||||
* Will be used by any standard InitialContext JNDI lookups.
|
||||
* @throws javax.naming.NameNotFoundException if the object could not be found
|
||||
*/
|
||||
@Override
|
||||
public Object lookup(String lookupName) throws NameNotFoundException {
|
||||
String name = this.root + lookupName;
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -139,7 +136,6 @@ public class SimpleNamingContext implements Context {
|
||||
return found;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object lookupLink(String name) throws NameNotFoundException {
|
||||
return lookup(name);
|
||||
}
|
||||
@@ -151,7 +147,6 @@ public class SimpleNamingContext implements Context {
|
||||
* Use SimpleNamingContextBuilder to set up JNDI bindings then.
|
||||
* @see org.springframework.mock.jndi.SimpleNamingContextBuilder#bind
|
||||
*/
|
||||
@Override
|
||||
public void bind(String name, Object obj) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Static JNDI binding: [" + this.root + name + "] = [" + obj + "]");
|
||||
@@ -159,7 +154,6 @@ public class SimpleNamingContext implements Context {
|
||||
this.boundObjects.put(this.root + name, obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind(String name) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Static JNDI remove: [" + this.root + name + "]");
|
||||
@@ -167,19 +161,16 @@ public class SimpleNamingContext implements Context {
|
||||
this.boundObjects.remove(this.root + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rebind(String name, Object obj) {
|
||||
bind(name, obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rename(String oldName, String newName) throws NameNotFoundException {
|
||||
Object obj = lookup(oldName);
|
||||
unbind(oldName);
|
||||
bind(newName, obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context createSubcontext(String name) {
|
||||
String subcontextName = this.root + name;
|
||||
if (!subcontextName.endsWith("/")) {
|
||||
@@ -190,104 +181,84 @@ public class SimpleNamingContext implements Context {
|
||||
return subcontext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroySubcontext(String name) {
|
||||
unbind(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String composeName(String name, String prefix) {
|
||||
return prefix + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hashtable<String, Object> getEnvironment() {
|
||||
return this.environment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object addToEnvironment(String propName, Object propVal) {
|
||||
return this.environment.put(propName, propVal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object removeFromEnvironment(String propName) {
|
||||
return this.environment.remove(propName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
|
||||
// Unsupported methods follow: no support for javax.naming.Name
|
||||
|
||||
@Override
|
||||
public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object lookup(Name name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object lookupLink(Name name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(Name name, Object obj) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind(Name name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rebind(Name name, Object obj) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rename(Name oldName, Name newName) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context createSubcontext(Name name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroySubcontext(Name name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameInNamespace() throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NameParser getNameParser(Name name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NameParser getNameParser(String name) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Name composeName(Name name, Name prefix) throws NamingException {
|
||||
throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]");
|
||||
}
|
||||
@@ -327,27 +298,22 @@ public class SimpleNamingContext implements Context {
|
||||
|
||||
protected abstract T createObject(String strippedName, Object obj);
|
||||
|
||||
@Override
|
||||
public boolean hasMore() {
|
||||
return this.iterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
return this.iterator.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMoreElements() {
|
||||
return this.iterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T nextElement() {
|
||||
return this.iterator.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
}
|
||||
}
|
||||
@@ -359,7 +325,6 @@ public class SimpleNamingContext implements Context {
|
||||
super(context, root);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NameClassPair createObject(String strippedName, Object obj) {
|
||||
return new NameClassPair(strippedName, obj.getClass().getName());
|
||||
}
|
||||
@@ -372,7 +337,6 @@ public class SimpleNamingContext implements Context {
|
||||
super(context, root);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Binding createObject(String strippedName, Object obj) {
|
||||
return new Binding(strippedName, obj);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,6 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
|
||||
* creating a new SimpleNamingContext instance.
|
||||
* @see SimpleNamingContext
|
||||
*/
|
||||
@Override
|
||||
public InitialContextFactory createInitialContextFactory(Hashtable<?,?> environment) {
|
||||
if (activated == null && environment != null) {
|
||||
Object icf = environment.get(Context.INITIAL_CONTEXT_FACTORY);
|
||||
@@ -226,7 +225,6 @@ public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder
|
||||
|
||||
// Default case...
|
||||
return new InitialContextFactory() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Context getInitialContext(Hashtable<?,?> environment) {
|
||||
return new SimpleNamingContext("", boundObjects, (Hashtable<String, Object>) environment);
|
||||
|
||||
@@ -54,12 +54,10 @@ public class DelegatingServletInputStream extends ServletInputStream {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return this.sourceStream.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
this.sourceStream.close();
|
||||
|
||||
@@ -54,18 +54,15 @@ public class DelegatingServletOutputStream extends ServletOutputStream {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
this.targetStream.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
super.flush();
|
||||
this.targetStream.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
this.targetStream.close();
|
||||
|
||||
@@ -77,17 +77,14 @@ public class MockBodyContent extends BodyContent {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Reader getReader() {
|
||||
return new StringReader(this.content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeOut(Writer writer) throws IOException {
|
||||
writer.write(this.content);
|
||||
}
|
||||
@@ -97,127 +94,102 @@ public class MockBodyContent extends BodyContent {
|
||||
// Delegating implementations of JspWriter's abstract methods
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void clear() throws IOException {
|
||||
getEnclosingWriter().clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBuffer() throws IOException {
|
||||
getEnclosingWriter().clearBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
getEnclosingWriter().close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRemaining() {
|
||||
return getEnclosingWriter().getRemaining();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newLine() throws IOException {
|
||||
getEnclosingWriter().println();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(char value[], int offset, int length) throws IOException {
|
||||
getEnclosingWriter().write(value, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(boolean value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(char value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(char[] value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(double value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(float value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(int value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(long value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(Object value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(String value) throws IOException {
|
||||
getEnclosingWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println() throws IOException {
|
||||
getEnclosingWriter().println();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(boolean value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(char value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(char[] value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(double value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(float value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(int value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(long value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(Object value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(String value) throws IOException {
|
||||
getEnclosingWriter().println(value);
|
||||
}
|
||||
|
||||
@@ -56,21 +56,18 @@ public class MockExpressionEvaluator extends ExpressionEvaluator {
|
||||
this.pageContext = pageContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Expression parseExpression(final String expression, final Class expectedType,
|
||||
final FunctionMapper functionMapper) throws ELException {
|
||||
|
||||
return new Expression() {
|
||||
|
||||
@Override
|
||||
public Object evaluate(VariableResolver variableResolver) throws ELException {
|
||||
return doEvaluate(expression, expectedType, functionMapper);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Object evaluate(String expression, Class expectedType, VariableResolver variableResolver,
|
||||
FunctionMapper functionMapper) throws ELException {
|
||||
|
||||
@@ -119,7 +119,6 @@ public class MockFilterChain implements FilterChain {
|
||||
* Invoke registered {@link Filter}s and/or {@link Servlet} also saving the
|
||||
* request and response.
|
||||
*/
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {
|
||||
Assert.notNull(request, "Request must not be null");
|
||||
Assert.notNull(response, "Response must not be null");
|
||||
@@ -163,18 +162,15 @@ public class MockFilterChain implements FilterChain {
|
||||
this.delegateServlet = servlet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
this.delegateServlet.service(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
|
||||
@@ -79,12 +79,10 @@ public class MockFilterConfig implements FilterConfig {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getFilterName() {
|
||||
return filterName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletContext getServletContext() {
|
||||
return servletContext;
|
||||
}
|
||||
@@ -94,13 +92,11 @@ public class MockFilterConfig implements FilterConfig {
|
||||
this.initParameters.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitParameter(String name) {
|
||||
Assert.notNull(name, "Parameter name must not be null");
|
||||
return this.initParameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return Collections.enumeration(this.initParameters.keySet());
|
||||
}
|
||||
|
||||
@@ -283,24 +283,20 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
// ServletRequest interface
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
checkActive();
|
||||
return this.attributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
checkActive();
|
||||
return Collections.enumeration(this.attributes.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharacterEncoding() {
|
||||
return this.characterEncoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharacterEncoding(String characterEncoding) {
|
||||
this.characterEncoding = characterEncoding;
|
||||
updateContentTypeHeader();
|
||||
@@ -320,7 +316,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContentLength() {
|
||||
return (this.content != null ? this.content.length : -1);
|
||||
}
|
||||
@@ -337,12 +332,10 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() {
|
||||
if (this.content != null) {
|
||||
return new DelegatingServletInputStream(new ByteArrayInputStream(this.content));
|
||||
@@ -462,25 +455,21 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.parameters.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String name) {
|
||||
Assert.notNull(name, "Parameter name must not be null");
|
||||
String[] arr = this.parameters.get(name);
|
||||
return (arr != null && arr.length > 0 ? arr[0] : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getParameterNames() {
|
||||
return Collections.enumeration(this.parameters.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterValues(String name) {
|
||||
Assert.notNull(name, "Parameter name must not be null");
|
||||
return this.parameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getParameterMap() {
|
||||
return Collections.unmodifiableMap(this.parameters);
|
||||
}
|
||||
@@ -489,7 +478,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return this.protocol;
|
||||
}
|
||||
@@ -498,7 +486,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.scheme = scheme;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScheme() {
|
||||
return this.scheme;
|
||||
}
|
||||
@@ -507,7 +494,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerName() {
|
||||
return this.serverName;
|
||||
}
|
||||
@@ -516,12 +502,10 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getServerPort() {
|
||||
return this.serverPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedReader getReader() throws UnsupportedEncodingException {
|
||||
if (this.content != null) {
|
||||
InputStream sourceStream = new ByteArrayInputStream(this.content);
|
||||
@@ -538,7 +522,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.remoteAddr = remoteAddr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteAddr() {
|
||||
return this.remoteAddr;
|
||||
}
|
||||
@@ -547,12 +530,10 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.remoteHost = remoteHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteHost() {
|
||||
return this.remoteHost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
checkActive();
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
@@ -564,7 +545,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
checkActive();
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
@@ -599,12 +579,10 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.locales.addAll(locales);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return this.locales.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<Locale> getLocales() {
|
||||
return Collections.enumeration(this.locales);
|
||||
}
|
||||
@@ -613,17 +591,14 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.secure = secure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return this.secure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestDispatcher getRequestDispatcher(String path) {
|
||||
return new MockRequestDispatcher(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRealPath(String path) {
|
||||
return this.servletContext.getRealPath(path);
|
||||
}
|
||||
@@ -632,7 +607,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.remotePort = remotePort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRemotePort() {
|
||||
return this.remotePort;
|
||||
}
|
||||
@@ -641,7 +615,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.localName = localName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalName() {
|
||||
return this.localName;
|
||||
}
|
||||
@@ -650,7 +623,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.localAddr = localAddr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalAddr() {
|
||||
return this.localAddr;
|
||||
}
|
||||
@@ -659,7 +631,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.localPort = localPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLocalPort() {
|
||||
return this.localPort;
|
||||
}
|
||||
@@ -672,7 +643,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.authType = authType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthType() {
|
||||
return this.authType;
|
||||
}
|
||||
@@ -681,7 +651,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.cookies = cookies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cookie[] getCookies() {
|
||||
return this.cookies;
|
||||
}
|
||||
@@ -730,7 +699,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDateHeader(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
Object value = (header != null ? header.getValue() : null);
|
||||
@@ -749,24 +717,20 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHeader(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
return (header != null ? header.getStringValue() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getHeaders(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
return Collections.enumeration(header != null ? header.getStringValues() : new LinkedList<String>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getHeaderNames() {
|
||||
return Collections.enumeration(this.headers.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntHeader(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
Object value = (header != null ? header.getValue() : null);
|
||||
@@ -788,7 +752,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
@@ -797,12 +760,10 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.pathInfo = pathInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPathInfo() {
|
||||
return this.pathInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPathTranslated() {
|
||||
return (this.pathInfo != null ? getRealPath(this.pathInfo) : null);
|
||||
}
|
||||
@@ -811,7 +772,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.contextPath = contextPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContextPath() {
|
||||
return this.contextPath;
|
||||
}
|
||||
@@ -820,7 +780,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.queryString = queryString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQueryString() {
|
||||
return this.queryString;
|
||||
}
|
||||
@@ -829,7 +788,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.remoteUser = remoteUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteUser() {
|
||||
return this.remoteUser;
|
||||
}
|
||||
@@ -838,7 +796,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.userRoles.add(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUserInRole(String role) {
|
||||
return (this.userRoles.contains(role) || (this.servletContext instanceof MockServletContext && ((MockServletContext) this.servletContext).getDeclaredRoles().contains(
|
||||
role)));
|
||||
@@ -848,7 +805,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.userPrincipal = userPrincipal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Principal getUserPrincipal() {
|
||||
return this.userPrincipal;
|
||||
}
|
||||
@@ -857,7 +813,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.requestedSessionId = requestedSessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestedSessionId() {
|
||||
return this.requestedSessionId;
|
||||
}
|
||||
@@ -866,12 +821,10 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.requestURI = requestURI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestURI() {
|
||||
return this.requestURI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringBuffer getRequestURL() {
|
||||
StringBuffer url = new StringBuffer(this.scheme);
|
||||
url.append("://").append(this.serverName).append(':').append(this.serverPort);
|
||||
@@ -883,7 +836,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.servletPath = servletPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServletPath() {
|
||||
return this.servletPath;
|
||||
}
|
||||
@@ -896,7 +848,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpSession getSession(boolean create) {
|
||||
checkActive();
|
||||
// Reset session if invalidated.
|
||||
@@ -910,7 +861,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
return this.session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpSession getSession() {
|
||||
return getSession(true);
|
||||
}
|
||||
@@ -919,7 +869,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.requestedSessionIdValid = requestedSessionIdValid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRequestedSessionIdValid() {
|
||||
return this.requestedSessionIdValid;
|
||||
}
|
||||
@@ -928,7 +877,6 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.requestedSessionIdFromCookie = requestedSessionIdFromCookie;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRequestedSessionIdFromCookie() {
|
||||
return this.requestedSessionIdFromCookie;
|
||||
}
|
||||
@@ -937,12 +885,10 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
this.requestedSessionIdFromURL = requestedSessionIdFromURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRequestedSessionIdFromURL() {
|
||||
return this.requestedSessionIdFromURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRequestedSessionIdFromUrl() {
|
||||
return isRequestedSessionIdFromURL();
|
||||
}
|
||||
|
||||
@@ -136,7 +136,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
return this.writerAccessAllowed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharacterEncoding(String characterEncoding) {
|
||||
this.characterEncoding = characterEncoding;
|
||||
this.charset = true;
|
||||
@@ -153,12 +152,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharacterEncoding() {
|
||||
return this.characterEncoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletOutputStream getOutputStream() {
|
||||
if (!this.outputStreamAccessAllowed) {
|
||||
throw new IllegalStateException("OutputStream access not allowed");
|
||||
@@ -166,7 +163,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
return this.outputStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrintWriter getWriter() throws UnsupportedEncodingException {
|
||||
if (!this.writerAccessAllowed) {
|
||||
throw new IllegalStateException("Writer access not allowed");
|
||||
@@ -190,7 +186,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
this.content.toString(this.characterEncoding) : this.content.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentLength(int contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
doAddHeaderValue(CONTENT_LENGTH_HEADER, contentLength, true);
|
||||
@@ -200,7 +195,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
return this.contentLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
if (contentType != null) {
|
||||
@@ -214,27 +208,22 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBufferSize(int bufferSize) {
|
||||
this.bufferSize = bufferSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBufferSize() {
|
||||
return this.bufferSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBuffer() {
|
||||
setCommitted(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetBuffer() {
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException("Cannot reset buffer - response is already committed");
|
||||
@@ -253,12 +242,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
this.committed = committed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCommitted() {
|
||||
return this.committed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
resetBuffer();
|
||||
this.characterEncoding = null;
|
||||
@@ -271,12 +258,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
this.errorMessage = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocale(Locale locale) {
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return this.locale;
|
||||
}
|
||||
@@ -286,7 +271,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
// HttpServletResponse interface
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void addCookie(Cookie cookie) {
|
||||
Assert.notNull(cookie, "Cookie must not be null");
|
||||
this.cookies.add(cookie);
|
||||
@@ -306,7 +290,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsHeader(String name) {
|
||||
return (HeaderValueHolder.getByName(this.headers, name) != null);
|
||||
}
|
||||
@@ -382,7 +365,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
* The default implementation returns the given URL String as-is.
|
||||
* <p>Can be overridden in subclasses, appending a session id or the like.
|
||||
*/
|
||||
@Override
|
||||
public String encodeURL(String url) {
|
||||
return url;
|
||||
}
|
||||
@@ -395,22 +377,18 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
* override the common {@link #encodeURL} method instead, applying
|
||||
* to redirect URLs as well as to general URLs.
|
||||
*/
|
||||
@Override
|
||||
public String encodeRedirectURL(String url) {
|
||||
return encodeURL(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encodeUrl(String url) {
|
||||
return encodeURL(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encodeRedirectUrl(String url) {
|
||||
return encodeRedirectURL(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendError(int status, String errorMessage) throws IOException {
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException("Cannot set error status - response is already committed");
|
||||
@@ -420,7 +398,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
setCommitted(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendError(int status) throws IOException {
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException("Cannot set error status - response is already committed");
|
||||
@@ -429,7 +406,6 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
setCommitted(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRedirect(String url) throws IOException {
|
||||
if (isCommitted()) {
|
||||
throw new IllegalStateException("Cannot send redirect - response is already committed");
|
||||
@@ -444,32 +420,26 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
return getHeader(LOCATION_HEADER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDateHeader(String name, long value) {
|
||||
setHeaderValue(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDateHeader(String name, long value) {
|
||||
addHeaderValue(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeader(String name, String value) {
|
||||
setHeaderValue(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHeader(String name, String value) {
|
||||
addHeaderValue(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIntHeader(String name, int value) {
|
||||
setHeaderValue(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIntHeader(String name, int value) {
|
||||
addHeaderValue(name, value);
|
||||
}
|
||||
@@ -517,12 +487,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatus(int status, String errorMessage) {
|
||||
this.status = status;
|
||||
this.errorMessage = errorMessage;
|
||||
@@ -585,14 +553,12 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
super(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
super.write(b);
|
||||
super.flush();
|
||||
setCommittedIfBufferSizeExceeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
super.flush();
|
||||
setCommitted(true);
|
||||
@@ -610,28 +576,24 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
super(out, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(char buf[], int off, int len) {
|
||||
super.write(buf, off, len);
|
||||
super.flush();
|
||||
setCommittedIfBufferSizeExceeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(String s, int off, int len) {
|
||||
super.write(s, off, len);
|
||||
super.flush();
|
||||
setCommittedIfBufferSizeExceeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int c) {
|
||||
super.write(c);
|
||||
super.flush();
|
||||
setCommittedIfBufferSizeExceeded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
super.flush();
|
||||
setCommitted(true);
|
||||
|
||||
@@ -98,12 +98,10 @@ public class MockHttpSession implements HttpSession {
|
||||
this.id = (id != null ? id : Integer.toString(nextId++));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCreationTime() {
|
||||
return this.creationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
@@ -113,53 +111,43 @@ public class MockHttpSession implements HttpSession {
|
||||
this.isNew = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastAccessedTime() {
|
||||
return this.lastAccessedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletContext getServletContext() {
|
||||
return this.servletContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxInactiveInterval(int interval) {
|
||||
this.maxInactiveInterval = interval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInactiveInterval() {
|
||||
return this.maxInactiveInterval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpSessionContext getSessionContext() {
|
||||
throw new UnsupportedOperationException("getSessionContext");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
return this.attributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(String name) {
|
||||
return getAttribute(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return Collections.enumeration(this.attributes.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getValueNames() {
|
||||
return this.attributes.keySet().toArray(new String[this.attributes.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
if (value != null) {
|
||||
@@ -173,12 +161,10 @@ public class MockHttpSession implements HttpSession {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putValue(String name, Object value) {
|
||||
setAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
Object value = this.attributes.remove(name);
|
||||
@@ -187,7 +173,6 @@ public class MockHttpSession implements HttpSession {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeValue(String name) {
|
||||
removeAttribute(name);
|
||||
}
|
||||
@@ -212,7 +197,6 @@ public class MockHttpSession implements HttpSession {
|
||||
*
|
||||
* @throws IllegalStateException if this method is called on an already invalidated session
|
||||
*/
|
||||
@Override
|
||||
public void invalidate() {
|
||||
if (this.invalid) {
|
||||
throw new IllegalStateException("The session has already been invalidated");
|
||||
@@ -231,7 +215,6 @@ public class MockHttpSession implements HttpSession {
|
||||
this.isNew = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNew() {
|
||||
return this.isNew;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,6 @@ public class MockJspWriter extends JspWriter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() throws IOException {
|
||||
if (this.response.isCommitted()) {
|
||||
throw new IOException("Response already committed");
|
||||
@@ -90,126 +89,101 @@ public class MockJspWriter extends JspWriter {
|
||||
this.response.resetBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBuffer() throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
this.response.flushBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRemaining() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newLine() throws IOException {
|
||||
getTargetWriter().println();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(char value[], int offset, int length) throws IOException {
|
||||
getTargetWriter().write(value, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(boolean value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(char value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(char[] value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(double value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(float value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(int value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(long value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(Object value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void print(String value) throws IOException {
|
||||
getTargetWriter().print(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println() throws IOException {
|
||||
getTargetWriter().println();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(boolean value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(char value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(char[] value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(double value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(float value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(int value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(long value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(Object value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void println(String value) throws IOException {
|
||||
getTargetWriter().println(value);
|
||||
}
|
||||
|
||||
@@ -96,42 +96,34 @@ public class MockMultipartFile implements MultipartFile {
|
||||
this(name, originalFilename, contentType, FileCopyUtils.copyToByteArray(contentStream));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOriginalFilename() {
|
||||
return this.originalFilename;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return (this.content.length == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return this.content.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getBytes() throws IOException {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return new ByteArrayInputStream(this.content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferTo(File dest) throws IOException, IllegalStateException {
|
||||
FileCopyUtils.copy(this.content, dest);
|
||||
}
|
||||
|
||||
@@ -66,17 +66,14 @@ public class MockMultipartHttpServletRequest extends MockHttpServletRequest impl
|
||||
this.multipartFiles.add(file.getName(), file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<String> getFileNames() {
|
||||
return this.multipartFiles.keySet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultipartFile getFile(String name) {
|
||||
return this.multipartFiles.getFirst(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MultipartFile> getFiles(String name) {
|
||||
List<MultipartFile> multipartFiles = this.multipartFiles.get(name);
|
||||
if (multipartFiles != null) {
|
||||
@@ -87,17 +84,14 @@ public class MockMultipartHttpServletRequest extends MockHttpServletRequest impl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, MultipartFile> getFileMap() {
|
||||
return this.multipartFiles.toSingleValueMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiValueMap<String, MultipartFile> getMultiFileMap() {
|
||||
return new LinkedMultiValueMap<String, MultipartFile>(this.multipartFiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMultipartContentType(String paramOrFileName) {
|
||||
MultipartFile file = getFile(paramOrFileName);
|
||||
if (file != null) {
|
||||
@@ -108,12 +102,10 @@ public class MockMultipartHttpServletRequest extends MockHttpServletRequest impl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpMethod getRequestMethod() {
|
||||
return HttpMethod.valueOf(getMethod());
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpHeaders getRequestHeaders() {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
Enumeration<String> headerNames = getHeaderNames();
|
||||
@@ -124,7 +116,6 @@ public class MockMultipartHttpServletRequest extends MockHttpServletRequest impl
|
||||
return headers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpHeaders getMultipartHeaders(String paramOrFileName) {
|
||||
String contentType = getMultipartContentType(paramOrFileName);
|
||||
if (contentType != null) {
|
||||
|
||||
@@ -126,7 +126,6 @@ public class MockPageContext extends PageContext {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(
|
||||
Servlet servlet, ServletRequest request, ServletResponse response,
|
||||
String errorPageURL, boolean needsSession, int bufferSize, boolean autoFlush) {
|
||||
@@ -134,11 +133,9 @@ public class MockPageContext extends PageContext {
|
||||
throw new UnsupportedOperationException("Use appropriate constructor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
if (value != null) {
|
||||
@@ -149,7 +146,6 @@ public class MockPageContext extends PageContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value, int scope) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
switch (scope) {
|
||||
@@ -170,13 +166,11 @@ public class MockPageContext extends PageContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
return this.attributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name, int scope) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
switch (scope) {
|
||||
@@ -194,7 +188,6 @@ public class MockPageContext extends PageContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object findAttribute(String name) {
|
||||
Object value = getAttribute(name);
|
||||
if (value == null) {
|
||||
@@ -209,7 +202,6 @@ public class MockPageContext extends PageContext {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
this.removeAttribute(name, PageContext.PAGE_SCOPE);
|
||||
@@ -218,7 +210,6 @@ public class MockPageContext extends PageContext {
|
||||
this.removeAttribute(name, PageContext.APPLICATION_SCOPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name, int scope) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
switch (scope) {
|
||||
@@ -239,7 +230,6 @@ public class MockPageContext extends PageContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAttributesScope(String name) {
|
||||
if (getAttribute(name) != null) {
|
||||
return PAGE_SCOPE;
|
||||
@@ -262,7 +252,6 @@ public class MockPageContext extends PageContext {
|
||||
return Collections.enumeration(this.attributes.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Enumeration<String> getAttributeNamesInScope(int scope) {
|
||||
switch (scope) {
|
||||
@@ -280,7 +269,6 @@ public class MockPageContext extends PageContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JspWriter getOut() {
|
||||
if (this.out == null) {
|
||||
this.out = new MockJspWriter(this.response);
|
||||
@@ -288,67 +276,54 @@ public class MockPageContext extends PageContext {
|
||||
return this.out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionEvaluator getExpressionEvaluator() {
|
||||
return new MockExpressionEvaluator(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ELContext getELContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VariableResolver getVariableResolver() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpSession getSession() {
|
||||
return this.request.getSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPage() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletRequest getRequest() {
|
||||
return this.request;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletResponse getResponse() {
|
||||
return this.response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Exception getException() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletConfig getServletConfig() {
|
||||
return this.servletConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletContext getServletContext() {
|
||||
return this.servletContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forward(String path) throws ServletException, IOException {
|
||||
this.request.getRequestDispatcher(path).forward(this.request, this.response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void include(String path) throws ServletException, IOException {
|
||||
this.request.getRequestDispatcher(path).include(this.request, this.response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void include(String path, boolean flush) throws ServletException, IOException {
|
||||
this.request.getRequestDispatcher(path).include(this.request, this.response);
|
||||
if (flush) {
|
||||
@@ -366,12 +341,10 @@ public class MockPageContext extends PageContext {
|
||||
return ((MockHttpServletResponse) this.response).getContentAsString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePageException(Exception ex) throws ServletException, IOException {
|
||||
throw new ServletException("Page exception", ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePageException(Throwable ex) throws ServletException, IOException {
|
||||
throw new ServletException("Page exception", ex);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ public class MockRequestDispatcher implements RequestDispatcher {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void forward(ServletRequest request, ServletResponse response) {
|
||||
Assert.notNull(request, "Request must not be null");
|
||||
Assert.notNull(response, "Response must not be null");
|
||||
@@ -68,7 +67,6 @@ public class MockRequestDispatcher implements RequestDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void include(ServletRequest request, ServletResponse response) {
|
||||
Assert.notNull(request, "Request must not be null");
|
||||
Assert.notNull(response, "Response must not be null");
|
||||
|
||||
@@ -78,12 +78,10 @@ public class MockServletConfig implements ServletConfig {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getServletName() {
|
||||
return this.servletName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletContext getServletContext() {
|
||||
return this.servletContext;
|
||||
}
|
||||
@@ -93,13 +91,11 @@ public class MockServletConfig implements ServletConfig {
|
||||
this.initParameters.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitParameter(String name) {
|
||||
Assert.notNull(name, "Parameter name must not be null");
|
||||
return this.initParameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return Collections.enumeration(this.initParameters.keySet());
|
||||
}
|
||||
|
||||
@@ -195,7 +195,6 @@ public class MockServletContext implements ServletContext {
|
||||
}
|
||||
|
||||
/* This is a Servlet API 2.5 method. */
|
||||
@Override
|
||||
public String getContextPath() {
|
||||
return this.contextPath;
|
||||
}
|
||||
@@ -204,7 +203,6 @@ public class MockServletContext implements ServletContext {
|
||||
this.contexts.put(contextPath, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletContext getContext(String contextPath) {
|
||||
if (this.contextPath.equals(contextPath)) {
|
||||
return this;
|
||||
@@ -216,7 +214,6 @@ public class MockServletContext implements ServletContext {
|
||||
this.majorVersion = majorVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMajorVersion() {
|
||||
return this.majorVersion;
|
||||
}
|
||||
@@ -225,7 +222,6 @@ public class MockServletContext implements ServletContext {
|
||||
this.minorVersion = minorVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinorVersion() {
|
||||
return this.minorVersion;
|
||||
}
|
||||
@@ -246,12 +242,10 @@ public class MockServletContext implements ServletContext {
|
||||
return this.effectiveMinorVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMimeType(String filePath) {
|
||||
return MimeTypeResolver.getMimeType(filePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getResourcePaths(String path) {
|
||||
String actualPath = (path.endsWith("/") ? path : path + "/");
|
||||
Resource resource = this.resourceLoader.getResource(getResourceLocation(actualPath));
|
||||
@@ -277,7 +271,6 @@ public class MockServletContext implements ServletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getResource(String path) throws MalformedURLException {
|
||||
Resource resource = this.resourceLoader.getResource(getResourceLocation(path));
|
||||
if (!resource.exists()) {
|
||||
@@ -295,7 +288,6 @@ public class MockServletContext implements ServletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResourceAsStream(String path) {
|
||||
Resource resource = this.resourceLoader.getResource(getResourceLocation(path));
|
||||
if (!resource.exists()) {
|
||||
@@ -310,7 +302,6 @@ public class MockServletContext implements ServletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestDispatcher getRequestDispatcher(String path) {
|
||||
if (!path.startsWith("/")) {
|
||||
throw new IllegalArgumentException("RequestDispatcher path at ServletContext level must start with '/'");
|
||||
@@ -318,7 +309,6 @@ public class MockServletContext implements ServletContext {
|
||||
return new MockRequestDispatcher(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestDispatcher getNamedDispatcher(String path) {
|
||||
return this.namedRequestDispatchers.get(path);
|
||||
}
|
||||
@@ -376,37 +366,30 @@ public class MockServletContext implements ServletContext {
|
||||
registerNamedDispatcher(this.defaultServletName, new MockRequestDispatcher(this.defaultServletName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Servlet getServlet(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<Servlet> getServlets() {
|
||||
return Collections.enumeration(new HashSet<Servlet>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getServletNames() {
|
||||
return Collections.enumeration(new HashSet<String>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String message) {
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(Exception ex, String message) {
|
||||
logger.info(message, ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String message, Throwable ex) {
|
||||
logger.info(message, ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRealPath(String path) {
|
||||
Resource resource = this.resourceLoader.getResource(getResourceLocation(path));
|
||||
try {
|
||||
@@ -418,18 +401,15 @@ public class MockServletContext implements ServletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerInfo() {
|
||||
return "MockServletContext";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitParameter(String name) {
|
||||
Assert.notNull(name, "Parameter name must not be null");
|
||||
return this.initParameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return Collections.enumeration(this.initParameters.keySet());
|
||||
}
|
||||
@@ -448,18 +428,15 @@ public class MockServletContext implements ServletContext {
|
||||
this.initParameters.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
return this.attributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return Collections.enumeration(this.attributes.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
if (value != null) {
|
||||
@@ -470,7 +447,6 @@ public class MockServletContext implements ServletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
Assert.notNull(name, "Attribute name must not be null");
|
||||
this.attributes.remove(name);
|
||||
@@ -480,7 +456,6 @@ public class MockServletContext implements ServletContext {
|
||||
this.servletContextName = servletContextName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServletContextName() {
|
||||
return this.servletContextName;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ public class PassThroughFilterChain implements FilterChain {
|
||||
/**
|
||||
* Pass the call on to the Filter/Servlet.
|
||||
*/
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) throws ServletException, IOException {
|
||||
if (this.filter != null) {
|
||||
this.filter.doFilter(request, response, this.nextFilterChain);
|
||||
|
||||
@@ -59,7 +59,6 @@ public class MockActionResponse extends MockStateAwareResponse implements Action
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setWindowState(WindowState windowState) throws WindowStateException {
|
||||
if (this.redirectedUrl != null) {
|
||||
throw new IllegalStateException("Cannot set WindowState after sendRedirect has been called");
|
||||
@@ -68,7 +67,6 @@ public class MockActionResponse extends MockStateAwareResponse implements Action
|
||||
this.redirectAllowed = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortletMode(PortletMode portletMode) throws PortletModeException {
|
||||
if (this.redirectedUrl != null) {
|
||||
throw new IllegalStateException("Cannot set PortletMode after sendRedirect has been called");
|
||||
@@ -77,7 +75,6 @@ public class MockActionResponse extends MockStateAwareResponse implements Action
|
||||
this.redirectAllowed = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderParameters(Map<String, String[]> parameters) {
|
||||
if (this.redirectedUrl != null) {
|
||||
throw new IllegalStateException("Cannot set render parameters after sendRedirect has been called");
|
||||
@@ -86,7 +83,6 @@ public class MockActionResponse extends MockStateAwareResponse implements Action
|
||||
this.redirectAllowed = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderParameter(String key, String value) {
|
||||
if (this.redirectedUrl != null) {
|
||||
throw new IllegalStateException("Cannot set render parameters after sendRedirect has been called");
|
||||
@@ -95,7 +91,6 @@ public class MockActionResponse extends MockStateAwareResponse implements Action
|
||||
this.redirectAllowed = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderParameter(String key, String[] values) {
|
||||
if (this.redirectedUrl != null) {
|
||||
throw new IllegalStateException("Cannot set render parameters after sendRedirect has been called");
|
||||
@@ -104,7 +99,6 @@ public class MockActionResponse extends MockStateAwareResponse implements Action
|
||||
this.redirectAllowed = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRedirect(String location) throws IOException {
|
||||
if (!this.redirectAllowed) {
|
||||
throw new IllegalStateException(
|
||||
@@ -114,7 +108,6 @@ public class MockActionResponse extends MockStateAwareResponse implements Action
|
||||
this.redirectedUrl = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRedirect(String location, String renderUrlParamName) throws IOException {
|
||||
sendRedirect(location);
|
||||
if (renderUrlParamName != null) {
|
||||
|
||||
@@ -56,21 +56,18 @@ public abstract class MockBaseURL implements BaseURL {
|
||||
// BaseURL methods
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void setParameter(String key, String value) {
|
||||
Assert.notNull(key, "Parameter key must be null");
|
||||
Assert.notNull(value, "Parameter value must not be null");
|
||||
this.parameters.put(key, new String[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameter(String key, String[] values) {
|
||||
Assert.notNull(key, "Parameter key must be null");
|
||||
Assert.notNull(values, "Parameter values must not be null");
|
||||
this.parameters.put(key, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameters(Map<String, String[]> parameters) {
|
||||
Assert.notNull(parameters, "Parameters Map must not be null");
|
||||
this.parameters.clear();
|
||||
@@ -90,12 +87,10 @@ public abstract class MockBaseURL implements BaseURL {
|
||||
return this.parameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getParameterMap() {
|
||||
return Collections.unmodifiableMap(this.parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecure(boolean secure) throws PortletSecurityException {
|
||||
this.secure = secure;
|
||||
}
|
||||
@@ -104,17 +99,14 @@ public abstract class MockBaseURL implements BaseURL {
|
||||
return this.secure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writer out) throws IOException {
|
||||
out.write(toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writer out, boolean escapeXML) throws IOException {
|
||||
out.write(toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addProperty(String key, String value) {
|
||||
String[] values = this.properties.get(key);
|
||||
if (values != null) {
|
||||
@@ -125,7 +117,6 @@ public abstract class MockBaseURL implements BaseURL {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(String key, String value) {
|
||||
this.properties.put(key, new String[] {value});
|
||||
}
|
||||
|
||||
@@ -35,42 +35,34 @@ public class MockCacheControl implements CacheControl {
|
||||
private boolean useCachedContent = false;
|
||||
|
||||
|
||||
@Override
|
||||
public int getExpirationTime() {
|
||||
return this.expirationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExpirationTime(int time) {
|
||||
this.expirationTime = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPublicScope() {
|
||||
return this.publicScope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPublicScope(boolean publicScope) {
|
||||
this.publicScope = publicScope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getETag() {
|
||||
return this.etag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setETag(String token) {
|
||||
this.etag = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useCachedContent() {
|
||||
return this.useCachedContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseCachedContent(boolean useCachedContent) {
|
||||
this.useCachedContent = useCachedContent;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ public class MockClientDataRequest extends MockPortletRequest implements ClientD
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getPortletInputStream() throws IOException {
|
||||
if (this.content != null) {
|
||||
return new ByteArrayInputStream(this.content);
|
||||
@@ -86,12 +85,10 @@ public class MockClientDataRequest extends MockPortletRequest implements ClientD
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharacterEncoding(String characterEncoding) {
|
||||
this.characterEncoding = characterEncoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedReader getReader() throws UnsupportedEncodingException {
|
||||
if (this.content != null) {
|
||||
InputStream sourceStream = new ByteArrayInputStream(this.content);
|
||||
@@ -104,7 +101,6 @@ public class MockClientDataRequest extends MockPortletRequest implements ClientD
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharacterEncoding() {
|
||||
return this.characterEncoding;
|
||||
}
|
||||
@@ -113,12 +109,10 @@ public class MockClientDataRequest extends MockPortletRequest implements ClientD
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContentLength() {
|
||||
return (this.content != null ? content.length : -1);
|
||||
}
|
||||
@@ -127,7 +121,6 @@ public class MockClientDataRequest extends MockPortletRequest implements ClientD
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
@@ -73,17 +73,14 @@ public class MockEvent implements Event {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public QName getQName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name.getLocalPart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ public class MockEventRequest extends MockPortletRequest implements EventRequest
|
||||
return EVENT_PHASE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Event getEvent() {
|
||||
return this.event;
|
||||
}
|
||||
@@ -82,7 +81,6 @@ public class MockEventRequest extends MockPortletRequest implements EventRequest
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import javax.portlet.EventResponse;
|
||||
*/
|
||||
public class MockEventResponse extends MockStateAwareResponse implements EventResponse {
|
||||
|
||||
@Override
|
||||
public void setRenderParameters(EventRequest request) {
|
||||
setRenderParameters(request.getParameterMap());
|
||||
}
|
||||
|
||||
@@ -101,7 +101,6 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
|
||||
// RenderResponse methods
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void setContentType(String contentType) {
|
||||
if (this.request != null) {
|
||||
Enumeration<String> supportedTypes = this.request.getResponseContentTypes();
|
||||
@@ -113,7 +112,6 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentType() {
|
||||
return this.contentType;
|
||||
}
|
||||
@@ -122,12 +120,10 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
|
||||
this.characterEncoding = characterEncoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCharacterEncoding() {
|
||||
return this.characterEncoding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrintWriter getWriter() throws UnsupportedEncodingException {
|
||||
if (this.writer == null) {
|
||||
Writer targetWriter = (this.characterEncoding != null
|
||||
@@ -154,22 +150,18 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return this.locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBufferSize(int bufferSize) {
|
||||
this.bufferSize = bufferSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBufferSize() {
|
||||
return this.bufferSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flushBuffer() {
|
||||
if (this.writer != null) {
|
||||
this.writer.flush();
|
||||
@@ -185,7 +177,6 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
|
||||
this.committed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetBuffer() {
|
||||
if (this.committed) {
|
||||
throw new IllegalStateException("Cannot reset buffer - response is already committed");
|
||||
@@ -197,12 +188,10 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
|
||||
this.committed = committed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCommitted() {
|
||||
return this.committed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
resetBuffer();
|
||||
this.characterEncoding = null;
|
||||
@@ -210,27 +199,22 @@ public class MockMimeResponse extends MockPortletResponse implements MimeRespons
|
||||
this.locale = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream getPortletOutputStream() throws IOException {
|
||||
return this.outputStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletURL createRenderURL() {
|
||||
return new MockPortletURL(getPortalContext(), MockPortletURL.URL_TYPE_RENDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletURL createActionURL() {
|
||||
return new MockPortletURL(getPortalContext(), MockPortletURL.URL_TYPE_ACTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceURL createResourceURL() {
|
||||
return new MockResourceURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CacheControl getCacheControl() {
|
||||
return this.cacheControl;
|
||||
}
|
||||
|
||||
@@ -56,17 +56,14 @@ public class MockMultipartActionRequest extends MockActionRequest implements Mul
|
||||
this.multipartFiles.add(file.getName(), file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<String> getFileNames() {
|
||||
return this.multipartFiles.keySet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultipartFile getFile(String name) {
|
||||
return this.multipartFiles.getFirst(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MultipartFile> getFiles(String name) {
|
||||
List<MultipartFile> multipartFiles = this.multipartFiles.get(name);
|
||||
if (multipartFiles != null) {
|
||||
@@ -77,17 +74,14 @@ public class MockMultipartActionRequest extends MockActionRequest implements Mul
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, MultipartFile> getFileMap() {
|
||||
return this.multipartFiles.toSingleValueMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiValueMap<String, MultipartFile> getMultiFileMap() {
|
||||
return new LinkedMultiValueMap<String, MultipartFile>(this.multipartFiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMultipartContentType(String paramOrFileName) {
|
||||
MultipartFile file = getFile(paramOrFileName);
|
||||
if (file != null) {
|
||||
|
||||
@@ -74,7 +74,6 @@ public class MockPortalContext implements PortalContext {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPortalInfo() {
|
||||
return "MockPortal/1.0";
|
||||
}
|
||||
@@ -83,22 +82,18 @@ public class MockPortalContext implements PortalContext {
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String name) {
|
||||
return this.properties.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getPropertyNames() {
|
||||
return Collections.enumeration(this.properties.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<PortletMode> getSupportedPortletModes() {
|
||||
return Collections.enumeration(this.portletModes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<WindowState> getSupportedWindowStates() {
|
||||
return Collections.enumeration(this.windowStates);
|
||||
}
|
||||
|
||||
@@ -96,12 +96,10 @@ public class MockPortletConfig implements PortletConfig {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPortletName() {
|
||||
return this.portletName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletContext getPortletContext() {
|
||||
return this.portletContext;
|
||||
}
|
||||
@@ -111,7 +109,6 @@ public class MockPortletConfig implements PortletConfig {
|
||||
this.resourceBundles.put(locale, resourceBundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceBundle getResourceBundle(Locale locale) {
|
||||
Assert.notNull(locale, "Locale must not be null");
|
||||
return this.resourceBundles.get(locale);
|
||||
@@ -122,13 +119,11 @@ public class MockPortletConfig implements PortletConfig {
|
||||
this.initParameters.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitParameter(String name) {
|
||||
Assert.notNull(name, "Parameter name must not be null");
|
||||
return this.initParameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return Collections.enumeration(this.initParameters.keySet());
|
||||
}
|
||||
@@ -137,7 +132,6 @@ public class MockPortletConfig implements PortletConfig {
|
||||
this.publicRenderParameterNames.add(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getPublicRenderParameterNames() {
|
||||
return Collections.enumeration(this.publicRenderParameterNames);
|
||||
}
|
||||
@@ -146,7 +140,6 @@ public class MockPortletConfig implements PortletConfig {
|
||||
this.defaultNamespace = defaultNamespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultNamespace() {
|
||||
return this.defaultNamespace;
|
||||
}
|
||||
@@ -155,7 +148,6 @@ public class MockPortletConfig implements PortletConfig {
|
||||
this.publishingEventQNames.add(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<QName> getPublishingEventQNames() {
|
||||
return Collections.enumeration(this.publishingEventQNames);
|
||||
}
|
||||
@@ -164,7 +156,6 @@ public class MockPortletConfig implements PortletConfig {
|
||||
this.processingEventQNames.add(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<QName> getProcessingEventQNames() {
|
||||
return Collections.enumeration(this.processingEventQNames);
|
||||
}
|
||||
@@ -173,7 +164,6 @@ public class MockPortletConfig implements PortletConfig {
|
||||
this.supportedLocales.add(locale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<Locale> getSupportedLocales() {
|
||||
return Collections.enumeration(this.supportedLocales);
|
||||
}
|
||||
@@ -186,7 +176,6 @@ public class MockPortletConfig implements PortletConfig {
|
||||
this.containerRuntimeOptions.put(key, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getContainerRuntimeOptions() {
|
||||
return Collections.unmodifiableMap(this.containerRuntimeOptions);
|
||||
}
|
||||
|
||||
@@ -126,12 +126,10 @@ public class MockPortletContext implements PortletContext {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getServerInfo() {
|
||||
return "MockPortal/1.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletRequestDispatcher getRequestDispatcher(String path) {
|
||||
if (!path.startsWith("/")) {
|
||||
throw new IllegalArgumentException(
|
||||
@@ -140,12 +138,10 @@ public class MockPortletContext implements PortletContext {
|
||||
return new MockPortletRequestDispatcher(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletRequestDispatcher getNamedDispatcher(String path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResourceAsStream(String path) {
|
||||
Resource resource = this.resourceLoader.getResource(getResourceLocation(path));
|
||||
try {
|
||||
@@ -157,22 +153,18 @@ public class MockPortletContext implements PortletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMajorVersion() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinorVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMimeType(String filePath) {
|
||||
return MimeTypeResolver.getMimeType(filePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRealPath(String path) {
|
||||
Resource resource = this.resourceLoader.getResource(getResourceLocation(path));
|
||||
try {
|
||||
@@ -184,7 +176,6 @@ public class MockPortletContext implements PortletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getResourcePaths(String path) {
|
||||
Resource resource = this.resourceLoader.getResource(getResourceLocation(path));
|
||||
try {
|
||||
@@ -203,7 +194,6 @@ public class MockPortletContext implements PortletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getResource(String path) throws MalformedURLException {
|
||||
Resource resource = this.resourceLoader.getResource(getResourceLocation(path));
|
||||
try {
|
||||
@@ -215,17 +205,14 @@ public class MockPortletContext implements PortletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
return this.attributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return new Vector<String>(this.attributes.keySet()).elements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
if (value != null) {
|
||||
this.attributes.put(name, value);
|
||||
@@ -235,7 +222,6 @@ public class MockPortletContext implements PortletContext {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
this.attributes.remove(name);
|
||||
}
|
||||
@@ -245,23 +231,19 @@ public class MockPortletContext implements PortletContext {
|
||||
this.initParameters.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitParameter(String name) {
|
||||
Assert.notNull(name, "Parameter name must not be null");
|
||||
return this.initParameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return Collections.enumeration(this.initParameters.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String message) {
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String message, Throwable t) {
|
||||
logger.info(message, t);
|
||||
}
|
||||
@@ -270,7 +252,6 @@ public class MockPortletContext implements PortletContext {
|
||||
this.portletContextName = portletContextName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPortletContextName() {
|
||||
return this.portletContextName;
|
||||
}
|
||||
@@ -279,7 +260,6 @@ public class MockPortletContext implements PortletContext {
|
||||
this.containerRuntimeOptions.add(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getContainerRuntimeOptions() {
|
||||
return Collections.enumeration(this.containerRuntimeOptions);
|
||||
}
|
||||
|
||||
@@ -56,32 +56,27 @@ public class MockPortletPreferences implements PortletPreferences {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadOnly(String key) {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
return this.readOnly.contains(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(String key, String def) {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
String[] values = this.preferences.get(key);
|
||||
return (values != null && values.length > 0 ? values[0] : def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getValues(String key, String[] def) {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
String[] values = this.preferences.get(key);
|
||||
return (values != null && values.length > 0 ? values : def);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String key, String value) throws ReadOnlyException {
|
||||
setValues(key, new String[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(String key, String[] values) throws ReadOnlyException {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
if (isReadOnly(key)) {
|
||||
@@ -90,17 +85,14 @@ public class MockPortletPreferences implements PortletPreferences {
|
||||
this.preferences.put(key, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getNames() {
|
||||
return Collections.enumeration(this.preferences.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getMap() {
|
||||
return Collections.unmodifiableMap(this.preferences);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(String key) throws ReadOnlyException {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
if (isReadOnly(key)) {
|
||||
@@ -113,7 +105,6 @@ public class MockPortletPreferences implements PortletPreferences {
|
||||
this.preferencesValidator = preferencesValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void store() throws IOException, ValidatorException {
|
||||
if (this.preferencesValidator != null) {
|
||||
this.preferencesValidator.validate(this);
|
||||
|
||||
@@ -174,12 +174,10 @@ public class MockPortletRequest implements PortletRequest {
|
||||
// PortletRequest methods
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public boolean isWindowStateAllowed(WindowState windowState) {
|
||||
return CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPortletModeAllowed(PortletMode portletMode) {
|
||||
return CollectionUtils.contains(this.portalContext.getSupportedPortletModes(), portletMode);
|
||||
}
|
||||
@@ -189,7 +187,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.portletMode = portletMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletMode getPortletMode() {
|
||||
return this.portletMode;
|
||||
}
|
||||
@@ -199,7 +196,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.windowState = windowState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowState getWindowState() {
|
||||
return this.windowState;
|
||||
}
|
||||
@@ -209,7 +205,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.portletPreferences = preferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletPreferences getPreferences() {
|
||||
return this.portletPreferences;
|
||||
}
|
||||
@@ -222,12 +217,10 @@ public class MockPortletRequest implements PortletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletSession getPortletSession() {
|
||||
return getPortletSession(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletSession getPortletSession(boolean create) {
|
||||
checkActive();
|
||||
// Reset session if invalidated.
|
||||
@@ -273,25 +266,21 @@ public class MockPortletRequest implements PortletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProperty(String key) {
|
||||
Assert.notNull(key, "Property key must not be null");
|
||||
List<String> list = this.properties.get(key);
|
||||
return (list != null && list.size() > 0 ? list.get(0) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getProperties(String key) {
|
||||
Assert.notNull(key, "property key must not be null");
|
||||
return Collections.enumeration(this.properties.get(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getPropertyNames() {
|
||||
return Collections.enumeration(this.properties.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortalContext getPortalContext() {
|
||||
return this.portalContext;
|
||||
}
|
||||
@@ -300,7 +289,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.authType = authType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAuthType() {
|
||||
return this.authType;
|
||||
}
|
||||
@@ -309,7 +297,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.contextPath = contextPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContextPath() {
|
||||
return this.contextPath;
|
||||
}
|
||||
@@ -318,7 +305,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.remoteUser = remoteUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemoteUser() {
|
||||
return this.remoteUser;
|
||||
}
|
||||
@@ -327,7 +313,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.userPrincipal = userPrincipal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Principal getUserPrincipal() {
|
||||
return this.userPrincipal;
|
||||
}
|
||||
@@ -336,18 +321,15 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.userRoles.add(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUserInRole(String role) {
|
||||
return this.userRoles.contains(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
checkActive();
|
||||
return this.attributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
checkActive();
|
||||
return new Vector<String>(this.attributes.keySet()).elements();
|
||||
@@ -388,23 +370,19 @@ public class MockPortletRequest implements PortletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String name) {
|
||||
String[] arr = this.parameters.get(name);
|
||||
return (arr != null && arr.length > 0 ? arr[0] : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getParameterNames() {
|
||||
return Collections.enumeration(this.parameters.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterValues(String name) {
|
||||
return this.parameters.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getParameterMap() {
|
||||
return Collections.unmodifiableMap(this.parameters);
|
||||
}
|
||||
@@ -413,12 +391,10 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.secure = secure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecure() {
|
||||
return this.secure;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
checkActive();
|
||||
if (value != null) {
|
||||
@@ -429,13 +405,11 @@ public class MockPortletRequest implements PortletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
checkActive();
|
||||
this.attributes.remove(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRequestedSessionId() {
|
||||
PortletSession session = this.getPortletSession();
|
||||
return (session != null ? session.getId() : null);
|
||||
@@ -445,7 +419,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.requestedSessionIdValid = requestedSessionIdValid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRequestedSessionIdValid() {
|
||||
return this.requestedSessionIdValid;
|
||||
}
|
||||
@@ -458,12 +431,10 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.responseContentTypes.add(0, responseContentType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResponseContentType() {
|
||||
return this.responseContentTypes.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getResponseContentTypes() {
|
||||
return Collections.enumeration(this.responseContentTypes);
|
||||
}
|
||||
@@ -476,12 +447,10 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.locales.add(0, locale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return this.locales.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<Locale> getLocales() {
|
||||
return Collections.enumeration(this.locales);
|
||||
}
|
||||
@@ -490,7 +459,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.scheme = scheme;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScheme() {
|
||||
return this.scheme;
|
||||
}
|
||||
@@ -499,7 +467,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.serverName = serverName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerName() {
|
||||
return this.serverName;
|
||||
}
|
||||
@@ -508,7 +475,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.serverPort = serverPort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getServerPort() {
|
||||
return this.serverPort;
|
||||
}
|
||||
@@ -517,7 +483,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.windowID = windowID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWindowID() {
|
||||
return this.windowID;
|
||||
}
|
||||
@@ -526,12 +491,10 @@ public class MockPortletRequest implements PortletRequest {
|
||||
this.cookies = cookies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cookie[] getCookies() {
|
||||
return this.cookies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getPrivateParameterMap() {
|
||||
if (!this.publicParameterNames.isEmpty()) {
|
||||
Map<String, String[]> filtered = new LinkedHashMap<String, String[]>();
|
||||
@@ -547,7 +510,6 @@ public class MockPortletRequest implements PortletRequest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getPublicParameterMap() {
|
||||
if (!this.publicParameterNames.isEmpty()) {
|
||||
Map<String, String[]> filtered = new LinkedHashMap<String, String[]>();
|
||||
|
||||
@@ -53,12 +53,10 @@ public class MockPortletRequestDispatcher implements PortletRequestDispatcher {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void include(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
||||
include((PortletRequest) request, (PortletResponse) response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void include(PortletRequest request, PortletResponse response) throws PortletException, IOException {
|
||||
Assert.notNull(request, "Request must not be null");
|
||||
Assert.notNull(response, "Response must not be null");
|
||||
@@ -71,7 +69,6 @@ public class MockPortletRequestDispatcher implements PortletRequestDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forward(PortletRequest request, PortletResponse response) throws PortletException, IOException {
|
||||
Assert.notNull(request, "Request must not be null");
|
||||
Assert.notNull(response, "Response must not be null");
|
||||
|
||||
@@ -85,7 +85,6 @@ public class MockPortletResponse implements PortletResponse {
|
||||
// PortletResponse methods
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void addProperty(String key, String value) {
|
||||
Assert.notNull(key, "Property key must not be null");
|
||||
String[] oldArr = this.properties.get(key);
|
||||
@@ -100,7 +99,6 @@ public class MockPortletResponse implements PortletResponse {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(String key, String value) {
|
||||
Assert.notNull(key, "Property key must not be null");
|
||||
this.properties.put(key, new String[] {value});
|
||||
@@ -121,7 +119,6 @@ public class MockPortletResponse implements PortletResponse {
|
||||
return this.properties.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String encodeURL(String path) {
|
||||
return path;
|
||||
}
|
||||
@@ -130,12 +127,10 @@ public class MockPortletResponse implements PortletResponse {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNamespace() {
|
||||
return this.namespace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addProperty(Cookie cookie) {
|
||||
Assert.notNull(cookie, "Cookie must not be null");
|
||||
this.cookies.add(cookie);
|
||||
@@ -155,7 +150,6 @@ public class MockPortletResponse implements PortletResponse {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addProperty(String key, Element value) {
|
||||
Assert.notNull(key, "Property key must not be null");
|
||||
Element[] oldArr = this.xmlProperties.get(key);
|
||||
@@ -186,7 +180,6 @@ public class MockPortletResponse implements PortletResponse {
|
||||
return this.xmlProperties.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Element createElement(String tagName) throws DOMException {
|
||||
if (this.xmlDocument == null) {
|
||||
try {
|
||||
|
||||
@@ -77,12 +77,10 @@ public class MockPortletSession implements PortletSession {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
return this.portletAttributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name, int scope) {
|
||||
if (scope == PortletSession.PORTLET_SCOPE) {
|
||||
return this.portletAttributes.get(name);
|
||||
@@ -93,12 +91,10 @@ public class MockPortletSession implements PortletSession {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return new Vector<String>(this.portletAttributes.keySet()).elements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames(int scope) {
|
||||
if (scope == PortletSession.PORTLET_SCOPE) {
|
||||
return new Vector<String>(this.portletAttributes.keySet()).elements();
|
||||
@@ -109,12 +105,10 @@ public class MockPortletSession implements PortletSession {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCreationTime() {
|
||||
return this.creationTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
@@ -124,12 +118,10 @@ public class MockPortletSession implements PortletSession {
|
||||
setNew(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastAccessedTime() {
|
||||
return this.lastAccessedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxInactiveInterval() {
|
||||
return this.maxInactiveInterval;
|
||||
}
|
||||
@@ -155,7 +147,6 @@ public class MockPortletSession implements PortletSession {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
this.invalid = true;
|
||||
clearAttributes();
|
||||
@@ -169,17 +160,14 @@ public class MockPortletSession implements PortletSession {
|
||||
this.isNew = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNew() {
|
||||
return this.isNew;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
this.portletAttributes.remove(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name, int scope) {
|
||||
if (scope == PortletSession.PORTLET_SCOPE) {
|
||||
this.portletAttributes.remove(name);
|
||||
@@ -189,7 +177,6 @@ public class MockPortletSession implements PortletSession {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
if (value != null) {
|
||||
this.portletAttributes.put(name, value);
|
||||
@@ -199,7 +186,6 @@ public class MockPortletSession implements PortletSession {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value, int scope) {
|
||||
if (scope == PortletSession.PORTLET_SCOPE) {
|
||||
if (value != null) {
|
||||
@@ -219,22 +205,18 @@ public class MockPortletSession implements PortletSession {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxInactiveInterval(int interval) {
|
||||
this.maxInactiveInterval = interval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletContext getPortletContext() {
|
||||
return this.portletContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAttributeMap() {
|
||||
return Collections.unmodifiableMap(this.portletAttributes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAttributeMap(int scope) {
|
||||
if (scope == PortletSession.PORTLET_SCOPE) {
|
||||
return Collections.unmodifiableMap(this.portletAttributes);
|
||||
|
||||
@@ -69,7 +69,6 @@ public class MockPortletURL extends MockBaseURL implements PortletURL {
|
||||
// PortletURL methods
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void setWindowState(WindowState windowState) throws WindowStateException {
|
||||
if (!CollectionUtils.contains(this.portalContext.getSupportedWindowStates(), windowState)) {
|
||||
throw new WindowStateException("WindowState not supported", windowState);
|
||||
@@ -77,12 +76,10 @@ public class MockPortletURL extends MockBaseURL implements PortletURL {
|
||||
this.windowState = windowState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowState getWindowState() {
|
||||
return this.windowState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortletMode(PortletMode portletMode) throws PortletModeException {
|
||||
if (!CollectionUtils.contains(this.portalContext.getSupportedPortletModes(), portletMode)) {
|
||||
throw new PortletModeException("PortletMode not supported", portletMode);
|
||||
@@ -90,12 +87,10 @@ public class MockPortletURL extends MockBaseURL implements PortletURL {
|
||||
this.portletMode = portletMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletMode getPortletMode() {
|
||||
return this.portletMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePublicRenderParameter(String name) {
|
||||
this.parameters.remove(name);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ public class MockRenderRequest extends MockPortletRequest implements RenderReque
|
||||
return RENDER_PHASE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getETag() {
|
||||
return getProperty(RenderRequest.ETAG);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ public class MockRenderResponse extends MockMimeResponse implements RenderRespon
|
||||
// RenderResponse methods
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
@@ -78,7 +77,6 @@ public class MockRenderResponse extends MockMimeResponse implements RenderRespon
|
||||
return this.title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) {
|
||||
this.nextPossiblePortletModes = portletModes;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,6 @@ public class MockResourceRequest extends MockClientDataRequest implements Resour
|
||||
this.resourceID = resourceID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResourceID() {
|
||||
return this.resourceID;
|
||||
}
|
||||
@@ -106,12 +105,10 @@ public class MockResourceRequest extends MockClientDataRequest implements Resour
|
||||
this.cacheability = cacheLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCacheability() {
|
||||
return this.cacheability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getETag() {
|
||||
return getProperty(RenderRequest.ETAG);
|
||||
}
|
||||
@@ -124,7 +121,6 @@ public class MockResourceRequest extends MockClientDataRequest implements Resour
|
||||
this.privateRenderParameterMap.put(key, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getPrivateRenderParameterMap() {
|
||||
return Collections.unmodifiableMap(this.privateRenderParameterMap);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public class MockResourceResponse extends MockMimeResponse implements ResourceRe
|
||||
private int contentLength = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public void setContentLength(int len) {
|
||||
this.contentLength = len;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ public class MockResourceURL extends MockBaseURL implements ResourceURL {
|
||||
// ResourceURL methods
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void setResourceID(String resourceID) {
|
||||
this.resourceID = resourceID;
|
||||
}
|
||||
@@ -45,12 +44,10 @@ public class MockResourceURL extends MockBaseURL implements ResourceURL {
|
||||
return this.resourceID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCacheability(String cacheLevel) {
|
||||
this.cacheability = cacheLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCacheability() {
|
||||
return this.cacheability;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,6 @@ public class MockStateAwareResponse extends MockPortletResponse implements State
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setWindowState(WindowState windowState) throws WindowStateException {
|
||||
if (!CollectionUtils.contains(getPortalContext().getSupportedWindowStates(), windowState)) {
|
||||
throw new WindowStateException("WindowState not supported", windowState);
|
||||
@@ -76,12 +75,10 @@ public class MockStateAwareResponse extends MockPortletResponse implements State
|
||||
this.windowState = windowState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowState getWindowState() {
|
||||
return this.windowState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPortletMode(PortletMode portletMode) throws PortletModeException {
|
||||
if (!CollectionUtils.contains(getPortalContext().getSupportedPortletModes(), portletMode)) {
|
||||
throw new PortletModeException("PortletMode not supported", portletMode);
|
||||
@@ -89,26 +86,22 @@ public class MockStateAwareResponse extends MockPortletResponse implements State
|
||||
this.portletMode = portletMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletMode getPortletMode() {
|
||||
return this.portletMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderParameters(Map<String, String[]> parameters) {
|
||||
Assert.notNull(parameters, "Parameters Map must not be null");
|
||||
this.renderParameters.clear();
|
||||
this.renderParameters.putAll(parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderParameter(String key, String value) {
|
||||
Assert.notNull(key, "Parameter key must not be null");
|
||||
Assert.notNull(value, "Parameter value must not be null");
|
||||
this.renderParameters.put(key, new String[] {value});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderParameter(String key, String[] values) {
|
||||
Assert.notNull(key, "Parameter key must not be null");
|
||||
Assert.notNull(values, "Parameter values must not be null");
|
||||
@@ -130,22 +123,18 @@ public class MockStateAwareResponse extends MockPortletResponse implements State
|
||||
return this.renderParameters.keySet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getRenderParameterMap() {
|
||||
return Collections.unmodifiableMap(this.renderParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePublicRenderParameter(String name) {
|
||||
this.renderParameters.remove(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEvent(QName name, Serializable value) {
|
||||
this.events.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEvent(String name, Serializable value) {
|
||||
this.events.put(new QName(name), value);
|
||||
}
|
||||
|
||||
@@ -59,105 +59,85 @@ public class ServletWrappingPortletContext implements PortletContext {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getServerInfo() {
|
||||
return this.servletContext.getServerInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletRequestDispatcher getRequestDispatcher(String path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PortletRequestDispatcher getNamedDispatcher(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResourceAsStream(String path) {
|
||||
return this.servletContext.getResourceAsStream(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMajorVersion() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinorVersion() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMimeType(String file) {
|
||||
return this.servletContext.getMimeType(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRealPath(String path) {
|
||||
return this.servletContext.getRealPath(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Set<String> getResourcePaths(String path) {
|
||||
return this.servletContext.getResourcePaths(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getResource(String path) throws MalformedURLException {
|
||||
return this.servletContext.getResource(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
return this.servletContext.getAttribute(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return this.servletContext.getAttributeNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitParameter(String name) {
|
||||
return this.servletContext.getInitParameter(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Enumeration<String> getInitParameterNames() {
|
||||
return this.servletContext.getInitParameterNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String msg) {
|
||||
this.servletContext.log(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String message, Throwable throwable) {
|
||||
this.servletContext.log(message, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttribute(String name) {
|
||||
this.servletContext.removeAttribute(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object object) {
|
||||
this.servletContext.setAttribute(name, object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPortletContextName() {
|
||||
return this.servletContext.getServletContextName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getContainerRuntimeOptions() {
|
||||
return Collections.enumeration(new HashSet<String>());
|
||||
}
|
||||
|
||||
@@ -173,7 +173,6 @@ public abstract class AbstractDependencyInjectionSpringContextTests extends Abst
|
||||
* message will be written to the log.
|
||||
* @see #injectDependencies()
|
||||
*/
|
||||
@Override
|
||||
protected void prepareTestInstance() throws Exception {
|
||||
if (getApplicationContext() == null) {
|
||||
if (this.logger.isInfoEnabled()) {
|
||||
|
||||
@@ -95,7 +95,6 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
* This implementation is final. Override {@code onSetUp} for custom behavior.
|
||||
* @see #onSetUp()
|
||||
*/
|
||||
@Override
|
||||
protected final void setUp() throws Exception {
|
||||
// lazy load, in case getApplicationContext() has not yet been called.
|
||||
if (this.applicationContext == null) {
|
||||
@@ -137,7 +136,6 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
* custom behavior.
|
||||
* @see #onTearDown()
|
||||
*/
|
||||
@Override
|
||||
protected final void tearDown() throws Exception {
|
||||
onTearDown();
|
||||
}
|
||||
@@ -170,7 +168,6 @@ public abstract class AbstractSingleSpringContextTests extends AbstractSpringCon
|
||||
* {@code contextKey()} returns.
|
||||
* @see #getConfigLocations()
|
||||
*/
|
||||
@Override
|
||||
protected ConfigurableApplicationContext loadContext(Object key) throws Exception {
|
||||
return loadContextLocations((String[]) key);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,6 @@ public abstract class AbstractTransactionalDataSourceSpringContextTests
|
||||
* cleared, as a defensive measure against accidental <i>permanent</i> wiping of a database.
|
||||
* @see org.springframework.test.AbstractTransactionalSpringContextTests#setComplete()
|
||||
*/
|
||||
@Override
|
||||
protected final void setComplete() {
|
||||
if (this.zappedTables) {
|
||||
throw new IllegalStateException("Cannot set complete after deleting tables");
|
||||
|
||||
@@ -187,7 +187,6 @@ public abstract class AbstractTransactionalSpringContextTests extends AbstractDe
|
||||
* @throws Exception simply let any exception propagate
|
||||
* @see #onTearDown()
|
||||
*/
|
||||
@Override
|
||||
protected void onSetUp() throws Exception {
|
||||
this.complete = !this.isRollback();
|
||||
|
||||
@@ -251,7 +250,6 @@ public abstract class AbstractTransactionalSpringContextTests extends AbstractDe
|
||||
* @throws Exception simply let any exception propagate
|
||||
* @see #onSetUp()
|
||||
*/
|
||||
@Override
|
||||
protected void onTearDown() throws Exception {
|
||||
// Call onTearDownInTransaction and end transaction if the transaction
|
||||
// is still active.
|
||||
|
||||
@@ -66,7 +66,6 @@ public abstract class ConditionalTestCase extends TestCase {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runBare() throws Throwable {
|
||||
// getName will return the name of the method being run
|
||||
if (isDisabledInThisEnvironment(getName())) {
|
||||
|
||||
@@ -174,7 +174,6 @@ public abstract class AbstractAnnotationAwareTransactionalTests extends
|
||||
|
||||
// Let JUnit handle execution. We're just changing the state of the test class first.
|
||||
runTestTimed(new TestExecutionCallback() {
|
||||
@Override
|
||||
public void run() throws Throwable {
|
||||
try {
|
||||
AbstractAnnotationAwareTransactionalTests.super.runBare();
|
||||
|
||||
@@ -50,7 +50,6 @@ public class SystemProfileValueSource implements ProfileValueSource {
|
||||
* system properties.
|
||||
* @see System#getProperty(String)
|
||||
*/
|
||||
@Override
|
||||
public String get(String key) {
|
||||
Assert.hasText(key, "'key' must not be empty");
|
||||
return System.getProperty(key);
|
||||
|
||||
@@ -177,7 +177,6 @@ public abstract class AbstractJUnit38SpringContextTests extends TestCase impleme
|
||||
* Sets the {@link ApplicationContext} to be used by this test instance,
|
||||
* provided via {@link ApplicationContextAware} semantics.
|
||||
*/
|
||||
@Override
|
||||
public final void setApplicationContext(final ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
@@ -216,7 +215,6 @@ public abstract class AbstractJUnit38SpringContextTests extends TestCase impleme
|
||||
|
||||
runTestTimed(new TestExecutionCallback() {
|
||||
|
||||
@Override
|
||||
public void run() throws Throwable {
|
||||
runManaged(testMethod);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@ public abstract class AbstractJUnit4SpringContextTests implements ApplicationCon
|
||||
* Set the {@link ApplicationContext} to be used by this test instance,
|
||||
* provided via {@link ApplicationContextAware} semantics.
|
||||
*/
|
||||
@Override
|
||||
public final void setApplicationContext(final ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
* @since 3.1
|
||||
* @see #processLocations(Class, String...)
|
||||
*/
|
||||
@Override
|
||||
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
|
||||
String[] processedLocations = processLocations(configAttributes.getDeclaringClass(),
|
||||
configAttributes.getLocations());
|
||||
@@ -175,7 +174,6 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
|
||||
* @see org.springframework.test.context.ContextLoader#processLocations(Class, String...)
|
||||
* @see #processContextConfiguration(ContextConfigurationAttributes)
|
||||
*/
|
||||
@Override
|
||||
public final String[] processLocations(Class<?> clazz, String... locations) {
|
||||
return (ObjectUtils.isEmpty(locations) && isGenerateDefaultLocations()) ? generateDefaultLocations(clazz)
|
||||
: modifyLocations(clazz, locations);
|
||||
|
||||
@@ -142,7 +142,6 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||
* context configuration; or if both candidate loaders detect defaults for the
|
||||
* supplied context configuration
|
||||
*/
|
||||
@Override
|
||||
public void processContextConfiguration(final ContextConfigurationAttributes configAttributes) {
|
||||
|
||||
Assert.notNull(configAttributes, "configAttributes must not be null");
|
||||
@@ -237,7 +236,6 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||
* @throws IllegalStateException if neither candidate loader is capable of loading an
|
||||
* {@code ApplicationContext} from the supplied merged context configuration
|
||||
*/
|
||||
@Override
|
||||
public ApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
|
||||
Assert.notNull(mergedConfig, "mergedConfig must not be null");
|
||||
|
||||
@@ -270,7 +268,6 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||
* {@link #processContextConfiguration(ContextConfigurationAttributes)} instead.
|
||||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
@Override
|
||||
public final String[] processLocations(Class<?> clazz, String... locations) {
|
||||
throw new UnsupportedOperationException("DelegatingSmartContextLoaders do not support the ContextLoader SPI. "
|
||||
+ "Call processContextConfiguration(ContextConfigurationAttributes) instead.");
|
||||
@@ -282,7 +279,6 @@ public abstract class AbstractDelegatingSmartContextLoader implements SmartConte
|
||||
* {@link #loadContext(MergedContextConfiguration)} instead.
|
||||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
@Override
|
||||
public final ApplicationContext loadContext(String... locations) throws Exception {
|
||||
throw new UnsupportedOperationException("DelegatingSmartContextLoaders do not support the ContextLoader SPI. "
|
||||
+ "Call loadContext(MergedContextConfiguration) instead.");
|
||||
|
||||
@@ -90,7 +90,6 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
* @see GenericApplicationContext
|
||||
* @since 3.1
|
||||
*/
|
||||
@Override
|
||||
public final ConfigurableApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("Loading ApplicationContext for merged context configuration [%s].",
|
||||
@@ -143,7 +142,6 @@ public abstract class AbstractGenericContextLoader extends AbstractContextLoader
|
||||
* @see #loadContext(MergedContextConfiguration)
|
||||
* @since 2.5
|
||||
*/
|
||||
@Override
|
||||
public final ConfigurableApplicationContext loadContext(String... locations) throws Exception {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("Loading ApplicationContext for locations [%s].",
|
||||
|
||||
@@ -34,7 +34,6 @@ public abstract class AbstractTestExecutionListener implements TestExecutionList
|
||||
* The default implementation is <em>empty</em>. Can be overridden by
|
||||
* subclasses as necessary.
|
||||
*/
|
||||
@Override
|
||||
public void beforeTestClass(TestContext testContext) throws Exception {
|
||||
/* no-op */
|
||||
}
|
||||
@@ -43,7 +42,6 @@ public abstract class AbstractTestExecutionListener implements TestExecutionList
|
||||
* The default implementation is <em>empty</em>. Can be overridden by
|
||||
* subclasses as necessary.
|
||||
*/
|
||||
@Override
|
||||
public void prepareTestInstance(TestContext testContext) throws Exception {
|
||||
/* no-op */
|
||||
}
|
||||
@@ -52,7 +50,6 @@ public abstract class AbstractTestExecutionListener implements TestExecutionList
|
||||
* The default implementation is <em>empty</em>. Can be overridden by
|
||||
* subclasses as necessary.
|
||||
*/
|
||||
@Override
|
||||
public void beforeTestMethod(TestContext testContext) throws Exception {
|
||||
/* no-op */
|
||||
}
|
||||
@@ -61,7 +58,6 @@ public abstract class AbstractTestExecutionListener implements TestExecutionList
|
||||
* The default implementation is <em>empty</em>. Can be overridden by
|
||||
* subclasses as necessary.
|
||||
*/
|
||||
@Override
|
||||
public void afterTestMethod(TestContext testContext) throws Exception {
|
||||
/* no-op */
|
||||
}
|
||||
@@ -70,7 +66,6 @@ public abstract class AbstractTestExecutionListener implements TestExecutionList
|
||||
* The default implementation is <em>empty</em>. Can be overridden by
|
||||
* subclasses as necessary.
|
||||
*/
|
||||
@Override
|
||||
public void afterTestClass(TestContext testContext) throws Exception {
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
@@ -74,7 +74,6 @@ public class AnnotationConfigContextLoader extends AbstractGenericContextLoader
|
||||
* @see #isGenerateDefaultLocations()
|
||||
* @see #detectDefaultConfigurationClasses(Class)
|
||||
*/
|
||||
@Override
|
||||
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
|
||||
if (ObjectUtils.isEmpty(configAttributes.getClasses()) && isGenerateDefaultLocations()) {
|
||||
Class<?>[] defaultConfigClasses = detectDefaultConfigurationClasses(configAttributes.getDeclaringClass());
|
||||
|
||||
@@ -36,12 +36,10 @@ public class DelegatingSmartContextLoader extends AbstractDelegatingSmartContext
|
||||
private final SmartContextLoader annotationConfigLoader = new AnnotationConfigContextLoader();
|
||||
|
||||
|
||||
@Override
|
||||
protected SmartContextLoader getXmlLoader() {
|
||||
return this.xmlLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SmartContextLoader getAnnotationConfigLoader() {
|
||||
return this.annotationConfigLoader;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ public abstract class AbstractTestNGSpringContextTests implements IHookable, App
|
||||
*
|
||||
* @param applicationContext the applicationContext to set
|
||||
*/
|
||||
@Override
|
||||
public final void setApplicationContext(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
@@ -152,7 +151,6 @@ public abstract class AbstractTestNGSpringContextTests implements IHookable, App
|
||||
* @see org.testng.IHookable#run(org.testng.IHookCallBack,
|
||||
* org.testng.ITestResult)
|
||||
*/
|
||||
@Override
|
||||
public void run(IHookCallBack callBack, ITestResult testResult) {
|
||||
callBack.runTestMethod(testResult);
|
||||
|
||||
|
||||
@@ -153,7 +153,6 @@ public class TransactionalTestExecutionListener extends AbstractTestExecutionLis
|
||||
if (transactionAttribute != null) {
|
||||
transactionAttribute = new DelegatingTransactionAttribute(transactionAttribute) {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return testMethod.getName();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,6 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||
* @see org.springframework.test.context.SmartContextLoader#loadContext(MergedContextConfiguration)
|
||||
* @see GenericWebApplicationContext
|
||||
*/
|
||||
@Override
|
||||
public final ConfigurableApplicationContext loadContext(MergedContextConfiguration mergedConfig) throws Exception {
|
||||
|
||||
if (!(mergedConfig instanceof WebMergedContextConfiguration)) {
|
||||
@@ -217,7 +216,6 @@ public abstract class AbstractGenericWebContextLoader extends AbstractContextLoa
|
||||
* @see org.springframework.test.context.ContextLoader#loadContext(java.lang.String[])
|
||||
* @throws UnsupportedOperationException
|
||||
*/
|
||||
@Override
|
||||
public final ApplicationContext loadContext(String... locations) throws Exception {
|
||||
throw new UnsupportedOperationException(
|
||||
"AbstractGenericWebContextLoader does not support the loadContext(String... locations) method");
|
||||
|
||||
@@ -75,7 +75,6 @@ public class AnnotationConfigWebContextLoader extends AbstractGenericWebContextL
|
||||
* @see #isGenerateDefaultLocations()
|
||||
* @see #detectDefaultConfigurationClasses(Class)
|
||||
*/
|
||||
@Override
|
||||
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
|
||||
if (ObjectUtils.isEmpty(configAttributes.getClasses()) && isGenerateDefaultLocations()) {
|
||||
Class<?>[] defaultConfigClasses = detectDefaultConfigurationClasses(configAttributes.getDeclaringClass());
|
||||
|
||||
@@ -41,7 +41,6 @@ public class GenericXmlWebContextLoader extends AbstractGenericWebContextLoader
|
||||
/**
|
||||
* Returns "{@code -context.xml}".
|
||||
*/
|
||||
@Override
|
||||
protected String getResourceSuffix() {
|
||||
return "-context.xml";
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ public class ServletTestExecutionListener extends AbstractTestExecutionListener
|
||||
* @see TestExecutionListener#prepareTestInstance(TestContext)
|
||||
* @see #setUpRequestContextIfNecessary(TestContext)
|
||||
*/
|
||||
@Override
|
||||
public void prepareTestInstance(TestContext testContext) throws Exception {
|
||||
setUpRequestContextIfNecessary(testContext);
|
||||
}
|
||||
@@ -81,7 +80,6 @@ public class ServletTestExecutionListener extends AbstractTestExecutionListener
|
||||
* @see TestExecutionListener#beforeTestMethod(TestContext)
|
||||
* @see #setUpRequestContextIfNecessary(TestContext)
|
||||
*/
|
||||
@Override
|
||||
public void beforeTestMethod(TestContext testContext) throws Exception {
|
||||
setUpRequestContextIfNecessary(testContext);
|
||||
}
|
||||
@@ -93,7 +91,6 @@ public class ServletTestExecutionListener extends AbstractTestExecutionListener
|
||||
*
|
||||
* @see TestExecutionListener#afterTestMethod(TestContext)
|
||||
*/
|
||||
@Override
|
||||
public void afterTestMethod(TestContext testContext) throws Exception {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("Resetting RequestContextHolder for test context %s.", testContext));
|
||||
|
||||
@@ -37,12 +37,10 @@ public class WebDelegatingSmartContextLoader extends AbstractDelegatingSmartCont
|
||||
private final SmartContextLoader annotationConfigLoader = new AnnotationConfigWebContextLoader();
|
||||
|
||||
|
||||
@Override
|
||||
protected SmartContextLoader getXmlLoader() {
|
||||
return this.xmlLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SmartContextLoader getAnnotationConfigLoader() {
|
||||
return this.annotationConfigLoader;
|
||||
}
|
||||
|
||||
@@ -330,7 +330,6 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
this.ltw = ltw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof LocalContainerEntityManagerFactoryBean) {
|
||||
((LocalContainerEntityManagerFactoryBean) bean).setLoadTimeWeaver(this.ltw);
|
||||
@@ -351,7 +350,6 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
this.shadowingClassLoader = shadowingClassLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTransformer(ClassFileTransformer transformer) {
|
||||
try {
|
||||
Method addClassFileTransformer =
|
||||
@@ -364,12 +362,10 @@ public abstract class AbstractJpaTests extends AbstractAnnotationAwareTransactio
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getInstrumentableClassLoader() {
|
||||
return this.shadowingClassLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getThrowawayClassLoader() {
|
||||
// Be sure to copy the same resource overrides and same class file transformers:
|
||||
// We want the throwaway class loader to behave like the instrumentable class loader.
|
||||
|
||||
Reference in New Issue
Block a user