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 [12/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/PropertyChainCrossValTestCase.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/PropertyChainCrossValTestCase.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/PropertyChainCrossValTestCase.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/PropertyChainCrossValTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,144 @@
+/*
+ * 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.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 PropertyChainCrossValTestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+    @Override
+    protected void setUpTestCase()
+    {
+        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);
+    }
+
+    @Test
+    public void testCrossComponentEqualsValidationCorrect() throws Exception
+    {
+        validatePropertyChainCrossComponentValidationUseCase("14.05.1983", "14.05.1983");
+
+        checkMessageCount(0);
+    }
+
+    @Test
+    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);
+
+        processCrossValidation();
+
+        //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);
+
+        processCrossValidation();
+
+        //no update model needed
+    }
+
+    protected PropertyChainCrossValTestDateBean getEntityInstance()
+    {
+        return new PropertyChainCrossValTestDateBean();
+    }
+}
\ 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/PropertyChainCrossValTestDateBean.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/PropertyChainCrossValTestDateBean.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/PropertyChainCrossValTestDateBean.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/PropertyChainCrossValTestDateBean.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 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_2_0/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_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/PropertyChainCrossValTestDateSubBean.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/PropertyChainCrossValTestDateSubBean.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/PropertyChainCrossValTestDateSubBean.java Mon May 30 08:38:45 2011
@@ -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_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/crossval/RequiredIf1TestBean.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/RequiredIf1TestBean.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/RequiredIf1TestBean.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/RequiredIf1TestBean.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.RequiredIf;
+
+public class RequiredIf1TestBean
+{
+    private String property1;
+
+    @RequiredIf(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/RequiredIf1TestCase.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/RequiredIf1TestCase.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/RequiredIf1TestCase.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/RequiredIf1TestCase.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 RequiredIf1TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public RequiredIf1TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        RequiredIf1TestBean bean = new RequiredIf1TestBean();
+        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 testRequiredIfTargetNotEmptyFailed() 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(1);
+
+        assertNavigationBlocked(true);
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testRequiredIfTargetNotEmptyCorrect1() 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 testRequiredIfTargetNotEmptyCorrect2() 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 testRequiredIfTargetNotEmptyCorrect3() 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/RequiredIf2TestBean.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/RequiredIf2TestBean.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/RequiredIf2TestBean.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/RequiredIf2TestBean.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.RequiredIf;
+import static org.apache.myfaces.extensions.validator.crossval.annotation.RequiredIfType.*;
+
+public class RequiredIf2TestBean
+{
+    private String property1;
+    @RequiredIf(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/RequiredIf2TestCase.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/RequiredIf2TestCase.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/RequiredIf2TestCase.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/RequiredIf2TestCase.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 RequiredIf2TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public RequiredIf2TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        RequiredIf2TestBean bean = new RequiredIf2TestBean();
+        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 testRequiredIfTargetEmptyFailed() 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(1);
+
+        assertNavigationBlocked(true);
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testRequiredIfTargetEmptyCorrect1() 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
+    }
+
+    @Test
+    public void testRequiredIfTargetEmptyCorrect2() 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 testRequiredIfTargetEmptyCorrect3() 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/RequiredIf3TestBean.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/RequiredIf3TestBean.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/RequiredIf3TestBean.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/RequiredIf3TestBean.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.RequiredIf;
+
+public class RequiredIf3TestBean
+{
+    private Boolean property1;
+    @RequiredIf(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/RequiredIf3TestCase.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/RequiredIf3TestCase.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/RequiredIf3TestCase.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/RequiredIf3TestCase.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 RequiredIf3TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public RequiredIf3TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        RequiredIf3TestBean bean = new RequiredIf3TestBean();
+        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 testRequiredIfBooleanTargetNotEmptyFailed() 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(1);
+
+        assertNavigationBlocked(true);
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testRequiredIfBooleanTargetNotEmptyCorrect1() 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 testRequiredIfBooleanTargetNotEmptyCorrect2() 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 testRequiredIfBooleanTargetNotEmptyCorrect3() 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/RequiredIf4TestBean.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/RequiredIf4TestBean.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/RequiredIf4TestBean.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/RequiredIf4TestBean.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.RequiredIf;
+import static org.apache.myfaces.extensions.validator.crossval.annotation.RequiredIfType.*;
+
+public class RequiredIf4TestBean
+{
+    private boolean property1;
+    @RequiredIf(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/RequiredIf4TestCase.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/RequiredIf4TestCase.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/RequiredIf4TestCase.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/RequiredIf4TestCase.java Mon May 30 08:38:45 2011
@@ -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 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;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class RequiredIf4TestCase extends AbstractPropertyValidationTestCase
+{
+
+    HtmlInputText inputComponent1 = null;
+    HtmlInputText inputComponent2 = null;
+
+    UIViewRoot rootComponent = null;
+
+    public RequiredIf4TestCase()
+    {
+        inputComponent1 = null;
+        inputComponent2 = null;
+        rootComponent = null;
+    }
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        RequiredIf4TestBean bean = new RequiredIf4TestBean();
+        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 testRequiredIfBooleanTargetEmptyFailed() 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(1);
+
+        assertNavigationBlocked(true);
+        checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+
+        //no update model needed
+    }
+
+    @Test
+    public void testRequiredIfBooleanTargetEmptyCorrect1() 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
+    }
+
+    @Test
+    public void testRequiredIfBooleanTargetEmptyCorrect2() 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 testRequiredIfBooleanTargetEmptyCorrect3() 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/mock/MockEqualsValidationStrategy.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/mock/MockEqualsValidationStrategy.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/mock/MockEqualsValidationStrategy.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/mock/MockEqualsValidationStrategy.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.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_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/custom/CustomViolationSeverity.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/custom/CustomViolationSeverity.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/custom/CustomViolationSeverity.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/custom/CustomViolationSeverity.java Mon May 30 08:38:45 2011
@@ -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.custom;
+
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterKey;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterValue;
+
+import javax.faces.application.FacesMessage;
+
+public interface CustomViolationSeverity
+{
+    interface Warning extends ValidationParameter
+    {
+        @ParameterKey
+        public Class KEY = CustomViolationSeverity.class;
+
+        @ParameterValue
+        FacesMessage.Severity SEVERITY = FacesMessage.SEVERITY_WARN;
+    }
+}
\ 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/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.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/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.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/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.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/interceptor/RegistrationModuleMetaDataExtractionInterceptorTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,187 @@
+/*
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+import java.util.List;
+
+public class RegistrationModuleMetaDataExtractionInterceptorTestCase extends AbstractExValCoreTestCase
+{
+
+
+    @Test
+    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_2_0/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_2_0/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/interceptor/RegistrationModulePropertyValidationInterceptorTestCase.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/interceptor/RegistrationModulePropertyValidationInterceptorTestCase.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/interceptor/RegistrationModulePropertyValidationInterceptorTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,212 @@
+/*
+ * 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 org.junit.Assert;
+import org.junit.Test;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import java.util.List;
+import java.util.Map;
+
+public class RegistrationModulePropertyValidationInterceptorTestCase extends AbstractExValCoreTestCase
+{
+
+    @Test
+    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

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/interceptor/RegistrationRendererInterceptorTestCase.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/interceptor/RegistrationRendererInterceptorTestCase.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/interceptor/RegistrationRendererInterceptorTestCase.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/interceptor/RegistrationRendererInterceptorTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,70 @@
+/*
+ * 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.interceptor.RendererInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.AbstractRendererInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationInterceptor;
+import org.apache.myfaces.extensions.validator.PropertyValidationModuleValidationInterceptor;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.List;
+
+public class RegistrationRendererInterceptorTestCase extends AbstractExValCoreTestCase
+{
+
+
+    @SuppressWarnings({"ConstantConditions"})
+    @Test
+    public void testRendererInterceptorInitialization()
+    {
+        ExtValContext.getContext().registerRendererInterceptor(new TestComponentInitializer());
+        ExtValContext.getContext().registerRendererInterceptor(new TestComponentInitializer1());
+        ExtValContext.getContext().registerRendererInterceptor(new TestComponentInitializer2());
+
+        List<RendererInterceptor> result = ExtValContext.getContext().getRendererInterceptors();
+
+        int resultLength = 4;
+        Assert.assertEquals(resultLength, result.size());
+
+        RendererInterceptor tmp;
+        for(int i = 0; i < resultLength; i++)
+        {
+            tmp = result.get(i);
+            Assert.assertTrue(tmp instanceof TestComponentInitializer ||
+                    tmp instanceof ValidationInterceptor ||  /*due to a junit issue*/
+                    tmp instanceof PropertyValidationModuleValidationInterceptor);
+        }
+    }
+
+    class TestComponentInitializer extends AbstractRendererInterceptor
+    {
+    }
+
+    class TestComponentInitializer1 extends TestComponentInitializer
+    {
+    }
+
+    class TestComponentInitializer2 extends TestComponentInitializer
+    {
+    }
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/pom.xml?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/pom.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/pom.xml Mon May 30 08:38:45 2011
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+
+    <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+    <artifactId>myfaces-extval-trinidad-support-tests</artifactId>
+
+    <name>MyFaces Extensions-Validator Trinidad Component-Support-Tests</name>
+    <version>2.0.5-SNAPSHOT</version>
+
+    <parent>
+        <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+        <artifactId>test-modules-project</artifactId>
+        <version>2.0.5-SNAPSHOT</version>
+    </parent>
+
+	<!--  Is there a way to synchronize this value with the component support module POM -->
+    <properties>
+        <trinidad.version>2.0.0</trinidad.version>
+    </properties>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+            <artifactId>myfaces-extval-property-validation</artifactId>
+            <version>2.0.5-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+            <artifactId>myfaces-extval-base-test-infrastructure</artifactId>
+            <version>2.0.5-SNAPSHOT</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+            <artifactId>myfaces-extval-core-tests</artifactId>
+            <version>2.0.5-SNAPSHOT</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+            <artifactId>myfaces-extval-trinidad-support</artifactId>
+            <version>2.0.5-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.trinidad</groupId>
+            <artifactId>trinidad-api</artifactId>
+            <version>${trinidad.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.myfaces.trinidad</groupId>
+            <artifactId>trinidad-impl</artifactId>
+            <version>${trinidad.version}</version>
+            <scope>test</scope>
+        </dependency>
+            
+    </dependencies>
+</project>

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/AbstractTrinidadSupportTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/AbstractTrinidadSupportTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/AbstractTrinidadSupportTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/AbstractTrinidadSupportTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,144 @@
+/*
+ * 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.trinidad;
+
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKit;
+import org.apache.myfaces.extensions.validator.test.base.AbstractExValTestCase;
+import org.apache.myfaces.extensions.validator.trinidad.startup.TrinidadModuleStartupListener;
+import org.apache.myfaces.test.config.ConfigParser;
+import org.apache.myfaces.test.mock.MockRenderKit;
+import org.apache.myfaces.trinidad.component.UIXInput;
+import org.apache.myfaces.trinidad.context.RenderingContext;
+import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidad.skin.SkinFactory;
+import org.apache.myfaces.trinidadinternal.context.RequestContextBean;
+import org.apache.myfaces.trinidadinternal.context.RequestContextImpl;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
+import org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl;
+
+import javax.el.ValueExpression;
+import javax.faces.FactoryFinder;
+import javax.faces.el.ValueBinding;
+import javax.faces.render.RenderKitFactory;
+import java.net.URL;
+import java.util.Enumeration;
+
+/**
+ * @author Rudy De Busscher
+ *         since v4
+ */
+public abstract class AbstractTrinidadSupportTestCase extends AbstractExValTestCase
+{
+
+    private RequestContext requestContext;
+
+    private RenderingContext renderingContext;
+
+    @Override
+    protected void setFactories() throws Exception
+    {
+        super.setFactories();
+                FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
+                "org.apache.myfaces.trinidadinternal.renderkit.CoreRenderKitFactory");
+
+    }
+
+    @Override
+    protected void setUpRenderKit() throws Exception
+    {
+
+        RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
+                .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+        renderKit = new ExtValRenderKit(new CoreRenderKit());
+        renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT,
+                renderKit);
+
+        renderKitFactory.addRenderKit("org.apache.myfaces.trinidad.core",
+                renderKit);
+        renderKitFactory.addRenderKit("org.apache.myfaces.trinidadinternal.core",
+                renderKit);
+        renderKitFactory.addRenderKit("org.apache.myfaces.trinidad.core.desktop",
+                renderKit);
+        renderKitFactory.addRenderKit("org.apache.myfaces.trinidad.core.pda",
+                renderKit);
+
+        ConfigParser parser = new ConfigParser();
+
+        Enumeration<URL> facesConfigEnum =getClass().getClassLoader().getResources("META-INF/faces-config.xml");
+
+        while (facesConfigEnum.hasMoreElements() ) {
+            URL url = facesConfigEnum.nextElement();
+            if (url.toExternalForm().contains("trinidad")) {
+                parser.parse(url);
+            }
+        }
+
+
+    }
+
+    @Override
+    protected void invokeStartupListeners()
+    {
+        new TrinidadModuleStartupListener()
+        {
+            private static final long serialVersionUID = 423076920926752646L;
+
+            @Override
+            protected void init()
+            {
+                super.init();
+            }
+        }.init();
+
+    }
+
+    @Override
+    protected void resetTestCase()
+    {
+        renderingContext.release();
+        requestContext.release();
+        super.resetTestCase();
+    }
+
+    @Override
+    protected void setUpTestCase()
+    {
+        super.setUpTestCase();
+        SkinFactory.setFactory(new SkinFactoryImpl());
+        requestContext = new RequestContextImpl(new RequestContextBean());
+        ((RequestContextImpl)requestContext).init(externalContext);
+        renderingContext = new CoreRenderingContext();
+
+
+    }
+
+    protected void createValueBinding(UIXInput uiInput, String name, String expression)
+    {
+        ValueBinding valueBinding = application.createValueBinding(expression);
+        ValueExpression valueExpression = application.getExpressionFactory().createValueExpression(
+                facesContext.getELContext(), expression, Object.class);
+
+        if (uiInput != null)
+        {
+            uiInput.setValueBinding(name, valueBinding);
+            uiInput.setValueExpression(name, valueExpression);
+        }
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/config/ExtValTrinidadSupportModuleConfigurationCustomTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/config/ExtValTrinidadSupportModuleConfigurationCustomTestCase.java?rev=1129058&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/config/ExtValTrinidadSupportModuleConfigurationCustomTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_2_0/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/config/ExtValTrinidadSupportModuleConfigurationCustomTestCase.java Mon May 30 08:38:45 2011
@@ -0,0 +1,80 @@
+/*
+ * 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.trinidad.config;
+
+import org.apache.myfaces.extensions.validator.trinidad.DefaultExtValTrinidadSupportModuleConfiguration;
+import org.apache.myfaces.extensions.validator.trinidad.ExtValTrinidadSupportModuleConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValTrinidadSupportModuleConfigurationCustomTestCase extends
+        ExtValTrinidadSupportModuleConfigurationTestCase
+{
+
+    public static class CustomExtValTrinidadSupportModuleConfiguration extends
+            DefaultExtValTrinidadSupportModuleConfiguration
+    {
+
+        @Override
+        public boolean deactivateClientSideValidation()
+        {
+            return true;
+        }
+
+    }
+
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needCustomConfig())
+        {
+            addInitParameter(ExtValTrinidadSupportModuleConfiguration.class.getName(),
+                    CustomExtValTrinidadSupportModuleConfiguration.class.getName());
+
+        }
+    }
+
+    @Override
+    protected ExtValTrinidadSupportModuleConfiguration getCustomTrinidadSupportModuleConfiguration()
+    {
+        // Don't specify the custom config here. We explicitly want to test the
+        // web.xml parameter.
+        return null;
+    }
+
+    @Test
+    public void testExtValTrinidadSupportModuleConfigurationCustomDefault()
+    {
+        Assert.assertFalse(ExtValTrinidadSupportModuleConfiguration.get().deactivateClientSideValidation());
+    }
+
+    @Test
+    public void testExtValTrinidadSupportModuleConfigurationCustomCustomConfig()
+    {
+        Assert.assertTrue(ExtValTrinidadSupportModuleConfiguration.get().deactivateClientSideValidation());
+
+    }
+
+}