|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.springframework.webflow.test.execution.AbstractFlowExecutionTests
org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests
public abstract class AbstractExternalizedFlowExecutionTests
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.
Constructor Summary | |
---|---|
AbstractExternalizedFlowExecutionTests()
Constructs a default externalized flow execution test. |
|
AbstractExternalizedFlowExecutionTests(java.lang.String name)
Constructs an externalized flow execution test with given name. |
Method Summary | |
---|---|
protected Flow |
createFlow(FlowDefinitionResource resource,
FlowServiceLocator serviceLocator)
Factory method to assemble a flow definition from a resource. |
protected abstract FlowBuilder |
createFlowBuilder(org.springframework.core.io.Resource resource,
FlowServiceLocator serviceLocator)
Factory method to create the builder that will build the flow definition whose execution will be tested. |
protected FlowDefinitionResource |
createFlowDefinitionResource(java.io.File file)
Convenient factory method that creates a FlowDefinitionResource from a file. |
protected FlowDefinitionResource |
createFlowDefinitionResource(java.lang.String filePath)
Convenient factory method that creates a FlowDefinitionResource from a file path. |
protected FlowDefinitionResource |
createFlowDefinitionResource(java.lang.String fileDirectory,
java.lang.String fileName)
Convenient factory method that creates a FlowDefinitionResource from a file in a directory. |
protected FlowServiceLocator |
createFlowServiceLocator()
Returns the flow service locator to use during flow definition construction time for accessing externally managed flow artifacts such as actions and flows to be used as subflows. |
protected FlowDefinition |
getFlowDefinition()
Returns the flow definition being tested. |
protected abstract FlowDefinitionResource |
getFlowDefinitionResource()
Returns the pointer to the resource that houses the definition of the flow to be tested. |
protected boolean |
isCacheFlowDefinition()
Returns if flow definition caching is turned on. |
protected void |
registerMockServices(MockFlowServiceLocator serviceRegistry)
Template method called by createFlowServiceLocator() to allow registration of mock implementations of
services needed to test the flow execution. |
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. |
protected void |
setFlowExecutionAttributes(AttributeMap executionAttributes)
Sets system attributes to be associated with the flow execution the next time one is started
by this test. |
protected void |
setFlowExecutionListener(FlowExecutionListener executionListener)
Set a single listener to be attached to the flow execution the next time one is started by
this test. |
protected void |
setFlowExecutionListeners(FlowExecutionListener[] executionListeners)
Set the listeners to be attached to the flow execution the next time one is started by this
test. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
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, fail, fail, failNotEquals, failNotSame, failSame |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractExternalizedFlowExecutionTests()
TestCase.setName(String)
public AbstractExternalizedFlowExecutionTests(java.lang.String name)
name
- the name of the testMethod Detail |
---|
protected boolean isCacheFlowDefinition()
protected void setCacheFlowDefinition(boolean cacheFlowDefinition)
protected void setFlowExecutionAttributes(AttributeMap executionAttributes)
started
by this test. Useful for assigning attributes that influence flow execution behavior.
executionAttributes
- the system attributes to assignprotected void setFlowExecutionListener(FlowExecutionListener executionListener)
started
by
this test. Useful for attaching a listener that does test assertions during the execution of the flow.
executionListener
- the listener to attachprotected void setFlowExecutionListeners(FlowExecutionListener[] executionListeners)
started
by this
test. Useful for attaching listeners that do test assertions during the execution of the flow.
executionListeners
- the listeners to attachprotected final FlowDefinition getFlowDefinition()
getFlowDefinition
in class AbstractFlowExecutionTests
protected FlowServiceLocator createFlowServiceLocator()
This implementation just creates a MockFlowServiceLocator
and populates it with services by calling
registerMockServices(MockFlowServiceLocator)
.
protected void registerMockServices(MockFlowServiceLocator serviceRegistry)
createFlowServiceLocator()
to allow registration of mock implementations of
services needed to test the flow execution. Useful when testing flow definitions in execution in isolation from
flows and middle-tier services. Subclasses may override.
serviceRegistry
- the mock service registry (and locator)protected final Flow createFlow(FlowDefinitionResource resource, FlowServiceLocator serviceLocator)
getFlowDefinition()
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.
resource
- the flow definition resource
createFlowBuilder(Resource, FlowServiceLocator)
protected abstract FlowDefinitionResource getFlowDefinitionResource()
Example usage:
protected FlowDefinitionResource getFlowDefinitionResource() { return createFlowDefinitionResource("/WEB-INF/flows/order-flow.xml"); }
protected abstract FlowBuilder createFlowBuilder(org.springframework.core.io.Resource resource, FlowServiceLocator serviceLocator)
A subclass may return a builder that sets up mock implementations of services needed locally by the flow definition at runtime.
resource
- the externalized flow definition resource locationserviceLocator
- the flow service locator
protected final FlowDefinitionResource createFlowDefinitionResource(java.lang.String filePath)
FlowDefinitionResource
from a file path. Typically called by
subclasses overriding getFlowDefinitionResource()
.
filePath
- the full path to the externalized flow definition file
protected final FlowDefinitionResource createFlowDefinitionResource(java.lang.String fileDirectory, java.lang.String fileName)
FlowDefinitionResource
from a file in a directory. Typically
called by subclasses overriding getFlowDefinitionResource()
.
fileDirectory
- the directory containing the filefileName
- the short file name
protected FlowDefinitionResource createFlowDefinitionResource(java.io.File file)
FlowDefinitionResource
from a file. Typically called by
subclasses overriding getFlowDefinitionResource()
.
file
- the file
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |