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/06/26 23:29:08 UTC

svn commit: r788876 - in /myfaces/extensions/validator/branches/branch_for_jsf_1_1: core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/ validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions...

Author: gpetracek
Date: Fri Jun 26 21:29:07 2009
New Revision: 788876

URL: http://svn.apache.org/viewvc?rev=788876&view=rev
Log:
test cases and support for additional constraint aspect styles

Added:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientValidation.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/AdditionalValidator.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationInterceptor.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationStrategyProvider.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidatorProvider.java
Modified:
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/ParameterTestCase.java
    myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestPerson.java

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java?rev=788876&r1=788875&r2=788876&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DefaultValidationParameterExtractor.java Fri Jun 26 21:29:07 2009
@@ -36,6 +36,7 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.WildcardType;
+import java.lang.reflect.Modifier;
 
 /**
  * @author Gerhard Petracek
@@ -145,6 +146,12 @@
         return result;
     }
 
+    /*
+     * don't use the Introspector in this case
+     * if you have a better solution which supports all supported parameter styles (see extval wiki),
+     * you can impl. it and use it (exchange the impls. via the ExtValContext).
+     * furthermore, you can provide the fix for the community
+     */
     private void processParameterValue(
             Annotation annotation, Class paramClass, Map<Object, List<Object>> result, Class valueId) throws Exception
     {
@@ -153,38 +160,69 @@
 
         if(ValidationParameter.class.isAssignableFrom(paramClass))
         {
-            //support pure interface approach e.g. ViolationSeverity.Warn.class
-            for(Field currentField : paramClass.getDeclaredFields())
-            {
-                key = processFoundField(annotation, currentField, parameterValues, key, valueId);
-            }
+            List<Field> processedFields = new ArrayList<Field>();
+            List<Method> processedMethods = new ArrayList<Method>();
 
-            for(Class currentInterface : paramClass.getInterfaces())
+            Class currentParamClass = paramClass;
+            while (currentParamClass != null && !Object.class.getName().equals(currentParamClass.getName()))
             {
-                if(!ValidationParameter.class.isAssignableFrom(currentInterface))
+                /*
+                 * process class
+                 */
+                //support pure interface approach e.g. ViolationSeverity.Warn.class
+                for(Field currentField : currentParamClass.getDeclaredFields())
                 {
-                    continue;
+                    if(!processedFields.contains(currentField))
+                    {
+                        key = processFoundField(annotation, currentField, parameterValues, key, valueId);
+                        processedFields.add(currentField);
+                    }
                 }
 
-                //support interface + impl. approach e.g. MyParamImpl.class
-                //(MyParamImpl implements MyParam
-                //MyParam extends ValidationParameter
-                //methods in the interface have to be marked with @ParameterValue and @ParameterKey
-                for(Method currentMethod : currentInterface.getDeclaredMethods())
+                //inspect the other methods of the implementing class
+                for(Method currentMethod : currentParamClass.getDeclaredMethods())
                 {
-                    key = processFoundMethod(paramClass, currentMethod, parameterValues, key, valueId);
+                    if(!processedMethods.contains(currentMethod))
+                    {
+                        key = processFoundMethod(currentParamClass, currentMethod, parameterValues, key, valueId);
+                        processedMethods.add(currentMethod);
+                    }
                 }
 
-                for(Field currentField : currentInterface.getDeclaredFields())
+                /*
+                 * process interfaces
+                 */
+                for(Class currentInterface : currentParamClass.getInterfaces())
                 {
-                    key = processFoundField(annotation, currentField, parameterValues, key, valueId);
+                    if(!ValidationParameter.class.isAssignableFrom(currentInterface))
+                    {
+                        continue;
+                    }
+
+                    //support interface + impl. approach e.g. MyParamImpl.class
+                    //(MyParamImpl implements MyParam
+                    //MyParam extends ValidationParameter
+                    //methods in the interface have to be marked with @ParameterValue and @ParameterKey
+                    for(Method currentMethod : currentInterface.getDeclaredMethods())
+                    {
+                        if(!processedMethods.contains(currentMethod))
+                        {
+                            key = processFoundMethod(currentParamClass, currentMethod, parameterValues, key, valueId);
+                            processedMethods.add(currentMethod);
+                        }
+                    }
+
+                    for(Field currentField : currentInterface.getDeclaredFields())
+                    {
+                        if(!processedFields.contains(currentField))
+                        {
+                            key = processFoundField(annotation, currentField, parameterValues, key, valueId);
+                            processedFields.add(currentField);
+                        }
+                    }
                 }
-            }
 
-            //inspect the other methods of the implementing class
-            for(Method currentMethod : paramClass.getDeclaredMethods())
-            {
-                processFoundMethod(paramClass, currentMethod, parameterValues, key, valueId);
+                currentParamClass = currentParamClass.getSuperclass();
             }
         }
 
@@ -279,7 +317,10 @@
         {
             try
             {
-                newKey = currentMethod.invoke(paramClass.newInstance());
+                if(!(Modifier.isAbstract(paramClass.getModifiers()) || Modifier.isInterface(paramClass.getModifiers())))
+                {
+                    newKey = currentMethod.invoke(paramClass.newInstance());
+                }
             }
             catch (Throwable e)
             {
@@ -301,7 +342,12 @@
                 }
                 catch (Throwable e)
                 {
-                    if(this.logger.isWarnEnabled())
+                    //check if it's a none-static inner class -> return this class
+                    if(paramClass.getEnclosingClass() != null)
+                    {
+                        parameterValues.add(paramClass);
+                    }
+                    else if(this.logger.isWarnEnabled())
                     {
                         this.logger.warn(e);
                     }

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientValidation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientValidation.java?rev=788876&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientValidation.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/parameter/DisableClientValidation.java Fri Jun 26 21:29:07 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.core.validation.parameter;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+/**
+ * @author Gerhard Petracek
+ * @since 1.x.3
+ */
+@UsageInformation(UsageCategory.API)
+public interface DisableClientValidation extends ValidationParameter
+{
+}
\ No newline at end of file

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/AdditionalValidator.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/AdditionalValidator.java?rev=788876&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/AdditionalValidator.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/AdditionalValidator.java Fri Jun 26 21:29:07 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.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

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/ParameterTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/ParameterTestCase.java?rev=788876&r1=788875&r2=788876&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/ParameterTestCase.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/ParameterTestCase.java Fri Jun 26 21:29:07 2009
@@ -23,7 +23,9 @@
 import junit.framework.TestSuite;
 import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameterExtractor;
 import org.apache.myfaces.extensions.validator.core.validation.parameter.DefaultValidationParameterExtractor;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.DisableClientValidation;
 import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
+import org.apache.myfaces.extensions.validator.core.interceptor.PropertyValidationInterceptor;
 import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
 
 import javax.faces.application.FacesMessage;
@@ -73,4 +75,62 @@
         assertEquals(extractor.extract(required, TestPriority.class, String.class, TestPriority.ShortDescription.class), "do it asap");
         assertEquals(extractor.extract(required, TestPriority.class, String.class, TestPriority.LongDescription.class), "do it immediately");
     }
+
+    public void testParameterStyleFour() throws Exception
+    {
+        ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+        TestPerson person = new TestPerson();
+        Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+        assertNotNull(extractor.extract(required).containsKey(PropertyValidationInterceptor.class));
+        assertNotNull(extractor.extract(required, PropertyValidationInterceptor.class).iterator().next());
+        assertEquals(extractor.extract(required, PropertyValidationInterceptor.class).size(), 1);
+        assertEquals(extractor.extract(required, PropertyValidationInterceptor.class, PropertyValidationInterceptor.class).iterator().next().getClass().getName(), TestValidationInterceptor.class.getName());
+    }
+
+    public void testParameterStyleFive() throws Exception
+    {
+        ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+        TestPerson person = new TestPerson();
+        Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+        assertNotNull(extractor.extract(required).containsKey(DisableClientValidation.class));
+        assertNotNull(extractor.extract(required, DisableClientValidation.class).iterator().next());
+        assertEquals(extractor.extract(required, DisableClientValidation.class).size(), 1);
+        assertEquals(extractor.extract(required, DisableClientValidation.class, Class.class).size(), 1);
+        assertEquals(extractor.extract(required, DisableClientValidation.class, Class.class).iterator().next().getName(), DisableClientValidation.class.getName());
+    }
+
+    /*
+     * TODO these tests work in an ide but not via commandline - check it
+     */
+    /*
+    public void testParameterStyleSix() throws Exception
+    {
+        ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+        TestPerson person = new TestPerson();
+        Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+        assertNotNull(extractor.extract(required).containsKey(TestValidatorProvider.class));
+        assertNotNull(extractor.extract(required, TestValidatorProvider.class).iterator().next());
+        assertEquals(extractor.extract(required, TestValidatorProvider.class, Class.class).size(), 2);
+    }
+
+    public void testParameterStyleSeven() throws Exception
+    {
+        ValidationParameterExtractor extractor = new DefaultValidationParameterExtractor();
+
+        TestPerson person = new TestPerson();
+        Required required = person.getClass().getDeclaredField("lastName").getAnnotation(Required.class);
+
+        assertNotNull(extractor.extract(required).containsKey(TestValidatorProvider.class));
+        for (Class currentClass : extractor.extract(required, TestValidatorProvider.class, Class.class))
+        {
+            assertTrue(TestValidatorProvider.class.isAssignableFrom(currentClass));
+        }
+    }
+    */
 }

Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestPerson.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestPerson.java?rev=788876&r1=788875&r2=788876&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestPerson.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestPerson.java Fri Jun 26 21:29:07 2009
@@ -19,7 +19,14 @@
 package org.apache.myfaces.extensions.validator.test.baseval.parameter;
 
 import org.apache.myfaces.extensions.validator.baseval.annotation.Required;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
 import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.DisableClientValidation;
+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;
 
 public class TestPerson
 {
@@ -29,9 +36,70 @@
     @Required(parameters = {
             ViolationSeverity.Info.class,
             TestDenyClientSideValidation.class,
-            TestPriorityHigh.class})
+            TestPriorityHigh.class,
+            TestValidationInterceptor.class,
+            DisableClientValidation.class,
+            //LoginValidator.class,
+            AdditionalValidator.class})
     private String lastName;
 
+    private int failedLogins = 0;
+    private boolean userLocked;
+
+    /*
+     * TODO these tests work in an ide but not via commandline - check it
+     */
+    /*
+    public class LoginValidator extends TestValidatorProvider
+    {
+        @ParameterValue
+        public TestValidationStrategyProvider getValue()
+        {
+            return this;
+        }
+
+        @Override
+        public ValidationStrategy getValidationStrategy()
+        {
+            return new ValidationStrategy() {
+
+                int failedLogins;
+
+                public void validate(FacesContext facesContext, UIComponent uiComponent, MetaDataEntry metaDataEntry, Object convertedObject)
+                {
+                    if((this.failedLogins = isLoginSuccessful()) > 0)
+                    {
+                        if(this.failedLogins > 3)
+                        {
+                            lock();
+                        }
+                    }
+                }
+            };
+        }
+    }
+    */
+
+    private int isLoginSuccessful()
+    {
+        //force an exception
+        return ++this.failedLogins;
+    }
+
+    public boolean isLocked()
+    {
+        return userLocked;
+    }
+
+    private void lock()
+    {
+        this.userLocked = true;
+    }
+
+    /*
+     * generated
+     */
+
     public String getFirstName()
     {
         return firstName;

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationInterceptor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationInterceptor.java?rev=788876&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationInterceptor.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationInterceptor.java Fri Jun 26 21:29:07 2009
@@ -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.myfaces.extensions.validator.test.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.interceptor.PropertyValidationInterceptor;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterValue;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import java.util.Map;
+
+public class TestValidationInterceptor implements PropertyValidationInterceptor
+{
+    private static PropertyValidationInterceptor propertyValidationInterceptor;
+
+    @ParameterValue
+    public PropertyValidationInterceptor getInstance()
+    {
+        if(propertyValidationInterceptor == null)
+        {
+            propertyValidationInterceptor = new TestValidationInterceptor();
+        }
+        return propertyValidationInterceptor;
+    }
+
+    public boolean beforeValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+    {
+        throw new UnsupportedOperationException("it's a test class");
+    }
+
+    public void afterValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+    {
+        throw new UnsupportedOperationException("it's a test class");
+    }
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationStrategyProvider.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationStrategyProvider.java?rev=788876&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationStrategyProvider.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidationStrategyProvider.java Fri Jun 26 21:29:07 2009
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+
+public interface TestValidationStrategyProvider
+{
+    ValidationStrategy getValidationStrategy();
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidatorProvider.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidatorProvider.java?rev=788876&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidatorProvider.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/property-validation/src/test/java/org/apache/myfaces/extensions/validator/test/baseval/parameter/TestValidatorProvider.java Fri Jun 26 21:29:07 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.baseval.parameter;
+
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ParameterKey;
+
+public class TestValidatorProvider implements ValidationParameter, TestValidationStrategyProvider
+{
+    @ParameterKey
+    public Class getKey()
+    {
+        return TestValidatorProvider.class;
+    }
+
+    /**
+     * it isn't allowed to have an abstract class in this case - so this impl. is required
+     */
+    public ValidationStrategy getValidationStrategy()
+    {
+        throw new IllegalStateException("you have to override this method");
+    }
+}