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, setFlowExecutionContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetCurrentTransition, setCurrentViewgetActiveFlow, getAttributes, getConversationScope, getCurrentEvent, getCurrentState, getCurrentTransition, getCurrentView, getExternalContext, getFlashScope, getFlowExecutionContext, getFlowExecutionUrl, getFlowScope, getMatchingTransition, getMessageContext, getRequestParameters, getRequestScope, getViewScope, inViewStatepublic MockRequestControlContext()
public MockRequestControlContext(Flow flow)
flow - the flow definitionpublic MockRequestControlContext(FlowExecutionContext flowExecutionContext)
flowExecutionContext - the flow execution contextpublic void setCurrentState(State state)
RequestControlContextsetCurrentState in interface RequestControlContextstate - the current stateState.enter(RequestControlContext)public FlowExecutionKey assignFlowExecutionKey()
RequestControlContextassignFlowExecutionKey in interface RequestControlContextpublic void viewRendering(View view)
RequestControlContextviewRendering in interface RequestControlContextview - the view to be renderedpublic void viewRendered(View view)
RequestControlContextviewRendered in interface RequestControlContextview - the view that renderedpublic boolean handleEvent(Event event)
RequestControlContextonEvent() method of the flow involved in the flow execution will be called.handleEvent in interface RequestControlContextevent - the event that occurredFlow.handleEvent(RequestControlContext)public boolean execute(Transition transition)
RequestControlContextexecute in interface RequestControlContexttransition - the transitionTransition.execute(State, RequestControlContext)public void removeAllFlowExecutionSnapshots()
RequestControlContextremoveAllFlowExecutionSnapshots in interface RequestControlContextpublic void removeCurrentFlowExecutionSnapshot()
RequestControlContextremoveCurrentFlowExecutionSnapshot in interface RequestControlContextpublic void updateCurrentFlowExecutionSnapshot()
RequestControlContextupdateCurrentFlowExecutionSnapshot in interface RequestControlContextpublic void start(Flow flow, MutableAttributeMap<?> input) throws java.lang.IllegalStateException
RequestControlContextThis will start a new flow session in the current flow execution, which is already active.
start in interface RequestControlContextflow - 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.IllegalStateExceptionFlow.start(RequestControlContext, MutableAttributeMap)public void endActiveFlowSession(java.lang.String outcome,
MutableAttributeMap<java.lang.Object> output)
throws java.lang.IllegalStateException
RequestControlContextend() method of the flow involved in the flow execution will be
called.endActiveFlowSession in interface RequestControlContextoutcome - 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()
RequestControlContextgetRedirectOnPause in interface RequestControlContextpublic boolean getRedirectInSameState()
RequestControlContextRequestControlContext.getRedirectOnPause().getRedirectInSameState in interface RequestControlContextpublic boolean getEmbeddedMode()
RequestControlContextgetEmbeddedMode in interface RequestControlContextpublic void setAlwaysRedirectOnPause(boolean alwaysRedirectOnPause)
public void setRedirectInSameState(boolean redirectInSameState)
public void setEmbeddedMode()