struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcucchi...@apache.org
Subject svn commit: r1199696 - in /struts/struts2/trunk/xwork-core/src: main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java test/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManagerTest.java
Date Wed, 09 Nov 2011 11:03:36 GMT
Author: mcucchiara
Date: Wed Nov  9 11:03:35 2011
New Revision: 1199696

URL: http://svn.apache.org/viewvc?rev=1199696&view=rev
Log:
WW-3699 - from now, buildValidatorKey includes the package name

Modified:
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManagerTest.java

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java?rev=1199696&r1=1199695&r2=1199696&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java
(original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java
Wed Nov  9 11:03:35 2011
@@ -19,12 +19,14 @@ package com.opensymphony.xwork2.validato
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ActionProxy;
+import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.FileManager;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
 import com.opensymphony.xwork2.validator.validators.VisitorFieldValidator;
+import org.apache.commons.lang.StringUtils;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -217,13 +219,18 @@ public class AnnotationActionValidatorMa
     protected static String buildValidatorKey(Class clazz) {
         ActionInvocation invocation = ActionContext.getContext().getActionInvocation();
         ActionProxy proxy = invocation.getProxy();
+        ActionConfig config = proxy.getConfig();
 
         //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(proxy.getConfig().getName());
+        if (StringUtils.isNotBlank(config.getPackageName())) {
+            sb.append(config.getPackageName());
+            sb.append("/");
+        }
+        sb.append(config.getName());
         sb.append("|");
         sb.append(proxy.getMethod());
         return sb.toString();

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManagerTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManagerTest.java?rev=1199696&r1=1199695&r2=1199696&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManagerTest.java
(original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManagerTest.java
Wed Nov  9 11:03:35 2011
@@ -23,10 +23,10 @@ import com.opensymphony.xwork2.test.Simp
 import com.opensymphony.xwork2.test.SimpleAnnotationAction3;
 import com.opensymphony.xwork2.util.FileManager;
 import com.opensymphony.xwork2.validator.validators.*;
+import org.easymock.EasyMock;
 
 import java.util.List;
 
-import org.easymock.EasyMock;
 
 
 /**
@@ -47,7 +47,7 @@ public class AnnotationActionValidatorMa
         super.setUp();
         annotationActionValidatorManager = (AnnotationActionValidatorManager) container.getInstance(ActionValidatorManager.class);
 
-        ActionConfig config = new ActionConfig.Builder("", "name", "").build();
+        ActionConfig config = new ActionConfig.Builder("packageName", "name", "").build();
         ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
         ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class);
 
@@ -71,7 +71,7 @@ public class AnnotationActionValidatorMa
 
     public void testBuildValidatorKey() {
         String validatorKey = AnnotationActionValidatorManager.buildValidatorKey(SimpleAnnotationAction.class);
-        assertEquals(SimpleAnnotationAction.class.getName() + "/name|execute", validatorKey);
+        assertEquals(SimpleAnnotationAction.class.getName() + "/packageName/name|execute",
validatorKey);
     }
 
     public void testBuildsValidatorsForAlias() {



Mime
View raw message