Revision: 956
          http://stripes.svn.sourceforge.net/stripes/?rev=956&view=rev
Author:   javelotinfo
Date:     2008-09-27 18:19:07 +0000 (Sat, 27 Sep 2008)

Log Message:
-----------
Fix for STS-600

Modified Paths:
--------------
    branches/1.5.x/build.properties
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/validation/ValidationMetadata.java

Added Paths:
-----------
    
branches/1.5.x/tests/src/net/sourceforge/stripes/validation/ValidationAnnotationsTest.java

Modified: branches/1.5.x/build.properties
===================================================================
--- branches/1.5.x/build.properties     2008-08-18 13:08:50 UTC (rev 955)
+++ branches/1.5.x/build.properties     2008-09-27 18:19:07 UTC (rev 956)
@@ -2,7 +2,7 @@
 ## Properties file used during the Stripes build process.
 ## Author: Tim Fennell
 ###############################################################################
-stripes.version=1.5RC1
+stripes.version=1.5.1-beta
 
 tomcat.username=operator
 tomcat.password=tank

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/validation/ValidationMetadata.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/validation/ValidationMetadata.java
       2008-08-18 13:08:50 UTC (rev 955)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/validation/ValidationMetadata.java
       2008-09-27 18:19:07 UTC (rev 956)
@@ -117,7 +117,7 @@
 
     /** Returns true if the field is required when processing the specified 
event. */
     public boolean requiredOn(String event) {
-        return this.required && (
+        return this.required && !this.ignore && (
                 (this.on == null) ||
                 (this.onIsPositive && this.on.contains(event)) ||
                 (!this.onIsPositive && !this.on.contains(event))

Added: 
branches/1.5.x/tests/src/net/sourceforge/stripes/validation/ValidationAnnotationsTest.java
===================================================================
--- 
branches/1.5.x/tests/src/net/sourceforge/stripes/validation/ValidationAnnotationsTest.java
                          (rev 0)
+++ 
branches/1.5.x/tests/src/net/sourceforge/stripes/validation/ValidationAnnotationsTest.java
  2008-09-27 18:19:07 UTC (rev 956)
@@ -0,0 +1,42 @@
+package net.sourceforge.stripes.validation;
+
+import net.sourceforge.stripes.StripesTestFixture;
+import net.sourceforge.stripes.action.ActionBean;
+import net.sourceforge.stripes.action.ActionBeanContext;
+import net.sourceforge.stripes.action.Resolution;
+import net.sourceforge.stripes.mock.MockRoundtrip;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Tests combinations of validation annotations.
+ *
+ * @author Freddy Daoud
+ */
+public class ValidationAnnotationsTest implements ActionBean {
+    private ActionBeanContext context;
+    public ActionBeanContext getContext() { return context; }
+    public void setContext(ActionBeanContext context) { this.context = 
context;}
+
+    @Validate(required=true, on="validateRequiredAndIgnored", ignore=true)
+    private String first;
+    public String getFirst() { return first; }
+    public void setFirst(String first) { this.first = first; }
+
+    public Resolution validateRequiredAndIgnored() { return null; }
+
+    /**
+     * Tests that a required field that is also ignored, should be ignored and 
should not produce
+     * a validation error.
+     *
+     * @see http://www.stripesframework.org/jira/browse/STS-600
+     */
+    @Test(groups="fast")
+    public void testValidateRequiredAndIgnored() throws Exception {
+        MockRoundtrip trip = new 
MockRoundtrip(StripesTestFixture.getServletContext(), getClass());
+        trip.execute("validateRequiredAndIgnored");
+        ActionBean actionBean = trip.getActionBean(getClass());
+        Assert.assertEquals(0, 
actionBean.getContext().getValidationErrors().size());
+    }
+}


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to