JSFUnit and Seam named conversation problem
blabno Oct 22, 2010 8:46 AMHi Stan!
JSFUnit is so great! I'm successfully testing my Maven+Seam+JSFUnit+Unitils app. Still using Cargo (didn't have time for arquillian yet).
Everything was working great until I've switched named conversations on. Now I get redirected to my main page and get following faces message :
The conversation ended, timed out or was processing another request
Here is my sample test (which I guess will not tell you much):
public void testCreateModel() throws Exception { JSFSession jsfSession = new JSFSession("/"); JSFServerSession server = jsfSession.getJSFServerSession() JSFClientSession client = jsfSession.getJSFClientSession(); /**Login*/ CommonSteps.login(jsfSession, "s4237@pjwstk.edu.pl", "aaaaa"); /**Enter boat model list page*/ client.click("myBoatModels"); /**Enter boat model add page*/ client.click("mLF:c"); assertTrue(client.getContentPage().getUrl().toString().endsWith("/boat/model/add")); assertEquals("/view/boat/model/edit.xhtml", server.getCurrentViewID()); /** Fill the form */ simulateFillingInEditionForm(jsfSession, "Phobos", "6", "3", "8", "1", "0", "1", "0.50", "5", "20", "150", "1", "STEERING_WHEEL", "20", "BENZINE", "1"); client.click("editModelForm:save"); JSFUnitUtils.logFacesMessages(jsfSession); }
Here is how I declare the conversation:
<conversation name="boatModel" parameter-name="boatModelId" parameter-value="#{empty boatModelHome.id ? '' : boatModelHome.id}"/>
And my edit.page.xml:
<?xml version="1.0" encoding="UTF-8"?> <page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd" login-required="true" conversation="boatModel"> <rewrite pattern="/boat/model/edit/{boatModelId}"/> <rewrite pattern="/boat/model/add/{name}"/> <rewrite pattern="/boat/model/add"/> <param name="boatModelId" value="#{boatModelHome.id}" converterId="javax.faces.Long"/> <param name="name" value="#{boatModelHome.instance.name}"/> <description> #{empty boatModelHome.instance.id ? messages['view.boat.model.edit.conversationDescription.add'] : messages['view.boat.model.edit.conversationDescription.edit']} #{empty boatModelHome.instance.id ? null : boatModelHome.instance.name} </description> <begin-conversation join="true" flush-mode="manual"/> <navigation from-action="#{boatModelHome.persist}"> <rule if-outcome="persisted"> <end-conversation before-redirect="true"/> <redirect view-id="/view/boat/model/list.xhtml"/> </rule> </navigation> <navigation from-action="cancel"> <end-conversation before-redirect="true"/> <redirect view-id="/view/boat/model/list.xhtml"/> </navigation> </page>