Moved model validation behavior into the FlowActionListener, to only be invoked if an non-immediate ActionEvent has been signaled.
This commit is contained in:
@@ -12,8 +12,12 @@ import junit.framework.TestCase;
|
||||
import org.easymock.EasyMock;
|
||||
import org.springframework.webflow.core.collection.AttributeMap;
|
||||
import org.springframework.webflow.core.collection.LocalAttributeMap;
|
||||
import org.springframework.webflow.engine.Flow;
|
||||
import org.springframework.webflow.engine.ViewState;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.RequestContextHolder;
|
||||
import org.springframework.webflow.execution.View;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
|
||||
public class FlowActionListenerTests extends TestCase {
|
||||
|
||||
@@ -30,6 +34,7 @@ public class FlowActionListenerTests extends TestCase {
|
||||
RequestContextHolder.setRequestContext(context);
|
||||
AttributeMap flash = new LocalAttributeMap();
|
||||
EasyMock.expect(context.getFlashScope()).andStubReturn(flash);
|
||||
EasyMock.expect(context.getCurrentState()).andStubReturn(new MockViewState());
|
||||
EasyMock.replay(new Object[] { context });
|
||||
}
|
||||
|
||||
@@ -84,4 +89,17 @@ public class FlowActionListenerTests extends TestCase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class MockViewState extends ViewState {
|
||||
|
||||
public MockViewState() {
|
||||
super(new Flow("mockFlow"), "mockView", new ViewFactory() {
|
||||
|
||||
public View getView(RequestContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Auto-generated method stub");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,10 @@ import org.springframework.webflow.core.collection.LocalAttributeMap;
|
||||
import org.springframework.webflow.core.collection.MutableAttributeMap;
|
||||
import org.springframework.webflow.definition.FlowDefinition;
|
||||
import org.springframework.webflow.definition.StateDefinition;
|
||||
import org.springframework.webflow.engine.Flow;
|
||||
import org.springframework.webflow.engine.ViewState;
|
||||
import org.springframework.webflow.execution.FlowExecutionContext;
|
||||
import org.springframework.webflow.execution.FlowExecutionKey;
|
||||
import org.springframework.webflow.execution.RequestContext;
|
||||
import org.springframework.webflow.execution.RequestContextHolder;
|
||||
import org.springframework.webflow.execution.View;
|
||||
import org.springframework.webflow.execution.ViewFactory;
|
||||
import org.springframework.webflow.test.MockExternalContext;
|
||||
|
||||
public class JsfViewTests extends TestCase {
|
||||
@@ -145,7 +141,6 @@ public class JsfViewTests extends TestCase {
|
||||
Boolean.FALSE);
|
||||
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
|
||||
.andStubReturn(null);
|
||||
EasyMock.expect(context.getCurrentState()).andStubReturn(new MockViewState());
|
||||
|
||||
Lifecycle lifecycle = new NoEventLifecycle(jsfMock.lifecycle());
|
||||
|
||||
@@ -175,7 +170,6 @@ public class JsfViewTests extends TestCase {
|
||||
Boolean.FALSE);
|
||||
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
|
||||
.andStubReturn(null);
|
||||
EasyMock.expect(context.getCurrentState()).andStubReturn(new MockViewState());
|
||||
|
||||
Lifecycle lifecycle = new NoEventLifecycle(jsfMock.lifecycle());
|
||||
|
||||
@@ -205,7 +199,6 @@ public class JsfViewTests extends TestCase {
|
||||
Boolean.FALSE);
|
||||
EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject()))
|
||||
.andStubReturn(null);
|
||||
EasyMock.expect(context.getCurrentState()).andStubReturn(new MockViewState());
|
||||
|
||||
Lifecycle lifecycle = new EventSignalingLifecycle(jsfMock.lifecycle());
|
||||
|
||||
@@ -300,17 +293,4 @@ public class JsfViewTests extends TestCase {
|
||||
throw new UnsupportedOperationException("Auto-generated method stub");
|
||||
}
|
||||
}
|
||||
|
||||
private class MockViewState extends ViewState {
|
||||
|
||||
public MockViewState() {
|
||||
super(new Flow("mockFlow"), VIEW_ID, new ViewFactory() {
|
||||
|
||||
public View getView(RequestContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Auto-generated method stub");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user