You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by rd...@apache.org on 2011/05/30 10:38:54 UTC
svn commit: r1129058 [10/13] - in
/myfaces/extensions/validator/branches/branch_for_jsf_2_0: ./ test-modules/
test-modules/base-test-infrastructure/
test-modules/base-test-infrastructure/src/
test-modules/base-test-infrastructure/src/test/ test-modules...
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/ConstraintSourceAwareValidation6TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/ConstraintSourceAwareValidation6TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/ConstraintSourceAwareValidation6TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/ConstraintSourceAwareValidation6TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,102 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource;
+
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom.CustomConstraintSource;
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom.CustomIgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom.CustomTargetProperty;
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom.CustomTargetPropertyId;
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.model.ConstraintSourceAware6Bean;
+import org.junit.Test;
+
+import javax.faces.application.FacesMessage;
+import java.lang.annotation.Annotation;
+
+public class ConstraintSourceAwareValidation6TestCase extends
+ AbstractConstraintSourceTestCase<ConstraintSourceAware6Bean>
+{
+
+ protected ConstraintSourceAware6Bean getBeanToTest()
+ {
+ return new ConstraintSourceAware6Bean();
+ }
+
+
+ @Override
+ protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+ {
+ return new DefaultExtValCoreConfiguration() {
+ @Override
+ public Class<? extends Annotation> constraintSourceAnnotation()
+ {
+ return CustomConstraintSource.class;
+ }
+
+ @Override
+ public Class<? extends Annotation> ignoreConstraintSourceAnnotation()
+ {
+ return CustomIgnoreConstraintSource.class;
+ }
+
+ @Override
+ public Class<? extends Annotation> targetPropertyAnnotation()
+ {
+ return CustomTargetProperty.class;
+ }
+
+ @Override
+ public Class<? extends Annotation> targetPropertyIdAnnotation()
+ {
+ return CustomTargetPropertyId.class;
+ }
+ };
+ }
+
+ @Test
+ public void testCustomAnnotations1()
+ {
+ createValueBindingForComponent(this.inputComponent1,
+ "#{testBean.property1}");
+ setValueToValidate(this.inputComponent1, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent1);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+
+ @Test
+ public void testCustomAnnotations2()
+ {
+ createValueBindingForComponent(this.inputComponent2,
+ "#{testBean.property2}");
+ setValueToValidate(this.inputComponent2, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent2);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+
+ @Test
+ public void testCustomAnnotations3()
+ {
+ createValueBindingForComponent(this.inputComponent3,
+ "#{testBean.property3}");
+ setValueToValidate(this.inputComponent3, "");
+
+ validateComponents();
+
+ assertComponentValid(this.inputComponent3);
+ assertNavigationBlocked(false);
+
+ checkMessageCount(0);
+ }
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomConstraintSource.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomConstraintSource.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomConstraintSource.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomConstraintSource.java Mon May 30 08:38:45 2011
@@ -0,0 +1,18 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target({TYPE, FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomConstraintSource
+{
+ public abstract Class value();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomIgnoreConstraintSource.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomIgnoreConstraintSource.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomIgnoreConstraintSource.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomIgnoreConstraintSource.java Mon May 30 08:38:45 2011
@@ -0,0 +1,16 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target( { FIELD, METHOD })
+@Retention(RUNTIME)
+@Documented
+public @interface CustomIgnoreConstraintSource
+{
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomTargetProperty.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomTargetProperty.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomTargetProperty.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomTargetProperty.java Mon May 30 08:38:45 2011
@@ -0,0 +1,17 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomTargetProperty
+{
+ public abstract String value();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomTargetPropertyId.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomTargetPropertyId.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomTargetPropertyId.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/custom/CustomTargetPropertyId.java Mon May 30 08:38:45 2011
@@ -0,0 +1,18 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomTargetPropertyId
+{
+ public abstract Class<? extends Annotation> value();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware1Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware1Bean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware1Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware1Bean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,31 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+
+@ConstraintSource(ConstraintSourceAware1MetaDataBean.class)
+public class ConstraintSourceAware1Bean
+{
+ private String property1;
+
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware1MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware1MetaDataBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware1MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware1MetaDataBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,23 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+
+public class ConstraintSourceAware1MetaDataBean
+{
+ @Required
+ private String property1;
+
+ private String property2;
+
+ @Required
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware2Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware2Bean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware2Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware2Bean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,35 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.IgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.TargetProperty;
+
+@ConstraintSource(ConstraintSourceAware2MetaDataBean.class)
+public class ConstraintSourceAware2Bean
+{
+ @IgnoreConstraintSource
+ private String property1;
+
+ @TargetProperty("property3")
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware2MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware2MetaDataBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware2MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware2MetaDataBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,23 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+public class ConstraintSourceAware2MetaDataBean
+{
+ @Required
+ private String property1;
+
+ private String property3;
+
+ @Required
+ public String getProperty3()
+ {
+ return property3;
+ }
+
+ public void setProperty3(String property3)
+ {
+ this.property3 = property3;
+ }
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware3Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware3Bean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware3Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware3Bean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,31 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+
+public class ConstraintSourceAware3Bean
+{
+ private String property1;
+
+ @ConstraintSource(ConstraintSourceAware3MetaDataBean.class)
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware3MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware3MetaDataBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware3MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware3MetaDataBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,12 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+public class ConstraintSourceAware3MetaDataBean
+{
+ @Required
+ private String property1;
+
+ @Required
+ private String property2;
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware4Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware4Bean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware4Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware4Bean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,33 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.TargetProperty;
+
+public class ConstraintSourceAware4Bean
+{
+ private String property1;
+
+ private String property2;
+
+ @TargetProperty("property")
+ @ConstraintSource(ConstraintSourceAware4MetaDataBean.class)
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware4MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware4MetaDataBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware4MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware4MetaDataBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,15 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+public class ConstraintSourceAware4MetaDataBean
+{
+ private String property;
+
+ @Required
+ public String getProperty()
+ {
+ return property;
+ }
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware5Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware5Bean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware5Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware5Bean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,34 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.TargetPropertyId;
+
+@ConstraintSource(ConstraintSourceAware5MetaDataBean.class)
+public class ConstraintSourceAware5Bean
+{
+ private String property1;
+
+ @TargetPropertyId(Target4.class)
+ private String property2;
+
+ @TargetPropertyId(Target3.class)
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware5MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware5MetaDataBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware5MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware5MetaDataBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,24 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+public class ConstraintSourceAware5MetaDataBean
+{
+ @Required
+ @Target3
+ private String property3;
+
+ private String property4;
+
+ @Required
+ @Target4
+ public String getProperty4()
+ {
+ return property4;
+ }
+
+ public void setProperty4(String property4)
+ {
+ this.property4 = property4;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware6Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware6Bean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware6Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware6Bean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,49 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom.CustomConstraintSource;
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom.CustomIgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom.CustomTargetProperty;
+import org.apache.myfaces.extensions.validator.test.propval.constraintsource.custom.CustomTargetPropertyId;
+
+@CustomConstraintSource(ConstraintSourceAware6MetaDataBean.class)
+public class ConstraintSourceAware6Bean
+{
+ private String property1;
+
+ @CustomTargetPropertyId(Target4.class)
+ private String property2;
+
+ @CustomIgnoreConstraintSource
+ private String property3;
+
+ @CustomTargetProperty("property3")
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+
+ public String getProperty3()
+ {
+ return property3;
+ }
+
+ public void setProperty3(String property3)
+ {
+ this.property3 = property3;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware6MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware6MetaDataBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware6MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/ConstraintSourceAware6MetaDataBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,24 @@
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+public class ConstraintSourceAware6MetaDataBean
+{
+ @Required
+ private String property3;
+
+ private String property4;
+
+ @Required
+ @Target4
+ public String getProperty4()
+ {
+ return property4;
+ }
+
+ public void setProperty4(String property4)
+ {
+ this.property4 = property4;
+ }
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/Target3.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/Target3.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/Target3.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/Target3.java Mon May 30 08:38:45 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface Target3
+{
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/Target4.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/Target4.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/Target4.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/model/Target4.java Mon May 30 08:38:45 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.constraintsource.model;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface Target4
+{
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class CrossValTestBean
+{
+ private String property1;
+
+ @Equals("property1")
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+ public String getProperty2()
+ {
+ return property2;
+ }
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class CrossValTestCase extends AbstractPropertyValidationTestCase
+{
+
+ HtmlInputText inputComponent1 = null;
+ HtmlInputText inputComponent2 = null;
+
+ UIViewRoot rootComponent = null;
+
+ public CrossValTestCase()
+ {
+ inputComponent1 = null;
+ inputComponent2 = null;
+ rootComponent = null;
+ }
+
+ @Override
+ protected void setUpTestCase()
+ {
+ super.setUpTestCase();
+ CrossValTestBean bean = new CrossValTestBean();
+ 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");
+ }
+
+ @Test
+ public void testEqualsCorrect() throws Exception
+ {
+ createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+ createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+ //decode
+ inputComponent1.setSubmittedValue("1d3");
+ inputComponent2.setSubmittedValue("1d3");
+
+ //validate
+ inputComponent1.validate(facesContext);
+ inputComponent2.validate(facesContext);
+
+ processCrossValidation();
+ checkMessageCount(0);
+
+ //no update model needed
+ }
+
+ @Test
+ public void testEqualsFail() throws Exception
+ {
+ createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+ createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+ //decode
+ inputComponent1.setSubmittedValue("1d3");
+ inputComponent2.setSubmittedValue("1d4");
+
+ //validate
+ inputComponent1.validate(facesContext);
+ inputComponent2.validate(facesContext);
+
+
+ processCrossValidation();
+ checkMessageCount(2);
+
+ //no update model needed
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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;
+import java.util.Locale;
+
+/**
+ * @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/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs1TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs2TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs3TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs4TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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/branches/branch_for_jsf_2_0/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/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+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;
+ }
+
+}