Package org.springframework.webflow.test
Class MockFlowSession
java.lang.Object
org.springframework.webflow.test.MockFlowSession
- All Implemented Interfaces:
FlowSession
Mock implementation of the
FlowSession
interface.- Author:
- Erwin Vervaet
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new mock flow session that sets a flow with id "mockFlow" as the 'active flow' in state "mockState".MockFlowSession
(Flow flow) Creates a new mock session in a created state for the specified flow definition.MockFlowSession
(Flow flow, AttributeMap<?> input) Creates a new mock session for the specified flow definition. -
Method Summary
Modifier and TypeMethodDescriptionReturns the flow definition backing this session.Returns the flow definition of this session.Returns the parent flow session in the current flow execution, ornull
if there is no parent flow session.getScope()
Return this session's local attributes; the basis for "flow scope" (flow session scope).getState()
Returns the current state of this flow session.Returns the current state of this session.Returns a mutable map for data held in "view scope".boolean
Returns true if the flow session was started in embedded page mode.boolean
isRoot()
Returns whether this flow session is the root flow session in the ongoing flow execution.void
setDefinition
(Flow flow) Set the flow associated with this flow session.void
setParent
(FlowSession parent) Set the parent flow session of this flow session in the ongoing flow execution.void
setScope
(MutableAttributeMap<Object> scope) Set the scope data maintained by this flow session.void
Set the currently active state.
-
Constructor Details
-
MockFlowSession
public MockFlowSession()Creates a new mock flow session that sets a flow with id "mockFlow" as the 'active flow' in state "mockState". -
MockFlowSession
Creates a new mock session in a created state for the specified flow definition. -
MockFlowSession
Creates a new mock session for the specified flow definition.- Parameters:
flow
- the flow definition for the sessioninput
- initial contents of 'flow scope'
-
-
Method Details
-
getDefinition
Description copied from interface:FlowSession
Returns the flow definition backing this session.- Specified by:
getDefinition
in interfaceFlowSession
-
getState
Description copied from interface:FlowSession
Returns the current state of this flow session. This value changes as the flow executes.- Specified by:
getState
in interfaceFlowSession
-
getScope
Description copied from interface:FlowSession
Return this session's local attributes; the basis for "flow scope" (flow session scope).- Specified by:
getScope
in interfaceFlowSession
- Returns:
- the flow scope attributes
-
getViewScope
Description copied from interface:FlowSession
Returns a mutable map for data held in "view scope". Attributes in this map are cleared out when the current view state exits.- Specified by:
getViewScope
in interfaceFlowSession
- Returns:
- view scope
- Throws:
IllegalStateException
- if this flow session is not currently in a view state
-
isEmbeddedMode
public boolean isEmbeddedMode()Description copied from interface:FlowSession
Returns true if the flow session was started in embedded page mode. An embedded flow can make different assumptions with regards to whether redirect after post is necessary.- Specified by:
isEmbeddedMode
in interfaceFlowSession
-
getParent
Description copied from interface:FlowSession
Returns the parent flow session in the current flow execution, ornull
if there is no parent flow session.- Specified by:
getParent
in interfaceFlowSession
-
isRoot
public boolean isRoot()Description copied from interface:FlowSession
Returns whether this flow session is the root flow session in the ongoing flow execution. The root flow session does not have a parent flow session.- Specified by:
isRoot
in interfaceFlowSession
-
setDefinition
Set the flow associated with this flow session. -
setState
Set the currently active state. -
setScope
Set the scope data maintained by this flow session. This will be the flow scope data of the ongoing flow execution. -
setParent
Set the parent flow session of this flow session in the ongoing flow execution. -
getDefinitionInternal
Returns the flow definition of this session. -
getStateInternal
Returns the current state of this session.
-