You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by rd...@apache.org on 2011/05/30 10:38:54 UTC

svn commit: r1129058 [11/13] - in /myfaces/extensions/validator/branches/branch_for_jsf_2_0: ./ test-modules/ test-modules/base-test-infrastructure/ test-modules/base-test-infrastructure/src/ test-modules/base-test-infrastructure/src/test/ test-modules...

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/DateIs5TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.convert.DateTimeConverter;
+
+/**
+ * @author Rudy De Busscher
+ */
+public class DateIs5TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public DateIs5TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        DateIs5TestBean bean = new DateIs5TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+
+        DateTimeConverter converter = new DateTimeConverter();
+        converter.setPattern("DD/MM/yyyy");
+        inputComponent1.setConverter(converter);
+        inputComponent2.setConverter(converter);
+    }
+
+    @Test
+    public void testDateIsAfterCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("23/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsAfterSameCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsAfterSameWrong() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("23/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+    }
+
+    @Test
+    public void testDateIsAfterSameSourceNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("25/01/2011");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+    @Test
+    public void testDateIsAfterSameTargetNull() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("25/01/2011");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+    }
+
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValReverseMessageTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,74 @@
+/*
+ * 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 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;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ELCrossValReverseMessageTestCase extends ELCrossValTestCase
+{
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+
+        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
+    }
+
+    @Test
+    public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+    {
+        super.testModelAwareCrossEqualsValidationCorrect();
+        Assert.assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+    }
+
+    @Test
+    public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+    {
+        super.testModelAwareCrossEqualsValidationFailedValidation();
+        Assert.assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+        //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+        Assert.assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,158 @@
+/*
+ * 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 org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class ELCrossValTestCase extends AbstractPropertyValidationTestCase
+{
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public ELCrossValTestCase()
+    {
+         inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        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);
+    }
+
+
+    @Test
+    public void testCrossComponentEqualsValidationCorrect() throws Exception
+    {
+        validateELCrossComponentValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "14.05.1983");
+
+        checkMessageCount(0);
+    }
+
+    @Test
+    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);
+
+        processCrossValidation();
+
+        //no update model needed
+    }
+
+    @Test
+    public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+    {
+        validateELModelAwareCrossValidationUseCase("14.05.1983", "14.05.1983", "14.05.1983", "14.05.1983");
+
+        checkMessageCount(0);
+    }
+
+    @Test
+    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);
+
+        processCrossValidation();
+
+        //no update model needed
+    }
+
+    protected ELCrossValTestDateBean getEntityInstance()
+    {
+        return new ELCrossValTestDateBean();
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/ELCrossValTestDateBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.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_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf1TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf1TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf1TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf1TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.EmptyIf;
+
+public class EmptyIf1TestBean
+{
+    private String property1;
+
+    @EmptyIf(valueOf = "property1")
+    private String property2;
+
+    public String getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(String property1)
+    {
+        this.property1 = property1;
+    }
+
+    public String getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(String property2)
+    {
+        this.property2 = property2;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf1TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf1TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf1TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf1TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.application.FacesMessage;
+
+public class EmptyIf1TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public EmptyIf1TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        EmptyIf1TestBean bean = new EmptyIf1TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+    }
+
+    @Test
+    public void testEmptyIfTargetNotEmptyCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfTargetNotEmptyFailed() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfTargetEmptyCorrect1() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfTargetEmptyCorrect2() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf2TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf2TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf2TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf2TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.EmptyIf;
+import static org.apache.myfaces.extensions.validator.crossval.annotation.EmptyIfType.*;
+
+public class EmptyIf2TestBean
+{
+    private String property1;
+    @EmptyIf(valueOf = "property1", is = empty)
+    private String property2;
+
+    public String getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(String property1)
+    {
+        this.property1 = property1;
+    }
+
+    public String getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(String property2)
+    {
+        this.property2 = property2;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf2TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf2TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf2TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf2TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.application.FacesMessage;
+
+public class EmptyIf2TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public EmptyIf2TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        EmptyIf2TestBean bean = new EmptyIf2TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+    }
+
+    @Test
+    public void testEmptyIfTargetEmptyCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfTargetEmptyFailed() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("");
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfTargetNotEmptyCorrect1() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfTargetNotEmptyCorrect2() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf3TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf3TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf3TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf3TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.EmptyIf;
+
+public class EmptyIf3TestBean
+{
+    private Boolean property1;
+    @EmptyIf(valueOf = "property1")
+    private String property2;
+
+    public Boolean getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(Boolean property1)
+    {
+        this.property1 = property1;
+    }
+
+    public String getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(String property2)
+    {
+        this.property2 = property2;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf3TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf3TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf3TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf3TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.application.FacesMessage;
+
+public class EmptyIf3TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public EmptyIf3TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        EmptyIf3TestBean bean = new EmptyIf3TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+    }
+
+    @Test
+    public void testEmptyIfBooleanTargetNotEmptyCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue(Boolean.TRUE.toString());
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfBooleanTargetNotEmptyFailed() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue(Boolean.TRUE.toString());
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfBooleanTargetEmptyCorrect1() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue(Boolean.FALSE.toString());
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfBooleanTargetEmptyCorrect2() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue(Boolean.FALSE.toString());
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf4TestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf4TestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf4TestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf4TestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.EmptyIf;
+import static org.apache.myfaces.extensions.validator.crossval.annotation.EmptyIfType.*;
+
+public class EmptyIf4TestBean
+{
+    private boolean property1;
+    @EmptyIf(valueOf = "property1", is = empty)
+    private String property2;
+
+    public boolean isProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(boolean property1)
+    {
+        this.property1 = property1;
+    }
+
+    public String getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(String property2)
+    {
+        this.property2 = property2;
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf4TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf4TestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf4TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EmptyIf4TestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.application.FacesMessage;
+
+public class EmptyIf4TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public EmptyIf4TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        EmptyIf4TestBean bean = new EmptyIf4TestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+    }
+
+    @Test
+    public void testEmptyIfBooleanTargetEmptyCorrect() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue(Boolean.FALSE.toString());
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfBooleanTargetEmptyFailed() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue(Boolean.FALSE.toString());
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(1);
+
+        assertNavigationBlocked(true);
+
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfBooleanTargetNotEmptyCorrect1() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue(Boolean.TRUE.toString());
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testEmptyIfBooleanTargetNotEmptyCorrect2() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue(Boolean.TRUE.toString());
+        inputComponent2.setSubmittedValue("");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+        assertNavigationBlocked(false);
+
+        //no update model needed
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EqualsStringTestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EqualsStringTestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EqualsStringTestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EqualsStringTestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.myfaces.extensions.validator.crossval.parameter.CaseInsensitive;
+
+public class EqualsStringTestBean
+{
+    private String property1;
+
+    @Equals(value = "property1")
+    private String property2;
+
+    @Equals(value = "property1", parameters = CaseInsensitive.class)
+    private String property3;
+
+    public String getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(String property1)
+    {
+        this.property1 = property1;
+    }
+
+    public String getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(String property2)
+    {
+        this.property2 = property2;
+    }
+
+    public String getProperty3()
+    {
+        return property3;
+    }
+
+    public void setProperty3(String property3)
+    {
+        this.property3 = property3;
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EqualsStringTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EqualsStringTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EqualsStringTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/EqualsStringTestCase.java Mon May 30 08:38:45 2011
@@ -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.crossval;
+
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+
+public class EqualsStringTestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public EqualsStringTestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        EqualsStringTestBean bean = new EqualsStringTestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+    }
+
+    @Test
+    public void testEqualsCaseSensitiveSame() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+    }
+
+    @Test
+    public void testEqualsCaseSensitiveDifferent() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1D3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(2); // For each field a message
+    }
+
+    @Test
+    public void testEqualsCaseInsensitiveSame() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property3}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+    }
+
+    @Test
+    public void testEqualsCaseInsensitiveDifferent() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property3}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1D3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0); // Due to extra parameter attribute, no longer an error.
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValReverseMessageTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,76 @@
+/*
+ * 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.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;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyCrossValReverseMessageTestCase extends LocalPropertyCrossValTestCase
+{
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+
+        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
+    }
+
+    @Override
+    @Test
+    public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+    {
+        super.testModelAwareCrossEqualsValidationCorrect();
+        Assert.assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+    }
+
+    @Override
+    @Test
+    public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+    {
+        super.testModelAwareCrossEqualsValidationFailedValidation();
+        Assert.assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+        //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+        Assert.assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class LocalPropertyCrossValTestCase extends ELCrossValTestCase
+{
+
+
+    @Override
+    protected ELCrossValTestDateBean getEntityInstance()
+    {
+        return new LocalPropertyCrossValTestDateBean();
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/LocalPropertyCrossValTestDateBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.crossval;
+
+import org.apache.myfaces.extensions.validator.crossval.annotation.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_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/NotEqualsStringTestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/NotEqualsStringTestBean.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/NotEqualsStringTestBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/NotEqualsStringTestBean.java Mon May 30 08:38:45 2011
@@ -0,0 +1,65 @@
+/*
+ * 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.NotEquals;
+import org.apache.myfaces.extensions.validator.crossval.parameter.CaseInsensitive;
+
+public class NotEqualsStringTestBean
+{
+
+    private String property1;
+
+    @NotEquals(value = "property1")
+    private String property2;
+
+    @NotEquals(value = "property1", parameters = CaseInsensitive.class)
+    private String property3;
+
+    public String getProperty1()
+    {
+        return property1;
+    }
+
+    public void setProperty1(String property1)
+    {
+        this.property1 = property1;
+    }
+
+    public String getProperty2()
+    {
+        return property2;
+    }
+
+    public void setProperty2(String property2)
+    {
+        this.property2 = property2;
+    }
+
+    public String getProperty3()
+    {
+        return property3;
+    }
+
+    public void setProperty3(String property3)
+    {
+        this.property3 = property3;
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/NotEqualsStringTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/NotEqualsStringTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/NotEqualsStringTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/NotEqualsStringTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,147 @@
+/*
+ * 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.CrossValidationPhaseListener;
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.junit.Test;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+
+public class NotEqualsStringTestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public NotEqualsStringTestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        NotEqualsStringTestBean bean = new NotEqualsStringTestBean();
+        createValueBinding(null, "value", "#{testBean}");
+        facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+        rootComponent = new UIViewRoot();
+        HtmlForm form = new HtmlForm();
+        form.setId("form");
+        rootComponent.getChildren().add(form);
+        inputComponent1 = new HtmlInputText();
+        form.getChildren().add(inputComponent1);
+        inputComponent1.setId("input1");
+        inputComponent2 = new HtmlInputText();
+        form.getChildren().add(inputComponent2);
+        inputComponent2.setId("input2");
+    }
+
+    @Test
+    public void testEqualsCaseSensitiveSame() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(2); // For each field a message
+
+    }
+
+    @Test
+    public void testEqualsCaseSensitiveDifferent() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property2}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1D3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(0);
+
+    }
+
+    @Test
+    public void testEqualsCaseInsensitiveSame() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property3}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1d3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(2);// For each field a message
+
+    }
+
+    @Test
+    public void testEqualsCaseInsensitiveDifferent() throws Exception
+    {
+        createValueBinding(inputComponent1, "value", "#{testBean.property1}");
+        createValueBinding(inputComponent2, "value", "#{testBean.property3}");
+
+        //decode
+        inputComponent1.setSubmittedValue("1d3");
+        inputComponent2.setSubmittedValue("1D3");
+
+        //validate
+        inputComponent1.validate(facesContext);
+        inputComponent2.validate(facesContext);
+
+        processCrossValidation();
+        checkMessageCount(2); // For each field a message, due to the extra parameter now evaluated as same and thus error
+
+    }
+
+    protected void processCrossValidation()
+    {
+        new CrossValidationPhaseListener().afterPhase(new PhaseEvent(
+                facesContext, PhaseId.ANY_PHASE, lifecycle));
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValReverseMessageTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,75 @@
+/*
+ * 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 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;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class PropertyChainCrossValReverseMessageTestCase extends PropertyChainCrossValTestCase
+{
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+
+        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
+    }
+
+    @Test
+    public void testModelAwareCrossEqualsValidationCorrect() throws Exception
+    {
+        super.testModelAwareCrossEqualsValidationCorrect();
+        Assert.assertFalse(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+    }
+
+    @Test
+    public void testModelAwareCrossEqualsValidationFailedValidation() throws Exception
+    {
+        super.testModelAwareCrossEqualsValidationFailedValidation();
+        Assert.assertTrue(MethodUtils.isMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage"));
+        //1x getReverseErrorMessageSummary and 1x getReverseErrorMessageDetail
+        Assert.assertTrue(MethodUtils.checkMethodCalled(MockEqualsValidationStrategy.class, "reverseMessage", 2));
+    }
+}
\ No newline at end of file