You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2011/05/28 01:09:27 UTC

svn commit: r1128511 [1/2] - in /incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic: ./ extval-shared-tests/ extval-shared-tests/java/ extval-shared-tests/java/org/ extval-shared-tests/java/org/apache/ extval-shared-tests/java/org/apache/bval/ extva...

Author: mbenson
Date: Fri May 27 23:09:25 2011
New Revision: 1128511

URL: http://svn.apache.org/viewvc?rev=1128511&view=rev
Log:
add shared tests module and JSF1.2-based test module

Added:
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/validation/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/view/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/pom.xml   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/validation/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/view/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/services/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/services/org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/validation/
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/validation.xml   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/validation/constraint-definitions.xml   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval12-tests/   (with props)
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval12-tests/pom.xml   (with props)
Modified:
    incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/pom.xml

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri May 27 23:09:25 2011
@@ -0,0 +1,3 @@
+*.log
+.*
+target

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java Fri May 27 23:09:25 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.bval.jsr303.dynamic.extval;
+
+import org.apache.bval.jsr303.dynamic.DynamicValidatorContext;
+import org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider;
+import org.apache.myfaces.extensions.validator.test.beanval.BaseBeanValPropertyValidationTestCase;
+
+/**
+ * 
+ * 
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseDynamicBeanValPropertyValidationTestCase<T> extends BaseBeanValPropertyValidationTestCase<T> {
+    private final DynamicValidatorContextProvider validatorContextProvider = DynamicBeanValidation
+        .uniqueService(DynamicValidatorContextProvider.class);
+
+    @Override
+    protected void invokeStartupListeners() {
+        super.invokeStartupListeners();
+        new DynamicBeanValidationStartupListener().init();
+    }
+
+    protected DynamicValidatorContext validatorContext() {
+        return (DynamicValidatorContext) validatorContextProvider.get();
+    }
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java Fri May 27 23:09:25 2011
@@ -0,0 +1,128 @@
+/*
+ *  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.bval.jsr303.dynamic.extval;
+
+import org.apache.bval.jsr303.dynamic.StubConstraint;
+import org.apache.bval.jsr303.dynamic.extval.model.Bean;
+import org.apache.bval.jsr303.dynamic.extval.model.BeanHolder;
+import org.apache.bval.jsr303.dynamic.extval.view.PageBean;
+import org.apache.myfaces.extensions.validator.test.beanval.validation.ClassLevelEqual;
+import org.junit.Test;
+
+/**
+ * Test dynamic model validation.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DynamicModelValidationTestCase extends BaseDynamicBeanValPropertyValidationTestCase<PageBean> {
+
+    @Override
+    protected PageBean getBeanToTest() {
+        return new PageBean();
+    }
+
+    @Test
+    public void testDynamicModelValidation() {
+        createValueBindingForComponent(this.inputComponent1, "#{testBean.bean.property1}");
+        setValueToValidate(this.inputComponent1, "123");
+
+        createValueBindingForComponent(this.inputComponent2, "#{testBean.bean.property2}");
+        setValueToValidate(this.inputComponent2, "456");
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(false);
+
+        checkMessageCount(0);
+
+        validatorContext().constrain(Bean.class, StubConstraint.build(ClassLevelEqual.class));
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(true);
+
+        checkMessageCount(1);
+    }
+
+    @Test
+    public void testDynamicNestedModelValidation() {
+        createValueBindingForComponent(this.inputComponent1, "#{testBean.beanHolder.bean.property1}");
+        setValueToValidate(this.inputComponent1, "123");
+
+        createValueBindingForComponent(this.inputComponent2, "#{testBean.beanHolder.bean.property2}");
+        setValueToValidate(this.inputComponent2, "456");
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(false);
+
+        checkMessageCount(0);
+
+        validatorContext().constrain(BeanHolder.class, "bean", StubConstraint.build(ClassLevelEqual.class));
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(true);
+
+        checkMessageCount(1);
+    }
+
+    @Test
+    public void testDynamicNestedIndexedModelValidation() {
+        createValueBindingForComponent(this.inputComponent1, "#{testBean.beanHolder.beans[1].property1}");
+        setValueToValidate(this.inputComponent1, "123");
+
+        createValueBindingForComponent(this.inputComponent2, "#{testBean.beanHolder.beans[1].property2}");
+        setValueToValidate(this.inputComponent2, "456");
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(false);
+
+        checkMessageCount(0);
+
+        validatorContext().constrain(BeanHolder.class, "beans[0]", StubConstraint.build(ClassLevelEqual.class));
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+        
+        assertNavigationBlocked(false);
+        
+        checkMessageCount(0);
+        
+        validatorContext().constrain(BeanHolder.class, "beans[1]", StubConstraint.build(ClassLevelEqual.class));
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(true);
+
+        checkMessageCount(1);
+    }
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java Fri May 27 23:09:25 2011
@@ -0,0 +1,51 @@
+/*
+ *  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.bval.jsr303.dynamic.extval;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.validation.Validation;
+import javax.validation.ValidatorContext;
+import javax.validation.ValidatorFactory;
+
+import org.apache.bval.jsr303.dynamic.DynamicValidatorContext;
+import org.apache.bval.jsr303.dynamic.DynamicValidatorFactory;
+import org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider;
+
+/**
+ * Test {@code DynamicValidatorContextProvider}.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DynamicValidatorContextProviderTestImpl implements DynamicValidatorContextProvider {
+    private ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
+
+    /**
+     * {@inheritDoc}
+     */
+    public synchronized DynamicValidatorContext get() {
+        Map<? super String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
+        DynamicValidatorContext result = (DynamicValidatorContext) sessionMap.get(ValidatorContext.class.getName());
+        if (result == null) {
+            result = validatorFactory.unwrap(DynamicValidatorFactory.class).usingContext();
+            sessionMap.put(ValidatorContext.class.getName(), result);
+        }
+        return result;
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java Fri May 27 23:09:25 2011
@@ -0,0 +1,71 @@
+/*
+ *  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.bval.jsr303.dynamic.extval;
+
+import org.apache.bval.jsr303.dynamic.extval.test.runners.DynamicBeanValidationExtValSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.CascadedValidationTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation1TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation2TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation3TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation4TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation5TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation6TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.CustomSeverity1TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.DefaultGroupTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.DeregisterSubNameMapperTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.LabelReplacementTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ModelValidation1TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ModelValidation2TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ModelValidation3TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ModelValidation4TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.RestrictGroupsTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.UseGroupValidation1TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.UseGroupValidation2TestCase;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * 
+ * 
+ * @version $Rev$ $Date$
+ */
+@RunWith(DynamicBeanValidationExtValSuite.class)
+// @formatter:off
+@SuiteClasses({
+    CascadedValidationTestCase.class,
+    ConstraintSourceAwareValidation1TestCase.class,
+    ConstraintSourceAwareValidation2TestCase.class,
+    ConstraintSourceAwareValidation3TestCase.class,
+    ConstraintSourceAwareValidation4TestCase.class,
+    ConstraintSourceAwareValidation6TestCase.class,
+    CustomSeverity1TestCase.class,
+    DefaultGroupTestCase.class,
+    ConstraintSourceAwareValidation5TestCase.class,
+    DeregisterSubNameMapperTestCase.class,
+    LabelReplacementTestCase.class,
+    ModelValidation1TestCase.class,
+    ModelValidation2TestCase.class,
+    ModelValidation3TestCase.class,
+    ModelValidation4TestCase.class,
+    RestrictGroupsTestCase.class,
+    UseGroupValidation1TestCase.class,
+    UseGroupValidation2TestCase.class
+})
+// @formatter:on
+public class StaticBeanValidationCompatibilityTest {
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java Fri May 27 23:09:25 2011
@@ -0,0 +1,66 @@
+/*
+ *  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.bval.jsr303.dynamic.extval.model;
+
+/**
+ * Test bean.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class Bean {
+    private String property1;
+    private String property2;
+
+    /**
+     * Get the property1.
+     * 
+     * @return String
+     */
+    public String getProperty1() {
+        return property1;
+    }
+
+    /**
+     * Set the property1.
+     * 
+     * @param property1
+     *            the String to set
+     */
+    public void setProperty1(String property1) {
+        this.property1 = property1;
+    }
+
+    /**
+     * Get the property2.
+     * 
+     * @return String
+     */
+    public String getProperty2() {
+        return property2;
+    }
+
+    /**
+     * Set the property2.
+     * 
+     * @param property2
+     *            the String to set
+     */
+    public void setProperty2(String property2) {
+        this.property2 = property2;
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java Fri May 27 23:09:25 2011
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.jsr303.dynamic.extval.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.validation.Valid;
+
+/**
+ * Holder of {@link Bean}s.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class BeanHolder {
+    @Valid
+    private Bean bean = new Bean();
+
+    @Valid
+    private List<Bean> beans;
+
+    {
+        beans = new ArrayList<Bean>();
+        beans.add(new Bean());
+        beans.add(new Bean());
+        beans.add(new Bean());
+    }
+
+    /**
+     * Get the bean.
+     * 
+     * @return Bean
+     */
+    public Bean getBean() {
+        return bean;
+    }
+
+    /**
+     * Set the bean.
+     * 
+     * @param bean
+     *            the Bean to set
+     */
+    public void setBean(Bean bean) {
+        this.bean = bean;
+    }
+
+    /**
+     * Get the beans.
+     * 
+     * @return List<Bean>
+     */
+    public List<Bean> getBeans() {
+        return beans;
+    }
+
+    /**
+     * Set the beans.
+     * 
+     * @param beans
+     *            the List<Bean> to set
+     */
+    public void setBeans(List<Bean> beans) {
+        this.beans = beans;
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java Fri May 27 23:09:25 2011
@@ -0,0 +1,77 @@
+/*
+ *  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.bval.jsr303.dynamic.extval.test.runners;
+
+import java.util.List;
+
+import org.apache.bval.jsr303.dynamic.extval.DynamicBeanValidationStartupListener;
+import org.junit.Before;
+import org.junit.internal.runners.statements.RunBefores;
+import org.junit.runner.Runner;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.RunnerBuilder;
+import org.junit.runners.model.Statement;
+
+/**
+ * 
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DynamicBeanValidationExtValRunner extends BlockJUnit4ClassRunner {
+    public static class Builder extends RunnerBuilder {
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Runner runnerForClass(Class<?> testClass) throws Throwable {
+            return new DynamicBeanValidationExtValRunner(testClass);
+        }
+
+    }
+
+    /**
+     * Create a new DynamicBeanValidationExtValRunner instance.
+     * 
+     * @param klass
+     * @throws InitializationError
+     */
+    public DynamicBeanValidationExtValRunner(Class<?> klass) throws InitializationError {
+        super(klass);
+    }
+
+    @Override
+    protected Statement withBefores(FrameworkMethod method, Object target, final Statement statement) {
+        List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(Before.class);
+        return befores.isEmpty() ? statement : new RunBefores(new Statement() {
+
+            @Override
+            public void evaluate() throws Throwable {
+                new DynamicBeanValidationStartupListener() {
+                    private static final long serialVersionUID = 1L;
+
+                    public void init() {
+                        super.init();
+                    }
+                }.init();
+                statement.evaluate();
+            }
+        }, befores, target);
+    }
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java Fri May 27 23:09:25 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.bval.jsr303.dynamic.extval.test.runners;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.internal.builders.AllDefaultPossibilitiesBuilder;
+import org.junit.runner.Runner;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.Suite;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.RunnerBuilder;
+
+/**
+ * Implements crosscutting registration of the {@code DynamicBeanValidationStartupListener}.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DynamicBeanValidationExtValSuite extends Suite {
+
+    private static List<Runner> runners(Class<?> testSuite) throws InitializationError {
+        SuiteClasses annotation = testSuite.getAnnotation(SuiteClasses.class);
+        if (annotation == null) {
+            throw new InitializationError(String.format("class '%s' must have a SuiteClasses annotation",
+                testSuite.getName()));
+        }
+        List<Throwable> errors = new ArrayList<Throwable>();
+
+        RunnerBuilder dynamicBval = new DynamicBeanValidationExtValRunner.Builder();
+        RunnerBuilder fallback = new AllDefaultPossibilitiesBuilder(true);
+        ArrayList<Runner> result = new ArrayList<Runner>(annotation.value().length);
+        for (Class<?> suiteClass : annotation.value()) {
+            Runner r = dynamicBval.safeRunnerForClass(suiteClass);
+            if (r == null) {
+                r = fallback.safeRunnerForClass(suiteClass);
+                if (r instanceof BlockJUnit4ClassRunner) {
+                    r = null;
+                }
+            }
+            if (r != null) {
+                result.add(r);
+                continue;
+            }
+            errors.add(new IllegalArgumentException(String.format("No runner for class %s", suiteClass)));
+        }
+        if (errors.isEmpty()) {
+            return result;
+        }
+        throw new InitializationError(errors);
+    }
+
+    /**
+     * Create a new DynamicBeanValidationExtValSuite instance.
+     */
+    public DynamicBeanValidationExtValSuite(Class<?> testSuite) throws Throwable {
+        super(testSuite, runners(testSuite));
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java Fri May 27 23:09:25 2011
@@ -0,0 +1,46 @@
+/*
+ *  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.bval.jsr303.dynamic.extval.validation;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import org.apache.bval.jsr303.dynamic.extval.model.Bean;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.myfaces.extensions.validator.test.beanval.validation.ClassLevelEqual;
+
+/**
+ * Validate {@link ClassLevelEqual} constraint for {@link Bean}.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ClassLevelEqualValidatorForBean implements ConstraintValidator<ClassLevelEqual, Bean> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void initialize(ClassLevelEqual constraintAnnotation) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isValid(Bean value, ConstraintValidatorContext context) {
+        return ObjectUtils.equals(value.getProperty1(), value.getProperty2());
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java Fri May 27 23:09:25 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.bval.jsr303.dynamic.extval.view;
+
+import org.apache.bval.jsr303.dynamic.extval.model.Bean;
+import org.apache.bval.jsr303.dynamic.extval.model.BeanHolder;
+import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidation;
+import org.apache.myfaces.extensions.validator.beanval.annotation.ModelValidation;
+
+/**
+ * Test page bean.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class PageBean {
+    @BeanValidation(modelValidation = @ModelValidation(isActive = true))
+    private Bean bean = new Bean();
+
+    @BeanValidation(modelValidation = @ModelValidation(isActive = true))
+    private BeanHolder beanHolder = new BeanHolder();
+
+    /**
+     * Get the bean.
+     * 
+     * @return Bean
+     */
+    public Bean getBean() {
+        return bean;
+    }
+
+    /**
+     * Set the bean.
+     * 
+     * @param bean
+     *            the Bean to set
+     */
+    public void setBean(Bean bean) {
+        this.bean = bean;
+    }
+
+    /**
+     * Get the beanHolder.
+     * 
+     * @return BeanHolder
+     */
+    public BeanHolder getBeanHolder() {
+        return beanHolder;
+    }
+
+    /**
+     * Set the beanHolder.
+     * 
+     * @param beanHolder
+     *            the BeanHolder to set
+     */
+    public void setBeanHolder(BeanHolder beanHolder) {
+        this.beanHolder = beanHolder;
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/pom.xml?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/pom.xml (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/pom.xml Fri May 27 23:09:25 2011
@@ -0,0 +1,112 @@
+<?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.
+-->
+<!--
+    Maven release plugin requires the project tag to be on a single line.
+-->
+<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>
+  <parent>
+    <groupId>org.apache.bval</groupId>
+    <artifactId>bval-jsr303-dynamic</artifactId>
+    <version>0.4-incubating-SNAPSHOT</version>
+  </parent>
+  <artifactId>bval-jsr303-dynamic-extval-shared-tests</artifactId>
+  <name>Apache Bean Validation :: bval-jsr303-dynamic-extval-shared-tests</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.bval</groupId>
+      <artifactId>bval-jsr303-dynamic-extval-shared</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+      <artifactId>myfaces-extval-bean-validation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+      <artifactId>myfaces-extval-base-test-infrastructure</artifactId>
+      <type>test-jar</type>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+      <artifactId>myfaces-extval-bean-validation-tests</artifactId>
+      <type>test-jar</type>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.myfaces.core</groupId>
+      <artifactId>myfaces-api</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.myfaces.core</groupId>
+      <artifactId>myfaces-impl</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet.jsp</groupId>
+      <artifactId>jsp-api</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.myfaces.test</groupId>
+      <artifactId>myfaces-test12</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-proxy2-stub</artifactId>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <skipTests>true</skipTests>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java Fri May 27 23:09:25 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.bval.jsr303.dynamic.extval;
+
+import org.apache.bval.jsr303.dynamic.DynamicValidatorContext;
+import org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider;
+import org.apache.myfaces.extensions.validator.test.beanval.BaseBeanValPropertyValidationTestCase;
+
+/**
+ * 
+ * 
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseDynamicBeanValPropertyValidationTestCase<T> extends BaseBeanValPropertyValidationTestCase<T> {
+    private final DynamicValidatorContextProvider validatorContextProvider = DynamicBeanValidation
+        .uniqueService(DynamicValidatorContextProvider.class);
+
+    @Override
+    protected void invokeStartupListeners() {
+        super.invokeStartupListeners();
+        new DynamicBeanValidationStartupListener().init();
+    }
+
+    protected DynamicValidatorContext validatorContext() {
+        return (DynamicValidatorContext) validatorContextProvider.get();
+    }
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/BaseDynamicBeanValPropertyValidationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java Fri May 27 23:09:25 2011
@@ -0,0 +1,128 @@
+/*
+ *  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.bval.jsr303.dynamic.extval;
+
+import org.apache.bval.jsr303.dynamic.StubConstraint;
+import org.apache.bval.jsr303.dynamic.extval.model.Bean;
+import org.apache.bval.jsr303.dynamic.extval.model.BeanHolder;
+import org.apache.bval.jsr303.dynamic.extval.view.PageBean;
+import org.apache.myfaces.extensions.validator.test.beanval.validation.ClassLevelEqual;
+import org.junit.Test;
+
+/**
+ * Test dynamic model validation.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DynamicModelValidationTestCase extends BaseDynamicBeanValPropertyValidationTestCase<PageBean> {
+
+    @Override
+    protected PageBean getBeanToTest() {
+        return new PageBean();
+    }
+
+    @Test
+    public void testDynamicModelValidation() {
+        createValueBindingForComponent(this.inputComponent1, "#{testBean.bean.property1}");
+        setValueToValidate(this.inputComponent1, "123");
+
+        createValueBindingForComponent(this.inputComponent2, "#{testBean.bean.property2}");
+        setValueToValidate(this.inputComponent2, "456");
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(false);
+
+        checkMessageCount(0);
+
+        validatorContext().constrain(Bean.class, StubConstraint.build(ClassLevelEqual.class));
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(true);
+
+        checkMessageCount(1);
+    }
+
+    @Test
+    public void testDynamicNestedModelValidation() {
+        createValueBindingForComponent(this.inputComponent1, "#{testBean.beanHolder.bean.property1}");
+        setValueToValidate(this.inputComponent1, "123");
+
+        createValueBindingForComponent(this.inputComponent2, "#{testBean.beanHolder.bean.property2}");
+        setValueToValidate(this.inputComponent2, "456");
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(false);
+
+        checkMessageCount(0);
+
+        validatorContext().constrain(BeanHolder.class, "bean", StubConstraint.build(ClassLevelEqual.class));
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(true);
+
+        checkMessageCount(1);
+    }
+
+    @Test
+    public void testDynamicNestedIndexedModelValidation() {
+        createValueBindingForComponent(this.inputComponent1, "#{testBean.beanHolder.beans[1].property1}");
+        setValueToValidate(this.inputComponent1, "123");
+
+        createValueBindingForComponent(this.inputComponent2, "#{testBean.beanHolder.beans[1].property2}");
+        setValueToValidate(this.inputComponent2, "456");
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(false);
+
+        checkMessageCount(0);
+
+        validatorContext().constrain(BeanHolder.class, "beans[0]", StubConstraint.build(ClassLevelEqual.class));
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+        
+        assertNavigationBlocked(false);
+        
+        checkMessageCount(0);
+        
+        validatorContext().constrain(BeanHolder.class, "beans[1]", StubConstraint.build(ClassLevelEqual.class));
+
+        validateComponents();
+        updateComponents();
+        processModelValidation();
+
+        assertNavigationBlocked(true);
+
+        checkMessageCount(1);
+    }
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicModelValidationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java Fri May 27 23:09:25 2011
@@ -0,0 +1,51 @@
+/*
+ *  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.bval.jsr303.dynamic.extval;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+import javax.validation.Validation;
+import javax.validation.ValidatorContext;
+import javax.validation.ValidatorFactory;
+
+import org.apache.bval.jsr303.dynamic.DynamicValidatorContext;
+import org.apache.bval.jsr303.dynamic.DynamicValidatorFactory;
+import org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider;
+
+/**
+ * Test {@code DynamicValidatorContextProvider}.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DynamicValidatorContextProviderTestImpl implements DynamicValidatorContextProvider {
+    private ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory();
+
+    /**
+     * {@inheritDoc}
+     */
+    public synchronized DynamicValidatorContext get() {
+        Map<? super String, Object> sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
+        DynamicValidatorContext result = (DynamicValidatorContext) sessionMap.get(ValidatorContext.class.getName());
+        if (result == null) {
+            result = validatorFactory.unwrap(DynamicValidatorFactory.class).usingContext();
+            sessionMap.put(ValidatorContext.class.getName(), result);
+        }
+        return result;
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/DynamicValidatorContextProviderTestImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java Fri May 27 23:09:25 2011
@@ -0,0 +1,71 @@
+/*
+ *  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.bval.jsr303.dynamic.extval;
+
+import org.apache.bval.jsr303.dynamic.extval.test.runners.DynamicBeanValidationExtValSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.CascadedValidationTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation1TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation2TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation3TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation4TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation5TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ConstraintSourceAwareValidation6TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.CustomSeverity1TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.DefaultGroupTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.DeregisterSubNameMapperTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.LabelReplacementTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ModelValidation1TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ModelValidation2TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ModelValidation3TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.ModelValidation4TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.RestrictGroupsTestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.UseGroupValidation1TestCase;
+import org.apache.myfaces.extensions.validator.test.beanval.UseGroupValidation2TestCase;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * 
+ * 
+ * @version $Rev$ $Date$
+ */
+@RunWith(DynamicBeanValidationExtValSuite.class)
+// @formatter:off
+@SuiteClasses({
+    CascadedValidationTestCase.class,
+    ConstraintSourceAwareValidation1TestCase.class,
+    ConstraintSourceAwareValidation2TestCase.class,
+    ConstraintSourceAwareValidation3TestCase.class,
+    ConstraintSourceAwareValidation4TestCase.class,
+    ConstraintSourceAwareValidation6TestCase.class,
+    CustomSeverity1TestCase.class,
+    DefaultGroupTestCase.class,
+    ConstraintSourceAwareValidation5TestCase.class,
+    DeregisterSubNameMapperTestCase.class,
+    LabelReplacementTestCase.class,
+    ModelValidation1TestCase.class,
+    ModelValidation2TestCase.class,
+    ModelValidation3TestCase.class,
+    ModelValidation4TestCase.class,
+    RestrictGroupsTestCase.class,
+    UseGroupValidation1TestCase.class,
+    UseGroupValidation2TestCase.class
+})
+// @formatter:on
+public class StaticBeanValidationCompatibilityTest {
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/StaticBeanValidationCompatibilityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java Fri May 27 23:09:25 2011
@@ -0,0 +1,66 @@
+/*
+ *  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.bval.jsr303.dynamic.extval.model;
+
+/**
+ * Test bean.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class Bean {
+    private String property1;
+    private String property2;
+
+    /**
+     * Get the property1.
+     * 
+     * @return String
+     */
+    public String getProperty1() {
+        return property1;
+    }
+
+    /**
+     * Set the property1.
+     * 
+     * @param property1
+     *            the String to set
+     */
+    public void setProperty1(String property1) {
+        this.property1 = property1;
+    }
+
+    /**
+     * Get the property2.
+     * 
+     * @return String
+     */
+    public String getProperty2() {
+        return property2;
+    }
+
+    /**
+     * Set the property2.
+     * 
+     * @param property2
+     *            the String to set
+     */
+    public void setProperty2(String property2) {
+        this.property2 = property2;
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/Bean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java Fri May 27 23:09:25 2011
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.jsr303.dynamic.extval.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.validation.Valid;
+
+/**
+ * Holder of {@link Bean}s.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class BeanHolder {
+    @Valid
+    private Bean bean = new Bean();
+
+    @Valid
+    private List<Bean> beans;
+
+    {
+        beans = new ArrayList<Bean>();
+        beans.add(new Bean());
+        beans.add(new Bean());
+        beans.add(new Bean());
+    }
+
+    /**
+     * Get the bean.
+     * 
+     * @return Bean
+     */
+    public Bean getBean() {
+        return bean;
+    }
+
+    /**
+     * Set the bean.
+     * 
+     * @param bean
+     *            the Bean to set
+     */
+    public void setBean(Bean bean) {
+        this.bean = bean;
+    }
+
+    /**
+     * Get the beans.
+     * 
+     * @return List<Bean>
+     */
+    public List<Bean> getBeans() {
+        return beans;
+    }
+
+    /**
+     * Set the beans.
+     * 
+     * @param beans
+     *            the List<Bean> to set
+     */
+    public void setBeans(List<Bean> beans) {
+        this.beans = beans;
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/model/BeanHolder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java Fri May 27 23:09:25 2011
@@ -0,0 +1,77 @@
+/*
+ *  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.bval.jsr303.dynamic.extval.test.runners;
+
+import java.util.List;
+
+import org.apache.bval.jsr303.dynamic.extval.DynamicBeanValidationStartupListener;
+import org.junit.Before;
+import org.junit.internal.runners.statements.RunBefores;
+import org.junit.runner.Runner;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.RunnerBuilder;
+import org.junit.runners.model.Statement;
+
+/**
+ * 
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DynamicBeanValidationExtValRunner extends BlockJUnit4ClassRunner {
+    public static class Builder extends RunnerBuilder {
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Runner runnerForClass(Class<?> testClass) throws Throwable {
+            return new DynamicBeanValidationExtValRunner(testClass);
+        }
+
+    }
+
+    /**
+     * Create a new DynamicBeanValidationExtValRunner instance.
+     * 
+     * @param klass
+     * @throws InitializationError
+     */
+    public DynamicBeanValidationExtValRunner(Class<?> klass) throws InitializationError {
+        super(klass);
+    }
+
+    @Override
+    protected Statement withBefores(FrameworkMethod method, Object target, final Statement statement) {
+        List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(Before.class);
+        return befores.isEmpty() ? statement : new RunBefores(new Statement() {
+
+            @Override
+            public void evaluate() throws Throwable {
+                new DynamicBeanValidationStartupListener() {
+                    private static final long serialVersionUID = 1L;
+
+                    public void init() {
+                        super.init();
+                    }
+                }.init();
+                statement.evaluate();
+            }
+        }, befores, target);
+    }
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValRunner.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java Fri May 27 23:09:25 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.bval.jsr303.dynamic.extval.test.runners;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.internal.builders.AllDefaultPossibilitiesBuilder;
+import org.junit.runner.Runner;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.Suite;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.RunnerBuilder;
+
+/**
+ * Implements crosscutting registration of the {@code DynamicBeanValidationStartupListener}.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class DynamicBeanValidationExtValSuite extends Suite {
+
+    private static List<Runner> runners(Class<?> testSuite) throws InitializationError {
+        SuiteClasses annotation = testSuite.getAnnotation(SuiteClasses.class);
+        if (annotation == null) {
+            throw new InitializationError(String.format("class '%s' must have a SuiteClasses annotation",
+                testSuite.getName()));
+        }
+        List<Throwable> errors = new ArrayList<Throwable>();
+
+        RunnerBuilder dynamicBval = new DynamicBeanValidationExtValRunner.Builder();
+        RunnerBuilder fallback = new AllDefaultPossibilitiesBuilder(true);
+        ArrayList<Runner> result = new ArrayList<Runner>(annotation.value().length);
+        for (Class<?> suiteClass : annotation.value()) {
+            Runner r = dynamicBval.safeRunnerForClass(suiteClass);
+            if (r == null) {
+                r = fallback.safeRunnerForClass(suiteClass);
+                if (r instanceof BlockJUnit4ClassRunner) {
+                    r = null;
+                }
+            }
+            if (r != null) {
+                result.add(r);
+                continue;
+            }
+            errors.add(new IllegalArgumentException(String.format("No runner for class %s", suiteClass)));
+        }
+        if (errors.isEmpty()) {
+            return result;
+        }
+        throw new InitializationError(errors);
+    }
+
+    /**
+     * Create a new DynamicBeanValidationExtValSuite instance.
+     */
+    public DynamicBeanValidationExtValSuite(Class<?> testSuite) throws Throwable {
+        super(testSuite, runners(testSuite));
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/test/runners/DynamicBeanValidationExtValSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java Fri May 27 23:09:25 2011
@@ -0,0 +1,46 @@
+/*
+ *  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.bval.jsr303.dynamic.extval.validation;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+import org.apache.bval.jsr303.dynamic.extval.model.Bean;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.myfaces.extensions.validator.test.beanval.validation.ClassLevelEqual;
+
+/**
+ * Validate {@link ClassLevelEqual} constraint for {@link Bean}.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ClassLevelEqualValidatorForBean implements ConstraintValidator<ClassLevelEqual, Bean> {
+
+    /**
+     * {@inheritDoc}
+     */
+    public void initialize(ClassLevelEqual constraintAnnotation) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isValid(Bean value, ConstraintValidatorContext context) {
+        return ObjectUtils.equals(value.getProperty1(), value.getProperty2());
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/validation/ClassLevelEqualValidatorForBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java Fri May 27 23:09:25 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.bval.jsr303.dynamic.extval.view;
+
+import org.apache.bval.jsr303.dynamic.extval.model.Bean;
+import org.apache.bval.jsr303.dynamic.extval.model.BeanHolder;
+import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidation;
+import org.apache.myfaces.extensions.validator.beanval.annotation.ModelValidation;
+
+/**
+ * Test page bean.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class PageBean {
+    @BeanValidation(modelValidation = @ModelValidation(isActive = true))
+    private Bean bean = new Bean();
+
+    @BeanValidation(modelValidation = @ModelValidation(isActive = true))
+    private BeanHolder beanHolder = new BeanHolder();
+
+    /**
+     * Get the bean.
+     * 
+     * @return Bean
+     */
+    public Bean getBean() {
+        return bean;
+    }
+
+    /**
+     * Set the bean.
+     * 
+     * @param bean
+     *            the Bean to set
+     */
+    public void setBean(Bean bean) {
+        this.bean = bean;
+    }
+
+    /**
+     * Get the beanHolder.
+     * 
+     * @return BeanHolder
+     */
+    public BeanHolder getBeanHolder() {
+        return beanHolder;
+    }
+
+    /**
+     * Set the beanHolder.
+     * 
+     * @param beanHolder
+     *            the BeanHolder to set
+     */
+    public void setBeanHolder(BeanHolder beanHolder) {
+        this.beanHolder = beanHolder;
+    }
+
+}

Propchange: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/java/org/apache/bval/jsr303/dynamic/extval/view/PageBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/services/org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/services/org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider?rev=1128511&view=auto
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/services/org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider (added)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303-dynamic/extval-shared-tests/src/main/resources/META-INF/services/org.apache.bval.jsr303.dynamic.extval.spi.DynamicValidatorContextProvider Fri May 27 23:09:25 2011
@@ -0,0 +1,16 @@
+# 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
+org.apache.bval.jsr303.dynamic.extval.DynamicValidatorContextProviderTestImpl