Package org.springframework.webflow.test
Class MockFlowBuilderContext
java.lang.Object
org.springframework.webflow.engine.builder.support.FlowBuilderContextImpl
org.springframework.webflow.test.MockFlowBuilderContext
- All Implemented Interfaces:
FlowBuilderContext
A stub flow service locator implementation suitable for a test environment.
Allows programmatic registration of subflows needed by a flow execution being tested, see
registerSubflow(Flow)
. Subflows registered are typically stubs that verify parent flow input and output
scenarios.
Also supports programmatic registration of additional custom services needed by a flow (such as Actions) managed in a
backing Spring ConfigurableBeanFactory
. See the registerBean(String, Object)
method. Beans
registered are typically mocks or stubs of business services invoked by the flow.
- Author:
- Keith Donald
-
Constructor Summary
ConstructorDescriptionMockFlowBuilderContext
(String flowId) Creates a new mock flow service locator.MockFlowBuilderContext
(String flowId, AttributeMap<Object> attributes) Creates a new mock flow service locator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
registerBean
(String beanName, Object bean) Register a bean in the backing bean factory, typically to support a flow execution test.void
registerSubflow
(Flow subflow) Register a subflow definition in the backing flow registry, typically to support a flow execution test.Methods inherited from class org.springframework.webflow.engine.builder.support.FlowBuilderContextImpl
createConversionService, getApplicationContext, getConversionService, getExpressionParser, getFlowArtifactFactory, getFlowAttributes, getFlowBuilderServices, getFlowDefinitionLocator, getFlowId, getValidationHintResolver, getValidator, getViewFactoryCreator
-
Constructor Details
-
MockFlowBuilderContext
Creates a new mock flow service locator. -
MockFlowBuilderContext
Creates a new mock flow service locator.
-
-
Method Details
-
registerSubflow
Register a subflow definition in the backing flow registry, typically to support a flow execution test. For test scenarios, the subflow is often a stub used to verify parent flow input and output mapping behavior.- Parameters:
subflow
- the subflow
-
registerBean
Register a bean in the backing bean factory, typically to support a flow execution test. For test scenarios, if the bean is a service invoked by a bean invoking action it is often a stub or dynamic mock implementation of the service's business interface.- Parameters:
beanName
- the bean namebean
- the singleton instance
-