myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdebussc...@apache.org
Subject svn commit: r1066035 - in /myfaces/extensions/validator/trunk: test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ validation-modules/property-validation/src/main/java/org/apache/myfaces/e...
Date Tue, 01 Feb 2011 12:58:21 GMT
Author: rdebusscher
Date: Tue Feb  1 12:58:20 2011
New Revision: 1066035

URL: http://svn.apache.org/viewvc?rev=1066035&view=rev
Log:
EXTVAL-124, EXTVAL-125, EXTVAL-126

Added:
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestBean.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestCase.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestBean.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestCase.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestBean.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestCase.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestBean.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestCase.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestBean.java
    myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java
Modified:
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java
    myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/resources/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestBean.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestBean.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,38 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIs;
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
+
+import java.util.Date;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs1TestBean
+{
+
+    private Date property1;
+
+    @DateIs(valueOf = "property1", type = DateIsType.before)
+    private Date property2;
+
+    public Date getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(Date property1)
+    {
+        this.property1 = property1;
+    }
+
+    public Date getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(Date property2)
+    {
+        this.property2 = property2;
+    }
+}

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestCase.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestCase.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,138 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.convert.DateTimeConverter;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs1TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public DateIs1TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        DateIs1TestBean bean = new DateIs1TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+
+        DateTimeConverter converter = new DateTimeConverter();
+        converter.setPattern("DD/MM/yyyy");
+        inputComponent1.setConverter(converter);
+        inputComponent2.setConverter(converter);
+    }
+
+    @Test
+    public void testDateIsBeforeCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("23/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsBeforeWrong() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("23/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+    }
+
+    @Test
+    public void testDateIsBeforeTargetNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsBeforeSourceNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestBean.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestBean.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,38 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIs;
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
+
+import java.util.Date;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs2TestBean
+{
+    private Date property1;
+
+    @DateIs(valueOf = "property1", type = DateIsType.after)
+    private Date property2;
+
+    public Date getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(Date property1)
+    {
+        this.property1 = property1;
+    }
+
+    public Date getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(Date property2)
+    {
+        this.property2 = property2;
+    }
+
+}

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestCase.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestCase.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,138 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.convert.DateTimeConverter;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs2TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public DateIs2TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        DateIs2TestBean bean = new DateIs2TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+
+        DateTimeConverter converter = new DateTimeConverter();
+        converter.setPattern("DD/MM/yyyy");
+        inputComponent1.setConverter(converter);
+        inputComponent2.setConverter(converter);
+    }
+
+    @Test
+    public void testDateIsAfterCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("23/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsAfterWrong() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("23/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+    }
+
+    @Test
+    public void testDateIsAfterTargetNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsAfterSourceNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestBean.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestBean.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,38 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIs;
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
+
+import java.util.Date;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs3TestBean
+{
+    private Date property1;
+
+    @DateIs(valueOf = "property1", type = DateIsType.same)
+    private Date property2;
+
+    public Date getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(Date property1)
+    {
+        this.property1 = property1;
+    }
+
+    public Date getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(Date property2)
+    {
+        this.property2 = property2;
+    }
+
+}

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestCase.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestCase.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,143 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.convert.DateTimeConverter;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs3TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public DateIs3TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        DateIs3TestBean bean = new DateIs3TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+
+        DateTimeConverter converter = new DateTimeConverter();
+        converter.setPattern("DD/MM/yyyy");
+        inputComponent1.setConverter(converter);
+        inputComponent2.setConverter(converter);
+    }
+
+    @Test
+    public void testDateIsSameCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsSameWrong() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("23/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+    }
+
+    @Test
+    public void testDateIsSameTargetNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+
+    }
+
+    @Test
+    public void testDateIssSameSourceNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+    }
+
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestBean.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestBean.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,38 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIs;
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
+
+import java.util.Date;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs4TestBean
+{
+    private Date property1;
+
+    @DateIs(valueOf = "property1", type = DateIsType.beforeOrSame)
+    private Date property2;
+
+    public Date getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(Date property1)
+    {
+        this.property1 = property1;
+    }
+
+    public Date getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(Date property2)
+    {
+        this.property2 = property2;
+    }
+
+}

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestCase.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestCase.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,158 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.convert.DateTimeConverter;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs4TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public DateIs4TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        DateIs4TestBean bean = new DateIs4TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+
+        DateTimeConverter converter = new DateTimeConverter();
+        converter.setPattern("DD/MM/yyyy");
+        inputComponent1.setConverter(converter);
+        inputComponent2.setConverter(converter);
+    }
+
+    @Test
+    public void testDateIsBeforeCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("23/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsBeforeSameCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsBeforeWrong() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("23/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+    }
+
+    @Test
+    public void testDateIsBeforeSourceNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsBeforeTargetNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+}
\ No newline at end of file

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestBean.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestBean.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,38 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIs;
+import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
+
+import java.util.Date;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs5TestBean
+{
+    private Date property1;
+
+    @DateIs(valueOf = "property1", type = DateIsType.afterOrSame)
+    private Date property2;
+
+    public Date getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(Date property1)
+    {
+        this.property1 = property1;
+    }
+
+    public Date getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(Date property2)
+    {
+        this.property2 = property2;
+    }
+
+}

Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java?rev=1066035&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java Tue Feb  1 12:58:20 2011
@@ -0,0 +1,158 @@
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.convert.DateTimeConverter;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs5TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public DateIs5TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        DateIs5TestBean bean = new DateIs5TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+
+        DateTimeConverter converter = new DateTimeConverter();
+        converter.setPattern("DD/MM/yyyy");
+        inputComponent1.setConverter(converter);
+        inputComponent2.setConverter(converter);
+    }
+
+    @Test
+    public void testDateIsAfterCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("23/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsAfterSameCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsAfterSameWrong() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("23/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+    }
+
+    @Test
+    public void testDateIsAfterSameSourceNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsAfterSameTargetNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+}
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java?rev=1066035&r1=1066034&r2=1066035&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIs.java Tue Feb  1 12:58:20 2011
@@ -57,9 +57,15 @@ public @interface DateIs
 
     String notAfterErrorMsgKey() default "wrong_date_not_after";
 
+    String notBeforeOrSameErrorMsgKey() default "wrong_date_not_before_or_same";
+
+    String notAfterOrSameErrorMsgKey() default "wrong_date_not_after_or_same";
+
     String notEqualErrorMsgKey() default "wrong_date_not_equal";
 
     int errorMessageDateStyle() default DateFormat.MEDIUM;
 
+    String errorMessageDatePattern() default "";
+
     Class<? extends ValidationParameter>[] parameters() default ViolationSeverity.Error.class;
 }
\ No newline at end of file

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java?rev=1066035&r1=1066034&r2=1066035&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/annotation/DateIsType.java Tue Feb  1 12:58:20 2011
@@ -18,8 +18,6 @@
  */
 package org.apache.myfaces.extensions.validator.crossval.annotation;
 
-import org.apache.myfaces.extensions.validator.internal.ToDo;
-import org.apache.myfaces.extensions.validator.internal.Priority;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
 import org.apache.myfaces.extensions.validator.internal.UsageCategory;
 
@@ -27,9 +25,8 @@ import org.apache.myfaces.extensions.val
  * @author Gerhard Petracek
  * @since 1.x.1
  */
-@ToDo(value = Priority.MEDIUM, description = "beforeOrSame, afterOrSame")
 @UsageInformation(UsageCategory.API)
 public enum DateIsType
 {
-    before, after, same
+    before, after, same, beforeOrSame, afterOrSame
 }

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java?rev=1066035&r1=1066034&r2=1066035&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/java/org/apache/myfaces/extensions/validator/crossval/strategy/DateIsStrategy.java Tue Feb  1 12:58:20 2011
@@ -19,7 +19,6 @@
 package org.apache.myfaces.extensions.validator.crossval.strategy;
 
 import org.apache.myfaces.extensions.validator.crossval.annotation.DateIs;
-import org.apache.myfaces.extensions.validator.crossval.annotation.DateIsType;
 import org.apache.myfaces.extensions.validator.crossval.annotation.MessageTarget;
 import org.apache.myfaces.extensions.validator.baseval.annotation.SkipValidationSupport;
 import org.apache.myfaces.extensions.validator.internal.UsageInformation;
@@ -27,6 +26,7 @@ import org.apache.myfaces.extensions.val
 
 import javax.faces.context.FacesContext;
 import java.text.DateFormat;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.MissingResourceException;
 import java.util.logging.Level;
@@ -41,6 +41,8 @@ public class DateIsStrategy extends Abst
 {
     protected static final String TOO_EARLY = "early";
     protected static final String TOO_LATE = "late";
+    protected static final String TOO_EARLY_SAME = "earlyNotSame";
+    protected static final String TOO_LATE_SAME = "lateNotSame";
     protected static final String NOT_EQUAL_DATE_TIME = "not equal";
     protected static final String RESULT_KEY = "result";
     protected static final String COMPARED_VALUE_KEY = "target value";
@@ -53,36 +55,55 @@ public class DateIsStrategy extends Abst
 
     public boolean isViolation(Object object1, Object object2, DateIs annotation)
     {
-        boolean violationFound;
-
-        if (annotation.type().equals(DateIsType.same))
+        boolean violationFound = false;
+        switch (annotation.type())
         {
-            violationFound = object1 != null && !object1.equals(object2);
-
-            if (violationFound)
-            {
-                this.violationResultStorage.put(RESULT_KEY, NOT_EQUAL_DATE_TIME);
-            }
-        }
-        else if (annotation.type().equals(DateIsType.before))
-        {
-            violationFound = object1 != null && object2 != null &&
-                            (!new Date(((Date) object1).getTime()).before((Date) object2) || object1.equals(object2));
-
-            if (violationFound)
-            {
-                this.violationResultStorage.put(RESULT_KEY, TOO_LATE);
-            }
-        }
-        else
-        {
-            violationFound = object1 != null && object2 != null &&
-                            (!new Date(((Date) object1).getTime()).after((Date) object2) || object1.equals(object2));
-
-            if (violationFound)
-            {
-                this.violationResultStorage.put(RESULT_KEY, TOO_EARLY);
-            }
+            case before:
+                violationFound = object1 != null && object2 != null &&
+                              (!new Date(((Date) object1).getTime()).before((Date) object2) || object1.equals(object2));
+
+                if (violationFound)
+                {
+                    this.violationResultStorage.put(RESULT_KEY, TOO_LATE);
+                }
+                break;
+            case after:
+                violationFound = object1 != null && object2 != null &&
+                               (!new Date(((Date) object1).getTime()).after((Date) object2) || object1.equals(object2));
+
+                if (violationFound)
+                {
+                    this.violationResultStorage.put(RESULT_KEY, TOO_EARLY);
+                }
+                break;
+            case same:
+                violationFound = object1 != null && !object1.equals(object2);
+
+                if (violationFound)
+                {
+                    this.violationResultStorage.put(RESULT_KEY, NOT_EQUAL_DATE_TIME);
+                }
+                break;
+            case beforeOrSame:
+                violationFound = object1 != null && object2 != null &&
+                                new Date(((Date) object1).getTime()).after((Date) object2);
+
+                if (violationFound)
+                {
+                    this.violationResultStorage.put(RESULT_KEY, TOO_LATE_SAME);
+                }
+                break;
+            case afterOrSame:
+                violationFound = object1 != null && object2 != null &&
+                                new Date(((Date) object1).getTime()).before((Date) object2);
+
+                if (violationFound)
+                {
+                    this.violationResultStorage.put(RESULT_KEY, TOO_EARLY_SAME);
+                }
+                break;
+            default:
+                // Nothing to do.
         }
 
         if (violationFound)
@@ -115,10 +136,18 @@ public class DateIsStrategy extends Abst
         {
             return getNotAfterErrorMsgKey(annotation);
         }
+        else if (TOO_EARLY_SAME.equals(result))
+        {
+            return getNotAfterOrSameErrorMsgKey(annotation);
+        }
         else if (TOO_LATE.equals(result))
         {
             return getNotBeforeErrorMsgKey(annotation);
         }
+        else if (TOO_LATE_SAME.equals(result))
+        {
+            return getNotBeforeOrSameErrorMsgKey(annotation);
+        }
         else
         {
             return getNotEqualErrorMsgKey(annotation);
@@ -127,35 +156,47 @@ public class DateIsStrategy extends Abst
 
     private String reverseResult(String result)
     {
+
         if (TOO_EARLY.equals(result))
         {
             return TOO_LATE;
         }
-        else
+        else if (TOO_EARLY_SAME.equals(result))
+        {
+            return TOO_LATE_SAME;
+        }
+        else if (TOO_LATE_SAME.equals(result))
+        {
+            return TOO_EARLY_SAME;
+        }
+        else if (TOO_LATE.equals(result))
         {
             return TOO_EARLY;
         }
+        return result;
     }
 
     @Override
     protected String getErrorMessageSummary(DateIs annotation, boolean isTargetComponent)
     {
+        /*
         if (!isTargetComponent)
         {
             return super.getErrorMessageSummary(annotation, isTargetComponent);
         }
-
+        */
         return getErrorMessage(getValidationErrorMsgKey(annotation, isTargetComponent), annotation, isTargetComponent);
     }
 
     @Override
     protected String getErrorMessageDetail(DateIs annotation, boolean isTargetComponent)
     {
+        /*
         if (!isTargetComponent)
         {
             return super.getErrorMessageDetail(annotation, isTargetComponent);
         }
-
+        */
         try
         {
             return getErrorMessage(getValidationErrorMsgKey(annotation, isTargetComponent)
@@ -195,8 +236,8 @@ public class DateIsStrategy extends Abst
     {
         String message = resolveMessage(key);
 
-        DateFormat dateFormat = DateFormat.getDateInstance(annotation.errorMessageDateStyle(),
-            FacesContext.getCurrentInstance().getViewRoot().getLocale());
+        DateFormat dateFormat = getDateFormat(annotation.errorMessageDateStyle(),
+                annotation.errorMessageDatePattern());
 
         String result;
 
@@ -215,6 +256,15 @@ public class DateIsStrategy extends Abst
         return result;
     }
 
+    private DateFormat getDateFormat(int dateStyle, String datePattern)
+    {
+        if (datePattern == null || datePattern.length() == 0)
+        {
+            return DateFormat.getDateInstance(dateStyle, FacesContext.getCurrentInstance().getViewRoot().getLocale());
+        }
+        return new SimpleDateFormat(datePattern, FacesContext.getCurrentInstance().getViewRoot().getLocale());
+    }
+
     /*
      * private
      */
@@ -227,6 +277,15 @@ public class DateIsStrategy extends Abst
         return annotation.validationErrorMsgKey();
     }
 
+    private String getNotAfterOrSameErrorMsgKey(DateIs annotation)
+    {
+        if (annotation.validationErrorMsgKey().equals(""))
+        {
+            return annotation.notAfterOrSameErrorMsgKey();
+        }
+        return annotation.validationErrorMsgKey();
+    }
+
     private String getNotBeforeErrorMsgKey(DateIs annotation)
     {
         if (annotation.validationErrorMsgKey().equals(""))
@@ -236,6 +295,15 @@ public class DateIsStrategy extends Abst
         return annotation.validationErrorMsgKey();
     }
 
+    private String getNotBeforeOrSameErrorMsgKey(DateIs annotation)
+    {
+        if (annotation.validationErrorMsgKey().equals(""))
+        {
+            return annotation.notBeforeOrSameErrorMsgKey();
+        }
+        return annotation.validationErrorMsgKey();
+    }
+
     private String getNotEqualErrorMsgKey(DateIs annotation)
     {
         if (annotation.validationErrorMsgKey().equals(""))

Modified: myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/resources/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/resources/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties?rev=1066035&r1=1066034&r2=1066035&view=diff
==============================================================================
--- myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/resources/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties (original)
+++ myfaces/extensions/validator/trunk/validation-modules/property-validation/src/main/resources/org/apache/myfaces/extensions/validator/crossval/message/bundle/validation_messages.properties Tue Feb  1 12:58:20 2011
@@ -27,8 +27,14 @@ wrong_date_detail=Wrong date
 wrong_date_not_before=Date has to be after {0}
 wrong_date_not_before_detail=Date has to be after {0}
 
+wrong_date_not_before_or_same=Date has to be after or equals to {0}
+wrong_date_not_before_or_same_detail=Date has to be after or equals to {0}
+
 wrong_date_not_after=Date has to be before {0}
 wrong_date_not_after_detail=Date has to be before {0}
 
+wrong_date_not_after_or_same=Date has to be before or equals to {0}
+wrong_date_not_after_or_same_detail=Date has to be before or equals to {0}
+
 wrong_date_not_equal=Date isn't equal to {0}
 wrong_date_not_equal_detail=Date isn't equal to {0}
\ No newline at end of file



Mime
View raw message