Commits

Anonymous committed d70caa8

Allow easy overriding of "excludeMethods" and "includeMethods" of ValidationInterceptor
Issue number: WW-1187
Obtained from:
Submitted by:
Reviewed by:

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

Comments (0)

Files changed (1)

tiger/src/test/com/opensymphony/xwork/interceptor/annotations/AnnotationWorkflowInterceptorTest.java

 import com.opensymphony.xwork.config.ConfigurationProvider;
 import com.opensymphony.xwork.config.entities.ActionConfig;
 import com.opensymphony.xwork.config.entities.PackageConfig;
+import com.opensymphony.xwork.config.entities.InterceptorMapping;
 
 /**
  * @author Zsolt Szasz, zsolt at lorecraft dot com
  * @author Rainer Hermanns
  */
 public class AnnotationWorkflowInterceptorTest extends TestCase {
-	private static final String ANNOTATED_ACTION = "annotatedAction";
-	private static final String SHORTCIRCUITED_ACTION = "shortCircuitedAction";
-	private final AnnotationWorkflowInterceptor annotationInterceptor = new AnnotationWorkflowInterceptor();
-	
-	public void setUp() {
+    private static final String ANNOTATED_ACTION = "annotatedAction";
+    private static final String SHORTCIRCUITED_ACTION = "shortCircuitedAction";
+    private final AnnotationWorkflowInterceptor annotationInterceptor = new AnnotationWorkflowInterceptor();
+
+    public void setUp() {
         ConfigurationManager.clearConfigurationProviders();
         ConfigurationManager.addConfigurationProvider(new MockConfigurationProvider());
         ConfigurationManager.getConfiguration().reload();
-	}
-	
-	public void testInterceptsBeforeAndAfter() throws Exception {
+    }
+
+    public void testInterceptsBeforeAndAfter() throws Exception {
         ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy("", ANNOTATED_ACTION, null, false, false);
         assertEquals(Action.SUCCESS, proxy.execute());
         AnnotatedAction action = (AnnotatedAction)proxy.getInvocation().getAction();
-        assertEquals("baseBefore-before-execute-beforeResult-after", action.log);		
-	}
-	
-	public void testInterceptsShortcircuitedAction() throws Exception {
+        assertEquals("baseBefore-before-execute-beforeResult-after", action.log);
+    }
+
+    public void testInterceptsShortcircuitedAction() throws Exception {
         ActionProxy proxy = ActionProxyFactory.getFactory().createActionProxy("", SHORTCIRCUITED_ACTION, null, false, false);
         assertEquals("shortcircuit", proxy.execute());
         ShortcircuitedAction action = (ShortcircuitedAction)proxy.getInvocation().getAction();
-        assertEquals("baseBefore-before", action.log);		
-	}
-	
-	private class MockConfigurationProvider implements ConfigurationProvider {
+        assertEquals("baseBefore-before", action.log);
+    }
+
+    private class MockConfigurationProvider implements ConfigurationProvider {
+
+        public void init(Configuration configuration) throws ConfigurationException {
+            PackageConfig packageConfig = new PackageConfig();
+            configuration.addPackageConfig("default", packageConfig);
+
+            ActionConfig actionConfig = new ActionConfig(null, AnnotatedAction.class, null, null,
+                    Arrays.asList(new Object[]{ new InterceptorMapping("annotationInterceptor", annotationInterceptor) }));
+            packageConfig.addActionConfig(ANNOTATED_ACTION, actionConfig);
+            actionConfig = new ActionConfig(null, ShortcircuitedAction.class, null, null,
+                    Arrays.asList(new Object[]{ new InterceptorMapping("annotationInterceptor", annotationInterceptor) }));
+            packageConfig.addActionConfig(SHORTCIRCUITED_ACTION, actionConfig);
+            configuration.addPackageConfig("defaultPackage", packageConfig);
+        }
 
-		public void init(Configuration configuration) throws ConfigurationException {
-			PackageConfig packageConfig = new PackageConfig();
-			configuration.addPackageConfig("default", packageConfig);
-			
-			ActionConfig actionConfig = new ActionConfig(null, AnnotatedAction.class, null, null, 
-					Arrays.asList(new Object[]{ annotationInterceptor }));
-			packageConfig.addActionConfig(ANNOTATED_ACTION, actionConfig);
-			actionConfig = new ActionConfig(null, ShortcircuitedAction.class, null, null, 
-					Arrays.asList(new Object[]{ annotationInterceptor }));
-			packageConfig.addActionConfig(SHORTCIRCUITED_ACTION, actionConfig);
-	        configuration.addPackageConfig("defaultPackage", packageConfig);			
-		}
+        public boolean needsReload() {
+            return false;
+        }
 
-		public boolean needsReload() {
-			return false;
-		}
-		
-		public void destroy() { }
-	}
+        public void destroy() { }
+    }
 }