Return-Path:
Delivered-To: apmail-struts-commits-archive@locus.apache.org
Received: (qmail 21091 invoked from network); 5 Jul 2006 18:01:56 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199)
by minotaur.apache.org with SMTP; 5 Jul 2006 18:01:56 -0000
Received: (qmail 80656 invoked by uid 500); 5 Jul 2006 18:01:50 -0000
Delivered-To: apmail-struts-commits-archive@struts.apache.org
Received: (qmail 80543 invoked by uid 500); 5 Jul 2006 18:01:49 -0000
Mailing-List: contact commits-help@struts.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: dev@struts.apache.org
Delivered-To: mailing list commits@struts.apache.org
Received: (qmail 80468 invoked by uid 99); 5 Jul 2006 18:01:49 -0000
Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49)
by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 11:01:49 -0700
X-ASF-Spam-Status: No, hits=-9.4 required=10.0
tests=ALL_TRUSTED,NO_REAL_NAME
X-Spam-Check-By: apache.org
Received-SPF: pass (asf.osuosl.org: local policy)
Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113)
by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 11:01:44 -0700
Received: by eris.apache.org (Postfix, from userid 65534)
id A6CDC1A9820; Wed, 5 Jul 2006 11:01:24 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r419299 [2/3] - in /struts/shale/trunk:
shale-remoting/src/main/java/org/apache/shale/remoting/
shale-remoting/src/main/java/org/apache/shale/remoting/faces/
shale-remoting/src/main/java/org/apache/shale/remoting/impl/
shale-spring/src/main...
Date: Wed, 05 Jul 2006 18:01:11 -0000
To: commits@struts.apache.org
From: craigmcc@apache.org
X-Mailer: svnmailer-1.0.8
Message-Id: <20060705180124.A6CDC1A9820@eris.apache.org>
X-Virus-Checked: Checked by ClamAV on apache.org
X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockFacesContext.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockFacesContext.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockFacesContext.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockFacesContext.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -68,6 +68,11 @@
// ----------------------------------------------------- Mock Object Methods
+ /**
+ * Set the Application
instance for this instance.
+ *
+ * @param application The new Application
+ */
public void setApplication(Application application) {
this.application = application;
@@ -75,6 +80,11 @@
}
+ /**
+ * Set the ExternalContext
instance for this instance.
+ *
+ * @param externalContext The new ExternalContext
+ */
public void setExternalContext(ExternalContext externalContext) {
this.externalContext = externalContext;
@@ -98,6 +108,7 @@
// ---------------------------------------------------- FacesContext Methods
+ /** {@inheritDoc} */
public Application getApplication() {
return this.application;
@@ -105,6 +116,7 @@
}
+ /** {@inheritDoc} */
public Iterator getClientIdsWithMessages() {
return messages.keySet().iterator();
@@ -112,6 +124,7 @@
}
+ /** {@inheritDoc} */
public ExternalContext getExternalContext() {
return this.externalContext;
@@ -119,6 +132,7 @@
}
+ /** {@inheritDoc} */
public Severity getMaximumSeverity() {
Severity severity = null;
@@ -136,6 +150,7 @@
}
+ /** {@inheritDoc} */
public Iterator getMessages() {
ArrayList results = new ArrayList();
@@ -149,6 +164,7 @@
}
+ /** {@inheritDoc} */
public Iterator getMessages(String clientId) {
List list = (List) messages.get(clientId);
@@ -160,6 +176,7 @@
}
+ /** {@inheritDoc} */
public RenderKit getRenderKit() {
UIViewRoot vr = getViewRoot();
@@ -177,6 +194,7 @@
}
+ /** {@inheritDoc} */
public boolean getRenderResponse() {
return this.renderResponse;
@@ -184,6 +202,7 @@
}
+ /** {@inheritDoc} */
public boolean getResponseComplete() {
return this.responseComplete;
@@ -191,6 +210,7 @@
}
+ /** {@inheritDoc} */
public ResponseStream getResponseStream() {
return this.responseStream;
@@ -198,6 +218,7 @@
}
+ /** {@inheritDoc} */
public void setResponseStream(ResponseStream responseStream) {
this.responseStream = responseStream;
@@ -205,6 +226,7 @@
}
+ /** {@inheritDoc} */
public ResponseWriter getResponseWriter() {
return this.responseWriter;
@@ -212,6 +234,7 @@
}
+ /** {@inheritDoc} */
public void setResponseWriter(ResponseWriter responseWriter) {
this.responseWriter = responseWriter;
@@ -219,6 +242,7 @@
}
+ /** {@inheritDoc} */
public UIViewRoot getViewRoot() {
return this.viewRoot;
@@ -226,6 +250,7 @@
}
+ /** {@inheritDoc} */
public void setViewRoot(UIViewRoot viewRoot) {
this.viewRoot = viewRoot;
@@ -233,7 +258,8 @@
}
- public void addMessage(String clientId, FacesMessage message){
+ /** {@inheritDoc} */
+ public void addMessage(String clientId, FacesMessage message) {
if (message == null) {
throw new NullPointerException();
@@ -248,6 +274,7 @@
}
+ /** {@inheritDoc} */
public void release() {
application = null;
@@ -263,6 +290,7 @@
}
+ /** {@inheritDoc} */
public void renderResponse() {
this.renderResponse = true;
@@ -270,6 +298,7 @@
}
+ /** {@inheritDoc} */
public void responseComplete() {
this.responseComplete = true;
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockFacesContextFactory.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockFacesContextFactory.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockFacesContextFactory.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockFacesContextFactory.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -39,8 +39,8 @@
/**
* Return a default instance.
*/
- public MockFacesContextFactory() {}
-
+ public MockFacesContextFactory() { }
+
// ----------------------------------------------------- Mock Object Methods
@@ -51,9 +51,10 @@
// --------------------------------------------- FacesContextFactory Methods
+ /** {@inheritDoc} */
public FacesContext getFacesContext(Object context, Object request,
- Object response,
- Lifecycle lifecycle) throws FacesException {
+ Object response,
+ Lifecycle lifecycle) throws FacesException {
MockExternalContext externalContext =
new MockExternalContext((ServletContext) context,
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpServletRequest.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpServletRequest.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpServletRequest.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpServletRequest.java Wed Jul 5 11:01:09 2006
@@ -95,12 +95,20 @@
/**
* Add a new listener instance that should be notified about
* attribute changes.
+ *
+ * @param listener The new listener to register
*/
public void addAttributeListener(ServletRequestAttributeListener listener) {
attributeListeners.add(listener);
}
+ /**
+ * Add a date-valued header for this request.
+ *
+ * @param name Header name
+ * @param value Header value
+ */
public void addDateHeader(String name, long value) {
headers.add(name + ": " + formatDate(value));
@@ -108,6 +116,12 @@
}
+ /**
+ * Add a String-valued header for this request.
+ *
+ * @param name Header name
+ * @param value Header value
+ */
public void addHeader(String name, String value) {
headers.add(name + ": " + value);
@@ -115,6 +129,12 @@
}
+ /**
+ * Add an integer-valued header for this request.
+ *
+ * @param name Header name
+ * @param value Header value
+ */
public void addIntHeader(String name, int value) {
headers.add(name + ": " + value);
@@ -122,15 +142,21 @@
}
+ /**
+ * Add a request parameter for this request.
+ *
+ * @param name Parameter name
+ * @param value Parameter value
+ */
public void addParameter(String name, String value) {
- String values[] = (String[]) parameters.get(name);
+ String[] values = (String[]) parameters.get(name);
if (values == null) {
- String results[] = new String[] { value };
+ String[] results = new String[] { value };
parameters.put(name, results);
return;
}
- String results[] = new String[values.length + 1];
+ String[] results = new String[values.length + 1];
System.arraycopy(values, 0, results, 0, values.length);
results[values.length] = value;
parameters.put(name, results);
@@ -138,6 +164,10 @@
}
+ /**
+ * Return the ServletContext
associated with
+ * this request.
+ */
public ServletContext getServletContext() {
return this.servletContext;
@@ -145,6 +175,11 @@
}
+ /**
+ * Set the HttpSession
associated with this request.
+ *
+ * @param session The new session
+ */
public void setHttpSession(HttpSession session) {
this.session = session;
@@ -152,6 +187,11 @@
}
+ /**
+ * Set the Locale
associated with this request.
+ *
+ * @param locale The new locale
+ */
public void setLocale(Locale locale) {
this.locale = locale;
@@ -159,6 +199,14 @@
}
+ /**
+ * Set the parsed path elements associated with this request.
+ *
+ * @param contextPath The context path
+ * @param servletPath The servlet path
+ * @param pathInfo The extra path information
+ * @param queryString The query string
+ */
public void setPathElements(String contextPath, String servletPath,
String pathInfo, String queryString) {
@@ -170,6 +218,11 @@
}
+ /**
+ * Set the ServletContext
associated with this request.
+ *
+ * @param servletContext The new servlet context
+ */
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
@@ -177,6 +230,11 @@
}
+ /**
+ * Set the Principal
associated with this request.
+ *
+ * @param principal The new Principal
+ */
public void setUserPrincipal(Principal principal) {
this.principal = principal;
@@ -204,6 +262,7 @@
// ---------------------------------------------- HttpServletRequest Methods
+ /** {@inheritDoc} */
public String getAuthType() {
throw new UnsupportedOperationException();
@@ -211,6 +270,7 @@
}
+ /** {@inheritDoc} */
public String getContextPath() {
return contextPath;
@@ -218,6 +278,7 @@
}
+ /** {@inheritDoc} */
public Cookie[] getCookies() {
throw new UnsupportedOperationException();
@@ -225,6 +286,7 @@
}
+ /** {@inheritDoc} */
public long getDateHeader(String name) {
String match = name + ":";
@@ -240,6 +302,7 @@
}
+ /** {@inheritDoc} */
public String getHeader(String name) {
String match = name + ":";
@@ -255,6 +318,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getHeaderNames() {
Vector values = new Vector();
@@ -274,6 +338,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getHeaders(String name) {
String match = name + ":";
@@ -290,6 +355,7 @@
}
+ /** {@inheritDoc} */
public int getIntHeader(String name) {
String match = name + ":";
@@ -305,6 +371,7 @@
}
+ /** {@inheritDoc} */
public String getMethod() {
throw new UnsupportedOperationException();
@@ -312,6 +379,7 @@
}
+ /** {@inheritDoc} */
public String getPathInfo() {
return pathInfo;
@@ -319,6 +387,7 @@
}
+ /** {@inheritDoc} */
public String getPathTranslated() {
throw new UnsupportedOperationException();
@@ -326,6 +395,7 @@
}
+ /** {@inheritDoc} */
public String getQueryString() {
return queryString;
@@ -333,6 +403,7 @@
}
+ /** {@inheritDoc} */
public String getRemoteUser() {
if (principal != null) {
@@ -344,6 +415,7 @@
}
+ /** {@inheritDoc} */
public String getRequestedSessionId() {
throw new UnsupportedOperationException();
@@ -351,6 +423,7 @@
}
+ /** {@inheritDoc} */
public String getRequestURI() {
StringBuffer sb = new StringBuffer();
@@ -371,6 +444,7 @@
}
+ /** {@inheritDoc} */
public StringBuffer getRequestURL() {
throw new UnsupportedOperationException();
@@ -378,6 +452,7 @@
}
+ /** {@inheritDoc} */
public String getServletPath() {
return (servletPath);
@@ -385,6 +460,7 @@
}
+ /** {@inheritDoc} */
public HttpSession getSession() {
return getSession(true);
@@ -392,6 +468,7 @@
}
+ /** {@inheritDoc} */
public HttpSession getSession(boolean create) {
if (create && (session == null)) {
@@ -402,6 +479,7 @@
}
+ /** {@inheritDoc} */
public Principal getUserPrincipal() {
return principal;
@@ -409,6 +487,7 @@
}
+ /** {@inheritDoc} */
public boolean isRequestedSessionIdFromCookie() {
throw new UnsupportedOperationException();
@@ -416,6 +495,7 @@
}
+ /** {@inheritDoc} */
public boolean isRequestedSessionIdFromUrl() {
throw new UnsupportedOperationException();
@@ -423,6 +503,7 @@
}
+ /** {@inheritDoc} */
public boolean isRequestedSessionIdFromURL() {
throw new UnsupportedOperationException();
@@ -430,6 +511,7 @@
}
+ /** {@inheritDoc} */
public boolean isRequestedSessionIdValid() {
throw new UnsupportedOperationException();
@@ -437,6 +519,7 @@
}
+ /** {@inheritDoc} */
public boolean isUserInRole(String role) {
throw new UnsupportedOperationException();
@@ -447,6 +530,7 @@
// ------------------------------------------------- ServletRequest Methods
+ /** {@inheritDoc} */
public Object getAttribute(String name) {
return attributes.get(name);
@@ -454,6 +538,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getAttributeNames() {
return new MockEnumeration(attributes.keySet().iterator());
@@ -461,6 +546,7 @@
}
+ /** {@inheritDoc} */
public String getCharacterEncoding() {
throw new UnsupportedOperationException();
@@ -468,6 +554,7 @@
}
+ /** {@inheritDoc} */
public int getContentLength() {
throw new UnsupportedOperationException();
@@ -475,6 +562,7 @@
}
+ /** {@inheritDoc} */
public String getContentType() {
throw new UnsupportedOperationException();
@@ -482,6 +570,7 @@
}
+ /** {@inheritDoc} */
public ServletInputStream getInputStream() {
throw new UnsupportedOperationException();
@@ -489,6 +578,7 @@
}
+ /** {@inheritDoc} */
public Locale getLocale() {
return locale;
@@ -496,6 +586,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getLocales() {
throw new UnsupportedOperationException();
@@ -503,6 +594,7 @@
}
+ /** {@inheritDoc} */
public String getLocalAddr() {
throw new UnsupportedOperationException();
@@ -510,6 +602,7 @@
}
+ /** {@inheritDoc} */
public String getLocalName() {
throw new UnsupportedOperationException();
@@ -517,6 +610,7 @@
}
+ /** {@inheritDoc} */
public int getLocalPort() {
throw new UnsupportedOperationException();
@@ -524,9 +618,10 @@
}
+ /** {@inheritDoc} */
public String getParameter(String name) {
- String values[] = (String[]) parameters.get(name);
+ String[] values = (String[]) parameters.get(name);
if (values != null) {
return values[0];
} else {
@@ -536,6 +631,7 @@
}
+ /** {@inheritDoc} */
public Map getParameterMap() {
return parameters;
@@ -543,6 +639,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getParameterNames() {
return new MockEnumeration(parameters.keySet().iterator());
@@ -550,6 +647,7 @@
}
+ /** {@inheritDoc} */
public String[] getParameterValues(String name) {
return (String[]) parameters.get(name);
@@ -557,6 +655,7 @@
}
+ /** {@inheritDoc} */
public String getProtocol() {
throw new UnsupportedOperationException();
@@ -564,6 +663,7 @@
}
+ /** {@inheritDoc} */
public BufferedReader getReader() {
throw new UnsupportedOperationException();
@@ -571,6 +671,7 @@
}
+ /** {@inheritDoc} */
public String getRealPath(String path) {
throw new UnsupportedOperationException();
@@ -578,27 +679,34 @@
}
+ /** {@inheritDoc} */
public String getRemoteAddr() {
- // i figure testing never assumes a specific remote - so anything works
- return "1.2.3.4";
+ // i figure testing never assumes a specific remote - so anything works
+ return "1.2.3.4";
+
}
+ /** {@inheritDoc} */
public String getRemoteHost() {
- // i figure testing never assumes a specific remote - so anything works
- return "ShaleServer";
- }
+ // i figure testing never assumes a specific remote - so anything works
+ return "ShaleServer";
+
+ }
+ /** {@inheritDoc} */
public int getRemotePort() {
- // i figure testing never assumes a specific remote - so anything works
- return 46123;
+ // i figure testing never assumes a specific remote - so anything works
+ return 46123;
+
}
+ /** {@inheritDoc} */
public RequestDispatcher getRequestDispatcher(String path) {
throw new UnsupportedOperationException();
@@ -606,6 +714,7 @@
}
+ /** {@inheritDoc} */
public String getScheme() {
return ("http");
@@ -613,6 +722,7 @@
}
+ /** {@inheritDoc} */
public String getServerName() {
return ("localhost");
@@ -620,6 +730,7 @@
}
+ /** {@inheritDoc} */
public int getServerPort() {
return (8080);
@@ -627,6 +738,7 @@
}
+ /** {@inheritDoc} */
public boolean isSecure() {
return false;
@@ -634,6 +746,7 @@
}
+ /** {@inheritDoc} */
public void removeAttribute(String name) {
if (attributes.containsKey(name)) {
@@ -644,6 +757,7 @@
}
+ /** {@inheritDoc} */
public void setAttribute(String name, Object value) {
if (name == null) {
@@ -665,6 +779,7 @@
}
+ /** {@inheritDoc} */
public void setCharacterEncoding(String name) {
throw new UnsupportedOperationException();
@@ -675,6 +790,12 @@
// --------------------------------------------------------- Private Methods
+ /**
+ * Fire an attribute added event to interested listeners.
+ *
+ * @param key Attribute key whose value was added
+ * @param value The new attribute value
+ */
private void fireAttributeAdded(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
@@ -690,6 +811,12 @@
}
+ /**
+ * Fire an attribute removed event to interested listeners.
+ *
+ * @param key Attribute key whose value was removed
+ * @param value Attribute value that was removed
+ */
private void fireAttributeRemoved(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
@@ -705,6 +832,12 @@
}
+ /**
+ * Fire an attribute replaced event to interested listeners.
+ *
+ * @param key Attribute key whose value was replaced
+ * @param value The original value
+ */
private void fireAttributeReplaced(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
@@ -733,7 +866,7 @@
/**
* Return a properly formatted String version of the specified
- * date/time, formatted as required by the HTTP specification
+ * date/time, formatted as required by the HTTP specification.
*
* @param date Date/time, expressed as milliseconds since the epoch
*/
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpServletResponse.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpServletResponse.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpServletResponse.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpServletResponse.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2006 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -131,6 +131,7 @@
// -------------------------------------------- HttpServletResponse Methods
+ /** {@inheritDoc} */
public void addCookie(Cookie cookie) {
throw new UnsupportedOperationException();
@@ -138,6 +139,7 @@
}
+ /** {@inheritDoc} */
public void addDateHeader(String name, long value) {
headers.add(name + ": " + formatDate(value));
@@ -145,6 +147,7 @@
}
+ /** {@inheritDoc} */
public void addHeader(String name, String value) {
headers.add(name + ": " + value);
@@ -152,6 +155,7 @@
}
+ /** {@inheritDoc} */
public void addIntHeader(String name, int value) {
headers.add(name + ": " + value);
@@ -159,6 +163,7 @@
}
+ /** {@inheritDoc} */
public boolean containsHeader(String name) {
return getHeader(name) != null;
@@ -166,6 +171,7 @@
}
+ /** {@inheritDoc} */
public String encodeRedirectUrl(String url) {
return encodeRedirectURL(url);
@@ -173,6 +179,7 @@
}
+ /** {@inheritDoc} */
public String encodeRedirectURL(String url) {
return url;
@@ -180,6 +187,7 @@
}
+ /** {@inheritDoc} */
public String encodeUrl(String url) {
return encodeURL(url);
@@ -187,6 +195,7 @@
}
+ /** {@inheritDoc} */
public String encodeURL(String url) {
return url;
@@ -194,6 +203,7 @@
}
+ /** {@inheritDoc} */
public void sendError(int status) {
this.status = status;
@@ -201,6 +211,7 @@
}
+ /** {@inheritDoc} */
public void sendError(int status, String message) {
this.status = status;
@@ -209,6 +220,7 @@
}
+ /** {@inheritDoc} */
public void sendRedirect(String location) {
this.status = HttpServletResponse.SC_MOVED_TEMPORARILY;
@@ -217,6 +229,7 @@
}
+ /** {@inheritDoc} */
public void setDateHeader(String name, long value) {
removeHeader(name);
@@ -225,6 +238,7 @@
}
+ /** {@inheritDoc} */
public void setHeader(String name, String value) {
removeHeader(name);
@@ -233,6 +247,7 @@
}
+ /** {@inheritDoc} */
public void setIntHeader(String name, int value) {
removeHeader(name);
@@ -241,6 +256,7 @@
}
+ /** {@inheritDoc} */
public void setStatus(int status) {
throw new UnsupportedOperationException();
@@ -248,6 +264,7 @@
}
+ /** {@inheritDoc} */
public void setStatus(int status, String message) {
throw new UnsupportedOperationException();
@@ -258,6 +275,7 @@
// ------------------------------------------------ ServletResponse Methods
+ /** {@inheritDoc} */
public void flushBuffer() {
throw new UnsupportedOperationException();
@@ -265,6 +283,7 @@
}
+ /** {@inheritDoc} */
public int getBufferSize() {
throw new UnsupportedOperationException();
@@ -272,6 +291,7 @@
}
+ /** {@inheritDoc} */
public String getCharacterEncoding() {
return this.encoding;
@@ -279,6 +299,7 @@
}
+ /** {@inheritDoc} */
public String getContentType() {
return this.contentType;
@@ -286,6 +307,7 @@
}
+ /** {@inheritDoc} */
public Locale getLocale() {
throw new UnsupportedOperationException();
@@ -293,6 +315,7 @@
}
+ /** {@inheritDoc} */
public ServletOutputStream getOutputStream() throws IOException {
if (stream == null) {
@@ -306,6 +329,7 @@
}
+ /** {@inheritDoc} */
public PrintWriter getWriter() throws IOException {
if (writer == null) {
@@ -314,11 +338,12 @@
}
writer = new MockPrintWriter(new CharArrayWriter());
}
- return writer;
+ return writer;
}
+ /** {@inheritDoc} */
public boolean isCommitted() {
throw new UnsupportedOperationException();
@@ -326,6 +351,7 @@
}
+ /** {@inheritDoc} */
public void reset() {
throw new UnsupportedOperationException();
@@ -333,6 +359,7 @@
}
+ /** {@inheritDoc} */
public void resetBuffer() {
throw new UnsupportedOperationException();
@@ -340,6 +367,7 @@
}
+ /** {@inheritDoc} */
public void setBufferSize(int size) {
throw new UnsupportedOperationException();
@@ -347,6 +375,7 @@
}
+ /** {@inheritDoc} */
public void setCharacterEncoding(String charset) {
this.encoding = charset;
@@ -354,6 +383,7 @@
}
+ /** {@inheritDoc} */
public void setContentLength(int length) {
throw new UnsupportedOperationException();
@@ -361,6 +391,7 @@
}
+ /** {@inheritDoc} */
public void setContentType(String type) {
contentType = type;
@@ -368,6 +399,7 @@
}
+ /** {@inheritDoc} */
public void setLocale(Locale locale) {
throw new UnsupportedOperationException();
@@ -391,7 +423,7 @@
/**
* Return a properly formatted String version of the specified
- * date/time, formatted as required by the HTTP specification
+ * date/time, formatted as required by the HTTP specification.
*
* @param date Date/time, expressed as milliseconds since the epoch
*/
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpSession.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpSession.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpSession.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockHttpSession.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,6 +40,9 @@
// ------------------------------------------------------------ Constructors
+ /**
+ * Configure a default instance.
+ */
public MockHttpSession() {
super();
@@ -47,6 +50,12 @@
}
+ /**
+ * Configure a session instance associated with the specified
+ * servlet context.
+ *
+ * @param servletContext The associated servlet context
+ */
public MockHttpSession(ServletContext servletContext) {
super();
@@ -61,19 +70,19 @@
/**
* Add a new listener instance that should be notified about
* attribute changes.
+ *
+ * @param listener The new listener to be added
*/
public void addAttributeListener(HttpSessionAttributeListener listener) {
attributeListeners.add(listener);
}
- public ServletContext getServletContext() {
-
- return this.servletContext;
-
- }
-
-
+ /**
+ * Set the ServletContext associated with this session.
+ *
+ * @param servletContext The associated servlet context
+ */
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
@@ -93,6 +102,11 @@
// ---------------------------------------------------------- Public Methods
+ /**
+ * Set the session identifier of this session.
+ *
+ * @param id The new session identifier
+ */
public void setId(String id) {
this.id = id;
}
@@ -101,6 +115,7 @@
// ----------------------------------------------------- HttpSession Methods
+ /** {@inheritDoc} */
public Object getAttribute(String name) {
return attributes.get(name);
@@ -108,6 +123,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getAttributeNames() {
return new MockEnumeration(attributes.keySet().iterator());
@@ -115,6 +131,7 @@
}
+ /** {@inheritDoc} */
public long getCreationTime() {
throw new UnsupportedOperationException();
@@ -122,6 +139,7 @@
}
+ /** {@inheritDoc} */
public String getId() {
return this.id;
@@ -129,6 +147,7 @@
}
+ /** {@inheritDoc} */
public long getLastAccessedTime() {
throw new UnsupportedOperationException();
@@ -136,6 +155,7 @@
}
+ /** {@inheritDoc} */
public int getMaxInactiveInterval() {
throw new UnsupportedOperationException();
@@ -143,6 +163,15 @@
}
+ /** {@inheritDoc} */
+ public ServletContext getServletContext() {
+
+ return this.servletContext;
+
+ }
+
+
+ /** {@inheritDoc} */
public HttpSessionContext getSessionContext() {
throw new UnsupportedOperationException();
@@ -150,6 +179,7 @@
}
+ /** {@inheritDoc} */
public Object getValue(String name) {
throw new UnsupportedOperationException();
@@ -157,6 +187,7 @@
}
+ /** {@inheritDoc} */
public String[] getValueNames() {
throw new UnsupportedOperationException();
@@ -164,6 +195,7 @@
}
+ /** {@inheritDoc} */
public void invalidate() {
throw new UnsupportedOperationException();
@@ -171,6 +203,7 @@
}
+ /** {@inheritDoc} */
public boolean isNew() {
throw new UnsupportedOperationException();
@@ -178,13 +211,15 @@
}
+ /** {@inheritDoc} */
public void putValue(String name, Object value) {
throw new UnsupportedOperationException();
-
+
}
+ /** {@inheritDoc} */
public void removeAttribute(String name) {
if (attributes.containsKey(name)) {
@@ -195,6 +230,7 @@
}
+ /** {@inheritDoc} */
public void removeValue(String name) {
throw new UnsupportedOperationException();
@@ -202,6 +238,7 @@
}
+ /** {@inheritDoc} */
public void setAttribute(String name, Object value) {
if (name == null) {
@@ -223,6 +260,7 @@
}
+ /** {@inheritDoc} */
public void setMaxInactiveInterval(int interval) {
throw new UnsupportedOperationException();
@@ -233,6 +271,12 @@
// --------------------------------------------------------- Support Methods
+ /**
+ * Fire an attribute added event to interested listeners.
+ *
+ * @param key Attribute whose value was added
+ * @param value The new value
+ */
private void fireAttributeAdded(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
@@ -248,6 +292,12 @@
}
+ /**
+ * Fire an attribute removed event to interested listeners.
+ *
+ * @param key Attribute whose value was removed
+ * @param value The removed value
+ */
private void fireAttributeRemoved(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
@@ -263,6 +313,12 @@
}
+ /**
+ * Fire an attribute replaced event to interested listeners.
+ *
+ * @param key Attribute whose value was replaced
+ * @param value The original value
+ */
private void fireAttributeReplaced(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockLifecycle.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockLifecycle.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockLifecycle.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockLifecycle.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,12 +38,16 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * List of event listeners for this instance.
+ */
private List listeners = new ArrayList();
// ------------------------------------------------------- Lifecycle Methods
+ /** {@inheritDoc} */
public void addPhaseListener(PhaseListener listener) {
listeners.add(listener);
@@ -51,6 +55,7 @@
}
+ /** {@inheritDoc} */
public void execute(FacesContext context) throws FacesException {
throw new UnsupportedOperationException();
@@ -58,6 +63,7 @@
}
+ /** {@inheritDoc} */
public PhaseListener[] getPhaseListeners() {
return (PhaseListener[]) listeners.toArray(new PhaseListener[listeners.size()]);
@@ -65,6 +71,7 @@
}
+ /** {@inheritDoc} */
public void removePhaseListener(PhaseListener listener) {
listeners.remove(listener);
@@ -72,6 +79,7 @@
}
+ /** {@inheritDoc} */
public void render(FacesContext context) throws FacesException {
throw new UnsupportedOperationException();
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockLifecycleFactory.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockLifecycleFactory.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockLifecycleFactory.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockLifecycleFactory.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,12 +52,16 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * The set of Lifecycle instances registered with us.
+ */
private Map lifecycles = null;
// ------------------------------------------------ LifecycleFactory Methods
+ /** {@inheritDoc} */
public void addLifecycle(String lifecycleId, Lifecycle lifecycle) {
lifecycles.put(lifecycleId, lifecycle);
@@ -65,18 +69,20 @@
}
+ /** {@inheritDoc} */
public Lifecycle getLifecycle(String lifecycleId) {
- return (Lifecycle) lifecycles.get(lifecycleId);
+ return (Lifecycle) lifecycles.get(lifecycleId);
}
+ /** {@inheritDoc} */
public Iterator getLifecycleIds() {
return lifecycles.keySet().iterator();
}
-
+
}
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockMethodBinding.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockMethodBinding.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockMethodBinding.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockMethodBinding.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -45,18 +45,28 @@
// ------------------------------------------------------------ Constructors
+ /**
+ * Construct a default instance.
+ */
public MockMethodBinding() {
}
+ /**
+ * Construct a configured instance.
+ *
+ * @param application Application instance for this application
+ * @param ref Method binding expression to be parsed
+ * @param args Signature of this method
+ */
public MockMethodBinding(Application application, String ref,
- Class args[]) {
+ Class[] args) {
- this.application = application;
+ this.application = application;
this.args = args;
- if (ref.startsWith("#{") && ref.endsWith("}")) {
- ref = ref.substring(2, ref.length() - 1);
- }
+ if (ref.startsWith("#{") && ref.endsWith("}")) {
+ ref = ref.substring(2, ref.length() - 1);
+ }
this.ref = ref;
int period = ref.lastIndexOf(".");
if (period < 0) {
@@ -84,7 +94,8 @@
// --------------------------------------------------- MethodBinding Methods
- public Object invoke(FacesContext context, Object params[])
+ /** {@inheritDoc} */
+ public Object invoke(FacesContext context, Object[] params)
throws EvaluationException, MethodNotFoundException {
if (context == null) {
@@ -92,8 +103,8 @@
}
Object base = vb.getValue(context);
if (base == null) {
- throw new EvaluationException("Cannot find object via expression \"" +
- vb.getExpressionString() + "\"");
+ throw new EvaluationException("Cannot find object via expression \""
+ + vb.getExpressionString() + "\"");
}
Method method = method(base);
try {
@@ -107,6 +118,7 @@
}
+ /** {@inheritDoc} */
public Class getType(FacesContext context) {
Object base = vb.getValue(context);
@@ -120,85 +132,106 @@
}
+ /** {@inheritDoc} */
public String getExpressionString() {
- return "#{" + ref + "}";
+ return "#{" + ref + "}";
}
// ----------------------------------------------------- StateHolder Methods
+ /** {@inheritDoc} */
public Object saveState(FacesContext context) {
- Object values[] = new Object[4];
- values[0] = name;
- values[1] = ref;
- values[2] = UIComponentBase.saveAttachedState(context, vb);
- values[3] = args;
- return (values);
+ Object values[] = new Object[4];
+ values[0] = name;
+ values[1] = ref;
+ values[2] = UIComponentBase.saveAttachedState(context, vb);
+ values[3] = args;
+ return (values);
}
+ /** {@inheritDoc} */
public void restoreState(FacesContext context, Object state) {
- Object values[] = (Object[]) state;
- name = (String) values[0];
- ref = (String) values[1];
- vb = (ValueBinding) UIComponentBase.restoreAttachedState(context,
- values[2]);
- args = (Class []) values[3];
+ Object values[] = (Object[]) state;
+ name = (String) values[0];
+ ref = (String) values[1];
+ vb = (ValueBinding) UIComponentBase.restoreAttachedState(context,
+ values[2]);
+ args = (Class []) values[3];
}
+ /**
+ * Flag indicating this is a transient instance.
+ */
private boolean transientFlag = false;
+ /** {@inheritDoc} */
public boolean isTransient() {
- return (this.transientFlag);
+ return (this.transientFlag);
}
+ /** {@inheritDoc} */
public void setTransient(boolean transientFlag) {
- this.transientFlag = transientFlag;
+ this.transientFlag = transientFlag;
+ }
+
+ /** {@inheritDoc} */
+ public int hashCode() {
+ if (ref == null) {
+ return 0;
+ } else {
+ return ref.hashCode();
+ }
}
+ /** {@inheritDoc} */
public boolean equals(Object otherObj) {
- MockMethodBinding other = null;
+ MockMethodBinding other = null;
- if (!(otherObj instanceof MockMethodBinding)) {
- return false;
- }
- other = (MockMethodBinding) otherObj;
- // test object reference equality
- if (this.ref != other.ref) {
- // test object equality
- if (null != this.ref && null != other.ref) {
- if (!this.ref.equals(other.ref)) {
- return false;
- }
- }
- return false;
- }
- // no need to test name, since it flows from ref.
- // test our args array
- if (this.args != other.args) {
- if (this.args.length != other.args.length) {
- return false;
- }
- for (int i = 0, len = this.args.length; i < len; i++) {
- if (this.args[i] != other.args[i]) {
- if (!this.ref.equals(other.ref)) {
- return false;
- }
-
- }
- }
- }
- return true;
+ if (!(otherObj instanceof MockMethodBinding)) {
+ return false;
+ }
+ other = (MockMethodBinding) otherObj;
+ // test object reference equality
+ if (this.ref != other.ref) {
+ // test object equality
+ if (null != this.ref && null != other.ref) {
+ if (!this.ref.equals(other.ref)) {
+ return false;
+ }
+ }
+ return false;
+ }
+ // no need to test name, since it flows from ref.
+ // test our args array
+ if (this.args != other.args) {
+ if (this.args.length != other.args.length) {
+ return false;
+ }
+ for (int i = 0, len = this.args.length; i < len; i++) {
+ if (this.args[i] != other.args[i]) {
+ if (!this.ref.equals(other.ref)) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
}
// --------------------------------------------------------- Private Methods
- // Package private so that unit tests can call this
+ /**
+ * Return the Method
to be called.
+ *
+ * @param base Base object from which to extract the method reference
+ */
Method method(Object base) {
Class clazz = base.getClass();
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockNavigationHandler.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockNavigationHandler.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockNavigationHandler.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockNavigationHandler.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@
*/
public class MockNavigationHandler extends NavigationHandler {
-
+
// ------------------------------------------------------------ Constructors
@@ -40,13 +40,16 @@
*/
public MockNavigationHandler() {
}
-
+
// ----------------------------------------------------- Mock Object Methods
/**
* Add a outcome-viewId pair to the destinations map.
+ *
+ * @param outcome Logical outcome string
+ * @param viewId Destination view identifier
*/
public void addDestination(String outcome, String viewId) {
@@ -66,7 +69,7 @@
// ----------------------------------------------- NavigationHandler Methods
-
+
/**
* Process the specified navigation request.
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPrincipal.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPrincipal.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPrincipal.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPrincipal.java Wed Jul 5 11:01:09 2006
@@ -22,16 +22,24 @@
* Mock implementation of Principal
.
*/
public class MockPrincipal implements Principal {
-
+
// ------------------------------------------------------------ Constructors
+ /**
+ * Construct a default Principal instance.
+ */
public MockPrincipal() {
this(null);
}
+ /**
+ * Construct a Principal with the specified name.
+ *
+ * @param name Name for this Principal
+ */
public MockPrincipal(String name) {
this.name = name;
}
@@ -40,13 +48,20 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * The name for this Principal intance.
+ */
private String name = null;
// ----------------------------------------------------- Mock Object Methods
-
+ /**
+ * Set the name for this Principal.
+ *
+ * @param name The new name
+ */
public void setName(String name) {
this.name = name;
}
@@ -55,6 +70,7 @@
// ------------------------------------------------------- Principal Methods
+ /** {@inheritDoc} */
public String getName() {
return this.name;
}
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPrintWriter.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPrintWriter.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPrintWriter.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPrintWriter.java Wed Jul 5 11:01:09 2006
@@ -1,13 +1,12 @@
/*
- *
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -76,6 +75,9 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * The writer we will use for buffering.
+ */
private CharArrayWriter caw = null;
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPropertyResolver.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPropertyResolver.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPropertyResolver.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockPropertyResolver.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,7 +16,6 @@
package org.apache.shale.test.mock;
-import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
@@ -54,13 +53,14 @@
// ------------------------------------------------ PropertyResolver Methods
+ /** {@inheritDoc} */
public Object getValue(Object base, Object property)
throws EvaluationException, PropertyNotFoundException {
if (base == null) {
throw new NullPointerException();
}
- String name = property.toString();
+ String name = property.toString();
try {
if (base instanceof Map) {
Map map = (Map) base;
@@ -83,6 +83,7 @@
}
+ /** {@inheritDoc} */
public Object getValue(Object base, int index)
throws PropertyNotFoundException {
@@ -91,13 +92,14 @@
}
+ /** {@inheritDoc} */
public void setValue(Object base, Object property, Object value)
throws PropertyNotFoundException {
if (base == null) {
throw new NullPointerException();
}
- String name = property.toString();
+ String name = property.toString();
try {
if (base instanceof Map) {
((Map) base).put(name, value);
@@ -115,6 +117,7 @@
}
+ /** {@inheritDoc} */
public void setValue(Object base, int index, Object value)
throws PropertyNotFoundException {
@@ -123,18 +126,20 @@
}
+ /** {@inheritDoc} */
public boolean isReadOnly(Object base, Object property)
throws PropertyNotFoundException {
if (base == null) {
throw new NullPointerException();
}
- String name = property.toString();
+ String name = property.toString();
return !PropertyUtils.isWriteable(base, name);
}
+ /** {@inheritDoc} */
public boolean isReadOnly(Object base, int index)
throws PropertyNotFoundException {
@@ -143,13 +148,14 @@
}
+ /** {@inheritDoc} */
public Class getType(Object base, Object property)
throws PropertyNotFoundException {
if (base == null) {
throw new NullPointerException();
}
- String name = property.toString();
+ String name = property.toString();
try {
return PropertyUtils.getPropertyType(base, name);
} catch (IllegalAccessException e) {
@@ -163,6 +169,7 @@
}
+ /** {@inheritDoc} */
public Class getType(Object base, int index)
throws PropertyNotFoundException {
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRenderKit.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRenderKit.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRenderKit.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRenderKit.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -53,12 +53,16 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * The set of renderers registered here.
+ */
private Map renderers = new HashMap();
// ------------------------------------------------------- RenderKit Methods
+ /** {@inheritDoc} */
public void addRenderer(String family, String rendererType,
Renderer renderer) {
@@ -70,6 +74,7 @@
}
+ /** {@inheritDoc} */
public Renderer getRenderer(String family, String rendererType) {
if ((family == null) || (rendererType == null)) {
@@ -80,15 +85,17 @@
}
+ /** {@inheritDoc} */
public ResponseWriter createResponseWriter(Writer writer,
- String contentTypeList,
- String characterEncoding) {
+ String contentTypeList,
+ String characterEncoding) {
return new MockResponseWriter(writer, contentTypeList, characterEncoding);
}
+ /** {@inheritDoc} */
public ResponseStream createResponseStream(OutputStream out) {
final OutputStream stream = out;
@@ -102,11 +109,11 @@
stream.flush();
}
- public void write(byte b[]) throws IOException {
+ public void write(byte[] b) throws IOException {
stream.write(b);
}
- public void write(byte b[], int off, int len) throws IOException {
+ public void write(byte[] b, int off, int len) throws IOException {
stream.write(b, off, len);
}
@@ -120,6 +127,7 @@
}
+ /** {@inheritDoc} */
public ResponseStateManager getResponseStateManager() {
throw new UnsupportedOperationException();
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRenderKitFactory.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRenderKitFactory.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRenderKitFactory.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRenderKitFactory.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,7 +40,7 @@
* Return a default instance.
*/
public MockRenderKitFactory() {
-
+
renderKits = new HashMap();
}
@@ -52,12 +52,16 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * The set of render kits that have been registered here.
+ */
private Map renderKits = new HashMap();
// ------------------------------------------------ RenderKitFactory Methods
+ /** {@inheritDoc} */
public void addRenderKit(String renderKitId, RenderKit renderKit) {
if ((renderKitId == null) || (renderKit == null)) {
@@ -71,6 +75,7 @@
}
+ /** {@inheritDoc} */
public RenderKit getRenderKit(FacesContext context, String renderKitId) {
if (renderKitId == null) {
@@ -97,6 +102,7 @@
}
+ /** {@inheritDoc} */
public Iterator getRenderKitIds() {
return renderKits.keySet().iterator();
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRequestMap.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRequestMap.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRequestMap.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockRequestMap.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,6 +40,12 @@
// ------------------------------------------------------------ Constructors
+ /**
+ * Construct a new instance, exposing the attributes of the
+ * specified request as a map.
+ *
+ * @param request The HttpServletRequest to wrap
+ */
public MockRequestMap(HttpServletRequest request) {
this.request = request;
@@ -53,12 +59,17 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * The HttpServletRequest whose attributes we are exposing
+ * as a Map.
+ */
private HttpServletRequest request = null;
-
+
// ------------------------------------------------------------- Map Methods
+ /** {@inheritDoc} */
public void clear() {
Iterator keys = keySet().iterator();
@@ -69,6 +80,7 @@
}
+ /** {@inheritDoc} */
public boolean containsKey(Object key) {
return request.getAttribute(key(key)) != null;
@@ -76,6 +88,7 @@
}
+ /** {@inheritDoc} */
public boolean containsValue(Object value) {
if (value == null) {
@@ -93,6 +106,7 @@
}
+ /** {@inheritDoc} */
public Set entrySet() {
Set set = new HashSet();
@@ -105,6 +119,7 @@
}
+ /** {@inheritDoc} */
public boolean equals(Object o) {
return request.equals(o);
@@ -112,6 +127,7 @@
}
+ /** {@inheritDoc} */
public Object get(Object key) {
return request.getAttribute(key(key));
@@ -119,6 +135,7 @@
}
+ /** {@inheritDoc} */
public int hashCode() {
return request.hashCode();
@@ -126,6 +143,7 @@
}
+ /** {@inheritDoc} */
public boolean isEmpty() {
return size() < 1;
@@ -133,6 +151,7 @@
}
+ /** {@inheritDoc} */
public Set keySet() {
Set set = new HashSet();
@@ -145,6 +164,7 @@
}
+ /** {@inheritDoc} */
public Object put(Object key, Object value) {
if (value == null) {
@@ -158,6 +178,7 @@
}
+ /** {@inheritDoc} */
public void putAll(Map map) {
Iterator keys = map.keySet().iterator();
@@ -169,6 +190,7 @@
}
+ /** {@inheritDoc} */
public Object remove(Object key) {
String skey = key(key);
@@ -179,6 +201,7 @@
}
+ /** {@inheritDoc} */
public int size() {
int n = 0;
@@ -192,6 +215,7 @@
}
+ /** {@inheritDoc} */
public Collection values() {
List list = new ArrayList();
@@ -207,6 +231,11 @@
// --------------------------------------------------------- Private Methods
+ /**
+ * Return the specified key converted to a string.
+ *
+ * @param key The key to convert
+ */
private String key(Object key) {
if (key == null) {
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockResponseWriter.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockResponseWriter.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockResponseWriter.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockResponseWriter.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2005-2006 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,14 +22,21 @@
import javax.faces.context.ResponseWriter;
/**
- * Mock implementation of javax.faces.context.ResponseWriter.
+ * Mock implementation of javax.faces.context.ResponseWriter
.
*/
public class MockResponseWriter extends ResponseWriter {
-
+
// ------------------------------------------------------------ Constructors
+ /**
+ * Construct an instance wrapping the specified writer.
+ *
+ * @param writer Writer we are wrapping
+ * @param contentType Content type to be created
+ * @param characterEncoding Character encoding of this response
+ */
public MockResponseWriter(Writer writer, String contentType, String characterEncoding) {
this.writer = writer;
this.contentType = contentType;
@@ -49,6 +56,9 @@
// ----------------------------------------------------- Mock Object Methods
+ /**
+ * Return the Writer
that we are wrapping.
+ */
public Writer getWriter() {
return this.writer;
}
@@ -57,17 +67,20 @@
// -------------------------------------------------- ResponseWriter Methods
+ /** {@inheritDoc} */
public ResponseWriter cloneWithWriter(Writer writer) {
return new MockResponseWriter(writer, contentType, characterEncoding);
}
+ /** {@inheritDoc} */
public void endDocument() throws IOException {
finish();
writer.flush();
}
+ /** {@inheritDoc} */
public void endElement(String name) throws IOException {
if (open) {
writer.write("/");
@@ -80,26 +93,31 @@
}
+ /** {@inheritDoc} */
public String getCharacterEncoding() {
return this.characterEncoding;
}
+ /** {@inheritDoc} */
public String getContentType() {
return this.contentType;
}
+ /** {@inheritDoc} */
public void flush() throws IOException {
finish();
}
+ /** {@inheritDoc} */
public void startDocument() throws IOException {
- ; // Do nothing
+ // Do nothing
}
+ /** {@inheritDoc} */
public void startElement(String name, UIComponent component) throws IOException {
if (name == null) {
throw new NullPointerException();
@@ -111,6 +129,7 @@
}
+ /** {@inheritDoc} */
public void writeAttribute(String name, Object value, String property) throws IOException {
if ((name == null) || (value == null)) {
throw new NullPointerException();
@@ -130,6 +149,7 @@
}
+ /** {@inheritDoc} */
public void writeComment(Object comment) throws IOException {
if (comment == null) {
throw new NullPointerException();
@@ -145,6 +165,7 @@
}
+ /** {@inheritDoc} */
public void writeText(Object text, String property) throws IOException {
if (text == null) {
throw new NullPointerException();
@@ -158,7 +179,8 @@
}
- public void writeText(char text[], int off, int len) throws IOException {
+ /** {@inheritDoc} */
+ public void writeText(char[] text, int off, int len) throws IOException {
if (text == null) {
throw new NullPointerException();
}
@@ -170,6 +192,7 @@
}
+ /** {@inheritDoc} */
public void writeURIAttribute(String name, Object value, String property) throws IOException {
if ((name == null) || (value == null)) {
throw new NullPointerException();
@@ -192,13 +215,15 @@
// ---------------------------------------------------------- Writer Methods
+ /** {@inheritDoc} */
public void close() throws IOException {
finish();
writer.close();
}
- public void write(char cbuf[], int off, int len) throws IOException {
+ /** {@inheritDoc} */
+ public void write(char[] cbuf, int off, int len) throws IOException {
finish();
writer.write(cbuf, off, len);
}
@@ -211,6 +236,8 @@
* Write the specified character, filtering if necessary.
*
* @param ch Character to be written
+ *
+ * @exception IOException if an input/output error occurs
*/
private void character(char ch) throws IOException {
@@ -262,6 +289,8 @@
*
* @param writer Writer we are writing to
* @param ch Character to be translated and appended
+ *
+ * @exception IOException if an input/output error occurs
*/
private void numeric(Writer writer, char ch) throws IOException {
@@ -279,8 +308,10 @@
* @param text Character array containing text to be written
* @param off Starting offset (zero relative)
* @param len Number of characters to be written
+ *
+ * @exception IOException if an input/output error occurs
*/
- private void string(char text[], int off, int len) throws IOException {
+ private void string(char[] text, int off, int len) throws IOException {
// Process the specified characters
for (int i = off; i < (off + len); i++) {
@@ -295,6 +326,8 @@
* replacement of characters by corresponding entities).
*
* @param s String to be filtered and written
+ *
+ * @exception IOException if an input/output error occurs
*/
private void string(String s) throws IOException {
@@ -311,11 +344,7 @@
*/
private boolean substitution() {
- if ("UTF-8".equals(characterEncoding) || "UTF-16".equals(characterEncoding)) {
- return false;
- } else {
- return true;
- }
+ return !("UTF-8".equals(characterEncoding) || "UTF-16".equals(characterEncoding));
}
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServlet.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServlet.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServlet.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServlet.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,10 +36,18 @@
// ------------------------------------------------------------ Constructors
+ /**
+ * Create a default Servlet instance.
+ */
public MockServlet() {
}
+ /**
+ * Create a new Servlet with the specified ServletConfig.
+ *
+ * @param config The new ServletConfig instance
+ */
public MockServlet(ServletConfig config) throws ServletException {
init(config);
}
@@ -48,6 +56,11 @@
// ----------------------------------------------------- Mock Object Methods
+ /**
+ * Set the ServletConfig
instance for this servlet.
+ *
+ * @param config The new ServletConfig instance
+ */
public void setServletConfig(ServletConfig config) {
this.config = config;
@@ -58,16 +71,21 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * The ServletConfig
instance for this servlet.
+ */
private ServletConfig config;
// --------------------------------------------------------- Servlet Methods
+ /** {@inheritDoc} */
public void destroy() {
}
+ /** {@inheritDoc} */
public ServletConfig getServletConfig() {
return this.config;
@@ -75,6 +93,7 @@
}
+ /** {@inheritDoc} */
public String getServletInfo() {
return "MockServlet";
@@ -82,6 +101,7 @@
}
+ /** {@inheritDoc} */
public void init(ServletConfig config) throws ServletException {
this.config = config;
@@ -89,11 +109,11 @@
}
-
+ /** {@inheritDoc} */
public void service(ServletRequest request, ServletResponse response)
throws IOException, ServletException {
- ; // Do nothing by default
+ // Do nothing by default
}
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletConfig.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletConfig.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletConfig.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletConfig.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,10 +34,19 @@
// ------------------------------------------------------------ Constructors
+ /**
+ * Construct a default instance.
+ */
public MockServletConfig() {
}
+ /**
+ * Construct an instance associated with the specified
+ * servlet context.
+ *
+ * @param context The associated ServletContext
+ */
public MockServletConfig(ServletContext context) {
setServletContext(context);
}
@@ -46,6 +55,12 @@
// ----------------------------------------------------- Mock Object Methods
+ /**
+ * Add a servlet initialization parameter.
+ *
+ * @param name Parameter name
+ * @param value Parameter value
+ */
public void addInitParameter(String name, String value) {
parameters.put(name, value);
@@ -53,6 +68,11 @@
}
+ /**
+ * Set the servlet context for this application.
+ *
+ * @param context The new servlet context
+ */
public void setServletContext(ServletContext context) {
this.context = context;
@@ -70,6 +90,7 @@
// --------------------------------------------------- ServletConfig Methods
+ /** {@inheritDoc} */
public String getInitParameter(String name) {
return (String) parameters.get(name);
@@ -77,6 +98,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getInitParameterNames() {
return parameters.keys();
@@ -84,6 +106,7 @@
}
+ /** {@inheritDoc} */
public ServletContext getServletContext() {
return this.context;
@@ -91,6 +114,7 @@
}
+ /** {@inheritDoc} */
public String getServletName() {
return "MockServlet";
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletContext.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletContext.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletContext.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletContext.java Wed Jul 5 11:01:09 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2004-2006 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -60,6 +60,8 @@
/**
* Add a new listener instance that should be notified about
* attribute changes.
+ *
+ * @param listener Listener to be added
*/
public void addAttributeListener(ServletContextAttributeListener listener) {
attributeListeners.add(listener);
@@ -69,6 +71,9 @@
/**
* Add a context initialization parameter to the set of
* parameters recognized by this instance.
+ *
+ * @param name Parameter name
+ * @param value Parameter value
*/
public void addInitParameter(String name, String value) {
parameters.put(name, value);
@@ -112,6 +117,7 @@
// -------------------------------------------------- ServletContext Methods
+ /** {@inheritDoc} */
public Object getAttribute(String name) {
return attributes.get(name);
@@ -119,6 +125,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getAttributeNames() {
return attributes.keys();
@@ -126,19 +133,22 @@
}
+ /** {@inheritDoc} */
public ServletContext getContext(String uripath) {
throw new UnsupportedOperationException();
}
-
+
+ /** {@inheritDoc} */
public String getContextPath() {
-
- throw new UnsupportedOperationException();
-
+
+ throw new UnsupportedOperationException();
+
}
+ /** {@inheritDoc} */
public String getInitParameter(String name) {
return (String) parameters.get(name);
@@ -146,6 +156,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getInitParameterNames() {
return parameters.keys();
@@ -153,6 +164,7 @@
}
+ /** {@inheritDoc} */
public int getMajorVersion() {
return 2;
@@ -160,6 +172,7 @@
}
+ /** {@inheritDoc} */
public String getMimeType(String path) {
int period = path.lastIndexOf('.');
@@ -172,6 +185,7 @@
}
+ /** {@inheritDoc} */
public int getMinorVersion() {
return 4;
@@ -179,6 +193,7 @@
}
+ /** {@inheritDoc} */
public RequestDispatcher getNamedDispatcher(String name) {
throw new UnsupportedOperationException();
@@ -186,12 +201,13 @@
}
+ /** {@inheritDoc} */
public String getRealPath(String path) {
if (documentRoot != null) {
if (!path.startsWith("/")) {
- throw new IllegalArgumentException("The specified path ('" +
- path + "') does not start with a '/' character");
+ throw new IllegalArgumentException("The specified path ('"
+ + path + "') does not start with a '/' character");
}
File resolved = new File(documentRoot, path.substring(1));
try {
@@ -206,6 +222,7 @@
}
+ /** {@inheritDoc} */
public RequestDispatcher getRequestDispatcher(String path) {
throw new UnsupportedOperationException();
@@ -213,12 +230,13 @@
}
+ /** {@inheritDoc} */
public URL getResource(String path) throws MalformedURLException {
if (documentRoot != null) {
if (!path.startsWith("/")) {
- throw new MalformedURLException("The specified path ('" +
- path + "') does not start with a '/' character");
+ throw new MalformedURLException("The specified path ('"
+ + path + "') does not start with a '/' character");
}
File resolved = new File(documentRoot, path.substring(1));
if (resolved.exists()) {
@@ -233,6 +251,7 @@
}
+ /** {@inheritDoc} */
public InputStream getResourceAsStream(String path) {
try {
@@ -248,6 +267,7 @@
}
+ /** {@inheritDoc} */
public Set getResourcePaths(String path) {
if (documentRoot == null) {
@@ -256,8 +276,8 @@
// Enforce the leading slash restriction
if (!path.startsWith("/")) {
- throw new IllegalArgumentException("The specified path ('" +
- path + "') does not start with a '/' character");
+ throw new IllegalArgumentException("The specified path ('"
+ + path + "') does not start with a '/' character");
}
// Locate the File node for this path's directory (if it exists)
@@ -271,7 +291,7 @@
// Construct a Set containing the paths to the contents of this directory
Set set = new HashSet();
- String files[] = node.list();
+ String[] files = node.list();
if (files == null) {
return null;
}
@@ -290,6 +310,7 @@
}
+ /** {@inheritDoc} */
public Servlet getServlet(String name) throws ServletException {
throw new UnsupportedOperationException();
@@ -297,6 +318,7 @@
}
+ /** {@inheritDoc} */
public String getServletContextName() {
return "MockServletContext";
@@ -304,6 +326,7 @@
}
+ /** {@inheritDoc} */
public String getServerInfo() {
return "MockServletContext";
@@ -311,6 +334,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getServlets() {
throw new UnsupportedOperationException();
@@ -318,6 +342,7 @@
}
+ /** {@inheritDoc} */
public Enumeration getServletNames() {
throw new UnsupportedOperationException();
@@ -325,6 +350,7 @@
}
+ /** {@inheritDoc} */
public void log(String message) {
System.out.println(message);
@@ -332,6 +358,7 @@
}
+ /** {@inheritDoc} */
public void log(Exception exception, String message) {
System.out.println(message);
@@ -340,6 +367,7 @@
}
+ /** {@inheritDoc} */
public void log(String message, Throwable exception) {
System.out.println(message);
@@ -348,6 +376,7 @@
}
+ /** {@inheritDoc} */
public void removeAttribute(String name) {
if (attributes.containsKey(name)) {
@@ -358,6 +387,7 @@
}
+ /** {@inheritDoc} */
public void setAttribute(String name, Object value) {
if (name == null) {
@@ -382,6 +412,12 @@
// --------------------------------------------------------- Private Methods
+ /**
+ * Fire an attribute added event to interested listeners.
+ *
+ * @param key Attribute whose value has been added
+ * @param value The new value
+ */
private void fireAttributeAdded(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
@@ -397,6 +433,12 @@
}
+ /**
+ * Fire an attribute removed event to interested listeners.
+ *
+ * @param key Attribute whose value has been removed
+ * @param value The value that was removed
+ */
private void fireAttributeRemoved(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
@@ -412,6 +454,12 @@
}
+ /**
+ * Fire an attribute replaced event to interested listeners.
+ *
+ * @param key Attribute whose value has been replaced
+ * @param value The original value
+ */
private void fireAttributeReplaced(String key, Object value) {
if (attributeListeners.size() < 1) {
return;
Modified: struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletOutputStream.java
URL: http://svn.apache.org/viewvc/struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletOutputStream.java?rev=419299&r1=419298&r2=419299&view=diff
==============================================================================
--- struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletOutputStream.java (original)
+++ struts/shale/trunk/shale-test/src/main/java/org/apache/shale/test/mock/MockServletOutputStream.java Wed Jul 5 11:01:09 2006
@@ -1,13 +1,12 @@
/*
- *
* Copyright 2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,6 +33,8 @@
/**
* Return a default instance.
+ *
+ * @param stream The stream we will use to buffer output
*/
public MockServletOutputStream(ByteArrayOutputStream stream) {
this.baos = stream;
@@ -72,6 +73,9 @@
// ------------------------------------------------------ Instance Variables
+ /**
+ * The internal buffer we use to capture output.
+ */
private ByteArrayOutputStream baos = null;
@@ -82,8 +86,6 @@
* Write the specified content to our internal cache.
*
* @param content Content to be written
- *
- * @exception IOException if an input/output error occurs
*/
public void write(int content) {
baos.write(content);