SeamTest handles required page parameters wrong
-----------------------------------------------
Key: JBSEAM-3131
URL:
http://jira.jboss.com/jira/browse/JBSEAM-3131
Project: Seam
Issue Type: Bug
Components: Test Harness
Reporter: Christian Bauer
<page view-id="/docEdit*">
<param name="documentId" value="#{documentHome.nodeId}"
required="true"/>
The following test simulates a typical edit screen, first a GET request to start the
conversation, then a POST request to e.g. Save the form.
@Test
public void test() throws Exception {
final String conversationId = new NonFacesRequest("/docEdit.xhtml") {
protected void beforeRequest() {
setParameter("documentId", "6");
}
}.run();
new FacesRequest("/docEdit.xhtml") {
protected void beforeRequest() {
setParameter("cid", conversationId);
}
...
This sequence works fine in the real app, but throws an error during testing:
javax.faces.validator.ValidatorException: A value is required
at org.jboss.seam.navigation.Param.addRequiredMessage(Param.java:268)
at org.jboss.seam.navigation.Param.getStringValueFromRequest(Param.java:171)
at org.jboss.seam.navigation.Pages.storeRequestStringValuesInPageContext(Pages.java:716)
at org.jboss.seam.navigation.Pages.postRestore(Pages.java:374)
at org.jboss.seam.jsf.SeamPhaseListener.postRestorePage(SeamPhaseListener.java:546)
at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:392)
at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:228)
at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
at
org.jboss.seam.mock.AbstractSeamTest$Request.restoreViewPhase(AbstractSeamTest.java:754)
at
org.jboss.seam.mock.AbstractSeamTest$Request.emulateJsfLifecycle(AbstractSeamTest.java:581)
at org.jboss.seam.mock.AbstractSeamTest$Request.access$300(AbstractSeamTest.java:175)
at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:495)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
at
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406)
at
org.jboss.seam.wiki.core.ui.WikiUrlRewriteFilter.doFilter(WikiUrlRewriteFilter.java:45)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at
org.jboss.seam.wiki.core.ui.WikiUrlSessionIdFilter.doFilter(WikiUrlSessionIdFilter.java:86)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:489)
Looks to me like the emulateJsfLifecycle routine can't really distinguish between a
GET and POST request, and so it applies the same phase listener processing for page
parameters as it would on a GET.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira