You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2009/11/04 13:07:01 UTC
svn commit: r832716 [3/4] - in /myfaces/extensions/validator/trunk: ./
test-modules/ test-modules/base-test-infrastructure/
test-modules/base-test-infrastructure/src/
test-modules/base-test-infrastructure/src/test/
test-modules/base-test-infrastructure...
Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/ParameterTestCase.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/baseval/parameter/ParameterTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/ParameterTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/ParameterTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,136 @@
+/*
+ * 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.baseval.parameter;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameterExtractor;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.DefaultValidationParameterExtractor;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.DisableClientSideValidation;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
+import org.apache.myfaces.extensions.validator.core.interceptor.PropertyValidationInterceptor;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+import javax.faces.application.FacesMessage;
+
+public class ParameterTestCase extends TestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(ParameterTestCase.class);
+ }
+
+ public void testParameterStyleOne() throws Exception
+ {
+ ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+ TestPerson person = new TestPerson();
+ Required required = person.getClass().getDeclaredField("firstName").getAnnotation(Required.class);
+
+ assertNotNull(extractor.extract(required).containsKey(ViolationSeverity.class));
+ assertNotNull(extractor.extract(required, ViolationSeverity.class).iterator().next());
+ assertEquals(extractor.extract(required, ViolationSeverity.class).iterator().next(), FacesMessage.SEVERITY_WARN);
+ }
+
+ public void testParameterStyleTwo() throws Exception
+ {
+ ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+ TestPerson person = new TestPerson();
+ Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+ assertNotNull(extractor.extract(required).containsKey("client_side_validation_support"));
+ assertNotNull(extractor.extract(required, "client_side_validation_support").iterator().next());
+ assertEquals(extractor.extract(required, "client_side_validation_support").iterator().next(), false);
+ }
+
+ public void testParameterStyleThree() throws Exception
+ {
+ ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+ TestPerson person = new TestPerson();
+ Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+ assertNotNull(extractor.extract(required).containsKey(TestPriority.class));
+ assertNotNull(extractor.extract(required, TestPriority.class).iterator().next());
+ assertEquals(extractor.extract(required, TestPriority.class, Integer.class).iterator().next(), new Integer(1));
+ assertEquals(extractor.extract(required, TestPriority.class, String.class).size(), 2);
+ assertEquals(extractor.extract(required, TestPriority.class, String.class, TestPriority.ShortDescription.class), "do it asap");
+ assertEquals(extractor.extract(required, TestPriority.class, String.class, TestPriority.LongDescription.class), "do it immediately");
+ }
+
+ public void testParameterStyleFour() throws Exception
+ {
+ ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+ TestPerson person = new TestPerson();
+ Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+ assertNotNull(extractor.extract(required).containsKey(PropertyValidationInterceptor.class));
+ assertNotNull(extractor.extract(required, PropertyValidationInterceptor.class).iterator().next());
+ assertEquals(extractor.extract(required, PropertyValidationInterceptor.class).size(), 1);
+ assertEquals(extractor.extract(required, PropertyValidationInterceptor.class, PropertyValidationInterceptor.class).iterator().next().getClass().getName(), TestValidationInterceptor.class.getName());
+ }
+
+ public void testParameterStyleFive() throws Exception
+ {
+ ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+ TestPerson person = new TestPerson();
+ Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+ assertNotNull(extractor.extract(required).containsKey(DisableClientSideValidation.class));
+ assertNotNull(extractor.extract(required, DisableClientSideValidation.class).iterator().next());
+ assertEquals(extractor.extract(required, DisableClientSideValidation.class).size(), 1);
+ assertEquals(extractor.extract(required, DisableClientSideValidation.class, Class.class).size(), 1);
+ assertEquals(extractor.extract(required, DisableClientSideValidation.class, Class.class).iterator().next().getName(), DisableClientSideValidation.class.getName());
+ }
+
+ /*
+ * TODO these tests work in an ide but not via commandline - it's a Surefire issue
+ */
+ /*
+ public void testParameterStyleSix() throws Exception
+ {
+ ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+ TestPerson person = new TestPerson();
+ Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+ assertNotNull(extractor.extract(required).containsKey(TestValidatorProvider.class));
+ assertNotNull(extractor.extract(required, TestValidatorProvider.class).iterator().next());
+ assertEquals(extractor.extract(required, TestValidatorProvider.class, Class.class).size(), 2);
+ }
+
+ public void testParameterStyleSeven() throws Exception
+ {
+ ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+ TestPerson person = new TestPerson();
+ Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+ assertNotNull(extractor.extract(required).containsKey(TestValidatorProvider.class));
+ for (Class currentClass : extractor.extract(required, TestValidatorProvider.class, Class.class))
+ {
+ assertTrue(TestValidatorProvider.class.isAssignableFrom(currentClass));
+ }
+ }
+ */
+}
\ 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/baseval/parameter/TestAllowClientSideValidation.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/baseval/parameter/TestAllowClientSideValidation.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestAllowClientSideValidation.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestAllowClientSideValidation.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,32 @@
+/*
+ * 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.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterValue;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterKey;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+
+public interface TestAllowClientSideValidation extends ValidationParameter
+{
+ @ParameterKey
+ public String KEY = "client_side_validation_support";
+
+ @ParameterValue
+ boolean value = true;
+}
\ 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/baseval/parameter/TestDenyClientSideValidation.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/baseval/parameter/TestDenyClientSideValidation.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestDenyClientSideValidation.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestDenyClientSideValidation.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,32 @@
+/*
+ * 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.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterValue;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterKey;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+
+public interface TestDenyClientSideValidation extends ValidationParameter
+{
+ @ParameterKey
+ public String key = "client_side_validation_support";
+
+ @ParameterValue
+ boolean value = 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/baseval/parameter/TestPerson.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/baseval/parameter/TestPerson.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPerson.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPerson.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,116 @@
+/*
+ * 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.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.DisableClientSideValidation;
+
+public class TestPerson
+{
+ @Required(parameters = {ViolationSeverity.Warn.class, TestAllowClientSideValidation.class})
+ private String firstName;
+
+ @Required(parameters = {
+ ViolationSeverity.Info.class,
+ TestDenyClientSideValidation.class,
+ TestPriorityHigh.class,
+ TestValidationInterceptor.class,
+ DisableClientSideValidation.class,
+ //LoginValidator.class,
+ AdditionalValidator.class})
+ private String lastName;
+
+ private int failedLogins = 0;
+ private boolean userLocked;
+
+ /*
+ * TODO these tests work in an ide but not via commandline - it's a Surefire issue
+ */
+ /*
+ public class LoginValidator extends TestValidatorProvider
+ {
+ @ParameterValue
+ public TestValidationStrategyProvider getValue()
+ {
+ return this;
+ }
+
+ @Override
+ public ValidationStrategy getValidationStrategy()
+ {
+ return new ValidationStrategy() {
+
+ int failedLogins;
+
+ public void validate(FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject)
+ {
+ if((this.failedLogins = isLoginSuccessful()) > 0)
+ {
+ if(this.failedLogins > 3)
+ {
+ lock();
+ }
+ }
+ }
+ };
+ }
+ }
+ */
+
+ private int isLoginSuccessful()
+ {
+ //force an exception
+ return ++this.failedLogins;
+ }
+
+ public boolean isLocked()
+ {
+ return userLocked;
+ }
+
+ private void lock()
+ {
+ this.userLocked = true;
+ }
+
+ /*
+ * generated
+ */
+
+ public String getFirstName()
+ {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName)
+ {
+ this.firstName = firstName;
+ }
+
+ public String getLastName()
+ {
+ return lastName;
+ }
+
+ public void setLastName(String lastName)
+ {
+ this.lastName = lastName;
+ }
+}
\ 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/baseval/parameter/TestPriority.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/baseval/parameter/TestPriority.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriority.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriority.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterValue;
+
+public interface TestPriority extends ValidationParameter
+{
+ @ParameterValue
+ Integer getValue();
+
+ @ParameterValue(id = ShortDescription.class)
+ String getShortDescription();
+
+ @ParameterValue(id = LongDescription.class)
+ String getLongDescription();
+
+ interface ShortDescription{}
+ interface LongDescription{}
+}
\ 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/baseval/parameter/TestPriorityHigh.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/baseval/parameter/TestPriorityHigh.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityHigh.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityHigh.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,38 @@
+/*
+ * 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.baseval.parameter;
+
+public class TestPriorityHigh implements TestPriority
+{
+ public Integer getValue()
+ {
+ return 1;
+ }
+
+ public String getShortDescription()
+ {
+ return "do it asap";
+ }
+
+ public String getLongDescription()
+ {
+ return "do it immediately";
+ }
+
+}
\ 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/baseval/parameter/TestPriorityLow.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/baseval/parameter/TestPriorityLow.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityLow.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityLow.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.baseval.parameter;
+
+public class TestPriorityLow implements TestPriority
+{
+ public Integer getValue()
+ {
+ return 3;
+ }
+
+ public String getShortDescription()
+ {
+ return "not that important";
+ }
+
+ public String getLongDescription()
+ {
+ return "the topic is not that important";
+ }
+}
\ 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/baseval/parameter/TestValidationInterceptor.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/baseval/parameter/TestValidationInterceptor.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationInterceptor.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationInterceptor.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,53 @@
+/*
+ * 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.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.interceptor.PropertyValidationInterceptor;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterValue;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import java.util.Map;
+
+@InvocationOrder(210)
+public class TestValidationInterceptor implements PropertyValidationInterceptor
+{
+ private static PropertyValidationInterceptor propertyValidationInterceptor;
+
+ @ParameterValue
+ public PropertyValidationInterceptor getInstance()
+ {
+ if(propertyValidationInterceptor == null)
+ {
+ propertyValidationInterceptor = new TestValidationInterceptor();
+ }
+ return propertyValidationInterceptor;
+ }
+
+ public boolean beforeValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+ {
+ throw new UnsupportedOperationException("it's a test class");
+ }
+
+ public void afterValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+ {
+ throw new UnsupportedOperationException("it's a test class");
+ }
+}
\ 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/baseval/parameter/TestValidationStrategyProvider.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/baseval/parameter/TestValidationStrategyProvider.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationStrategyProvider.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationStrategyProvider.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,26 @@
+/*
+ * 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.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+
+public interface TestValidationStrategyProvider
+{
+ ValidationStrategy getValidationStrategy();
+}
\ 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/baseval/parameter/TestValidatorProvider.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/baseval/parameter/TestValidatorProvider.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidatorProvider.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidatorProvider.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,40 @@
+/*
+ * 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.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterKey;
+
+public class TestValidatorProvider implements ValidationParameter, TestValidationStrategyProvider
+{
+ @ParameterKey
+ public Class getKey()
+ {
+ return TestValidatorProvider.class;
+ }
+
+ /**
+ * it isn't allowed to have an abstract class in this case - so this impl. is required
+ */
+ public ValidationStrategy getValidationStrategy()
+ {
+ throw new IllegalStateException("you have to override this method");
+ }
+}
\ 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/CrossValTestBean.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/CrossValTestBean.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestBean.java Wed Nov 4 12:06:57 2009
@@ -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/trunk/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/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,117 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class CrossValTestCase extends AbstractPropertyValidationTestCase
+{
+
+ HtmlInputText inputComponent1 = null;
+ HtmlInputText inputComponent2 = null;
+
+ UIViewRoot rootComponent = null;
+
+ public CrossValTestCase(String name)
+ {
+ super(name);
+ inputComponent1 = null;
+ inputComponent2 = null;
+ rootComponent = null;
+ }
+
+ public static Test suite() {
+ return new TestSuite(CrossValTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ 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");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ 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);
+
+ processCrossValValidation();
+ checkMessageCount(0);
+
+ //no update model needed
+ }
+
+ 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);
+
+
+ processCrossValValidation();
+ checkMessageCount(2);
+
+ //no update model needed
+ }
+}
\ 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/ELCrossValReverseMessageTestCase.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/ELCrossValReverseMessageTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,82 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticInMemoryConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.test.propval.crossval.mock.MockEqualsValidationStrategy;
+import org.apache.myfaces.extensions.validator.test.base.util.MethodUtils;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ELCrossValReverseMessageTestCase extends ELCrossValTestCase
+{
+ public ELCrossValReverseMessageTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ELCrossValReverseMessageTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ StaticInMemoryConfiguration config = new StaticInMemoryConfiguration();
+
+ config.addMapping(Equals.class.getName(), MockEqualsValidationStrategy.class.getName());
+ ExtValContext.getContext().addStaticConfiguration(StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG, config);
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationCorrect();
+ assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ }
+
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationFailedValidation();
+ assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+ assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+ }
+}
\ 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/ELCrossValTestCase.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/ELCrossValTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,166 @@
+/*
+ * 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 javax.faces.convert.DateTimeConverter;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ELCrossValTestCase extends AbstractPropertyValidationTestCase
+{
+ HtmlInputText inputComponent1 = null;
+ HtmlInputText inputComponent2 = null;
+
+ UIViewRoot rootComponent = null;
+
+ public ELCrossValTestCase(String name)
+ {
+ super(name);
+ inputComponent1 = null;
+ inputComponent2 = null;
+ rootComponent = null;
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ELCrossValTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ createRequestScopedBean("bean1", getEntityInstance());
+ createRequestScopedBean("bean2", getEntityInstance());
+
+
+ rootComponent = new UIViewRoot();
+ HtmlForm form = new HtmlForm();
+ form.setId("form");
+ rootComponent.getChildren().add(form);
+
+ //input1
+ inputComponent1 = new HtmlInputText();
+ inputComponent1.setId("input1");
+ inputComponent1.setConverter(new DateTimeConverter());
+ ((DateTimeConverter)inputComponent1.getConverter()).setPattern("dd.MM.yyyy");
+ form.getChildren().add(inputComponent1);
+
+ //input2
+ inputComponent2 = new HtmlInputText();
+ inputComponent2.setId("input2");
+ inputComponent2.setConverter(new DateTimeConverter());
+ ((DateTimeConverter)inputComponent2.getConverter()).setPattern("dd.MM.yyyy");
+ form.getChildren().add(inputComponent2);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ validateELCrossComponentValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "14.05.1983");
+
+ checkMessageCount(0);
+ }
+
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ validateELCrossComponentValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "12.12.2008");
+
+ checkMessageCount(2);
+ }
+
+ private void validateELCrossComponentValidationUseCase(String valueBean1Property1, String valueBean1Property2, String valueBean2Property1, String valueBean2Property2)
+ {
+ createValueBinding(inputComponent1, "value", "#{bean1.date1}");
+ createValueBinding(inputComponent2, "value", "#{bean2.date2}");
+
+ //set model values
+ resolveBean("bean1", getEntityInstance().getClass()).setDate2((Date)inputComponent1.getConverter().getAsObject(facesContext, inputComponent1, valueBean1Property2));
+ resolveBean("bean2", getEntityInstance().getClass()).setDate1((Date)inputComponent2.getConverter().getAsObject(facesContext, inputComponent2, valueBean2Property1));
+
+
+ //decode
+ inputComponent1.setSubmittedValue(valueBean1Property1);
+ inputComponent2.setSubmittedValue(valueBean2Property2);
+
+ //validate
+ inputComponent1.validate(facesContext);
+ inputComponent2.validate(facesContext);
+
+ processCrossValValidation();
+
+ //no update model needed
+ }
+
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ validateELModelAwareCrossValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "14.05.1983");
+
+ checkMessageCount(0);
+ }
+
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ validateELModelAwareCrossValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "12.12.2008");
+
+ checkMessageCount(1);
+ }
+
+ private void validateELModelAwareCrossValidationUseCase(String valueBean1Property1, String valueBean1Property2, String valueBean2Property1, String valueBean2Property2)
+ {
+ createValueBinding(inputComponent1, "value", "#{bean1.date1}");
+
+ //set model values
+ resolveBean("bean1", getEntityInstance().getClass()).setDate2((Date)inputComponent1.getConverter().getAsObject(facesContext, inputComponent1, valueBean1Property2));
+ resolveBean("bean2", getEntityInstance().getClass()).setDate1((Date)inputComponent2.getConverter().getAsObject(facesContext, inputComponent2, valueBean2Property1));
+ resolveBean("bean2", getEntityInstance().getClass()).setDate2((Date)inputComponent2.getConverter().getAsObject(facesContext, inputComponent2, valueBean2Property2));
+
+
+ //decode
+ inputComponent1.setSubmittedValue(valueBean1Property1);
+
+ //validate
+ inputComponent1.validate(facesContext);
+
+ processCrossValValidation();
+
+ //no update model needed
+ }
+
+ protected ELCrossValTestDateBean getEntityInstance()
+ {
+ return new ELCrossValTestDateBean();
+ }
+}
\ 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/ELCrossValTestDateBean.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/ELCrossValTestDateBean.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java Wed Nov 4 12:06:57 2009
@@ -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.Equals;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ELCrossValTestDateBean
+{
+ private static final Date DEFAULT_DATE = new Date();
+
+ @Equals("#{bean2.date2}")
+ private Date date1 = DEFAULT_DATE;
+
+ private Date date2 = DEFAULT_DATE;
+
+ public Date getDate1()
+ {
+ return date1;
+ }
+
+ public void setDate1(Date date1)
+ {
+ this.date1 = date1;
+ }
+
+ public Date getDate2()
+ {
+ return date2;
+ }
+
+ public void setDate2(Date date2)
+ {
+ this.date2 = date2;
+ }
+}
\ 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/LocalPropertyCrossValReverseMessageTestCase.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/LocalPropertyCrossValReverseMessageTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,83 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticInMemoryConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.apache.myfaces.extensions.validator.test.propval.crossval.mock.MockEqualsValidationStrategy;
+import org.apache.myfaces.extensions.validator.test.base.util.MethodUtils;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyCrossValReverseMessageTestCase extends LocalPropertyCrossValTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(LocalPropertyCrossValReverseMessageTestCase.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ StaticInMemoryConfiguration config = new StaticInMemoryConfiguration();
+
+ config.addMapping(Equals.class.getName(), MockEqualsValidationStrategy.class.getName());
+ ExtValContext.getContext().addStaticConfiguration(StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG, config);
+ }
+
+ public LocalPropertyCrossValReverseMessageTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ @Override
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationCorrect();
+ assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ }
+
+ @Override
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationFailedValidation();
+ assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+ assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+ }
+}
\ 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/LocalPropertyCrossValTestCase.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/LocalPropertyCrossValTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,44 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyCrossValTestCase extends ELCrossValTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(LocalPropertyCrossValTestCase.class);
+ }
+
+ public LocalPropertyCrossValTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected ELCrossValTestDateBean getEntityInstance()
+ {
+ return new LocalPropertyCrossValTestDateBean();
+ }
+}
\ 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/LocalPropertyCrossValTestDateBean.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/LocalPropertyCrossValTestDateBean.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java Wed Nov 4 12:06:57 2009
@@ -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.Equals;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyCrossValTestDateBean extends ELCrossValTestDateBean
+{
+ private static final Date DEFAULT_DATE = new Date();
+
+ @Equals("date2")
+ private Date date1 = DEFAULT_DATE;
+
+ private Date date2 = DEFAULT_DATE;
+
+ public Date getDate1()
+ {
+ return date1;
+ }
+
+ public void setDate1(Date date1)
+ {
+ this.date1 = date1;
+ }
+
+ public Date getDate2()
+ {
+ return date2;
+ }
+
+ public void setDate2(Date date2)
+ {
+ this.date2 = date2;
+ }
+}
\ 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/PropertyChainCrossValReverseMessageTestCase.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/PropertyChainCrossValReverseMessageTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,81 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticInMemoryConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.test.propval.crossval.mock.MockEqualsValidationStrategy;
+import org.apache.myfaces.extensions.validator.test.base.util.MethodUtils;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValReverseMessageTestCase extends PropertyChainCrossValTestCase
+{
+ public static Test suite()
+ {
+ return new TestSuite(PropertyChainCrossValReverseMessageTestCase.class);
+ }
+
+ public PropertyChainCrossValReverseMessageTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ StaticInMemoryConfiguration config = new StaticInMemoryConfiguration();
+
+ config.addMapping(Equals.class.getName(), MockEqualsValidationStrategy.class.getName());
+ ExtValContext.getContext().addStaticConfiguration(StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG, config);
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ @Override
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ //don't retest this test-case
+ }
+
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationCorrect();
+ assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ }
+
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ super.testModelAwareCrossEqualsValidationFailedValidation();
+ assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+ //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+ assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+ }
+}
\ 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/PropertyChainCrossValTestCase.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/PropertyChainCrossValTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,155 @@
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.UIViewRoot;
+import javax.faces.convert.DateTimeConverter;
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValTestCase extends AbstractPropertyValidationTestCase
+{
+ HtmlInputText inputComponent1 = null;
+ HtmlInputText inputComponent2 = null;
+
+ UIViewRoot rootComponent = null;
+
+ public static Test suite()
+ {
+ return new TestSuite(PropertyChainCrossValTestCase.class);
+ }
+
+ public PropertyChainCrossValTestCase(String name)
+ {
+ super(name);
+ inputComponent1 = null;
+ inputComponent2 = null;
+ rootComponent = null;
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ createRequestScopedBean("bean1", getEntityInstance());
+
+ rootComponent = new UIViewRoot();
+ HtmlForm form = new HtmlForm();
+ form.setId("form");
+ rootComponent.getChildren().add(form);
+
+ //input1
+ inputComponent1 = new HtmlInputText();
+ inputComponent1.setId("input1");
+ inputComponent1.setConverter(new DateTimeConverter());
+ ((DateTimeConverter)inputComponent1.getConverter()).setPattern("dd.MM.yyyy");
+ form.getChildren().add(inputComponent1);
+
+ //input2
+ inputComponent2 = new HtmlInputText();
+ inputComponent2.setId("input2");
+ inputComponent2.setConverter(new DateTimeConverter());
+ ((DateTimeConverter)inputComponent2.getConverter()).setPattern("dd.MM.yyyy");
+ form.getChildren().add(inputComponent2);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testCrossComponentEqualsValidationCorrect() throws Exception
+ {
+ validatePropertyChainCrossComponentValidationUseCase("14.05.1983", "14.05.1983");
+
+ checkMessageCount(0);
+ }
+
+ public void testCrossComponentEqualsValidationFailedValidation() throws Exception
+ {
+ validatePropertyChainCrossComponentValidationUseCase("14.05.1983", "12.12.2008");
+
+ checkMessageCount(2);
+ }
+
+ private void validatePropertyChainCrossComponentValidationUseCase(String valueBean1Property1, String valueBean2Property2)
+ {
+ createValueBinding(inputComponent1, "value", "#{bean1.date1}");
+ createValueBinding(inputComponent2, "value", "#{bean1.subBean.date2}");
+
+ //decode
+ inputComponent1.setSubmittedValue(valueBean1Property1);
+ inputComponent2.setSubmittedValue(valueBean2Property2);
+
+ //validate
+ inputComponent1.validate(facesContext);
+ inputComponent2.validate(facesContext);
+
+ processCrossValValidation();
+
+ //no update model needed
+ }
+
+ public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+ {
+ validateELModelAwareCrossValidationUseCase("14.05.1983", "14.05.1983");
+
+ checkMessageCount(0);
+ }
+
+ public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+ {
+ validateELModelAwareCrossValidationUseCase("14.05.1983", "12.12.2008");
+
+ checkMessageCount(1);
+ }
+
+ private void validateELModelAwareCrossValidationUseCase(String valueBean1Property1, String valueBean2Property1)
+ {
+ createValueBinding(inputComponent1, "value", "#{bean1.date1}");
+
+ //set model values
+ resolveBean("bean1", getEntityInstance().getClass()).getSubBean().setDate2((Date)inputComponent2.getConverter().getAsObject(facesContext, inputComponent2, valueBean2Property1));
+
+
+ //decode
+ inputComponent1.setSubmittedValue(valueBean1Property1);
+
+ //validate
+ inputComponent1.validate(facesContext);
+
+ processCrossValValidation();
+
+ //no update model needed
+ }
+
+ protected PropertyChainCrossValTestDateBean getEntityInstance()
+ {
+ return new PropertyChainCrossValTestDateBean();
+ }
+}
\ 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/PropertyChainCrossValTestDateBean.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/PropertyChainCrossValTestDateBean.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateBean.java Wed Nov 4 12:06:57 2009
@@ -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.Equals;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValTestDateBean
+{
+ private static final Date DEFAULT_DATE = new Date();
+
+ @Equals("subBean.date2")
+ private Date date1 = DEFAULT_DATE;
+
+ private PropertyChainCrossValTestDateSubBean subBean = new PropertyChainCrossValTestDateSubBean();
+
+ public Date getDate1()
+ {
+ return date1;
+ }
+
+ public void setDate1(Date date1)
+ {
+ this.date1 = date1;
+ }
+
+ public PropertyChainCrossValTestDateSubBean getSubBean()
+ {
+ return subBean;
+ }
+
+ public void setSubBean(PropertyChainCrossValTestDateSubBean subBean)
+ {
+ this.subBean = subBean;
+ }
+}
\ 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/PropertyChainCrossValTestDateSubBean.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/PropertyChainCrossValTestDateSubBean.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateSubBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateSubBean.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,41 @@
+/*
+ * 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 java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValTestDateSubBean
+{
+ private static final Date DEFAULT_DATE = new Date();
+
+ private Date date2 = DEFAULT_DATE;
+
+ public Date getDate2()
+ {
+ return date2;
+ }
+
+ public void setDate2(Date date2)
+ {
+ this.date2 = date2;
+ }
+}
\ 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/mock/MockEqualsValidationStrategy.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/mock/MockEqualsValidationStrategy.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/mock/MockEqualsValidationStrategy.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/mock/MockEqualsValidationStrategy.java Wed Nov 4 12:06:57 2009
@@ -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.mock;
+
+import org.apache.myfaces.extensions.validator.crossval.strategy.EqualsStrategy;
+import org.apache.myfaces.extensions.validator.test.base.util.MethodUtils;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class MockEqualsValidationStrategy extends EqualsStrategy
+{
+ public MockEqualsValidationStrategy()
+ {
+ MethodUtils.signalClassUsed(getClass());
+ }
+
+ @Override
+ protected String getReverseErrorMessageSummary(Annotation annotation)
+ {
+ MethodUtils.signalMethodCalled(getClass(), "reverseMessage");
+ return super.getReverseErrorMessageSummary(annotation);
+ }
+
+ @Override
+ protected String getReverseErrorMessageDetail(Annotation annotation)
+ {
+ MethodUtils.signalMethodCalled(getClass(), "reverseMessage");
+ return super.getReverseErrorMessageDetail(annotation);
+ }
+}
\ No newline at end of file