Commits

musachy  committed ea7568e

WW-3194 Rollback changes made to WW-2996, try to fix both

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@2037e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits cbb01b0

Comments (0)

Files changed (10)

File core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java

 
 
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.ActionProxy;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.FileManager;
 import com.opensymphony.xwork2.util.ValueStack;
     }
 
     public synchronized List<Validator> getValidators(Class clazz, String context, String method) {
-        final String validatorKey = buildValidatorKey(clazz, context);
+        final String validatorKey = buildValidatorKey(clazz);
 
         if (validatorCache.containsKey(validatorKey)) {
             if (FileManager.isReloadingConfigs()) {
      * Builds a key for validators - used when caching validators.
      *
      * @param clazz   the action.
-     * @param context the action's context.
      * @return a validator key which is the class name plus context.
      */
-    protected static String buildValidatorKey(Class clazz, String context) {
+    protected static String buildValidatorKey(Class clazz) {
+        ActionInvocation invocation = ActionContext.getContext().getActionInvocation();
+        ActionProxy proxy = invocation.getProxy();
+
+        //the key needs to use the name of the action from the config file,
+        //instead of the url, so wild card actions will have the same validator
+        //see WW-2996
         StringBuilder sb = new StringBuilder(clazz.getName());
         sb.append("/");
-        sb.append(context);
+        sb.append(proxy.getConfig().getName());
+        sb.append("|");
+        sb.append(proxy.getMethod());
         return sb.toString();
     }
 

File core/src/main/java/com/opensymphony/xwork2/validator/ValidationInterceptor.java

     protected void doBeforeInvocation(ActionInvocation invocation) throws Exception {
         Object action = invocation.getAction();
         ActionProxy proxy = invocation.getProxy();
-        //use the name from the config, instead of the action name
-        //otherwise actions with patterns in the name won't be cached, see WW-2996
-        String context = proxy.getConfig().getName();
+
+        //the action name has to be from the url, otherwise validators that use aliases, like
+        //MyActio-someaction-validator.xml will not be found, see WW-3194
+        String context = proxy.getActionName();
         String method = proxy.getMethod();
 
         if (log.isDebugEnabled()) {

File core/src/test/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptor2Test.java

-/*
- * Copyright (c) 2002-2006 by OpenSymphony
- * All rights reserved.
- */
-package com.opensymphony.xwork2.interceptor;
-
-import com.opensymphony.xwork2.*;
-import com.opensymphony.xwork2.config.entities.InterceptorConfig;
-import com.opensymphony.xwork2.config.entities.ActionConfig;
-import com.opensymphony.xwork2.validator.ValidationInterceptor;
-import org.easymock.MockControl;
-
-import java.util.HashMap;
-
-/**
- * 
- * @author tm_jee
- * @version $Date$ $Id$
- */
-public class DefaultWorkflowInterceptor2Test extends XWorkTestCase {
-	
-	public void testDefaultResultNameIsReturnedWithBadValidation() throws Exception {
-		ValidationFailedAction action = new ValidationFailedAction();
-		
-		MockControl actionProxyControl = MockControl.createControl(ActionProxy.class);
-		ActionProxy actionProxy = (ActionProxy) actionProxyControl.getMock();
-		actionProxy.getMethod();
-		actionProxyControl.expectAndDefaultReturn(null, "execute");
-		
-		MockControl actionInvocationControl = MockControl.createControl(ActionInvocation.class);
-		ActionInvocation actionInvocation = (ActionInvocation) actionInvocationControl.getMock();
-		actionInvocation.getAction();
-		actionInvocationControl.expectAndDefaultReturn(null, action);
-		actionInvocation.getProxy();
-		actionInvocationControl.expectAndDefaultReturn(null, actionProxy);
-		
-		actionProxyControl.replay();
-		actionInvocationControl.replay();
-		
-		DefaultWorkflowInterceptor interceptor = new DefaultWorkflowInterceptor();
-		
-		String result = interceptor.intercept(actionInvocation);
-		
-		assertEquals(result, Action.INPUT);
-		
-		actionProxyControl.verify();
-		actionInvocationControl.verify();
-	}
-	
-	public void testDifferentResultNameCouldBeReturnedWithBadValidation() throws Exception {
-		
-		ValidationFailedAction action = new ValidationFailedAction();
-		
-		MockControl actionProxyControl = MockControl.createControl(ActionProxy.class);
-		ActionProxy actionProxy = (ActionProxy) actionProxyControl.getMock();
-		actionProxy.getMethod();
-		actionProxyControl.expectAndDefaultReturn(null, "execute");
-		
-		MockControl actionInvocationControl = MockControl.createControl(ActionInvocation.class);
-		ActionInvocation actionInvocation = (ActionInvocation) actionInvocationControl.getMock();
-		actionInvocation.getAction();
-		actionInvocationControl.expectAndDefaultReturn(null, action);
-		actionInvocation.getProxy();
-		actionInvocationControl.expectAndDefaultReturn(null, actionProxy);
-		
-		actionProxyControl.replay();
-		actionInvocationControl.replay();
-		
-		DefaultWorkflowInterceptor interceptor = new DefaultWorkflowInterceptor();
-		interceptor.setInputResultName("error");
-		
-		String result = interceptor.intercept(actionInvocation);
-		
-		assertEquals(result, "error");
-		
-		actionProxyControl.verify();
-		actionInvocationControl.verify();
-	}
-	
-	
-	public void testValidateXXXThrowsException() throws Exception {
-		
-		ValidateXXXAction action = new ValidateXXXAction();
-		
-		MockControl actionProxyControl = MockControl.createControl(ActionProxy.class);
-		ActionProxy actionProxy = (ActionProxy) actionProxyControl.getMock();
-		actionProxy.getMethod();
-		actionProxyControl.expectAndDefaultReturn(null, "execute");
-
-        ActionConfig config = new ActionConfig.Builder("", "action", "").build();
-
-        MockControl actionInvocationControl = MockControl.createControl(ActionInvocation.class);
-		ActionInvocation actionInvocation = (ActionInvocation) actionInvocationControl.getMock();
-		actionInvocation.invoke();
-		actionInvocationControl.expectAndDefaultReturn(null, "test");
-		actionInvocation.getProxy();
-		actionInvocationControl.expectAndDefaultReturn(null, actionProxy);
-		actionInvocation.getAction();
-		actionInvocationControl.expectAndDefaultReturn(null, action);
-		actionProxy.getConfig();
-		actionProxyControl.expectAndDefaultReturn(null, config);
-
-		actionInvocationControl.replay();
-		actionProxyControl.replay();
-		
-		ValidationInterceptor validationInterceptor = create();
-		DefaultWorkflowInterceptor interceptor = new DefaultWorkflowInterceptor();
-		try {
-		        validationInterceptor.intercept(actionInvocation);
-			interceptor.intercept(actionInvocation);
-			fail();
-		}
-		catch(Exception e) {
-			assertTrue(true);
-		}
-		
-		assertTrue(action.isExecuted);
-		actionInvocationControl.verify();
-		actionProxyControl.verify();
-	}
-	
-	
-	public void testValidateDoXXXThowsException() throws Exception {
-		ValidateDoXXXAction action = new ValidateDoXXXAction();
-		
-		MockControl actionProxyControl = MockControl.createControl(ActionProxy.class);
-		ActionProxy actionProxy = (ActionProxy) actionProxyControl.getMock();
-		actionProxy.getMethod();
-		actionProxyControl.expectAndDefaultReturn(null, "execute");
-
-        ActionConfig config = new ActionConfig.Builder("", "action", "").build();
-		
-		MockControl actionInvocationControl = MockControl.createControl(ActionInvocation.class);
-		ActionInvocation actionInvocation = (ActionInvocation) actionInvocationControl.getMock();
-		actionInvocation.invoke();
-		actionInvocationControl.expectAndDefaultReturn(null, "test");
-		actionInvocation.getProxy();
-		actionInvocationControl.expectAndDefaultReturn(null, actionProxy);
-		actionInvocation.getAction();
-		actionInvocationControl.expectAndDefaultReturn(null, action);
-		actionProxy.getConfig();
-        actionProxyControl.expectAndDefaultReturn(null, config);
-		
-		actionInvocationControl.replay();
-		actionProxyControl.replay();
-		
-		ValidationInterceptor validationInterceptor = create();
-		DefaultWorkflowInterceptor interceptor = new DefaultWorkflowInterceptor();
-		try {
-		        validationInterceptor.intercept(actionInvocation);
-			interceptor.intercept(actionInvocation);
-			fail();
-		}
-		catch(Exception e) {
-			assertTrue(true);
-		}
-		
-		assertTrue(action.isExecuted);
-		actionInvocationControl.verify();
-		actionProxyControl.verify();
-	}
-	
-	protected ValidationInterceptor create() {
-        ObjectFactory objectFactory = container.getInstance(ObjectFactory.class);
-        return (ValidationInterceptor) objectFactory.buildInterceptor(
-                new InterceptorConfig.Builder("model", ValidationInterceptor.class.getName()).build(), new HashMap());
-    }
-	
-	
-	public class ValidationFailedAction extends ActionSupport {
-		
-		private static final long serialVersionUID = -2618142505271508888L;
-
-		public ValidationFailedAction() {
-			addActionError("an action error");
-		}
-	}
-	
-	public class ValidateXXXAction extends ActionSupport {
-		
-		private static final long serialVersionUID = 1161896580929473760L;
-		
-		public boolean isExecuted = false;
-		public void validateExecute() throws Exception {
-			isExecuted = true;
-			throw new Exception("testing");
-		}
-	}
-	
-	public class ValidateDoXXXAction extends ActionSupport {
-		
-		private static final long serialVersionUID = 2923102033415402386L;
-		
-		public boolean isExecuted = false;
-		public void validateDoExecute() throws Exception {
-			isExecuted = true;
-			throw new Exception ("testing");
-		}
-	}
-}

File core/src/test/java/com/opensymphony/xwork2/interceptor/DefaultWorkflowInterceptorTest.java

  */
 package com.opensymphony.xwork2.interceptor;
 
-import com.mockobjects.dynamic.Mock;
 import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.config.entities.InterceptorConfig;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 
 import java.util.HashMap;
 
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
 
 /**
  * Unit test for {@link DefaultWorkflowInterceptor}.
 
     DefaultWorkflowInterceptor interceptor;
     private ActionInvocation invocation;
-    private Mock actionMock;
-    private Mock invocationMock;
     private Action action;
     private ActionProxy proxy;
-    private Mock proxyMock;
     private ActionConfig config;
+    private String result = "testing123";
 
 
     public void testInvokesActionInvocationIfNoErrors() throws Exception {
-        final String result = "testing123";
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        actionMock.expectAndReturn("hasErrors", false);
-        invocationMock.expectAndReturn("invoke", result);
-        invocationMock.expectAndReturn("invoke", result);
-        
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.intercept(invocation);
         assertEquals(result, interceptor.intercept(invocation));
     }
 
     public void testReturnsInputWithoutExecutingIfHasErrors() throws Exception {
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        actionMock.expectAndReturn("hasErrors", false);
-        invocationMock.expectAndReturn("invoke", Action.INPUT);
-        invocationMock.expectAndReturn("invoke", Action.INPUT);
-        
+        result = Action.INPUT;
+
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.intercept(invocation);
         assertEquals(Action.INPUT, interceptor.intercept(invocation));
 
     public void testExcludesMethod() throws Exception {
         interceptor.setExcludeMethods("execute");
-        final String result = "testing123";
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("invoke", result);
-        proxyMock.expectAndReturn("getMethod", "execute");        
-        invocationMock.expectAndReturn("invoke", result);
-                
+
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setExcludeMethods("execute");
         interceptor.setExcludeMethods("execute");
 
     public void testExcludesMethodWithWildCard() throws Exception {
         interceptor.setExcludeMethods("*");
-        final String result = "testing123";
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("invoke", result);
-        invocationMock.expectAndReturn("invoke", result);
-        
+
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.intercept(invocation);
         validationInterceptor.setExcludeMethods("*");
 
     public void testIncludesMethodWithWildcard() throws Exception {
         interceptor.setIncludeMethods("*");
-        final String result = "testing123";
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        invocationMock.expectAndReturn("invoke", result);
-        
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        actionMock.expectAndReturn("hasErrors", false);
-        invocationMock.expectAndReturn("invoke", result);
-        
+
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setIncludeMethods("*");
         validationInterceptor.intercept(invocation);
 
     public void testIncludesMethod() throws Exception {
         interceptor.setIncludeMethods("execute");
-        final String result = "testing123";
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        invocationMock.expectAndReturn("invoke", result);
-        
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        actionMock.expectAndReturn("hasErrors", false);
-        invocationMock.expectAndReturn("invoke", result);
-        
+
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setIncludeMethods("execute");
         validationInterceptor.intercept(invocation);
         interceptor.setExcludeMethods("execute,input,validate");
         interceptor.setIncludeMethods("execute");
         
-        final String result = "testing123";
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        invocationMock.expectAndReturn("invoke", result);
-        
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        actionMock.expectAndReturn("hasErrors", false);
-        invocationMock.expectAndReturn("invoke", result);
-        
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setExcludeMethods("execute,input,validate");
         validationInterceptor.setIncludeMethods("execute");
         interceptor.setExcludeMethods("*");
         interceptor.setIncludeMethods("*");
         
-        final String result = "testing123";
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        invocationMock.expectAndReturn("invoke", result);
-        
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        actionMock.expectAndReturn("hasErrors", false);
-        invocationMock.expectAndReturn("invoke", result);
-        
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setExcludeMethods("*");
         validationInterceptor.setIncludeMethods("*");
         interceptor.setExcludeMethods("*");
         interceptor.setIncludeMethods("execute");
         
-        final String result = "testing123";
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        invocationMock.expectAndReturn("invoke", result);
-        
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        actionMock.expectAndReturn("hasErrors", false);
-        invocationMock.expectAndReturn("invoke", result);
-        
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setExcludeMethods("*");
         validationInterceptor.setIncludeMethods("execute");
         interceptor.setExcludeMethods("execute,input,validate");
         interceptor.setIncludeMethods("*");
         
-        final String result = "testing123";
-        proxyMock.expectAndReturn("getMethod", "execute");
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("invoke", result);
-        
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("invoke", result);
-        
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setExcludeMethods("execute,input,validate");
         validationInterceptor.setIncludeMethods("*");
         interceptor.setExcludeMethods("input,validate");
         interceptor.setIncludeMethods("*");
         
-        final String result = "testing123";
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        actionMock.expect("validate");
-        invocationMock.expectAndReturn("invoke", result);
-        
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        actionMock.expectAndReturn("hasErrors", false);
-        invocationMock.expectAndReturn("invoke", result);
-        
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setExcludeMethods("input,validate");
         validationInterceptor.setIncludeMethods("*");
     }
 
     public void testNoValidateAction() throws Exception {
-        actionMock = new Mock(Action.class);
-        action = (Action) actionMock.proxy();
-
-        interceptor.setExcludeMethods("execute,input,validate");
-        interceptor.setIncludeMethods("execute");
-        
-        final String result = "testing123";
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getConfig", config);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("getAction", action);
-        invocationMock.expectAndReturn("getProxy", proxy);
-        proxyMock.expectAndReturn("getMethod", "execute");
-        invocationMock.expectAndReturn("invoke", result);
-        invocationMock.expectAndReturn("invoke", result);
-        
         ValidationInterceptor validationInterceptor = create();
         validationInterceptor.setExcludeMethods("execute,input,validate");
         validationInterceptor.setIncludeMethods("execute");
     protected void setUp() throws Exception {
         super.setUp();
         config = new ActionConfig.Builder("", "name", "").build();
-        actionMock = new Mock(ValidateAction.class);
-        action = (ValidateAction) actionMock.proxy();
-        invocationMock = new Mock(ActionInvocation.class);
+        action = EasyMock.createNiceMock(ValidateAction.class);
+        invocation = EasyMock.createNiceMock(ActionInvocation.class);
         interceptor = new DefaultWorkflowInterceptor();
-        proxyMock = new Mock(ActionProxy.class);
-        proxy = (ActionProxy) proxyMock.proxy();
-        invocationMock.expectAndReturn("getProxy", proxy);
-        invocation = (ActionInvocation) invocationMock.proxy();
+        proxy = EasyMock.createNiceMock(ActionProxy.class);
+
+        EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
+        EasyMock.expect(invocation.getAction()).andReturn(action).anyTimes();
+        EasyMock.expect(invocation.invoke()).andAnswer(new IAnswer<String>() {
+            @Override
+            public String answer() throws Throwable {
+                return result;
+            }
+        }).anyTimes();
+
+        EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
+        EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
+
+
+        EasyMock.replay(invocation);
+        EasyMock.replay(action);
+        EasyMock.replay(proxy);
+
+        ActionContext contex = new ActionContext(new HashMap<String, Object>());
+        ActionContext.setContext(contex);
+        contex.setActionInvocation(invocation);
     }
 
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
-        actionMock.verify();
-        invocationMock.verify();
     }
     
     protected ValidationInterceptor create() {

File core/src/test/java/com/opensymphony/xwork2/interceptor/ValidationInterceptorPrefixMethodInvocationTest.java

 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.validator.ValidationInterceptor;
 import org.easymock.MockControl;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+import org.easymock.IMocksControl;
 
 import java.util.HashMap;
 
  * @version $Date$ $Id$
  */
 public class ValidationInterceptorPrefixMethodInvocationTest extends XWorkTestCase {
+    private ActionInvocation invocation;
+    private ActionConfig config;
+    private ActionProxy proxy;
+    private ValidateAction action;
+    private String result;
+    private String method;
 
-	public void testPrefixMethodInvocation1() throws Exception {
-		
-		MockControl controlAction = MockControl.createControl(ValidateAction.class);
-		ValidateAction mockAction = (ValidateAction) controlAction.getMock();
-		mockAction.validateDoSave();
-		controlAction.setVoidCallable(1);
-		mockAction.validate();
-		controlAction.setVoidCallable();
-
-        ActionConfig config = new ActionConfig.Builder("", "action", "").build();
-		
-		MockControl controlActionProxy = MockControl.createControl(ActionProxy.class);
-		ActionProxy mockActionProxy = (ActionProxy) controlActionProxy.getMock();
-		mockActionProxy.getMethod();
-		controlActionProxy.setDefaultReturnValue("save");
-		mockActionProxy.getConfig();
-		controlActionProxy.setDefaultReturnValue(config);
-		
-		MockControl controlActionInvocation = MockControl.createControl(ActionInvocation.class);
-		ActionInvocation mockActionInvocation = (ActionInvocation) controlActionInvocation.getMock();
-		mockActionInvocation.getAction();
-		controlActionInvocation.setDefaultReturnValue(mockAction);
-		mockActionInvocation.getProxy();
-		controlActionInvocation.setDefaultReturnValue(mockActionProxy);
-		mockActionInvocation.invoke();
-		controlActionInvocation.setDefaultReturnValue(Action.INPUT);
-		
-		
-		controlAction.replay();
-		controlActionProxy.replay();
-		controlActionInvocation.replay();
+    public void testPrefixMethodInvocation1() throws Exception {
+		method = "save";
+		result = Action.INPUT;
 		
 		ValidationInterceptor interceptor = create();
-		String result = interceptor.intercept(mockActionInvocation);
+		String result = interceptor.intercept(invocation);
 		
 		assertEquals(Action.INPUT, result);
-		controlAction.verify();
-		controlActionProxy.verify();
-		controlActionInvocation.verify();
 	}
 	
 	public void testPrefixMethodInvocation2() throws Exception {
-		MockControl controlAction = MockControl.createControl(ValidateAction.class);
-		ValidateAction mockAction = (ValidateAction) controlAction.getMock();
-		mockAction.validateSubmit();
-		controlAction.setVoidCallable(1);
-		mockAction.validate();
-		controlAction.setVoidCallable();
+		method = "save";
+		result = "okok";
 
-        ActionConfig config = new ActionConfig.Builder("", "action", "").build();
-		
-		MockControl controlActionProxy = MockControl.createControl(ActionProxy.class);
-		ActionProxy mockActionProxy = (ActionProxy) controlActionProxy.getMock();
-		mockActionProxy.getMethod();
-		controlActionProxy.setDefaultReturnValue("submit");
-		mockActionProxy.getConfig();
-        controlActionProxy.setDefaultReturnValue(config);
-		
-		MockControl controlActionInvocation = MockControl.createControl(ActionInvocation.class);
-		ActionInvocation mockActionInvocation = (ActionInvocation) controlActionInvocation.getMock();
-		mockActionInvocation.getAction();
-		controlActionInvocation.setDefaultReturnValue(mockAction);
-		mockActionInvocation.getProxy();
-		controlActionInvocation.setDefaultReturnValue(mockActionProxy);
-		mockActionInvocation.invoke();
-		controlActionInvocation.setReturnValue("okok");
-		
-		
-		controlAction.replay();
-		controlActionProxy.replay();
-		controlActionInvocation.replay();
-		
 		ValidationInterceptor interceptor = create();
-		String result = interceptor.intercept(mockActionInvocation);
+		String result = interceptor.intercept(invocation);
 		
 		assertEquals("okok", result);
-		controlAction.verify();
-		controlActionProxy.verify();
-		controlActionInvocation.verify();
 	}
 	
 	protected ValidationInterceptor create() {
 		void validateSubmit();
 		String submit();
     }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        config = new ActionConfig.Builder("", "action", "").build();
+        invocation = EasyMock.createNiceMock(ActionInvocation.class);
+        proxy = EasyMock.createNiceMock(ActionProxy.class);
+        action = EasyMock.createNiceMock(ValidateAction.class);
+
+
+        EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
+        EasyMock.expect(invocation.getAction()).andReturn(action).anyTimes();
+        EasyMock.expect(invocation.invoke()).andAnswer(new IAnswer<String>() {
+            @Override
+            public String answer() throws Throwable {
+                return result;
+            }
+        }).anyTimes();
+
+        EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
+        EasyMock.expect(proxy.getMethod()).andAnswer(new IAnswer<String>() {
+            public String answer() throws Throwable {
+                return method;
+            }
+        }).anyTimes();
+
+
+        EasyMock.replay(invocation);
+        EasyMock.replay(action);
+        EasyMock.replay(proxy);
+
+        ActionContext contex = new ActionContext(new HashMap<String, Object>());
+        ActionContext.setContext(contex);
+        contex.setActionInvocation(invocation);
+    }
 }

File core/src/test/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManagerTest.java

  */
 package com.opensymphony.xwork2.validator;
 
-import com.opensymphony.xwork2.AnnotatedTestBean;
-import com.opensymphony.xwork2.SimpleAnnotationAction;
-import com.opensymphony.xwork2.XWorkTestCase;
-import com.opensymphony.xwork2.SimpleAction;
+import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.test.AnnotationDataAware2;
 import com.opensymphony.xwork2.test.AnnotationUser;
 import com.opensymphony.xwork2.test.SimpleAnnotationAction2;
 
 import java.util.List;
 
+import org.easymock.EasyMock;
+
 
 /**
  * AnnotationActionValidatorManagerTest
     @Override protected void setUp() throws Exception {
         super.setUp();
         annotationActionValidatorManager = (AnnotationActionValidatorManager) container.getInstance(ActionValidatorManager.class);
+
+        ActionConfig config = new ActionConfig.Builder("", "name", "").build();
+        ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
+        ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
+
+        EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
+        EasyMock.expect(invocation.getAction()).andReturn(null).anyTimes();
+        EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes();
+        EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
+        EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
+
+
+        EasyMock.replay(invocation);
+        EasyMock.replay(proxy);
+
+        ActionContext.getContext().setActionInvocation(invocation);
     }
 
     @Override protected void tearDown() throws Exception {
     }
 
     public void testBuildValidatorKey() {
-        String validatorKey = AnnotationActionValidatorManager.buildValidatorKey(SimpleAnnotationAction.class, alias);
-        assertEquals(SimpleAnnotationAction.class.getName() + "/" + alias, validatorKey);
+        String validatorKey = AnnotationActionValidatorManager.buildValidatorKey(SimpleAnnotationAction.class);
+        assertEquals(SimpleAnnotationAction.class.getName() + "/name|execute", validatorKey);
     }
 
     public void testBuildsValidatorsForAlias() {

File core/src/test/java/com/opensymphony/xwork2/validator/ExpressionValidatorTest.java

 import com.mockobjects.dynamic.Mock;
 import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.config.providers.MockConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.validator.validators.ExpressionValidator;
 
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import org.easymock.EasyMock;
+
 /**
  * Unit test for ExpressionValidator.
  *
         super.setUp();
 
         loadConfigurationProviders(new MockConfigurationProvider());
+
+        ActionConfig config = new ActionConfig.Builder("", "name", "").build();
+        ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
+        ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
+
+        EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
+        EasyMock.expect(invocation.getAction()).andReturn(null).anyTimes();
+        EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes();
+        EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
+        EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
+
+
+        EasyMock.replay(invocation);
+        EasyMock.replay(proxy);
+
+        ActionContext.getContext().setActionInvocation(invocation);
     }
 
 }

File core/src/test/java/com/opensymphony/xwork2/validator/StringValidatorTest.java

  */
 package com.opensymphony.xwork2.validator;
 
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ValidationAwareSupport;
-import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.*;
 import com.opensymphony.xwork2.config.providers.MockConfigurationProvider;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.test.Equidae;
 import com.opensymphony.xwork2.validator.validators.RequiredStringValidator;
 
 import java.util.List;
 import java.util.Map;
 
+import org.easymock.EasyMock;
+
 /**
  * @author Mark Woon
  * @author tm_jee (tm_jee (at) yahoo.co.uk )
     protected void setUp() throws Exception {
         super.setUp();
         loadConfigurationProviders(new MockConfigurationProvider());
+
+        ActionConfig config = new ActionConfig.Builder("", "name", "").build();
+        ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
+        ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
+
+        EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
+        EasyMock.expect(invocation.getAction()).andReturn(null).anyTimes();
+        EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes();
+        EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
+        EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
+
+
+        EasyMock.replay(invocation);
+        EasyMock.replay(proxy);
+
+        ActionContext.getContext().setActionInvocation(invocation);
     }
 }

File core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorModelTest.java

  */
 package com.opensymphony.xwork2.validator;
 
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.TestBean;
-import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.test.TestBean2;
 
 import java.util.*;
 
+import org.easymock.EasyMock;
+
 
 /**
  * VisitorFieldValidatorModelTest
         bean.setBirth(cal.getTime());
         bean.setCount(-1);
 
+        ActionConfig config = new ActionConfig.Builder("", "name", "").build();
+        ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
+        ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
+
+        EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
+        EasyMock.expect(invocation.getAction()).andReturn(null).anyTimes();
+        EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes();
+        EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
+        EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
+
+
+        EasyMock.replay(invocation);
+        EasyMock.replay(proxy);
+
+        ActionContext.getContext().setActionInvocation(invocation);
+
     }
 
     public void testModelFieldErrorsAddedWithoutFieldPrefix() throws Exception {

File core/src/test/java/com/opensymphony/xwork2/validator/VisitorFieldValidatorTest.java

  */
 package com.opensymphony.xwork2.validator;
 
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.TestBean;
-import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.*;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
+import com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor;
 
 import java.util.*;
 
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
 
 /**
  * VisitorFieldValidatorTest
         Calendar cal = new GregorianCalendar(1900, 01, 01);
         bean.setBirth(cal.getTime());
         bean.setCount(-1);
+
+        ActionConfig config = new ActionConfig.Builder("", "name", "").build();
+        ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
+        ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
+
+        EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes();
+        EasyMock.expect(invocation.getAction()).andReturn(action).anyTimes();
+        EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes();
+        EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes();
+        EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes();
+        
+
+        EasyMock.replay(invocation);
+        EasyMock.replay(proxy);
+
+        ActionContext.getContext().setActionInvocation(invocation);
     }
 
     public void testArrayValidation() throws Exception {