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 2010/03/24 13:03:17 UTC
svn commit: r927022 [1/2] - in
/myfaces/extensions/validator/branches/branch_for_jsf_1_1:
core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/
core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/
core/src/mai...
Author: gpetracek
Date: Wed Mar 24 12:03:16 2010
New Revision: 927022
URL: http://svn.apache.org/viewvc?rev=927022&view=rev
Log:
EXTVAL-83 basic draft
Added:
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/SingleViolationPropertyValidationInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorageManager.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MappedConstraintSourceStorage.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMappedConstraintSourceStorageNameMapper.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation1TestCase.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation2TestCase.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation3TestCase.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation4TestCase.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation5TestCase.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation6TestCase.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomConstraintSource.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomIgnoreConstraintSource.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetProperty.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetPropertyId.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1Bean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1MetaDataBean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2Bean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2MetaDataBean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3Bean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3MetaDataBean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware4Bean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware4MetaDataBean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware5Bean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware5MetaDataBean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware6Bean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware6MetaDataBean.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/Target3.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/Target4.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/MappedConstraintSourceBeanValidationModuleValidationInterceptor.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/MappedConstraintSourceBeanValidationModuleValidationInterceptorInternals.java
Modified:
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/BaseBeanValPropertyValidationTestCase.java
myfaces/extensions/validator/branches/branch_for_jsf_1_1/validation-modules/bean-validation/src/main/java/org/apache/myfaces/extensions/validator/beanval/startup/BeanValidationStartupListener.java
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/SingleViolationPropertyValidationInterceptor.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/interceptor/SingleViolationPropertyValidationInterceptor.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/SingleViolationPropertyValidationInterceptor.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/interceptor/SingleViolationPropertyValidationInterceptor.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.interceptor;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import javax.faces.component.EditableValueHolder;
+import java.util.Map;
+
+/**
+ * @author Gerhard Petracek
+ * @since r4
+ */
+public class SingleViolationPropertyValidationInterceptor implements PropertyValidationInterceptor
+{
+ public boolean beforeValidation(
+ FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+ {
+ if(uiComponent instanceof EditableValueHolder && !isComponentValid(uiComponent) && isNavigationBlocked())
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private boolean isComponentValid(UIComponent uiComponent)
+ {
+ return ((EditableValueHolder)uiComponent).isValid();
+ }
+
+ private boolean isNavigationBlocked()
+ {
+ return FacesContext.getCurrentInstance().getRenderResponse();
+ }
+
+ public void afterValidation(
+ FacesContext facesContext, UIComponent uiComponent, Object convertedObject, Map<String, Object> properties)
+ {
+ }
+}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.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/startup/ExtValStartupListener.java?rev=927022&r1=927021&r2=927022&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ExtValStartupListener.java Wed Mar 24 12:03:16 2010
@@ -61,6 +61,10 @@ import org.apache.myfaces.extensions.val
import org.apache.myfaces.extensions.validator.core.validation.parameter.DefaultViolationSeverityInterpreter;
import org.apache.myfaces.extensions.validator.core.validation.parameter.ViolationSeverity;
import org.apache.myfaces.extensions.validator.core.validation.parameter.DisableClientSideValidation;
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.IgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.TargetProperty;
+import org.apache.myfaces.extensions.validator.core.validation.TargetPropertyId;
import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererProxy;
import org.apache.myfaces.extensions.validator.util.ClassUtils;
import org.apache.myfaces.extensions.validator.util.ExtValUtils;
@@ -103,6 +107,8 @@ public class ExtValStartupListener exten
initViolationSeverityKey();
initDisableClientSideValidationKey();
initRequiredInitialization();
+ initDefaultConstraintSourceAnnotations();
+
executeCustomStartupListener();
}
@@ -234,6 +240,18 @@ public class ExtValStartupListener exten
}
}
+ private void initDefaultConstraintSourceAnnotations()
+ {
+ ExtValContext.getContext()
+ .addGlobalProperty(ConstraintSource.class.getName(), ConstraintSource.class, false);
+ ExtValContext.getContext()
+ .addGlobalProperty(IgnoreConstraintSource.class.getName(), IgnoreConstraintSource.class, false);
+ ExtValContext.getContext()
+ .addGlobalProperty(TargetProperty.class.getName(), TargetProperty.class, false);
+ ExtValContext.getContext()
+ .addGlobalProperty(TargetPropertyId.class.getName(), TargetPropertyId.class, false);
+ }
+
/**
* if it's configured that required init should happen,
* it's required to deactivate the support for the required attribute
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.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/storage/DefaultMappedConstraintSourceStorage.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorage.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,105 @@
+/*
+ * 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.storage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import static org.apache.myfaces.extensions.validator.internal.UsageCategory.INTERNAL;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.util.ProxyUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+/**
+ * @author Gerhard Petracek
+ * @since r4
+ */
+@UsageInformation(INTERNAL)
+public class DefaultMappedConstraintSourceStorage implements MappedConstraintSourceStorage
+{
+ protected final Log logger = LogFactory.getLog(getClass());
+
+ private Map<String, Map<String, PropertyDetails>> propertyDetailsMap =
+ new HashMap<String, Map<String, PropertyDetails>>();
+
+ public void storeMapping(Class originalClass, String originalProperty, PropertyDetails targetPropertyDetails)
+ {
+ if(targetPropertyDetails == null)
+ {
+ if(isFilteredClass(originalClass))
+ {
+ return;
+ }
+
+ Map<String, PropertyDetails> classMap = getMapForClass(originalClass);
+ classMap.put(originalProperty, null);
+ return;
+ }
+
+ PropertyDetails propertyDetails = new PropertyDetails(targetPropertyDetails.getKey(),
+ targetPropertyDetails.getBaseObject(), targetPropertyDetails.getProperty());
+
+ getMapForClass(originalClass).put(originalProperty, propertyDetails);
+ }
+
+ protected boolean isFilteredClass(Class originalClass)
+ {
+ return ResourceBundle.class.isAssignableFrom(originalClass);
+ }
+
+ public PropertyDetails getMappedConstraintSource(Class originalClass, String originalProperty)
+ {
+ if(isFilteredClass(originalClass))
+ {
+ return null;
+ }
+
+ PropertyDetails foundEntry = getMapForClass(originalClass).get(originalProperty);
+
+ if(foundEntry == null)
+ {
+ return null;
+ }
+
+ return new PropertyDetails(foundEntry.getKey(), foundEntry.getBaseObject(), foundEntry.getProperty());
+ }
+
+ public boolean containsMapping(Class originalClass, String originalProperty)
+ {
+ if(isFilteredClass(originalClass))
+ {
+ //avoid scanning process
+ return true;
+ }
+ return getMapForClass(originalClass).containsKey(originalProperty);
+ }
+
+ private Map<String, PropertyDetails> getMapForClass(Class target)
+ {
+ String key = ProxyUtils.getClassName(target);
+ if(!this.propertyDetailsMap.containsKey(key))
+ {
+ this.propertyDetailsMap.put(key, new HashMap<String, PropertyDetails>());
+ }
+ return this.propertyDetailsMap.get(key);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorageManager.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/storage/DefaultMappedConstraintSourceStorageManager.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorageManager.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultMappedConstraintSourceStorageManager.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.storage;
+
+import org.apache.myfaces.extensions.validator.core.storage.mapper.DefaultMappedConstraintSourceStorageNameMapper;
+import static org.apache.myfaces.extensions.validator.internal.UsageCategory.INTERNAL;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * default storage-manager for mapped properties information
+ *
+ * @author Gerhard Petracek
+ * @since r4
+ */
+@UsageInformation(INTERNAL)
+class DefaultMappedConstraintSourceStorageManager extends AbstractApplicationScopeAwareStorageManager<PropertyStorage>
+{
+ DefaultMappedConstraintSourceStorageManager()
+ {
+ register(new DefaultMappedConstraintSourceStorageNameMapper());
+ }
+
+ public String getStorageManagerKey()
+ {
+ return StorageManager.class.getName() + "_FOR_MAPPED_CONSTRAINT_SOURCE:KEY";
+ }
+}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.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/storage/DefaultStorageManagerFactory.java?rev=927022&r1=927021&r2=927022&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/DefaultStorageManagerFactory.java Wed Mar 24 12:03:16 2010
@@ -73,6 +73,8 @@ public class DefaultStorageManagerFactor
new DefaultRendererInterceptorPropertyStorageManager(), false);
setStorageManager(ViolationSeverityInterpreterStorage.class,
new DefaultViolationSeverityInterpreterStorageManager(), false);
+ setStorageManager(MappedConstraintSourceStorage.class,
+ new DefaultMappedConstraintSourceStorageManager(), false);
setStorageManager(FacesInformationStorage.class,
new DefaultFacesInformationStorageManager(), false);
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MappedConstraintSourceStorage.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/storage/MappedConstraintSourceStorage.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MappedConstraintSourceStorage.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/MappedConstraintSourceStorage.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.storage;
+
+import org.apache.myfaces.extensions.validator.core.property.PropertyDetails;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * @author Gerhard Petracek
+ * @since r4
+ */
+@UsageInformation(UsageCategory.INTERNAL)
+public interface MappedConstraintSourceStorage
+{
+ void storeMapping(Class targetClass, String property, PropertyDetails propertyDetails);
+
+ PropertyDetails getMappedConstraintSource(Class targetClass, String property);
+
+ boolean containsMapping(Class targetClass, String property);
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMappedConstraintSourceStorageNameMapper.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/storage/mapper/DefaultMappedConstraintSourceStorageNameMapper.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMappedConstraintSourceStorageNameMapper.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/storage/mapper/DefaultMappedConstraintSourceStorageNameMapper.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,43 @@
+/*
+ * 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.storage.mapper;
+
+import org.apache.myfaces.extensions.validator.core.InvocationOrder;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.storage.MappedConstraintSourceStorage;
+import org.apache.myfaces.extensions.validator.core.storage.DefaultMappedConstraintSourceStorage;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+/**
+ * use a public class to allow optional deregistration
+ *
+ * @author Gerhard Petracek
+ * @since r4
+ */
+@InvocationOrder(100)
+@UsageInformation(UsageCategory.INTERNAL)
+public class DefaultMappedConstraintSourceStorageNameMapper implements NameMapper<String>
+{
+ public String createName(String source)
+ {
+ return (MappedConstraintSourceStorage.class.getName().equals(source)) ?
+ DefaultMappedConstraintSourceStorage.class.getName() : null;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.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/ConstraintSource.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/ConstraintSource.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Gerhard Petracek
+ * @since r4
+ */
+@Target({TYPE, FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+@UsageInformation(UsageCategory.API)
+public @interface ConstraintSource
+{
+ Class value();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.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/IgnoreConstraintSource.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/IgnoreConstraintSource.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.core.validation;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Gerhard Petracek
+ * @since r4
+ */
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+@UsageInformation(UsageCategory.API)
+public @interface IgnoreConstraintSource
+{
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.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/TargetProperty.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetProperty.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Gerhard Petracek
+ * @since r4
+ */
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+@UsageInformation(UsageCategory.API)
+public @interface TargetProperty
+{
+ String value();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.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/TargetPropertyId.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/core/src/main/java/org/apache/myfaces/extensions/validator/core/validation/TargetPropertyId.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Annotation;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Gerhard Petracek
+ * @since r4
+ */
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+@UsageInformation(UsageCategory.API)
+public @interface TargetPropertyId
+{
+ Class<? extends Annotation> value();
+}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/BaseBeanValPropertyValidationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/BaseBeanValPropertyValidationTestCase.java?rev=927022&r1=927021&r2=927022&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/BaseBeanValPropertyValidationTestCase.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/BaseBeanValPropertyValidationTestCase.java Wed Mar 24 12:03:16 2010
@@ -18,6 +18,9 @@
*/
package org.apache.myfaces.extensions.validator.test.beanval;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.interceptor.SingleViolationPropertyValidationInterceptor;
+
import javax.faces.component.html.HtmlInputText;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.UIViewRoot;
@@ -53,6 +56,8 @@ public abstract class BaseBeanValPropert
bindBeanToExpression();
createComponents();
+
+ ExtValContext.getContext().addPropertyValidationInterceptor(new SingleViolationPropertyValidationInterceptor());
}
private void createComponents()
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation1TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation1TestCase.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation1TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation1TestCase.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.model.ConstraintSourceAware1Bean;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * EXTVAL-83
+ *
+ * @author Gerhard Petracek
+ */
+public class ConstraintSourceAwareValidation1TestCase extends BaseBeanValPropertyValidationTestCase<ConstraintSourceAware1Bean>
+{
+ public ConstraintSourceAwareValidation1TestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ConstraintSourceAwareValidation1TestCase.class);
+ }
+
+ protected ConstraintSourceAware1Bean getBeanToTest()
+ {
+ return new ConstraintSourceAware1Bean();
+ }
+
+ public void testImplecitFieldMapping()
+ {
+ createValueBindingForComponent(this.inputComponent1, "#{testBean.property1}");
+ setValueToValidate(this.inputComponent1, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent1);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+
+ public void testImplecitMethodMapping()
+ {
+ createValueBindingForComponent(this.inputComponent2, "#{testBean.property2}");
+ setValueToValidate(this.inputComponent2, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent2);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation2TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation2TestCase.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation2TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation2TestCase.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.model.ConstraintSourceAware2Bean;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * EXTVAL-83
+ *
+ * @author Gerhard Petracek
+ */
+public class ConstraintSourceAwareValidation2TestCase extends BaseBeanValPropertyValidationTestCase<ConstraintSourceAware2Bean>
+{
+ public ConstraintSourceAwareValidation2TestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ConstraintSourceAwareValidation2TestCase.class);
+ }
+
+ protected ConstraintSourceAware2Bean getBeanToTest()
+ {
+ return new ConstraintSourceAware2Bean();
+ }
+
+ public void testIgnoreConstraintSource()
+ {
+ createValueBindingForComponent(this.inputComponent1, "#{testBean.property1}");
+ setValueToValidate(this.inputComponent1, "");
+
+ validateComponents();
+
+ assertComponentValid(this.inputComponent1);
+ assertNavigationBlocked(false);
+
+ checkMessageCount(0);
+ }
+
+ public void testStringBasedTargetProperty()
+ {
+ createValueBindingForComponent(this.inputComponent2, "#{testBean.property2}");
+ setValueToValidate(this.inputComponent2, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent2);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation3TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation3TestCase.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation3TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation3TestCase.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.model.ConstraintSourceAware3Bean;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * EXTVAL-83
+ *
+ * @author Gerhard Petracek
+ */
+public class ConstraintSourceAwareValidation3TestCase extends BaseBeanValPropertyValidationTestCase<ConstraintSourceAware3Bean>
+{
+ public ConstraintSourceAwareValidation3TestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ConstraintSourceAwareValidation3TestCase.class);
+ }
+
+ protected ConstraintSourceAware3Bean getBeanToTest()
+ {
+ return new ConstraintSourceAware3Bean();
+ }
+
+ public void testMissingBasedConstraintSource()
+ {
+ createValueBindingForComponent(this.inputComponent1, "#{testBean.property1}");
+ setValueToValidate(this.inputComponent1, "");
+
+ validateComponents();
+
+ assertComponentValid(this.inputComponent1);
+ assertNavigationBlocked(false);
+
+ checkMessageCount(0);
+ }
+
+ public void testFieldBasedConstraintSource()
+ {
+ createValueBindingForComponent(this.inputComponent2, "#{testBean.property2}");
+ setValueToValidate(this.inputComponent2, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent2);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation4TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation4TestCase.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation4TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation4TestCase.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.model.ConstraintSourceAware4Bean;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * EXTVAL-83
+ *
+ * @author Gerhard Petracek
+ */
+public class ConstraintSourceAwareValidation4TestCase extends BaseBeanValPropertyValidationTestCase<ConstraintSourceAware4Bean>
+{
+ public ConstraintSourceAwareValidation4TestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ConstraintSourceAwareValidation4TestCase.class);
+ }
+
+ protected ConstraintSourceAware4Bean getBeanToTest()
+ {
+ return new ConstraintSourceAware4Bean();
+ }
+
+ public void testMethodBasedConstraintSourceAndTargetPropertyAnnotation()
+ {
+ createValueBindingForComponent(this.inputComponent1, "#{testBean.property1}");
+ setValueToValidate(this.inputComponent1, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent1);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+
+ public void testMissingBasedConstraintSource()
+ {
+ createValueBindingForComponent(this.inputComponent2, "#{testBean.property2}");
+ setValueToValidate(this.inputComponent2, "");
+
+ validateComponents();
+
+ assertComponentValid(this.inputComponent2);
+ assertNavigationBlocked(false);
+
+ checkMessageCount(0);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation5TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation5TestCase.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation5TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation5TestCase.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.model.ConstraintSourceAware5Bean;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * EXTVAL-83
+ *
+ * @author Gerhard Petracek
+ */
+public class ConstraintSourceAwareValidation5TestCase extends BaseBeanValPropertyValidationTestCase<ConstraintSourceAware5Bean>
+{
+ public ConstraintSourceAwareValidation5TestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ConstraintSourceAwareValidation5TestCase.class);
+ }
+
+ protected ConstraintSourceAware5Bean getBeanToTest()
+ {
+ return new ConstraintSourceAware5Bean();
+ }
+
+ public void testMethodBasedTargetPropertyIdAnnotation()
+ {
+ createValueBindingForComponent(this.inputComponent1, "#{testBean.property1}");
+ setValueToValidate(this.inputComponent1, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent1);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+
+ public void testFieldBasedTargetPropertyIdAnnotation()
+ {
+ createValueBindingForComponent(this.inputComponent2, "#{testBean.property2}");
+ setValueToValidate(this.inputComponent2, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent2);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation6TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation6TestCase.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation6TestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/ConstraintSourceAwareValidation6TestCase.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,110 @@
+/*
+ * 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.beanval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.model.ConstraintSourceAware6Bean;
+import org.apache.myfaces.extensions.validator.test.beanval.custom.CustomConstraintSource;
+import org.apache.myfaces.extensions.validator.test.beanval.custom.CustomIgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.test.beanval.custom.CustomTargetProperty;
+import org.apache.myfaces.extensions.validator.test.beanval.custom.CustomTargetPropertyId;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.IgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.TargetProperty;
+import org.apache.myfaces.extensions.validator.core.validation.TargetPropertyId;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * EXTVAL-83
+ *
+ * @author Gerhard Petracek
+ */
+public class ConstraintSourceAwareValidation6TestCase extends BaseBeanValPropertyValidationTestCase<ConstraintSourceAware6Bean>
+{
+ public ConstraintSourceAwareValidation6TestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ConstraintSourceAwareValidation6TestCase.class);
+ }
+
+ protected ConstraintSourceAware6Bean getBeanToTest()
+ {
+ return new ConstraintSourceAware6Bean();
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ ExtValContext extValContext = ExtValContext.getContext();
+
+ extValContext.addGlobalProperty(ConstraintSource.class.getName(), CustomConstraintSource.class);
+ extValContext.addGlobalProperty(IgnoreConstraintSource.class.getName(), CustomIgnoreConstraintSource.class);
+ extValContext.addGlobalProperty(TargetProperty.class.getName(), CustomTargetProperty.class);
+ extValContext.addGlobalProperty(TargetPropertyId.class.getName(), CustomTargetPropertyId.class);
+ }
+
+ public void testCustomAnnotations1()
+ {
+ createValueBindingForComponent(this.inputComponent1, "#{testBean.property1}");
+ setValueToValidate(this.inputComponent1, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent1);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+
+ public void testCustomAnnotations2()
+ {
+ createValueBindingForComponent(this.inputComponent2, "#{testBean.property2}");
+ setValueToValidate(this.inputComponent2, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent2);
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+
+ public void testCustomAnnotations3()
+ {
+ createValueBindingForComponent(this.inputComponent3, "#{testBean.property3}");
+ setValueToValidate(this.inputComponent3, "");
+
+ validateComponents();
+
+ assertComponentValid(this.inputComponent3);
+ assertNavigationBlocked(false);
+
+ checkMessageCount(0);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomConstraintSource.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomConstraintSource.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomConstraintSource.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomConstraintSource.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval.custom;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Target({TYPE, FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomConstraintSource
+{
+ public abstract Class value();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomIgnoreConstraintSource.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomIgnoreConstraintSource.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomIgnoreConstraintSource.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomIgnoreConstraintSource.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval.custom;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomIgnoreConstraintSource
+{
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetProperty.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetProperty.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetProperty.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetProperty.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.beanval.custom;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomTargetProperty
+{
+ public abstract String value();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetPropertyId.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetPropertyId.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetPropertyId.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/custom/CustomTargetPropertyId.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.beanval.custom;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomTargetPropertyId
+{
+ public abstract Class<? extends Annotation> value();
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1Bean.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1Bean.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+
+@ConstraintSource(ConstraintSourceAware1MetaDataBean.class)
+public class ConstraintSourceAware1Bean
+{
+ private String property1;
+
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1MetaDataBean.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware1MetaDataBean.java Wed Mar 24 12:03:16 2010
@@ -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.beanval.model;
+
+import javax.validation.constraints.NotNull;
+
+public class ConstraintSourceAware1MetaDataBean
+{
+ @NotNull
+ private String property1;
+
+ private String property2;
+
+ @NotNull
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2Bean.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2Bean.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,53 @@
+/*
+ * 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.beanval.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.IgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.TargetProperty;
+
+@ConstraintSource(ConstraintSourceAware2MetaDataBean.class)
+public class ConstraintSourceAware2Bean
+{
+ @IgnoreConstraintSource
+ private String property1;
+
+ @TargetProperty("property3")
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2MetaDataBean.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware2MetaDataBean.java Wed Mar 24 12:03:16 2010
@@ -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.beanval.model;
+
+import javax.validation.constraints.NotNull;
+
+public class ConstraintSourceAware2MetaDataBean
+{
+ @NotNull
+ private String property1;
+
+ private String property3;
+
+ @NotNull
+ public String getProperty3()
+ {
+ return property3;
+ }
+
+ public void setProperty3(String property3)
+ {
+ this.property3 = property3;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3Bean.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3Bean.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.validator.test.beanval.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+
+public class ConstraintSourceAware3Bean
+{
+ private String property1;
+
+ @ConstraintSource(ConstraintSourceAware3MetaDataBean.class)
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3MetaDataBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3MetaDataBean.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3MetaDataBean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware3MetaDataBean.java Wed Mar 24 12:03:16 2010
@@ -0,0 +1,30 @@
+/*
+ * 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.beanval.model;
+
+import javax.validation.constraints.NotNull;
+
+public class ConstraintSourceAware3MetaDataBean
+{
+ @NotNull
+ private String property1;
+
+ @NotNull
+ private String property2;
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware4Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware4Bean.java?rev=927022&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware4Bean.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/ConstraintSourceAware4Bean.java Wed Mar 24 12:03:16 2010
@@ -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.beanval.model;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.TargetProperty;
+
+public class ConstraintSourceAware4Bean
+{
+ private String property1;
+
+ private String property2;
+
+ @TargetProperty("property")
+ @ConstraintSource(ConstraintSourceAware4MetaDataBean.class)
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}