Hi I am trying to test the following flow:
In SWF 1.0.5 I was able to test the whole execution of the flow. The business methods were invoked as well as binding, validation etc.Code:<flow xmlns="..namespace removed.."> <var name="domainObject" class="domain.DomainObject"/> <view-state id="enterPropertyEj" model="domainObject"> <transition on="next" to="enterPropertyBi" /> </view-state> <view-state id="enterPropertyBi" model="domainObject" view="/WEB-INF/jsp/enterPropertyBi.jsp" > <transition on="next" to="enterPropertySi" > <evaluate expression="businessLogic.doBusinessOne(domainObject)" result="flowScope.domainObject"/> </transition> </view-state> <view-state id="enterPropertySi" model="domainObject" > <transition on="next" to="finished" > <evaluate expression="businessLogic.doBusinessTwo(domainObject)" result="flowScope.result"/> </transition> </view-state> <end-state id="finished" view="finished.jsp" /> </flow>
Here I am trying to achieve similar effect with SWF 2.0.1
DomainObject class looks like this:Code:/** * A simple test of passing through the whole flow, and mimicking * setting individual properties in subsequent states. */ public void testSimpleStartUp(){ MockExternalContext context = new MockExternalContext(); startFlow(context); assertCurrentStateEquals("enterPropertyEj"); DomainObject domainObject = (DomainObject) getRequiredFlowAttribute("domainObject"); assertNull(domainObject.getPropBi()); assertNull(domainObject.getPropEj()); assertNull(domainObject.getPropSi()); context.getMockRequestParameterMap().put("propEj", "A"); context.setEventId("next"); resumeFlow(context); assertCurrentStateEquals("enterPropertyBi"); domainObject = (DomainObject) getRequiredFlowAttribute("domainObject"); assertEquals("A", domainObject.getPropEj()); }
The test I pasted above fails. There is no binding of value provided by me inCode:public class DomainObject implements Serializable { private String propEj; private String propBi; private String propSi; /*setters, getters and the default constructor follow here*/to model object in the view state.Code:context.getMockRequestParameterMap().put("propEj", "A");
What am I doing wrong? What is the proper way of writing such tests in SWF2? The samples from the Reference Guide seem to test only the individual states, but never the whole flow. Please help
Regards
Maciek


Reply With Quote
