Class AbstractExternalizedFlowExecutionTests
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.springframework.webflow.test.execution.AbstractFlowExecutionTests
org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests
- All Implemented Interfaces:
junit.framework.Test
- Direct Known Subclasses:
AbstractXmlFlowExecutionTests
Base class for flow integration tests that verify an externalized flow definition executes as expected. Supports
caching of the flow definition built from an externalized resource to speed up test execution.
- Author:
- Keith Donald, Scott Andrews
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a default externalized flow execution test.Constructs an externalized flow execution test with given name. -
Method Summary
Modifier and TypeMethodDescriptionprotected final FlowFactory method to assemble a flow definition from a resource.protected voidconfigureFlowBuilderContext(MockFlowBuilderContext builderContext) Subclasses may override this hook to customize the builder context for the flow being tested.protected abstract FlowBuildercreateFlowBuilder(FlowDefinitionResource resource) Create the flow builder to build the flow at the specified resource location.protected org.springframework.core.io.ResourceLoaderReturns theResourceLoaderused by theFlowDefinitionResourceFactoryto load flow resources from a path.protected final FlowgetFlow()Returns the flow definition being tested as aFlowimplementation.protected final FlowDefinitionReturns the flow definition to be tested.protected FlowDefinitionRegistryReturns a reference to the flow definition registry used by the flow being tested to load subflows.protected abstract FlowDefinitionResourcegetResource(FlowDefinitionResourceFactory resourceFactory) Get the resource defining the flow to be tested.protected FlowDefinitionResourceFactoryReturns the factory used to create pointers to externalized flow definition resources.protected booleanReturns if flow definition caching is turned on.protected voidsetCacheFlowDefinition(boolean cacheFlowDefinition) Sets the flag indicating if the flow definition built from an externalized resource as part of this test should be cached.protected voidsetFlowExecutionAttributes(AttributeMap<Object> executionAttributes) Sets system attributes to be associated with the flow execution the next time one is started.protected voidsetFlowExecutionListener(FlowExecutionListener executionListener) Set a single listener to be attached to the flow execution the next time one is started by this test.protected voidsetFlowExecutionListeners(FlowExecutionListener[] executionListeners) Set the listeners to be attached to the flow execution the next time one is started.Methods inherited from class org.springframework.webflow.test.execution.AbstractFlowExecutionTests
assertActiveFlowEquals, assertCurrentStateEquals, assertFlowExecutionActive, assertFlowExecutionEnded, assertFlowExecutionOutcomeEquals, assertResponseWrittenEquals, createFlowExecutionFactory, getConversationAttribute, getConversationScope, getFlowAttribute, getFlowExecution, getFlowExecutionFactory, getFlowExecutionOutcome, getFlowScope, getRequiredConversationAttribute, getRequiredConversationAttribute, getRequiredFlowAttribute, getRequiredFlowAttribute, getRequiredViewAttribute, getRequiredViewAttribute, getViewAttribute, getViewScope, resumeFlow, setCurrentState, startFlow, startFlow, updateFlowExecutionMethods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
-
Constructor Details
-
AbstractExternalizedFlowExecutionTests
public AbstractExternalizedFlowExecutionTests()Constructs a default externalized flow execution test.- See Also:
-
TestCase.setName(String)
-
AbstractExternalizedFlowExecutionTests
Constructs an externalized flow execution test with given name.- Parameters:
name- the name of the test
-
-
Method Details
-
isCacheFlowDefinition
protected boolean isCacheFlowDefinition()Returns if flow definition caching is turned on. -
setCacheFlowDefinition
protected void setCacheFlowDefinition(boolean cacheFlowDefinition) Sets the flag indicating if the flow definition built from an externalized resource as part of this test should be cached. Default is false. -
setFlowExecutionAttributes
Sets system attributes to be associated with the flow execution the next time one is started. by this test. Useful for assigning attributes that influence flow execution behavior.- Parameters:
executionAttributes- the system attributes to assign
-
setFlowExecutionListener
Set a single listener to be attached to the flow execution the next time one is started by this test. Useful for attaching a listener that does test assertions during the execution of the flow.- Parameters:
executionListener- the listener to attach
-
setFlowExecutionListeners
Set the listeners to be attached to the flow execution the next time one is started. by this test. Useful for attaching listeners that do test assertions during the execution of the flow.- Parameters:
executionListeners- the listeners to attach
-
getResourceFactory
Returns the factory used to create pointers to externalized flow definition resources.- Returns:
- the resource factory
-
createResourceLoader
protected org.springframework.core.io.ResourceLoader createResourceLoader()Returns theResourceLoaderused by theFlowDefinitionResourceFactoryto load flow resources from a path. Subclasses may override to customize the resource loader used.- Returns:
- the resource loader
- See Also:
-
getFlowDefinition
Description copied from class:AbstractFlowExecutionTestsReturns the flow definition to be tested. Subclasses must implement.- Specified by:
getFlowDefinitionin classAbstractFlowExecutionTests- Returns:
- the flow definition
-
getFlow
Returns the flow definition being tested as aFlowimplementation. Useful if you need to do specific assertions against the configuration of the implementation. -
buildFlow
Factory method to assemble a flow definition from a resource. Called bygetFlowDefinition()to create the "main" flow to test. May also be called by subclasses to create subflow definitions whose executions should also be exercised by this test.- Returns:
- the built flow definition, ready for execution
-
configureFlowBuilderContext
Subclasses may override this hook to customize the builder context for the flow being tested. Useful for registering mock subflows or otherflow builder services. By default, this method does nothing.- Parameters:
builderContext- the mock flow builder context to configure
-
getFlowDefinitionRegistry
Returns a reference to the flow definition registry used by the flow being tested to load subflows. Allows late registration of dependent subflows on a per test-case basis. This is an alternative to registering such subflows upfront inconfigureFlowBuilderContext(MockFlowBuilderContext).- Returns:
- the flow definition registry
-
getResource
protected abstract FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory) Get the resource defining the flow to be tested.- Parameters:
resourceFactory- a helper for constructing the resource to be tested- Returns:
- the flow definition resource
-
createFlowBuilder
Create the flow builder to build the flow at the specified resource location.- Parameters:
resource- the resource location of the flow definition- Returns:
- the flow builder that can build the flow definition
-