public class MockRequestControlContext extends MockRequestContext implements RequestControlContext
RequestControlContext
interface to facilitate standalone Flow and State unit
tests.RequestContext
,
FlowSession
,
State
Constructor and Description |
---|
MockRequestControlContext()
Creates a new mock request control context.
|
MockRequestControlContext(Flow flow)
Creates a new mock request control context for controlling a mock execution of the provided flow definition.
|
MockRequestControlContext(FlowExecutionContext flowExecutionContext)
Creates a new mock request control context for controlling a flow execution.
|
Modifier and Type | Method and Description |
---|---|
FlowExecutionKey |
assignFlowExecutionKey()
Assign the ongoing flow execution its flow execution key.
|
void |
endActiveFlowSession(java.lang.String outcome,
MutableAttributeMap<java.lang.Object> output)
End the active flow session of the current flow execution.
|
boolean |
execute(Transition transition)
Execute this transition out of the current source state.
|
boolean |
getEmbeddedMode()
Returns true if the flow current flow execution was launched in embedded page mode.
|
boolean |
getRedirectInSameState()
Returns the value of the 'redirect in same state' flow execution attribute if set or otherwise it falls back on
the value returned by
RequestControlContext.getRedirectOnPause() . |
boolean |
getRedirectOnPause()
Returns true if the 'redirect on pause' flow execution attribute is set to true, false otherwise.
|
boolean |
handleEvent(Event event)
Signals the occurrence of an event in the current state of this flow execution request context.
|
void |
removeAllFlowExecutionSnapshots()
Remove all flow execution snapshots associated with the ongoing conversation.
|
void |
removeCurrentFlowExecutionSnapshot()
Remove the current flow execution snapshot to invalidate the current state.
|
void |
setAlwaysRedirectOnPause(boolean alwaysRedirectOnPause) |
void |
setCurrentState(State state)
Record the current state that has entered in the executing flow.
|
void |
setEmbeddedMode() |
void |
setRedirectInSameState(boolean redirectInSameState) |
void |
start(Flow flow,
MutableAttributeMap<?> input)
Spawn a new flow session and activate it in the currently executing flow.
|
void |
updateCurrentFlowExecutionSnapshot()
Update the current flow execution snapshot to save the current state.
|
void |
viewRendered(View view)
Called when the current view has completed rendering in the current view state.
|
void |
viewRendering(View view)
Called when the current view is about to be rendered in the current view state.
|
getActiveFlow, getAttributeMap, getAttributes, getConversationScope, getCurrentEvent, getCurrentState, getCurrentTransition, getCurrentView, getExternalContext, getFlashScope, getFlowExecutionContext, getFlowExecutionUrl, getFlowScope, getMatchingTransition, getMessageContext, getMockExternalContext, getMockFlowExecutionContext, getRequestParameters, getRequestScope, getRootFlow, getViewScope, inViewState, putRequestParameter, putRequestParameter, putRequestParameter, putRequestParameter, removeAttribute, sendFlowExecutionRedirect, setActiveSession, setAttribute, setCurrentEvent, setCurrentTransition, setCurrentView, setExternalContext, setFlowExecutionContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setCurrentTransition, setCurrentView
getActiveFlow, getAttributes, getConversationScope, getCurrentEvent, getCurrentState, getCurrentTransition, getCurrentView, getExternalContext, getFlashScope, getFlowExecutionContext, getFlowExecutionUrl, getFlowScope, getMatchingTransition, getMessageContext, getRequestParameters, getRequestScope, getViewScope, inViewState
public MockRequestControlContext()
public MockRequestControlContext(Flow flow)
flow
- the flow definitionpublic MockRequestControlContext(FlowExecutionContext flowExecutionContext)
flowExecutionContext
- the flow execution contextpublic void setCurrentState(State state)
RequestControlContext
setCurrentState
in interface RequestControlContext
state
- the current stateState.enter(RequestControlContext)
public FlowExecutionKey assignFlowExecutionKey()
RequestControlContext
assignFlowExecutionKey
in interface RequestControlContext
public void viewRendering(View view)
RequestControlContext
viewRendering
in interface RequestControlContext
view
- the view to be renderedpublic void viewRendered(View view)
RequestControlContext
viewRendered
in interface RequestControlContext
view
- the view that renderedpublic boolean handleEvent(Event event)
RequestControlContext
onEvent()
method of the flow involved in the flow execution will be called.handleEvent
in interface RequestControlContext
event
- the event that occurredFlow.handleEvent(RequestControlContext)
public boolean execute(Transition transition)
RequestControlContext
execute
in interface RequestControlContext
transition
- the transitionTransition.execute(State, RequestControlContext)
public void removeAllFlowExecutionSnapshots()
RequestControlContext
removeAllFlowExecutionSnapshots
in interface RequestControlContext
public void removeCurrentFlowExecutionSnapshot()
RequestControlContext
removeCurrentFlowExecutionSnapshot
in interface RequestControlContext
public void updateCurrentFlowExecutionSnapshot()
RequestControlContext
updateCurrentFlowExecutionSnapshot
in interface RequestControlContext
public void start(Flow flow, MutableAttributeMap<?> input) throws java.lang.IllegalStateException
RequestControlContext
This will start a new flow session in the current flow execution, which is already active.
start
in interface RequestControlContext
flow
- the flow to start, its start()
method will be calledinput
- initial contents of the newly created flow session (may be null
, e.g. empty)java.lang.IllegalStateException
Flow.start(RequestControlContext, MutableAttributeMap)
public void endActiveFlowSession(java.lang.String outcome, MutableAttributeMap<java.lang.Object> output) throws java.lang.IllegalStateException
RequestControlContext
end()
method of the flow involved in the flow execution will be
called.endActiveFlowSession
in interface RequestControlContext
outcome
- the logical outcome the ending session should returnoutput
- output the ending session should returnjava.lang.IllegalStateException
- when the flow execution is not activeFlow.end(RequestControlContext, String, MutableAttributeMap)
public boolean getRedirectOnPause()
RequestControlContext
getRedirectOnPause
in interface RequestControlContext
public boolean getRedirectInSameState()
RequestControlContext
RequestControlContext.getRedirectOnPause()
.getRedirectInSameState
in interface RequestControlContext
public boolean getEmbeddedMode()
RequestControlContext
getEmbeddedMode
in interface RequestControlContext
public void setAlwaysRedirectOnPause(boolean alwaysRedirectOnPause)
public void setRedirectInSameState(boolean redirectInSameState)
public void setEmbeddedMode()