You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2009/11/04 13:07:01 UTC
svn commit: r832716 [2/4] - in /myfaces/extensions/validator/trunk: ./
test-modules/ test-modules/base-test-infrastructure/
test-modules/base-test-infrastructure/src/
test-modules/base-test-infrastructure/src/test/
test-modules/base-test-infrastructure...
Added: myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/initializer/RegistrationComponentInitializerTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/initializer/RegistrationComponentInitializerTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/initializer/RegistrationComponentInitializerTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/initializer/RegistrationComponentInitializerTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,125 @@
+/*
+ * 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.core.initializer;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import java.util.Map;
+import java.util.List;
+
+public class RegistrationComponentInitializerTestCase extends AbstractExValCoreTestCase
+{
+ /**
+ * Construct a new instance of the test.
+ *
+ * @param name Name of the test.
+ */
+ public RegistrationComponentInitializerTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RegistrationComponentInitializerTestCase.class);
+ }
+
+ public void testComponentInitializerInitialization()
+ {
+ ExtValContext.getContext().addComponentInitializer(new TestComponentInitializer1000());
+ ExtValContext.getContext().addComponentInitializer(new TestComponentInitializer2());
+ ExtValContext.getContext().addComponentInitializer(new TestComponentInitializer());
+ ExtValContext.getContext().addComponentInitializer(new TestComponentInitializer3());
+ ExtValContext.getContext().addComponentInitializer(new TestComponentInitializer1());
+
+ List<ComponentInitializer> result = ExtValContext.getContext().getComponentInitializers();
+
+ 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 TestComponentInitializer1);
+ break;
+ case 1:
+ Assert.assertTrue(result.get(i) instanceof TestComponentInitializer2);
+ break;
+ case 2:
+ Assert.assertTrue(result.get(i) instanceof TestComponentInitializer3);
+ break;
+ case 3:
+ Assert.assertTrue(result.get(i) instanceof TestComponentInitializer1000);
+ break;
+ case 4:
+ Assert.assertTrue(result.get(i) instanceof TestComponentInitializer);
+ break;
+ }
+ }
+ }
+
+ class TestComponentInitializer implements ComponentInitializer
+ {
+ public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+ {
+ }
+ }
+
+ @InvocationOrder(1)
+ class TestComponentInitializer1 implements ComponentInitializer
+ {
+ public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+ {
+ }
+ }
+
+ @InvocationOrder(2)
+ class TestComponentInitializer2 implements ComponentInitializer
+ {
+ public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+ {
+ }
+ }
+
+ @InvocationOrder(3)
+ class TestComponentInitializer3 implements ComponentInitializer
+ {
+ public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+ {
+ }
+ }
+
+ @InvocationOrder(1000)
+ class TestComponentInitializer1000 implements ComponentInitializer
+ {
+ public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+ {
+ }
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationMetaDataExtractionInterceptorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationMetaDataExtractionInterceptorTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationMetaDataExtractionInterceptorTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationMetaDataExtractionInterceptorTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,123 @@
+/*
+ * 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.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.property.PropertyInformation;
+import org.apache.myfaces.extensions.validator.core.interceptor.MetaDataExtractionInterceptor;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import java.util.List;
+
+public class RegistrationMetaDataExtractionInterceptorTestCase extends AbstractExValCoreTestCase
+{
+ /**
+ * Construct a new instance of the test.
+ *
+ * @param name Name of the test.
+ */
+ public RegistrationMetaDataExtractionInterceptorTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RegistrationMetaDataExtractionInterceptorTestCase.class);
+ }
+
+ public void testMetaDataExtractionInterceptorInitialization()
+ {
+ ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestMetaDataExtractionInterceptor1000());
+ ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestMetaDataExtractionInterceptor2());
+ ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestComponentInitializer());
+ ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestMetaDataExtractionInterceptor3());
+ ExtValContext.getContext().addMetaDataExtractionInterceptor(new TestMetaDataExtractionInterceptor1());
+
+ List<MetaDataExtractionInterceptor> result = ExtValContext.getContext().getMetaDataExtractionInterceptors();
+
+ int resultLength = 5;
+ Assert.assertEquals(resultLength, result.size());
+
+ for(int i = 0; i < resultLength; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ Assert.assertEquals(TestMetaDataExtractionInterceptor1.class, result.get(i).getClass());
+ break;
+ case 1:
+ Assert.assertEquals(TestMetaDataExtractionInterceptor2.class, result.get(i).getClass());
+ break;
+ case 2:
+ Assert.assertEquals(TestMetaDataExtractionInterceptor3.class, result.get(i).getClass());
+ break;
+ case 3:
+ Assert.assertEquals(TestMetaDataExtractionInterceptor1000.class, result.get(i).getClass());
+ break;
+ case 4:
+ Assert.assertEquals(TestComponentInitializer.class, result.get(i).getClass());
+ break;
+ }
+ }
+ }
+
+ class TestComponentInitializer implements MetaDataExtractionInterceptor
+ {
+ public void afterExtracting(PropertyInformation propertyInformation)
+ {
+ }
+ }
+
+ @InvocationOrder(1)
+ class TestMetaDataExtractionInterceptor1 implements MetaDataExtractionInterceptor
+ {
+ public void afterExtracting(PropertyInformation propertyInformation)
+ {
+ }
+ }
+
+ @InvocationOrder(2)
+ class TestMetaDataExtractionInterceptor2 implements MetaDataExtractionInterceptor
+ {
+ public void afterExtracting(PropertyInformation propertyInformation)
+ {
+ }
+ }
+
+ @InvocationOrder(3)
+ class TestMetaDataExtractionInterceptor3 implements MetaDataExtractionInterceptor
+ {
+ public void afterExtracting(PropertyInformation propertyInformation)
+ {
+ }
+ }
+
+ @InvocationOrder(1000)
+ class TestMetaDataExtractionInterceptor1000 implements MetaDataExtractionInterceptor
+ {
+ public void afterExtracting(PropertyInformation propertyInformation)
+ {
+ }
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationPropertyValidationInterceptorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationPropertyValidationInterceptorTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationPropertyValidationInterceptorTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationPropertyValidationInterceptorTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,154 @@
+/*
+ * 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.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.interceptor.PropertyValidationInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.FacesMessagePropertyValidationInterceptor;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import java.util.List;
+import java.util.Map;
+
+public class RegistrationPropertyValidationInterceptorTestCase extends AbstractExValCoreTestCase
+{
+ /**
+ * Construct a new instance of the test.
+ *
+ * @param name Name of the test.
+ */
+ public RegistrationPropertyValidationInterceptorTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RegistrationPropertyValidationInterceptorTestCase.class);
+ }
+
+ public void testPropertyValidationInterceptorInitialization()
+ {
+ ExtValContext.getContext().addPropertyValidationInterceptor(new TestComponentInitializer());
+ ExtValContext.getContext().addPropertyValidationInterceptor(new TestMetaDataExtractionInterceptor1000());
+ ExtValContext.getContext().addPropertyValidationInterceptor(new TestMetaDataExtractionInterceptor2());
+ ExtValContext.getContext().addPropertyValidationInterceptor(new TestMetaDataExtractionInterceptor3());
+ ExtValContext.getContext().addPropertyValidationInterceptor(new TestMetaDataExtractionInterceptor1());
+
+ List<PropertyValidationInterceptor> result = ExtValContext.getContext().getPropertyValidationInterceptors();
+
+ int resultLength = 6;
+ Assert.assertEquals(resultLength, result.size());
+
+ for(int i = 0; i < resultLength; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ Assert.assertEquals(TestMetaDataExtractionInterceptor1.class, result.get(i).getClass());
+ break;
+ case 1:
+ Assert.assertEquals(TestMetaDataExtractionInterceptor2.class, result.get(i).getClass());
+ break;
+ case 2:
+ Assert.assertEquals(TestMetaDataExtractionInterceptor3.class, result.get(i).getClass());
+ break;
+ case 3:
+ Assert.assertEquals(FacesMessagePropertyValidationInterceptor.class, result.get(i).getClass());
+ break;
+ case 4:
+ Assert.assertEquals(TestMetaDataExtractionInterceptor1000.class, result.get(i).getClass());
+ break;
+ case 5:
+ Assert.assertEquals(TestComponentInitializer.class, result.get(i).getClass());
+ break;
+ }
+ }
+ }
+
+ class TestComponentInitializer 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 TestMetaDataExtractionInterceptor1 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 TestMetaDataExtractionInterceptor2 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(3)
+ class TestMetaDataExtractionInterceptor3 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(1000)
+ class TestMetaDataExtractionInterceptor1000 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/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationValidationExceptionInterceptorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationValidationExceptionInterceptorTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationValidationExceptionInterceptorTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/interceptor/RegistrationValidationExceptionInterceptorTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,139 @@
+/*
+ * 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.core.interceptor;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+import org.apache.myfaces.extensions.validator.core.interceptor.ValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.HtmlCoreComponentsValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.core.interceptor.ViolationSeverityValidationExceptionInterceptor;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+import java.util.List;
+
+public class RegistrationValidationExceptionInterceptorTestCase extends AbstractExValCoreTestCase
+{
+ /**
+ * Construct a new instance of the test.
+ *
+ * @param name Name of the test.
+ */
+ public RegistrationValidationExceptionInterceptorTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RegistrationValidationExceptionInterceptorTestCase.class);
+ }
+
+ public void testValidationExceptionInterceptorInitialization()
+ {
+ ExtValContext.getContext().addValidationExceptionInterceptor(new TestValidationExceptionInterceptor1());
+ ExtValContext.getContext().addValidationExceptionInterceptor(new TestValidationExceptionInterceptor2());
+ ExtValContext.getContext().addValidationExceptionInterceptor(new TestValidationExceptionInterceptor3());
+ ExtValContext.getContext().addValidationExceptionInterceptor(new TestValidationExceptionInterceptor1000());
+ ExtValContext.getContext().addValidationExceptionInterceptor(new TestValidationExceptionInterceptor());
+
+ List<ValidationExceptionInterceptor> result = ExtValContext.getContext().getValidationExceptionInterceptors();
+
+ int resultLength = 7;
+ Assert.assertEquals(resultLength, result.size());
+
+ for(int i = 0; i < resultLength; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ Assert.assertEquals(TestValidationExceptionInterceptor1.class, result.get(i).getClass());
+ break;
+ case 1:
+ Assert.assertEquals(TestValidationExceptionInterceptor2.class, result.get(i).getClass());
+ break;
+ case 2:
+ Assert.assertEquals(TestValidationExceptionInterceptor3.class, result.get(i).getClass());
+ break;
+ case 3:
+ Assert.assertEquals(ViolationSeverityValidationExceptionInterceptor.class, result.get(i).getClass());
+ break;
+ case 4:
+ Assert.assertEquals(HtmlCoreComponentsValidationExceptionInterceptor.class, result.get(i).getClass());
+ break;
+ case 5:
+ Assert.assertEquals(TestValidationExceptionInterceptor1000.class, result.get(i).getClass());
+ break;
+ case 6:
+ Assert.assertEquals(TestValidationExceptionInterceptor.class, result.get(i).getClass());
+ break;
+ }
+ }
+ }
+
+ class TestValidationExceptionInterceptor implements ValidationExceptionInterceptor
+ {
+ public boolean afterThrowing(UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject, ValidatorException validatorException, ValidationStrategy validatorExceptionSource)
+ {
+ return true;
+ }
+ }
+
+ @InvocationOrder(1)
+ class TestValidationExceptionInterceptor1 implements ValidationExceptionInterceptor
+ {
+ public boolean afterThrowing(UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject, ValidatorException validatorException, ValidationStrategy validatorExceptionSource)
+ {
+ return true;
+ }
+ }
+
+ @InvocationOrder(2)
+ class TestValidationExceptionInterceptor2 implements ValidationExceptionInterceptor
+ {
+ public boolean afterThrowing(UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject, ValidatorException validatorException, ValidationStrategy validatorExceptionSource)
+ {
+ return true;
+ }
+ }
+
+ @InvocationOrder(3)
+ class TestValidationExceptionInterceptor3 implements ValidationExceptionInterceptor
+ {
+ public boolean afterThrowing(UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject, ValidatorException validatorException, ValidationStrategy validatorExceptionSource)
+ {
+ return true;
+ }
+ }
+
+ @InvocationOrder(1000)
+ class TestValidationExceptionInterceptor1000 implements ValidationExceptionInterceptor
+ {
+ public boolean afterThrowing(UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject, ValidatorException validatorException, ValidationStrategy validatorExceptionSource)
+ {
+ return true;
+ }
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationMetaDataToValidationStrategyNameMapperTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationMetaDataToValidationStrategyNameMapperTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationMetaDataToValidationStrategyNameMapperTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationMetaDataToValidationStrategyNameMapperTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,211 @@
+/*
+ * 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.core.mapper;
+
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.mapper.*;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import org.apache.myfaces.extensions.validator.test.base.mock.MockValidationStrategyFactory;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import java.util.List;
+
+public class RegistrationMetaDataToValidationStrategyNameMapperTestCase extends AbstractExValCoreTestCase
+{
+ /**
+ * Construct a new instance of the test.
+ *
+ * @param name Name of the test.
+ */
+ public RegistrationMetaDataToValidationStrategyNameMapperTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RegistrationMetaDataToValidationStrategyNameMapperTestCase.class);
+ }
+
+ public void testMetaDataToValidationStrategyNameMapperInitialization()
+ {
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new TestValidationStrategyNameMapper());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new TestValidationStrategyNameMapper650());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new TestValidationStrategyNameMapper150());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new TestValidationStrategyNameMapper450());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new TestValidationStrategyNameMapper250());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new TestValidationStrategyNameMapper550());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new TestValidationStrategyNameMapper99());
+ ExtValUtils.registerMetaDataToValidationStrategyNameMapper(
+ new TestValidationStrategyNameMapper350());
+
+ List<NameMapper<String>> result = getNameMappers();
+ int resultLength = 16;
+ Assert.assertEquals(resultLength, result.size());
+
+ for(int i = 0; i < resultLength; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ Assert.assertEquals(TestValidationStrategyNameMapper99.class, result.get(i).getClass());
+ break;
+ case 1:
+ Assert.assertEquals(CustomConfiguredAnnotationToValidationStrategyNameMapper.class, result.get(i).getClass());
+ break;
+ case 2:
+ Assert.assertEquals(TestValidationStrategyNameMapper150.class, result.get(i).getClass());
+ break;
+ case 3:
+ Assert.assertEquals(CustomConventionAnnotationToValidationStrategyNameMapper.class, result.get(i).getClass());
+ break;
+ case 4:
+ Assert.assertEquals(TestValidationStrategyNameMapper250.class, result.get(i).getClass());
+ break;
+ case 5:
+ Assert.assertEquals(DefaultAnnotationToValidationStrategyNameMapper.class, result.get(i).getClass());
+ break;
+ case 6:
+ Assert.assertEquals(TestValidationStrategyNameMapper350.class, result.get(i).getClass());
+ break;
+ case 7:
+ Assert.assertEquals(SimpleAnnotationToValidationStrategyNameMapper.class, result.get(i).getClass());
+ break;
+ case 8:
+ Assert.assertEquals(TestValidationStrategyNameMapper450.class, result.get(i).getClass());
+ break;
+ case 9:
+ Assert.assertEquals(AnnotationToValidationStrategyBeanNameMapper.class, result.get(i).getClass());
+ break;
+ case 10:
+ Assert.assertEquals(AnnotationToValidationStrategyBeanNameMapper.class, result.get(i).getClass());
+ break;
+ case 11:
+ Assert.assertEquals(AnnotationToValidationStrategyBeanNameMapper.class, result.get(i).getClass());
+ break;
+ case 12:
+ Assert.assertEquals(AnnotationToValidationStrategyBeanNameMapper.class, result.get(i).getClass());
+ break;
+ case 13:
+ Assert.assertEquals(TestValidationStrategyNameMapper550.class, result.get(i).getClass());
+ break;
+ case 14:
+ Assert.assertEquals(TestValidationStrategyNameMapper650.class, result.get(i).getClass());
+ break;
+ case 15:
+ Assert.assertEquals(TestValidationStrategyNameMapper.class, result.get(i).getClass());
+ break;
+ }
+ }
+ }
+
+ private List<NameMapper<String>> getNameMappers()
+ {
+ NameMapperAwareFactory result = ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, NameMapperAwareFactory.class);
+
+ return ((MockValidationStrategyFactory)result).getRegisteredNameMapperList();
+ }
+
+ class TestValidationStrategyNameMapper extends AbstractMetaDataToValidationStrategyNameMapper
+ {
+ public String createName(String source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(99)
+ class TestValidationStrategyNameMapper99 extends AbstractMetaDataToValidationStrategyNameMapper
+ {
+ public String createName(String source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(150)
+ class TestValidationStrategyNameMapper150 extends AbstractMetaDataToValidationStrategyNameMapper
+ {
+ public String createName(String source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(250)
+ class TestValidationStrategyNameMapper250 extends AbstractMetaDataToValidationStrategyNameMapper
+ {
+ public String createName(String source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(350)
+ class TestValidationStrategyNameMapper350 extends AbstractMetaDataToValidationStrategyNameMapper
+ {
+ public String createName(String source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(450)
+ class TestValidationStrategyNameMapper450 extends AbstractMetaDataToValidationStrategyNameMapper
+ {
+ public String createName(String source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(550)
+ class TestValidationStrategyNameMapper550 extends AbstractMetaDataToValidationStrategyNameMapper
+ {
+ public String createName(String source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(650)
+ class TestValidationStrategyNameMapper650 extends AbstractMetaDataToValidationStrategyNameMapper
+ {
+ public String createName(String source)
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationValidationStrategyToMessageResolverNameMapperTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationValidationStrategyToMessageResolverNameMapperTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationValidationStrategyToMessageResolverNameMapperTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationValidationStrategyToMessageResolverNameMapperTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,203 @@
+/*
+ * 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.core.mapper;
+
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.validation.message.resolver.mapper.*;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import org.apache.myfaces.extensions.validator.test.base.mock.MockMessageResolverFactory;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import java.util.List;
+
+public class RegistrationValidationStrategyToMessageResolverNameMapperTestCase extends AbstractExValCoreTestCase
+{
+ /**
+ * Construct a new instance of the test.
+ *
+ * @param name Name of the test.
+ */
+ public RegistrationValidationStrategyToMessageResolverNameMapperTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RegistrationValidationStrategyToMessageResolverNameMapperTestCase.class);
+ }
+
+ public void testValidationStrategyToMessageResolverNameMapperInitialization()
+ {
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new TestMessageResolverNameMapper());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new TestMessageResolverNameMapper301());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new TestMessageResolverNameMapper150());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new TestMessageResolverNameMapper450());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new TestMessageResolverNameMapper250());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new TestMessageResolverNameMapper550());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new TestMessageResolverNameMapper99());
+ ExtValUtils.registerValidationStrategyToMessageResolverNameMapper(
+ new TestMessageResolverNameMapper350());
+
+ List<NameMapper<ValidationStrategy>> result = getNameMappers();
+ int resultLength = 13;
+ Assert.assertEquals(resultLength, result.size());
+
+ for(int i = 0; i < resultLength; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ Assert.assertEquals(TestMessageResolverNameMapper99.class, result.get(i).getClass());
+ break;
+ case 1:
+ Assert.assertEquals(CustomConfiguredValidationStrategyToMsgResolverNameMapper.class, result.get(i).getClass());
+ break;
+ case 2:
+ Assert.assertEquals(TestMessageResolverNameMapper150.class, result.get(i).getClass());
+ break;
+ case 3:
+ Assert.assertEquals(CustomConventionValidationStrategyToMsgResolverNameMapper.class, result.get(i).getClass());
+ break;
+ case 4:
+ Assert.assertEquals(TestMessageResolverNameMapper250.class, result.get(i).getClass());
+ break;
+ case 5:
+ Assert.assertEquals(DefaultValidationStrategyToMsgResolverNameMapper.class, result.get(i).getClass());
+ break;
+ case 6:
+ Assert.assertEquals(TestMessageResolverNameMapper301.class, result.get(i).getClass());
+ break;
+ case 7:
+ Assert.assertEquals(DefaultModuleValidationStrategyToMsgResolverNameMapper.class, result.get(i).getClass());
+ break;
+ case 8:
+ Assert.assertEquals(TestMessageResolverNameMapper350.class, result.get(i).getClass());
+ break;
+ case 9:
+ Assert.assertEquals(SimpleValidationStrategyToMsgResolverNameMapper.class, result.get(i).getClass());
+ break;
+ case 10:
+ Assert.assertEquals(TestMessageResolverNameMapper450.class, result.get(i).getClass());
+ break;
+ case 11:
+ Assert.assertEquals(TestMessageResolverNameMapper550.class, result.get(i).getClass());
+ break;
+ case 12:
+ Assert.assertEquals(TestMessageResolverNameMapper.class, result.get(i).getClass());
+ break;
+ }
+ }
+ }
+
+ private List<NameMapper<ValidationStrategy>> getNameMappers()
+ {
+ NameMapperAwareFactory result = ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.MESSAGE_RESOLVER_FACTORY, NameMapperAwareFactory.class);
+
+ return ((MockMessageResolverFactory)result).getRegisteredNameMapperList();
+ }
+
+ class TestMessageResolverNameMapper extends AbstractValidationStrategyToMsgResolverNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(99)
+ class TestMessageResolverNameMapper99 extends AbstractValidationStrategyToMsgResolverNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(150)
+ class TestMessageResolverNameMapper150 extends AbstractValidationStrategyToMsgResolverNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(250)
+ class TestMessageResolverNameMapper250 extends AbstractValidationStrategyToMsgResolverNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(301)
+ class TestMessageResolverNameMapper301 extends AbstractValidationStrategyToMsgResolverNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(350)
+ class TestMessageResolverNameMapper350 extends AbstractValidationStrategyToMsgResolverNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(450)
+ class TestMessageResolverNameMapper450 extends AbstractValidationStrategyToMsgResolverNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(550)
+ class TestMessageResolverNameMapper550 extends AbstractValidationStrategyToMsgResolverNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationValidationStrategyToMetaDataTransformerNameMapperTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationValidationStrategyToMetaDataTransformerNameMapperTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationValidationStrategyToMetaDataTransformerNameMapperTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/mapper/RegistrationValidationStrategyToMetaDataTransformerNameMapperTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,191 @@
+/*
+ * 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.core.mapper;
+
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.metadata.transformer.mapper.*;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+import org.apache.myfaces.extensions.validator.test.base.mock.MockMetaDataTransformerFactory;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.Assert;
+
+import java.util.List;
+
+public class RegistrationValidationStrategyToMetaDataTransformerNameMapperTestCase extends AbstractExValCoreTestCase
+{
+ /**
+ * Construct a new instance of the test.
+ *
+ * @param name Name of the test.
+ */
+ public RegistrationValidationStrategyToMetaDataTransformerNameMapperTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RegistrationValidationStrategyToMetaDataTransformerNameMapperTestCase.class);
+ }
+ public void testValidationStrategyToMetaDataTransformerMapperInitialization()
+ {
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new TestMetaDataTransformerNameMapper());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new TestMetaDataTransformerNameMapper150());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new TestMetaDataTransformerNameMapper450());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new TestMetaDataTransformerNameMapper250());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new TestMetaDataTransformerNameMapper550());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new TestMetaDataTransformerNameMapper99());
+ ExtValUtils.registerValidationStrategyToMetaDataTransformerNameMapper(
+ new TestMetaDataTransformerNameMapper350());
+
+ List<NameMapper<ValidationStrategy>> result = getNameMappers();
+ int resultLength = 13;
+ Assert.assertEquals(resultLength, result.size());
+
+ for(int i = 0; i < resultLength; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ Assert.assertEquals(TestMetaDataTransformerNameMapper99.class, result.get(i).getClass());
+ break;
+ case 1:
+ Assert.assertEquals(CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper.class, result.get(i).getClass());
+ break;
+ case 2:
+ Assert.assertEquals(ValidationStrategyToMetaDataTransformerSubMapperAwareNameMapper.class, result.get(i).getClass());
+ break;
+ case 3:
+ Assert.assertEquals(TestMetaDataTransformerNameMapper150.class, result.get(i).getClass());
+ break;
+ case 4:
+ Assert.assertEquals(CustomConventionValidationStrategyToMetaDataTransformerNameMapper.class, result.get(i).getClass());
+ break;
+ case 5:
+ Assert.assertEquals(TestMetaDataTransformerNameMapper250.class, result.get(i).getClass());
+ break;
+ case 6:
+ Assert.assertEquals(DefaultValidationStrategyToMetaDataTransformerNameMapper.class, result.get(i).getClass());
+ break;
+ case 7:
+ Assert.assertEquals(TestMetaDataTransformerNameMapper350.class, result.get(i).getClass());
+ break;
+ case 8:
+ Assert.assertEquals(SimpleValidationStrategyToMetaDataTransformerNameMapper.class, result.get(i).getClass());
+ break;
+ case 9:
+ Assert.assertEquals(TestMetaDataTransformerNameMapper450.class, result.get(i).getClass());
+ break;
+ case 10:
+ Assert.assertEquals(BeanValidationStrategyToMetaDataTransformerNameMapper.class, result.get(i).getClass());
+ break;
+ case 11:
+ Assert.assertEquals(TestMetaDataTransformerNameMapper550.class, result.get(i).getClass());
+ break;
+ case 12:
+ Assert.assertEquals(TestMetaDataTransformerNameMapper.class, result.get(i).getClass());
+ break;
+ }
+ }
+ }
+
+ private List<NameMapper<ValidationStrategy>> getNameMappers()
+ {
+ NameMapperAwareFactory result = ExtValContext.getContext()
+ .getFactoryFinder()
+ .getFactory(FactoryNames.META_DATA_TRANSFORMER_FACTORY, NameMapperAwareFactory.class);
+
+ return ((MockMetaDataTransformerFactory)result).getRegisteredNameMapperList();
+ }
+
+ class TestMetaDataTransformerNameMapper extends AbstractValidationStrategyToMetaDataTransformerNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(99)
+ class TestMetaDataTransformerNameMapper99 extends AbstractValidationStrategyToMetaDataTransformerNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(150)
+ class TestMetaDataTransformerNameMapper150 extends AbstractValidationStrategyToMetaDataTransformerNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(250)
+ class TestMetaDataTransformerNameMapper250 extends AbstractValidationStrategyToMetaDataTransformerNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(350)
+ class TestMetaDataTransformerNameMapper350 extends AbstractValidationStrategyToMetaDataTransformerNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(450)
+ class TestMetaDataTransformerNameMapper450 extends AbstractValidationStrategyToMetaDataTransformerNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+
+ @InvocationOrder(550)
+ class TestMetaDataTransformerNameMapper550 extends AbstractValidationStrategyToMetaDataTransformerNameMapper
+ {
+ public String createName(ValidationStrategy source)
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/pom.xml?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/pom.xml (added)
+++ myfaces/extensions/validator/trunk/test-modules/pom.xml Wed Nov 4 12:06:57 2009
@@ -0,0 +1,180 @@
+<?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>pom</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+ <artifactId>test-modules-project</artifactId>
+
+ <name>MyFaces Extensions-Validator Test-Modules</name>
+ <version>1.2.3-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-parent</artifactId>
+ <version>1.2.3-SNAPSHOT</version>
+ </parent>
+
+ <scm>
+ <connection>
+ scm:svn:http://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/validation-modules
+ </connection>
+ <developerConnection>
+ scm:svn:https://svn.apache.org/repos/asf/myfaces/extensions/validator/branches/1_2_2_rc/validation-modules
+ </developerConnection>
+ <url>http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/1_2_2_rc/validation-modules</url>
+ </scm>
+
+ <modules>
+ <module>base-test-infrastructure</module>
+ <module>core-tests</module>
+ <module>property-validation-tests</module>
+ <module>bean-validation-tests</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator</groupId>
+ <artifactId>myfaces-extval-core</artifactId>
+ <version>1.2.3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${jsf.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${jsf.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shale</groupId>
+ <artifactId>shale-test</artifactId>
+ <version>1.0.4</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/config</directory>
+ <includes>
+ <include>**/*xml</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ <targetPath>/META-INF</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ <configuration>
+ <excludes>
+ <exclude>**/Abstract*.java</exclude>
+ <exclude>**/TestUtils.java</exclude>
+ <exclude>**/*Bean.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/pom.xml?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/pom.xml (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/pom.xml Wed Nov 4 12:06:57 2009
@@ -0,0 +1,62 @@
+<?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-property-validation-tests</artifactId>
+
+ <name>MyFaces Extensions-Validator Property-Validation-Tests</name>
+ <version>1.2.3-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+ <artifactId>test-modules-project</artifactId>
+ <version>1.2.3-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+ <artifactId>myfaces-extval-base-test-infrastructure</artifactId>
+ <version>1.2.3-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>1.2.3-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.validation-modules</groupId>
+ <artifactId>myfaces-extval-property-validation</artifactId>
+ <version>1.2.3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/AbstractPropertyValidationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/AbstractPropertyValidationTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/AbstractPropertyValidationTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/AbstractPropertyValidationTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+import org.apache.myfaces.extensions.validator.test.base.AbstractExValTestCase;
+import org.apache.myfaces.extensions.validator.PropertyValidationModuleStartupListener;
+import org.apache.myfaces.extensions.validator.crossval.CrossValidationPhaseListener;
+
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+
+public abstract class AbstractPropertyValidationTestCase extends AbstractExValTestCase
+{
+ public AbstractPropertyValidationTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected void invokeStartupListeners()
+ {
+ new PropertyValidationModuleStartupListener(){
+ private static final long serialVersionUID = 423076920926752646L;
+
+ @Override
+ protected void init()
+ {
+ super.init();
+ }
+ }.init();
+ }
+
+ protected void processCrossValValidation()
+ {
+ new CrossValidationPhaseListener().afterPhase(new PhaseEvent(facesContext, PhaseId.ANY_PHASE,lifecycle));
+ }
+}
Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/BaseValTestBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/BaseValTestBean.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/BaseValTestBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/BaseValTestBean.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval;
+
+import org.apache.myfaces.extensions.validator.baseval.annotation.DoubleRange;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Length;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Pattern;
+import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class BaseValTestBean
+{
+ @Required
+ private String name;
+
+ @Length(minimum=2,maximum=3)
+ private String name1;
+
+ @Pattern("[A-Z][a-z]+")
+ private String patternName;
+
+ @DoubleRange(minimum=-300d)
+ private Double doubleValue1;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName1()
+ {
+ return name1;
+ }
+
+ public void setName1(String name1)
+ {
+ this.name1 = name1;
+ }
+
+ public String getPatternName()
+ {
+ return patternName;
+ }
+
+ public void setPatternName(String patternName)
+ {
+ this.patternName = patternName;
+ }
+
+ public Double getDoubleValue1()
+ {
+ return doubleValue1;
+ }
+
+ public void setDoubleValue1(Double doubleValue1)
+ {
+ this.doubleValue1 = doubleValue1;
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/BaseValTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/BaseValTestCase.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/BaseValTestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/BaseValTestCase.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.baseval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import javax.faces.el.ValueBinding;
+
+import org.apache.myfaces.extensions.validator.test.propval.AbstractPropertyValidationTestCase;
+import org.apache.myfaces.extensions.validator.test.propval.BaseValTestBean;
+
+/**
+ * @author Leonardo Uribe
+ */
+public class BaseValTestCase extends AbstractPropertyValidationTestCase
+{
+ HtmlInputText inputComponent = null;
+
+ UIViewRoot rootComponent = null;
+
+ BaseValTestBean bean = null;
+
+ public BaseValTestCase(String name)
+ {
+ super(name);
+ inputComponent = null;
+ rootComponent = null;
+ bean = null;
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(BaseValTestCase.class);
+ }
+
+ @SuppressWarnings({"UnusedDeclaration"})
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ bean = new BaseValTestBean();
+ ValueBinding vb = application.createValueBinding("#{testBean}");
+ facesContext.getExternalContext().getRequestMap().put("testBean", bean);
+
+ rootComponent = new UIViewRoot();
+ HtmlForm form = new HtmlForm();
+ form.setId("form");
+ rootComponent.getChildren().add(form);
+ inputComponent = new HtmlInputText();
+ form.getChildren().add(inputComponent);
+ inputComponent.setId("input1");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ inputComponent = null;
+ rootComponent = null;
+ bean = null;
+ }
+
+ public void testNameRequiredFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.name}");
+
+ inputComponent.setSubmittedValue("");
+
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testName1LenghtMaxFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.name1}");
+
+ //decode
+ inputComponent.setSubmittedValue("12345");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testName1LenghtCorrect() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.name1}");
+
+ //decode
+ inputComponent.setSubmittedValue("1d3");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertTrue(inputComponent.isValid());
+ checkMessageCount(0);
+ }
+
+ public void testName1LenghtMinFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.name1}");
+
+ //decode
+ inputComponent.setSubmittedValue("x");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testPatternNameFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.patternName}");
+
+ //decode
+ inputComponent.setSubmittedValue("Peter1");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testPatternNameCorrect() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.patternName}");
+
+ //decode
+ inputComponent.setSubmittedValue("Peter");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertTrue(inputComponent.isValid());
+ checkMessageCount(0);
+ }
+
+ public void testDoubleValueFail() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.doubleValue1}");
+
+ //decode
+ inputComponent.setSubmittedValue("-301");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertFalse(inputComponent.isValid());
+ checkMessageCount(1);
+ }
+
+ public void testDoubleValueCorrect() throws Exception
+ {
+ createValueBinding(inputComponent, "value", "#{testBean.doubleValue1}");
+
+ //decode
+ inputComponent.setSubmittedValue("200");
+
+ //validate
+ inputComponent.validate(facesContext);
+
+ assertTrue(inputComponent.isValid());
+ checkMessageCount(0);
+ assertEquals(200d, inputComponent.getValue());
+
+ inputComponent.updateModel(facesContext);
+ assertEquals(200d, bean.getDoubleValue1());
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/AdditionalValidator.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/AdditionalValidator.java?rev=832716&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/AdditionalValidator.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/baseval/parameter/AdditionalValidator.java Wed Nov 4 12:06:57 2009
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.propval.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.AbstractAnnotationValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterValue;
+import org.apache.myfaces.extensions.validator.core.metadata.MetaDataEntry;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.validator.ValidatorException;
+import java.lang.annotation.Annotation;
+
+public class AdditionalValidator extends TestValidatorProvider
+{
+ @ParameterValue
+ public Class getProviderClass()
+ {
+ return AdditionalValidator.class;
+ }
+
+ @Override
+ public ValidationStrategy getValidationStrategy()
+ {
+ return new AbstractAnnotationValidationStrategy()
+ {
+ protected String getValidationErrorMsgKey(Annotation annotation)
+ {
+ return "validation_failed";
+ }
+
+ protected void processValidation(FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject) throws ValidatorException
+ {
+ }
+ };
+ }
+}
\ No newline at end of file