[seam-commits] Seam SVN: r7678 - trunk/src/main/org/jboss/seam/mock.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Sat Mar 22 21:21:04 EDT 2008
Author: matt.drees
Date: 2008-03-22 21:21:04 -0400 (Sat, 22 Mar 2008)
New Revision: 7678
Modified:
trunk/src/main/org/jboss/seam/mock/AbstractSeamTest.java
Log:
JBSEAM-2720
Modified: trunk/src/main/org/jboss/seam/mock/AbstractSeamTest.java
===================================================================
--- trunk/src/main/org/jboss/seam/mock/AbstractSeamTest.java 2008-03-22 17:03:24 UTC (rev 7677)
+++ trunk/src/main/org/jboss/seam/mock/AbstractSeamTest.java 2008-03-23 01:21:04 UTC (rev 7678)
@@ -28,7 +28,9 @@
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
import javax.servlet.http.HttpSession;
import javax.transaction.UserTransaction;
@@ -528,14 +530,32 @@
protected void init()
{
- Cookie[] cookieArray = getCookies().toArray(new Cookie[] {});
- request = new MockHttpServletRequest(session, getPrincipalName(), getPrincipalRoles(), cookieArray, isGetRequest() ? "GET" : "POST");
- response = new MockHttpServletResponse();
+ request = createRequest();
+ response = createResponse();
externalContext = new MockExternalContext(servletContext, request, response);
facesContext = new MockFacesContext(externalContext, application);
facesContext.setCurrent();
}
+ /**
+ * Override if you wish to customize the HttpServletRequest used in this request.
+ * You may find {@link HttpServletRequestWrapper} useful.
+ */
+ protected HttpServletRequest createRequest()
+ {
+ Cookie[] cookieArray = getCookies().toArray(new Cookie[] {});
+ return new MockHttpServletRequest(session, getPrincipalName(), getPrincipalRoles(), cookieArray, isGetRequest() ? "GET" : "POST");
+ }
+
+ /**
+ * Override if you wish to customize the HttpServletResponse used in this request.
+ * You may find {@link HttpServletResponseWrapper} useful.
+ */
+ protected HttpServletResponse createResponse()
+ {
+ return new MockHttpServletResponse();
+ }
+
private void setStandardJspVariables()
{
// TODO: looks like we should also set request, session, application,
More information about the seam-commits
mailing list