From de66dd5720c5cdc31cef40309bc791fe983647cc Mon Sep 17 00:00:00 2001 From: Keith Donald Date: Mon, 31 Mar 2008 19:31:28 +0000 Subject: [PATCH] lastEvent -> currentEvent lastTransition -> currentTransition --- .../webflow/engine/ActionState.java | 4 +- .../webflow/engine/RequestControlContext.java | 8 ++-- .../webflow/engine/SubflowState.java | 2 +- .../webflow/engine/Transition.java | 2 +- .../webflow/engine/TransitionableState.java | 6 +-- .../impl/RequestControlContextImpl.java | 20 ++++---- .../support/DefaultTransitionCriteria.java | 2 +- .../support/EventIdTransitionCriteria.java | 4 +- .../webflow/execution/RequestContext.java | 27 ++++++----- .../el/ImplicitFlowVariableELResolver.java | 2 +- .../el/RequestContextELResolver.java | 2 +- .../webflow/test/MockRequestContext.java | 47 ++++++++----------- .../test/MockRequestControlContext.java | 19 ++------ .../webflow/action/FormActionTests.java | 2 +- .../webflow/engine/DecisionStateTests.java | 6 +-- .../webflow/engine/FlowTests.java | 18 +++---- .../TextToTransitionCriteriaTests.java | 4 +- .../EventIdTransitionCriteriaTests.java | 8 ++-- 18 files changed, 83 insertions(+), 100 deletions(-) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionState.java index 3313e8b1..1f5572c3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionState.java @@ -129,7 +129,7 @@ public class ActionState extends TransitionableState { public Transition getRequiredTransition(RequestContext context) throws NoMatchingTransitionException { Transition transition = getTransitionSet().getTransition(context); if (transition == null) { - throw new NoMatchingActionResultTransitionException(this, context.getLastEvent()); + throw new NoMatchingActionResultTransitionException(this, context.getCurrentEvent()); } return transition; } @@ -182,7 +182,7 @@ public class ActionState extends TransitionableState { executionCount++; } if (executionCount > 0) { - throw new NoMatchingTransitionException(getFlow().getId(), getId(), context.getLastEvent(), + throw new NoMatchingTransitionException(getFlow().getId(), getId(), context.getCurrentEvent(), "No transition was matched on the event(s) signaled by the [" + executionCount + "] action(s) that executed in this action state '" + getId() + "' of flow '" + getFlow().getId() + "'; transitions must be defined to handle action result outcomes -- " diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java index 62a26df4..31804409 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java @@ -54,12 +54,12 @@ public interface RequestControlContext extends RequestContext { public void setCurrentState(State state); /** - * Record the last transition that executed in the executing flow. This method will be called as part of executing a - * transition from one state to another. - * @param lastTransition the last transition that executed + * Record the transition executing in the flow. This method will be called as part of executing a transition from + * one state to another. + * @param transition the transition being executed * @see Transition#execute(State, RequestControlContext) */ - public void setLastTransition(Transition lastTransition); + public void setCurrentTransition(Transition transition); /** * Assign the ongoing flow execution its flow execution key. This method will be called before a state is about to diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowState.java index fa33ba6b..c8bbc234 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowState.java @@ -107,7 +107,7 @@ public class SubflowState extends TransitionableState { */ public boolean handleEvent(RequestControlContext context) { if (subflowAttributeMapper != null) { - AttributeMap subflowOutput = context.getLastEvent().getAttributes(); + AttributeMap subflowOutput = context.getCurrentEvent().getAttributes(); if (logger.isDebugEnabled()) { logger.debug("Mapping subflow output " + subflowOutput); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/Transition.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/Transition.java index 4c8eec00..8675a8f4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/Transition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/Transition.java @@ -207,7 +207,7 @@ public class Transition extends AnnotatedObject implements TransitionDefinition if (logger.isDebugEnabled()) { logger.debug("Executing " + this); } - context.setLastTransition(this); + context.setCurrentTransition(this); if (targetStateResolver != null) { State targetState = targetStateResolver.resolveTargetState(this, sourceState, context); if (targetState != null) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionableState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionableState.java index 050e54c3..fed4aeff 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionableState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionableState.java @@ -90,8 +90,8 @@ public abstract class TransitionableState extends State implements Transitionabl public Transition getRequiredTransition(RequestContext context) throws NoMatchingTransitionException { Transition transition = getTransitionSet().getTransition(context); if (transition == null) { - throw new NoMatchingTransitionException(getFlow().getId(), getId(), context.getLastEvent(), - "No transition found on occurence of event '" + context.getLastEvent() + "' in state '" + getId() + throw new NoMatchingTransitionException(getFlow().getId(), getId(), context.getCurrentEvent(), + "No transition found on occurence of event '" + context.getCurrentEvent() + "' in state '" + getId() + "' of flow '" + getFlow().getId() + "' -- valid transitional criteria are " + StylerUtils.style(getTransitionSet().getTransitionCriterias()) + " -- likely programmer error, check the set of TransitionCriteria for this state"); @@ -111,7 +111,7 @@ public abstract class TransitionableState extends State implements Transitionabl /** * Inform this state definition that an event was signaled in it. The signaled event is the last event available in - * given request context ({@link RequestContext#getLastEvent()}). + * given request context ({@link RequestContext#getCurrentEvent()}). * @param context the flow execution control context * @throws NoMatchingTransitionException when a matching transition cannot be found */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java index a52fc9e3..d685debd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java @@ -75,14 +75,14 @@ class RequestControlContextImpl implements RequestControlContext { private AttributeMap attributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP; /** - * The last event that occurred in this request context; initially null. + * The current event being processed by this flow; initially null. */ - private Event lastEvent; + private Event currentEvent; /** * The last transition that executed in this request context; initially null. */ - private Transition lastTransition; + private Transition currentTransition; /** * Create a new request context. @@ -148,12 +148,12 @@ class RequestControlContextImpl implements RequestControlContext { return flowExecution; } - public Event getLastEvent() { - return lastEvent; + public Event getCurrentEvent() { + return currentEvent; } - public TransitionDefinition getLastTransition() { - return lastTransition; + public TransitionDefinition getCurrentTransition() { + return currentTransition; } public AttributeMap getAttributes() { @@ -187,8 +187,8 @@ class RequestControlContextImpl implements RequestControlContext { flowExecution.setCurrentState(state, this); } - public void setLastTransition(Transition lastTransition) { - this.lastTransition = lastTransition; + public void setCurrentTransition(Transition transition) { + this.currentTransition = transition; } public FlowExecutionKey assignFlowExecutionKey() { @@ -205,7 +205,7 @@ class RequestControlContextImpl implements RequestControlContext { } public boolean handleEvent(Event event) throws FlowExecutionException { - this.lastEvent = event; + this.currentEvent = event; return flowExecution.handleEvent(event, this); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/DefaultTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/DefaultTransitionCriteria.java index 00a30b6e..34a96c29 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/DefaultTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/DefaultTransitionCriteria.java @@ -52,7 +52,7 @@ public class DefaultTransitionCriteria implements TransitionCriteria { return ((Boolean) result).booleanValue(); } else { String eventId = String.valueOf(result); - return context.getLastEvent().getId().equals(eventId); + return context.getCurrentEvent().getId().equals(eventId); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/EventIdTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/EventIdTransitionCriteria.java index 31d6b398..1a24dcb5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/EventIdTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/EventIdTransitionCriteria.java @@ -26,7 +26,7 @@ import org.springframework.webflow.execution.RequestContext; * Simple transition criteria that matches on an eventId and nothing else. Specifically, if the id of the last event * that occurred equals {@link #getEventId()} this criteria will return true. * - * @see RequestContext#getLastEvent() + * @see RequestContext#getCurrentEvent() * * @author Erwin Vervaet * @author Keith Donald @@ -67,7 +67,7 @@ public class EventIdTransitionCriteria implements TransitionCriteria, Serializab } public boolean test(RequestContext context) { - Event lastEvent = context.getLastEvent(); + Event lastEvent = context.getCurrentEvent(); if (lastEvent == null) { return false; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java index ea992b93..7b87a17c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java @@ -75,6 +75,14 @@ public interface RequestContext { */ public StateDefinition getCurrentState() throws IllegalStateException; + /** + * Returns true if the flow is currently active and in a view state. When in a view state {@link #getViewScope()}, + * can be safely called. + * @see #getViewScope() + * @return true if in a view state, false if not + */ + public boolean inViewState(); + /** * Returns a mutable map for accessing and/or setting attributes in request scope. Request scoped attributes * exist for the duration of this request only. @@ -89,18 +97,11 @@ public interface RequestContext { */ public MutableAttributeMap getFlashScope(); - /** - * Returns true if the flow is currently active and in a view state. When in a view state {@link #getViewScope()}, - * can be safely called. - * @see #getViewScope() - * @return true if in a view state, false if not - */ - public boolean inViewState(); - /** * Returns a mutable map for accessing and/or setting attributes in view scope. View scoped attributes exist for * the life of the current view state. * @return the view scope + * @see #inViewState() * @throws IllegalStateException this flow is not in a view-state */ public MutableAttributeMap getViewScope() throws IllegalStateException; @@ -161,17 +162,17 @@ public interface RequestContext { public FlowExecutionContext getFlowExecutionContext(); /** - * Returns the last event signaled during this request. The event may or may not have caused a state transition to - * happen. - * @return the last signaled event, or null if no event has been signaled yet + * Returns the current event being processed by this flow. The event may or may not have caused a state transition + * to happen. + * @return the current event, or null if no event has been signaled yet */ - public Event getLastEvent(); + public Event getCurrentEvent(); /** * Returns the last state transition that executed in this request. * @return the last transition, or null if no transition has occurred yet */ - public TransitionDefinition getLastTransition(); + public TransitionDefinition getCurrentTransition(); /** * Returns a context map for accessing arbitrary attributes about the state of the current request. These attributes diff --git a/spring-webflow/src/main/java/org/springframework/webflow/expression/el/ImplicitFlowVariableELResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/expression/el/ImplicitFlowVariableELResolver.java index bab6d123..78724e4a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/expression/el/ImplicitFlowVariableELResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/expression/el/ImplicitFlowVariableELResolver.java @@ -143,7 +143,7 @@ public class ImplicitFlowVariableELResolver extends ELResolver { private static final PropertyResolver currentEventResolver = new PropertyResolver() { protected Object doResolve(ELContext elContext, RequestContext requestContext, Object property) { - return requestContext.getLastEvent(); + return requestContext.getCurrentEvent(); } }; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/expression/el/RequestContextELResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/expression/el/RequestContextELResolver.java index 5da61e67..ad4378c9 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/expression/el/RequestContextELResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/expression/el/RequestContextELResolver.java @@ -28,7 +28,7 @@ import org.springframework.webflow.execution.RequestContextHolder; /** * Custom EL resolver that resolves the current RequestContext under the variable {@link #REQUEST_CONTEXT_VARIABLE_NAME}. - * Allows for accessing any propert of the RequestContext instance. For example: + * Allows for accessing any property of the RequestContext instance. For example: * "#{flowRequestContext.conversationScope.myProperty}". * * @author Jeremy Grelle diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java index 3aadc3d8..3e5e2841 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java @@ -45,8 +45,6 @@ import org.springframework.webflow.execution.RequestContext; */ public class MockRequestContext implements RequestContext { - protected static final String FLOW_VIEW_MAP_ATTRIBUTE = "flowViewMap"; - private FlowExecutionContext flowExecutionContext; private ExternalContext externalContext; @@ -57,9 +55,9 @@ public class MockRequestContext implements RequestContext { private MutableAttributeMap attributes = new LocalAttributeMap(); - private Event lastEvent; + private Event currentEvent; - private Transition lastTransition; + private Transition currentTransition; /** * Convenience constructor that creates a new mock request context with the following defaults: @@ -120,6 +118,10 @@ public class MockRequestContext implements RequestContext { return getFlowExecutionContext().getActiveSession().getState(); } + public boolean inViewState() { + return getFlowExecutionContext().isActive() && getCurrentState() != null && getCurrentState().isViewState(); + } + public MutableAttributeMap getRequestScope() { return requestScope; } @@ -128,19 +130,8 @@ public class MockRequestContext implements RequestContext { return getMockFlowExecutionContext().getFlashScope(); } - public boolean inViewState() { - return getFlowExecutionContext().isActive() && getCurrentState() != null && getCurrentState().isViewState(); - } - public MutableAttributeMap getViewScope() throws IllegalStateException { - if (!getFlowExecutionContext().isActive()) { - throw new IllegalStateException("This flow is not active"); - } - if (!getCurrentState().isViewState()) { - throw new IllegalStateException("The current state '" + getCurrentState().getId() + "' of this flow '" - + getActiveFlow().getId() + "' is not a view state - view scope not accessible"); - } - return (MutableAttributeMap) getFlowScope().get(FLOW_VIEW_MAP_ATTRIBUTE); + return getMockFlowExecutionContext().getActiveSession().getViewScope(); } public MutableAttributeMap getFlowScope() { @@ -167,12 +158,12 @@ public class MockRequestContext implements RequestContext { return flowExecutionContext; } - public Event getLastEvent() { - return lastEvent; + public Event getCurrentEvent() { + return currentEvent; } - public TransitionDefinition getLastTransition() { - return lastTransition; + public TransitionDefinition getCurrentTransition() { + return currentTransition; } public AttributeMap getAttributes() { @@ -228,19 +219,19 @@ public class MockRequestContext implements RequestContext { } /** - * Set the last event that occured in this request context. - * @param lastEvent the event to set + * Set the current event being processed by this flow. + * @param event the current event */ - public void setLastEvent(Event lastEvent) { - this.lastEvent = lastEvent; + public void setCurrentEvent(Event event) { + this.currentEvent = event; } /** - * Set the last transition that executed in this request context. - * @param lastTransition the last transition to set + * Set the current transition executing in this request context. + * @param transition the current transition to set */ - public void setLastTransition(Transition lastTransition) { - this.lastTransition = lastTransition; + public void setCurrentTransition(Transition transition) { + this.currentTransition = transition; } /** diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java index da7d7f55..f012b75e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java @@ -15,7 +15,6 @@ */ package org.springframework.webflow.test; -import org.springframework.webflow.core.collection.LocalAttributeMap; import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.engine.Flow; import org.springframework.webflow.engine.RequestControlContext; @@ -74,16 +73,8 @@ public class MockRequestControlContext extends MockRequestContext implements Req flow.start(this, input); } - public void initViewScope() { - getFlowScope().put(FLOW_VIEW_MAP_ATTRIBUTE, new LocalAttributeMap()); - } - - public void destroyViewScope() { - getFlowScope().remove(FLOW_VIEW_MAP_ATTRIBUTE); - } - public boolean handleEvent(Event event) { - setLastEvent(event); + setCurrentEvent(event); return ((Flow) getActiveFlow()).handleEvent(this); } @@ -104,14 +95,14 @@ public class MockRequestControlContext extends MockRequestContext implements Req return key; } - public boolean getAlwaysRedirectOnPause() { - return alwaysRedirectOnPause; - } - public boolean getFlowExecutionRedirectSent() { return this.flowExecutionRedirectSent; } + public boolean getAlwaysRedirectOnPause() { + return alwaysRedirectOnPause; + } + public void setAlwaysRedirectOnPause(boolean alwaysRedirectOnPause) { this.alwaysRedirectOnPause = alwaysRedirectOnPause; } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java index 00edc7b4..58419e37 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java @@ -342,7 +342,7 @@ public class FormActionTests extends TestCase { assertSame(formObject, errors.getTarget()); context = new MockRequestContext(); - context.setLastEvent(new Event(this, "start")); + context.setCurrentEvent(new Event(this, "start")); OtherTestBean freshBean = new OtherTestBean(); context.getFlowScope().put("test", freshBean); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/DecisionStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/DecisionStateTests.java index d00f87f6..fb94e1a8 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/DecisionStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/DecisionStateTests.java @@ -35,7 +35,7 @@ public class DecisionStateTests extends TestCase { state.getTransitionSet().add(new Transition(new EventIdTransitionCriteria("foo"), to("target"))); new EndState(flow, "target"); MockRequestControlContext context = new MockRequestControlContext(flow); - context.setLastEvent(new Event(this, "foo")); + context.setCurrentEvent(new Event(this, "foo")); state.enter(context); assertFalse(context.getFlowExecutionContext().isActive()); } @@ -47,7 +47,7 @@ public class DecisionStateTests extends TestCase { state.getTransitionSet().add(new Transition(to("target"))); new EndState(flow, "target"); MockRequestControlContext context = new MockRequestControlContext(flow); - context.setLastEvent(new Event(this, "bogus")); + context.setCurrentEvent(new Event(this, "bogus")); state.enter(context); assertFalse(context.getFlowExecutionContext().isActive()); } @@ -58,7 +58,7 @@ public class DecisionStateTests extends TestCase { state.getTransitionSet().add(new Transition(new EventIdTransitionCriteria("foo"), to("invalid"))); state.getTransitionSet().add(new Transition(new EventIdTransitionCriteria("bar"), to("invalid"))); MockRequestControlContext context = new MockRequestControlContext(flow); - context.setLastEvent(new Event(this, "bogus")); + context.setCurrentEvent(new Event(this, "bogus")); try { state.enter(context); fail("Expected no matching"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java index ade0d504..ee5629ab 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java @@ -230,7 +230,7 @@ public class FlowTests extends TestCase { MockRequestControlContext context = new MockRequestControlContext(flow); Event event = new Event(this, "foo"); try { - context.setLastEvent(event); + context.setCurrentEvent(event); flow.handleEvent(context); } catch (IllegalStateException e) { @@ -241,9 +241,9 @@ public class FlowTests extends TestCase { MockRequestControlContext context = new MockRequestControlContext(flow); context.setCurrentState(flow.getStateInstance("myState2")); Event event = new Event(this, "submit"); - context.setLastEvent(event); + context.setCurrentEvent(event); try { - context.setLastEvent(event); + context.setCurrentEvent(event); flow.handleEvent(context); } catch (IllegalStateException e) { @@ -254,9 +254,9 @@ public class FlowTests extends TestCase { MockRequestControlContext context = new MockRequestControlContext(flow); context.setCurrentState(flow.getStateInstance("myState1")); Event event = new Event(this, "submit"); - context.setLastEvent(event); + context.setCurrentEvent(event); assertTrue(context.getFlowExecutionContext().isActive()); - context.setLastEvent(event); + context.setCurrentEvent(event); flow.handleEvent(context); assertTrue(!context.getFlowExecutionContext().isActive()); } @@ -265,9 +265,9 @@ public class FlowTests extends TestCase { MockRequestControlContext context = new MockRequestControlContext(flow); context.setCurrentState(flow.getStateInstance("myState1")); Event event = new Event(this, "globalEvent"); - context.setLastEvent(event); + context.setCurrentEvent(event); assertTrue(context.getFlowExecutionContext().isActive()); - context.setLastEvent(event); + context.setCurrentEvent(event); flow.handleEvent(context); assertTrue(!context.getFlowExecutionContext().isActive()); } @@ -276,9 +276,9 @@ public class FlowTests extends TestCase { MockRequestControlContext context = new MockRequestControlContext(flow); context.setCurrentState(flow.getStateInstance("myState1")); Event event = new Event(this, "bogus"); - context.setLastEvent(event); + context.setCurrentEvent(event); try { - context.setLastEvent(event); + context.setCurrentEvent(event); flow.handleEvent(context); } catch (NoMatchingTransitionException e) { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteriaTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteriaTests.java index a1a86d04..3e900bb0 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteriaTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/support/TextToTransitionCriteriaTests.java @@ -74,7 +74,7 @@ public class TextToTransitionCriteriaTests extends TestCase { String expression = "${3 + 4}"; TransitionCriteria criterion = (TransitionCriteria) converter.convert(expression); MockRequestContext ctx = getRequestContext(); - ctx.setLastEvent(new Event(this, "7")); + ctx.setCurrentEvent(new Event(this, "7")); assertTrue("Criterion should evaluate to true", criterion.test(ctx)); } @@ -94,7 +94,7 @@ public class TextToTransitionCriteriaTests extends TestCase { MockRequestContext ctx = new MockRequestContext(flow); RequestContextHolder.setRequestContext(ctx); ctx.getFlowScope().put("foo", "bar"); - ctx.setLastEvent(new Event(this, "sample")); + ctx.setCurrentEvent(new Event(this, "sample")); return ctx; } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/support/EventIdTransitionCriteriaTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/support/EventIdTransitionCriteriaTests.java index ab5fbd6a..aade375b 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/support/EventIdTransitionCriteriaTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/support/EventIdTransitionCriteriaTests.java @@ -24,18 +24,18 @@ public class EventIdTransitionCriteriaTests extends TestCase { public void testTestCriteria() { EventIdTransitionCriteria c = new EventIdTransitionCriteria("foo"); MockRequestContext context = new MockRequestContext(); - context.setLastEvent(new Event(this, "foo")); + context.setCurrentEvent(new Event(this, "foo")); assertEquals(true, c.test(context)); - context.setLastEvent(new Event(this, "FOO")); + context.setCurrentEvent(new Event(this, "FOO")); assertEquals(false, c.test(context)); // case sensitive - context.setLastEvent(new Event(this, "bar")); + context.setCurrentEvent(new Event(this, "bar")); assertEquals(false, c.test(context)); } public void testNullLastEventId() { EventIdTransitionCriteria c = new EventIdTransitionCriteria("foo"); MockRequestContext context = new MockRequestContext(); - context.setLastEvent(null); + context.setCurrentEvent(null); assertEquals(false, c.test(context)); }