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:09:26 UTC

svn commit: r832719 [3/4] - in /myfaces/extensions/validator/branches/branch_for_jsf_1_1: ./ test-modules/ test-modules/base-test-infrastructure/ test-modules/base-test-infrastructure/src/ test-modules/base-test-infrastructure/src/test/ test-modules/ba...

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriority.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriority.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriority.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityHigh.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityHigh.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityHigh.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityLow.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityLow.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestPriorityLow.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationInterceptor.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationInterceptor.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationInterceptor.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationStrategyProvider.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationStrategyProvider.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidationStrategyProvider.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidatorProvider.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidatorProvider.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/TestValidatorProvider.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestBean.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/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_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestBean.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/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_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/CrossValTestCase.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestCase.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateBean.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateBean.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateSubBean.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateSubBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateSubBean.java Wed Nov  4 12:09:24 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/branches/branch_for_jsf_1_1/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/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/mock/MockEqualsValidationStrategy.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/mock/MockEqualsValidationStrategy.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/mock/MockEqualsValidationStrategy.java Wed Nov  4 12:09:24 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

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.java Wed Nov  4 12:09:24 2009
@@ -0,0 +1,199 @@
+/*
+ * 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.interceptor;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.ValidationModuleAware;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.interceptor.MetaDataExtractionInterceptor;
+import org.apache.myfaces.extensions.validator.PropertyValidationModuleKey;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import java.util.List;
+
+public class RegistrationModuleMetaDataExtractionInterceptorTestCase extends AbstractExValCoreTestCase
+{
+    /**
+     * Construct a new instance of the test.
+     *
+     * @param name Name of the test.
+     */
+    public RegistrationModuleMetaDataExtractionInterceptorTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static Test suite()
+    {
+        return new TestSuite(RegistrationModuleMetaDataExtractionInterceptorTestCase.class);
+    }
+
+    public void testModulePropertyValidationInterceptorInitialization()
+    {
+        resetExtValContext();
+
+        ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestGlobalPropertyValidationInterceptor());
+        ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestGlobalMetaDataExtractionInterceptor1000());
+        ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestModuleMetaDataExtractionInterceptor2());
+        ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestModuleMetaDataExtractionInterceptor3());
+        ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestGlobalMetaDataExtractionInterceptor1());
+
+        checkGlobalOnlyPropertyValidationInterceptors();
+        checkModuleAwarePropertyValidationInterceptorsWithTestModule();
+        checkModuleAwarePropertyValidationInterceptorsWithPropertyValidationModule();
+    }
+
+    private void checkGlobalOnlyPropertyValidationInterceptors()
+    {
+        List<MetaDataExtractionInterceptor> result = ExtValContext.getContext().getMetaDataExtractionInterceptors();
+
+        int resultLength = 3;
+        Assert.assertEquals(resultLength, result.size());
+
+        for(int i = 0; i < resultLength; i++)
+        {
+            switch (i)
+            {
+                case 0:
+                    Assert.assertEquals(TestGlobalMetaDataExtractionInterceptor1.class, result.get(i).getClass());
+                    break;
+                case 1:
+                    Assert.assertEquals(TestGlobalMetaDataExtractionInterceptor1000.class, result.get(i).getClass());
+                    break;
+                case 2:
+                    Assert.assertEquals(TestGlobalPropertyValidationInterceptor.class, result.get(i).getClass());
+                    break;
+            }
+        }
+    }
+
+    private void checkModuleAwarePropertyValidationInterceptorsWithTestModule()
+    {
+        List<MetaDataExtractionInterceptor> result = ExtValContext.getContext().getMetaDataExtractionInterceptorsFor(TestModule.class);
+
+        int resultLength = 5;
+        Assert.assertTrue(result.size() == resultLength);
+
+        for(int i = 0; i < resultLength; i++)
+        {
+            switch (i)
+            {
+                case 0:
+                    Assert.assertTrue(result.get(i) instanceof TestGlobalMetaDataExtractionInterceptor1);
+                    break;
+                case 1:
+                    Assert.assertTrue(result.get(i) instanceof TestModuleMetaDataExtractionInterceptor2);
+                    break;
+                case 2:
+                    Assert.assertTrue(result.get(i) instanceof TestModuleMetaDataExtractionInterceptor3);
+                    break;
+                case 3:
+                    Assert.assertTrue(result.get(i) instanceof TestGlobalMetaDataExtractionInterceptor1000);
+                    break;
+                case 4:
+                    Assert.assertTrue(result.get(i) instanceof TestGlobalPropertyValidationInterceptor);
+                    break;
+            }
+        }
+    }
+
+    private void checkModuleAwarePropertyValidationInterceptorsWithPropertyValidationModule()
+    {
+        List<MetaDataExtractionInterceptor> result = ExtValContext.getContext().getMetaDataExtractionInterceptorsFor(PropertyValidationModuleKey.class);
+
+        int resultLength = 4;
+        Assert.assertTrue(result.size() == resultLength);
+
+        for(int i = 0; i < resultLength; i++)
+        {
+            switch (i)
+            {
+                case 0:
+                    Assert.assertEquals(TestGlobalMetaDataExtractionInterceptor1.class, result.get(i).getClass());
+                    break;
+                case 1:
+                    Assert.assertEquals(TestModuleMetaDataExtractionInterceptor2.class, result.get(i).getClass());
+                    break;
+                case 2:
+                    Assert.assertEquals(TestGlobalMetaDataExtractionInterceptor1000.class, result.get(i).getClass());
+                    break;
+                case 3:
+                    Assert.assertEquals(TestGlobalPropertyValidationInterceptor.class, result.get(i).getClass());
+                    break;
+            }
+        }
+    }
+
+    class TestGlobalPropertyValidationInterceptor implements MetaDataExtractionInterceptor
+    {
+        public void afterExtracting(PropertyInformation propertyInformation)
+        {
+        }
+    }
+
+    @InvocationOrder(1)
+    class TestGlobalMetaDataExtractionInterceptor1 implements MetaDataExtractionInterceptor
+    {
+        public void afterExtracting(PropertyInformation propertyInformation)
+        {
+        }
+    }
+
+    @InvocationOrder(2)
+    class TestModuleMetaDataExtractionInterceptor2 implements MetaDataExtractionInterceptor, ValidationModuleAware
+    {
+        public void afterExtracting(PropertyInformation propertyInformation)
+        {
+        }
+
+        public String[] getModuleKeys()
+        {
+            return new String[] {PropertyValidationModuleKey.class.getName(), TestModule.class.getName()};
+        }
+    }
+
+    @InvocationOrder(3)
+    class TestModuleMetaDataExtractionInterceptor3 implements MetaDataExtractionInterceptor, ValidationModuleAware
+    {
+        public void afterExtracting(PropertyInformation propertyInformation)
+        {
+        }
+
+        public String[] getModuleKeys()
+        {
+            return new String[] {TestModule.class.getName()};
+        }
+    }
+
+    class TestModule
+    {
+    }
+
+    @InvocationOrder(1000)
+    class TestGlobalMetaDataExtractionInterceptor1000 implements MetaDataExtractionInterceptor
+    {
+        public void afterExtracting(PropertyInformation propertyInformation)
+        {
+        }
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModulePropertyValidationInterceptorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModulePropertyValidationInterceptorTestCase.java?rev=832719&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModulePropertyValidationInterceptorTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModulePropertyValidationInterceptorTestCase.java Wed Nov  4 12:09:24 2009
@@ -0,0 +1,226 @@
+/*
+ * 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.interceptor;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.ValidationModuleAware;
+import org.apache.myfaces.extensions.validator.core.interceptor.PropertyValidationInterceptor;
+import org.apache.myfaces.extensions.validator.PropertyValidationModuleKey;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import java.util.List;
+import java.util.Map;
+
+public class RegistrationModulePropertyValidationInterceptorTestCase extends AbstractExValCoreTestCase
+{
+    /**
+     * Construct a new instance of the test.
+     *
+     * @param name Name of the test.
+     */
+    public RegistrationModulePropertyValidationInterceptorTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static Test suite()
+    {
+        return new TestSuite(RegistrationModulePropertyValidationInterceptorTestCase.class);
+    }
+
+    public void testModulePropertyValidationInterceptorInitialization()
+    {
+        resetExtValContext();
+
+        ExtValContext.getContext().addPropertyValidationInterceptor(new TestGlobalPropertyValidationInterceptor());
+        ExtValContext.getContext().addPropertyValidationInterceptor(new TestGlobalPropertyValidationInterceptor1000());
+        ExtValContext.getContext().addPropertyValidationInterceptor(new TestModulePropertyValidationInterceptor2());
+        ExtValContext.getContext().addPropertyValidationInterceptor(new TestModulePropertyValidationInterceptor3());
+        ExtValContext.getContext().addPropertyValidationInterceptor(new TestGlobalPropertyValidationInterceptor1());
+
+        checkGlobalOnlyPropertyValidationInterceptors();
+        checkModuleAwarePropertyValidationInterceptorsWithTestModule();
+        checkModuleAwarePropertyValidationInterceptorsWithPropertyValidationModule();
+    }
+
+    private void checkGlobalOnlyPropertyValidationInterceptors()
+    {
+        List<PropertyValidationInterceptor> result = ExtValContext.getContext().getPropertyValidationInterceptors();
+
+        int resultLength = 3;
+        Assert.assertEquals(resultLength, result.size());
+
+        for(int i = 0; i < resultLength; i++)
+        {
+            switch (i)
+            {
+                case 0:
+                    Assert.assertEquals(TestGlobalPropertyValidationInterceptor1.class, result.get(i).getClass());
+                    break;
+                case 1:
+                    Assert.assertEquals(TestGlobalPropertyValidationInterceptor1000.class, result.get(i).getClass());
+                    break;
+                case 2:
+                    Assert.assertEquals(TestGlobalPropertyValidationInterceptor.class, result.get(i).getClass());
+                    break;
+            }
+        }
+    }
+
+    private void checkModuleAwarePropertyValidationInterceptorsWithTestModule()
+    {
+        List<PropertyValidationInterceptor> result = ExtValContext.getContext().getPropertyValidationInterceptorsFor(TestModule.class);
+
+        int resultLength = 5;
+        Assert.assertTrue(result.size() == resultLength);
+
+        for(int i = 0; i < resultLength; i++)
+        {
+            switch (i)
+            {
+                case 0:
+                    Assert.assertTrue(result.get(i) instanceof TestGlobalPropertyValidationInterceptor1);
+                    break;
+                case 1:
+                    Assert.assertTrue(result.get(i) instanceof TestModulePropertyValidationInterceptor2);
+                    break;
+                case 2:
+                    Assert.assertTrue(result.get(i) instanceof TestModulePropertyValidationInterceptor3);
+                    break;
+                case 3:
+                    Assert.assertTrue(result.get(i) instanceof TestGlobalPropertyValidationInterceptor1000);
+                    break;
+                case 4:
+                    Assert.assertTrue(result.get(i) instanceof TestGlobalPropertyValidationInterceptor);
+                    break;
+            }
+        }
+    }
+
+    private void checkModuleAwarePropertyValidationInterceptorsWithPropertyValidationModule()
+    {
+        List<PropertyValidationInterceptor> result = ExtValContext.getContext().getPropertyValidationInterceptorsFor(PropertyValidationModuleKey.class);
+
+        int resultLength = 4;
+        Assert.assertTrue(result.size() == resultLength);
+
+        for(int i = 0; i < resultLength; i++)
+        {
+            switch (i)
+            {
+                case 0:
+                    Assert.assertEquals(TestGlobalPropertyValidationInterceptor1.class, result.get(i).getClass());
+                    break;
+                case 1:
+                    Assert.assertEquals(TestModulePropertyValidationInterceptor2.class, result.get(i).getClass());
+                    break;
+                case 2:
+                    Assert.assertEquals(TestGlobalPropertyValidationInterceptor1000.class, result.get(i).getClass());
+                    break;
+                case 3:
+                    Assert.assertEquals(TestGlobalPropertyValidationInterceptor.class, result.get(i).getClass());
+                    break;
+            }
+        }
+    }
+
+    class TestGlobalPropertyValidationInterceptor implements PropertyValidationInterceptor
+    {
+        public boolean beforeValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+            return true;
+        }
+
+        public void afterValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+        }
+    }
+
+    @InvocationOrder(1)
+    class TestGlobalPropertyValidationInterceptor1 implements PropertyValidationInterceptor
+    {
+        public boolean beforeValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+            return true;
+        }
+
+        public void afterValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+        }
+    }
+
+    @InvocationOrder(2)
+    class TestModulePropertyValidationInterceptor2 implements PropertyValidationInterceptor, ValidationModuleAware
+    {
+        public boolean beforeValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+            return true;
+        }
+
+        public void afterValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+        }
+
+        public String[] getModuleKeys()
+        {
+            return new String[] {PropertyValidationModuleKey.class.getName(), TestModule.class.getName()};
+        }
+    }
+
+    @InvocationOrder(3)
+    class TestModulePropertyValidationInterceptor3 implements PropertyValidationInterceptor, ValidationModuleAware
+    {
+        public boolean beforeValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+            return true;
+        }
+
+        public void afterValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+        }
+
+        public String[] getModuleKeys()
+        {
+            return new String[] {TestModule.class.getName()};
+        }
+    }
+
+    class TestModule
+    {
+    }
+
+    @InvocationOrder(1000)
+    class TestGlobalPropertyValidationInterceptor1000 implements PropertyValidationInterceptor
+    {
+        public boolean beforeValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+            return true;
+        }
+
+        public void afterValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+        {
+        }
+    }
+}
\ No newline at end of file