org.springframework.webflow.test.execution
Class AbstractExternalizedFlowExecutionTests

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.springframework.webflow.test.execution.AbstractFlowExecutionTests
              extended by org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractXmlFlowExecutionTests

public abstract class AbstractExternalizedFlowExecutionTests
extends AbstractFlowExecutionTests

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

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 buildFlow()
          Factory method to assemble a flow definition from a resource.
protected  void configure(MockFlowBuilderContext builderContext)
          Subclasses may override this hook to customize the builder context for the flow being tested.
protected abstract  FlowBuilder createFlowBuilder(org.springframework.core.io.Resource path)
          Create the flow builder to build the flow at the specified resource location.
protected  FlowBuilderContext createFlowBuilderContext(FlowDefinitionResource resource)
          Create the flow builder context to build the flow definition at the resource location provided.
protected  FlowDefinition getFlowDefinition()
          Returns the flow definition being tested.
protected abstract  FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory)
          Get the flow definition to be tested.
protected  boolean isCacheFlowDefinition()
          Returns if flow definition caching is turned on.
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.
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.
 
Methods inherited from class org.springframework.webflow.test.execution.AbstractFlowExecutionTests
assertActiveFlowEquals, assertCurrentStateEquals, assertFlowExecutionActive, assertFlowExecutionEnded, createFlowExecutionFactory, getConversationAttribute, getFlashAttribute, getFlowAttribute, getFlowExecution, getFlowExecutionFactory, getRequiredConversationAttribute, getRequiredConversationAttribute, getRequiredFlashAttribute, getRequiredFlashAttribute, getRequiredFlowAttribute, getRequiredFlowAttribute, resumeFlow, signalEvent, signalEvent, signalEvent, startFlow, updateFlowExecution
 
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

AbstractExternalizedFlowExecutionTests

public AbstractExternalizedFlowExecutionTests()
Constructs a default externalized flow execution test.

See Also:
TestCase.setName(String)

AbstractExternalizedFlowExecutionTests

public AbstractExternalizedFlowExecutionTests(java.lang.String name)
Constructs an externalized flow execution test with given name.

Parameters:
name - the name of the test
Since:
1.0.2
Method Detail

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

protected void setFlowExecutionAttributes(AttributeMap executionAttributes)
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

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. Useful for attaching a listener that does test assertions during the execution of the flow.

Parameters:
executionListener - the listener to attach

setFlowExecutionListeners

protected void setFlowExecutionListeners(FlowExecutionListener[] executionListeners)
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

getFlowDefinition

protected final FlowDefinition getFlowDefinition()
Returns the flow definition being tested.

Specified by:
getFlowDefinition in class AbstractFlowExecutionTests
Returns:
the flow definition

buildFlow

protected final Flow buildFlow()
Factory method to assemble a flow definition from a resource. Called by 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.

Returns:
the built flow definition, ready for execution

createFlowBuilderContext

protected FlowBuilderContext createFlowBuilderContext(FlowDefinitionResource resource)
Create the flow builder context to build the flow definition at the resource location provided.

Parameters:
resource - the flow definition resource
Returns:
the flow builder context

configure

protected void configure(MockFlowBuilderContext builderContext)
Subclasses may override this hook to customize the builder context for the flow being tested. Useful for registering mock subflows or other builder services.

Parameters:
builderContext - the mock flow builder context.

getResource

protected abstract FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory)
Get the flow definition to be tested.

Parameters:
a - helper for constructing the resource to be tested
Returns:
the flow definition resource

createFlowBuilder

protected abstract FlowBuilder createFlowBuilder(org.springframework.core.io.Resource path)
Create the flow builder to build the flow at the specified resource location.

Parameters:
path - the location of the flow definition
Returns:
the flow builder that can build the flow definition


Copyright � 2004-2007. All Rights Reserved.