Code reviewed and cleaned up some tests.
This commit is contained in:
@@ -29,7 +29,11 @@ import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.factory.StaticFlowExecutionListenerLoader;
|
||||
import org.springframework.webflow.test.MockExternalContext;
|
||||
|
||||
/**
|
||||
* Test case for {@link FlowExecutionImplFactory}.
|
||||
*/
|
||||
public class FlowExecutionImplFactoryTests extends TestCase {
|
||||
|
||||
private FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
|
||||
|
||||
private Flow flowDefinition = new SimpleFlow();
|
||||
|
||||
@@ -40,10 +40,8 @@ import org.springframework.webflow.test.MockExternalContext;
|
||||
import org.springframework.webflow.test.MockParameterMap;
|
||||
|
||||
/**
|
||||
* Test case for FlowExecutionStack.
|
||||
*
|
||||
* @see FlowExecutionImpl
|
||||
*
|
||||
* Test case for {@link FlowExecutionImplStateRestorer}.
|
||||
*
|
||||
* @author Erwin Vervaet
|
||||
*/
|
||||
public class FlowExecutionImplStateRestorerTests extends TestCase {
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.springframework.webflow.execution.Event;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
|
||||
public class InfiniteLoopTestAction extends MultiAction {
|
||||
|
||||
public Event method(RequestContext context) {
|
||||
return success();
|
||||
}
|
||||
|
||||
@@ -33,8 +33,13 @@ import org.springframework.webflow.execution.FlowExecution;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.support.ApplicationView;
|
||||
import org.springframework.webflow.test.MockExternalContext;
|
||||
import org.springframework.webflow.test.MockFlowServiceLocator;
|
||||
|
||||
/**
|
||||
* Miscellaneous flow execution tests.
|
||||
*/
|
||||
public class MiscFlowExecutionTests extends TestCase {
|
||||
|
||||
public void testRequestScopePutInEntryAction() {
|
||||
Flow parentFlow = new Flow("parent");
|
||||
Flow flow = new Flow("test");
|
||||
@@ -76,16 +81,18 @@ public class MiscFlowExecutionTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void testInfiniteLoop() {
|
||||
MockFlowServiceLocator serviceLocator = new MockFlowServiceLocator();
|
||||
serviceLocator.registerBean("action", new InfiniteLoopTestAction());
|
||||
XmlFlowBuilder builder = new XmlFlowBuilder(new ClassPathResource("infinite-loop.xml", getClass()));
|
||||
builder.setFlowServiceLocator(serviceLocator);
|
||||
Flow flow = new FlowAssembler("myFlow", builder).assembleFlow();
|
||||
FlowExecutionImpl execution = new FlowExecutionImpl(flow);
|
||||
try {
|
||||
execution.start(null, new MockExternalContext());
|
||||
} catch (RequiredMappingException e) {
|
||||
|
||||
}
|
||||
catch (StackOverflowError e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
|
||||
"http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
|
||||
<!-- Application context definition -->
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="action" class="org.springframework.webflow.execution.InfiniteLoopTestAction"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,18 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<start-state id="invokeAction" />
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow xmlns="http://www.springframework.org/schema/webflow"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/webflow
|
||||
http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
|
||||
|
||||
<start-state idref="invokeAction"/>
|
||||
|
||||
<action-state id="invokeAction">
|
||||
<action bean="action" method="method"/>
|
||||
<transition on="success" to="displayCustomer">
|
||||
<transition on="success" to="end">
|
||||
<!-- transition is not allowed to execute since second action signals error,
|
||||
as a result the source state will be re-entered, starting a loop... -->
|
||||
<action bean="action" method="method"/>
|
||||
<action bean="action" method="errorMethod"/>
|
||||
</transition>
|
||||
</action-state>
|
||||
|
||||
<end-state id="displayCustomer" view="customer"/>
|
||||
|
||||
<import resource="infinite-loop-beans.xml"/>
|
||||
<end-state id="end"/>
|
||||
</flow>
|
||||
Reference in New Issue
Block a user