[hibernate-commits] Hibernate SVN: r15767 - in validator/trunk/hibernate-validator/src: main/java/org/hibernate/validation/impl and 8 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Jan 12 09:03:45 EST 2009


Author: hardy.ferentschik
Date: 2009-01-12 09:03:45 -0500 (Mon, 12 Jan 2009)
New Revision: 15767

Added:
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcodeConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcodeConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcode.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcodeConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroups.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroupsConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessage.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessageConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/ValidProperty.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/GermanAddress.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/All.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/First.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Last.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java
Removed:
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/All.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/First.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Last.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Second.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcode.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcodeConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroups.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroupsConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessage.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessageConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcode.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcodeConstraint.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/ValidProperty.java
Modified:
   validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaData.java
   validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaDataImpl.java
   validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorFactoryImplementor.java
   validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
   validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/BeanDescriptorImpl.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Animal.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Author.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Book.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Dictonary.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/EnglishDictonary.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/FrenchAddress.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/TestUtil.java
Log:
BVAL-31 - continued work on composite constraints and reorganised some packages

Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaData.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaData.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaData.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -64,10 +64,10 @@
 	Map<Class<?>, List<Class<?>>> getGroupSequences();
 
 	/**
-	 * @return A list of <code>ValidatorMetaData</code> instances encapsulating the information of all the constraints
+	 * @return A list of <code>MetaConstraint</code> instances encapsulating the information of all the constraints
 	 *         defined on the bean.
 	 */
-	List<MetaConstraint> getConstraintMetaDataList();
+	List<MetaConstraint> geMetaConstraintList();
 
 	/**
 	 * @return A map keying the property name of a constraint to its <code>ElementDescriptor</code>.

Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaDataImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaDataImpl.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/BeanMetaDataImpl.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -194,6 +194,7 @@
 				metaConstraintList.add( metaConstraint );
 			}
 			if ( field.isAnnotationPresent( Valid.class ) ) {
+				ReflectionHelper.setAccessibility( field );
 				cascadedFields.add( field );
 			}
 		}
@@ -208,6 +209,7 @@
 				metaConstraintList.add( metaConstraint );
 			}
 			if ( method.isAnnotationPresent( Valid.class ) ) {
+				ReflectionHelper.setAccessibility( method );
 				cascadedMethods.add( method );
 			}
 		}
@@ -257,7 +259,7 @@
 			}
 		}
 
-		return new ConstraintDescriptorImpl(annotation, groups);
+		return new ConstraintDescriptorImpl( annotation, groups );
 	}
 
 	/**
@@ -377,7 +379,7 @@
 		return groupSequences;
 	}
 
-	public List<MetaConstraint> getConstraintMetaDataList() {
+	public List<MetaConstraint> geMetaConstraintList() {
 		return metaConstraintList;
 	}
 

Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorFactoryImplementor.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorFactoryImplementor.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorFactoryImplementor.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -27,5 +27,5 @@
 	 * @param clazz The bean class for which to retrieve the meta data.
 	 * @return Gives access to the required parsed meta data. This never returns an <code>null</code> object.
 	 */
-	<T> BeanMetaDataImpl<T> getBeanMetaData(Class<T> clazz);
+	<T> BeanMetaData<T> getBeanMetaData(Class<T> clazz);
 }

Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -27,6 +27,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.ListIterator;
 import javax.validation.BeanDescriptor;
 import javax.validation.Constraint;
 import javax.validation.ConstraintDescriptor;
@@ -38,9 +39,12 @@
 import javax.validation.Validator;
 import javax.validation.groups.Default;
 
+import org.slf4j.Logger;
+
 import org.hibernate.validation.impl.ConstraintViolationImpl;
 import org.hibernate.validation.util.PropertyIterator;
 import org.hibernate.validation.util.ReflectionHelper;
+import org.hibernate.validation.util.LoggerFactory;
 
 /**
  * The main Bean Validation class.
@@ -50,8 +54,9 @@
  * @todo Make all properties transient for serializability.
  */
 public class ValidatorImpl implements Validator {
-
+	private static final Logger log = LoggerFactory.make();
 	private static final Set<Class<?>> INDEXABLE_CLASS = new HashSet<Class<?>>();
+	private static final Class<?>[] DEFAULT_GROUP = new Class<?>[] { Default.class };
 
 	static {
 		INDEXABLE_CLASS.add( Integer.class );
@@ -65,7 +70,7 @@
 	private final MessageResolver messageResolver;
 
 	private final ValidatorFactoryImplementor factory;
-	private static final Class<?>[] DEFAULT_GROUP = new Class<?>[] { Default.class };
+
 	private final ConstraintFactory constraintFactory;
 	private final TraversableResolver traversableResolver;
 
@@ -77,7 +82,6 @@
 		this.constraintFactory = constraintFactory;
 	}
 
-
 	/**
 	 * {@inheritDoc}
 	 */
@@ -136,33 +140,38 @@
 	/**
 	 * Validates the non-cascaded constraints.
 	 *
-	 * @param context The current validation context.
+	 * @param validationContext The current validation context.
 	 */
-	private <T> void validateConstraints(ValidationContext<T> context) {
+	private <T> void validateConstraints(ValidationContext<T> validationContext) {
 		//casting rely on the fact that root object is at the top of the stack
 		@SuppressWarnings("unchecked")
 		BeanMetaData<T> beanMetaData =
-				( BeanMetaData<T> ) factory.getBeanMetaData( context.peekValidatedObjectType() );
-		for ( MetaConstraint metaConstraint : beanMetaData.getConstraintMetaDataList() ) {
+				( BeanMetaData<T> ) factory.getBeanMetaData( validationContext.peekValidatedObjectType() );
+		for ( MetaConstraint metaConstraint : beanMetaData.geMetaConstraintList() ) {
 			ConstraintDescriptor mainConstraintDescriptor = metaConstraint.getDescriptor();
-			context.pushProperty( metaConstraint.getPropertyName() );
+			validationContext.pushProperty( metaConstraint.getPropertyName() );
 
-			if ( !context.needsValidation( mainConstraintDescriptor.getGroups() ) ) {
-				context.popProperty();
+			if ( !validationContext.needsValidation( mainConstraintDescriptor.getGroups() ) ) {
+				validationContext.popProperty();
 				continue;
 			}
 
-			final Object leafBeanInstance = context.peekValidatedObject();
+			final Object leafBeanInstance = validationContext.peekValidatedObject();
 			Object value = metaConstraint.getValue( leafBeanInstance );
 
 			// we have to check the main constraint and all composing constraints
-			Set<ConstraintDescriptor> descriptors = new HashSet<ConstraintDescriptor>();
-			descriptors.addAll( mainConstraintDescriptor.getComposingConstraints() );
-			descriptors.add(mainConstraintDescriptor);
-			for (ConstraintDescriptor descriptor : descriptors) {
-				ConstraintContextImpl contextImpl = new ConstraintContextImpl( descriptor );
-				if ( !getConstraint( descriptor ).isValid( value, contextImpl ) ) {
-					for ( ConstraintContextImpl.ErrorMessage error : contextImpl.getErrorMessages() ) {
+			List<ConstraintDescriptor> descriptors = new ArrayList<ConstraintDescriptor>();
+			descriptors.add( mainConstraintDescriptor );
+			// use a list iterator so that we can keep modifying the underlying list
+			ListIterator<ConstraintDescriptor> listIter = descriptors.listIterator();
+			while ( listIter.hasNext() ) {
+				ConstraintDescriptor descriptor = listIter.next();
+				ConstraintContextImpl constraintContext = new ConstraintContextImpl( descriptor );
+				if ( log.isTraceEnabled() ) {
+					log.trace( "Validating value {} against constraint defined by {}", value, descriptor );
+				}
+				if ( !getConstraint( descriptor ).isValid( value, constraintContext ) ) {
+					for ( ConstraintContextImpl.ErrorMessage error : constraintContext.getErrorMessages() ) {
 						final String message = error.getMessage();
 						String interpolatedMessage = messageResolver.interpolate(
 								message,
@@ -172,23 +181,36 @@
 						ConstraintViolationImpl<T> failingConstraintViolation = new ConstraintViolationImpl<T>(
 								message,
 								interpolatedMessage,
-								context.getRootBean(),
+								validationContext.getRootBean(),
 								beanMetaData.getBeanClass(),
 								leafBeanInstance,
 								value,
-								context.peekPropertyPath(), //FIXME use error.getProperty()
-								context.getCurrentGroup(),
+								validationContext.peekPropertyPath(), //FIXME use error.getProperty()
+								validationContext.getCurrentGroup(),
 								descriptor
 						);
-						context.addConstraintFailure( failingConstraintViolation );
+						validationContext.addConstraintFailure( failingConstraintViolation );
 					}
 				}
+				// check for composing constraints and add them to the list. The list iterator needs to set back each time!
+				for ( ConstraintDescriptor composingDescriptor : descriptor.getComposingConstraints() ) {
+					listIter.add( composingDescriptor );
+					listIter = descriptors.listIterator( listIter.previousIndex() );
+				}
 			}
-			context.popProperty();
+			validationContext.popProperty();
 		}
-		context.markProcessedForCurrentGroup();
+		validationContext.markProcessedForCurrentGroup();
 	}
 
+	/**
+	 * Called when processing cascaded constraints. This methods inspects the type of the cascaded constraints and in case
+	 * of a list or array creates an iterator in order to validate each element.
+	 *
+	 * @param context the validation context.
+	 * @param type the type of the cascaded field or property.
+	 * @param value the actual value.
+	 */
 	private <T> void validateCascadedConstraint(ValidationContext<T> context, Type type, Object value) {
 		if ( value == null ) {
 			return;
@@ -224,8 +246,6 @@
 		for ( Member member : cascadedMembers ) {
 			Type type = ReflectionHelper.typeOf( member );
 			context.pushProperty( ReflectionHelper.getPropertyName( member ) );
-			//FIXME change accessibility only once, that's somewhat costly. do it when Member is created
-			ReflectionHelper.setAccessibility( member );
 			Object value = ReflectionHelper.getValue( member, context.peekValidatedObject() );
 			validateCascadedConstraint( context, type, value );
 			context.popProperty();
@@ -427,7 +447,7 @@
 		propertyIter.split();
 
 		if ( !propertyIter.hasNext() ) {
-			List<MetaConstraint> metaConstraintList = factory.getBeanMetaData( clazz ).getConstraintMetaDataList();
+			List<MetaConstraint> metaConstraintList = factory.getBeanMetaData( clazz ).geMetaConstraintList();
 			for ( MetaConstraint metaConstraint : metaConstraintList ) {
 				ConstraintDescriptor constraintDescriptor = metaConstraint.getDescriptor();
 				if ( metaConstraint.getPropertyName().equals( propertyIter.getHead() ) ) {
@@ -465,7 +485,7 @@
 
 		// bottom out - there is only one token left
 		if ( !propertyIter.hasNext() ) {
-			List<MetaConstraint> metaConstraintList = factory.getBeanMetaData( clazz ).getConstraintMetaDataList();
+			List<MetaConstraint> metaConstraintList = factory.getBeanMetaData( clazz ).geMetaConstraintList();
 			for ( MetaConstraint metaConstraint : metaConstraintList ) {
 				ConstraintDescriptor constraintDescriptor = metaConstraint.getDescriptor();
 				if ( metaConstraint.getPropertyName().equals( propertyIter.getHead() ) ) {
@@ -479,7 +499,6 @@
 			List<Member> cascadedMembers = factory.getBeanMetaData( clazz ).getCascadedMembers();
 			for ( Member m : cascadedMembers ) {
 				if ( ReflectionHelper.getPropertyName( m ).equals( propertyIter.getHead() ) ) {
-					ReflectionHelper.setAccessibility( m );
 					Object newValue;
 					if ( propertyIter.isIndexed() ) {
 						newValue = ReflectionHelper.getValue( m, value );
@@ -526,7 +545,7 @@
 		}
 
 		boolean isGroupSequence;
-		BeanMetaDataImpl<T> metaDataProvider = factory.getBeanMetaData( beanType );
+		BeanMetaData<T> metaDataProvider = factory.getBeanMetaData( beanType );
 		if ( metaDataProvider.getGroupSequences().containsKey( group ) ) {
 			expandedGroups.addAll( metaDataProvider.getGroupSequences().get( group ) );
 			isGroupSequence = true;

Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/BeanDescriptorImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/BeanDescriptorImpl.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/impl/BeanDescriptorImpl.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -22,7 +22,7 @@
 	 * @todo add child validation
 	 */
 	public boolean hasConstraints() {
-		return metadataBean.getConstraintMetaDataList().size() > 0;
+		return metadataBean.geMetaConstraintList().size() > 0;
 	}
 
 	public PropertyDescriptor getConstraintsForProperty(String propertyName) {

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java (from rev 15763, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcode.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,64 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.composition;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.ConstraintValidator;
+import javax.validation.OverridesParameter;
+import javax.validation.OverridesParameters;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+import org.hibernate.validation.constraints.Pattern;
+import org.hibernate.validation.constraints.Patterns;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at NotNull
+ at Size
+// first pattern just duplicates the length of 5 characters, the second pattern is just to proof that parameters can be overridden.
+ at Patterns({ @Pattern(regex = "....."), @Pattern(regex = "bar") })
+ at ConstraintValidator(FrenchZipcodeConstraint.class)
+ at Documented
+ at Target({ METHOD, FIELD, TYPE })
+ at Retention(RUNTIME)
+public @interface FrenchZipcode {
+	String message() default "Wrong zipcode";
+
+	Class<?>[] groups() default { };
+
+	@OverridesParameters({
+			@OverridesParameter(constraint = Size.class, parameter = "min"),
+			@OverridesParameter(constraint = Size.class, parameter = "max")
+	})
+	int size() default 5;
+
+	@OverridesParameter(constraint = Size.class, parameter = "message")
+    String sizeMessage() default "A french zip code has a length of 5";
+
+
+	@OverridesParameter(constraint = Pattern.class, parameter = "regex", index=2)
+	String regex() default "\\d*";
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcode.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcodeConstraint.java (from rev 15756, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcodeConstraint.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcodeConstraint.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcodeConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,34 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.composition;
+
+import javax.validation.Constraint;
+import javax.validation.ConstraintContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class FrenchZipcodeConstraint implements Constraint<FrenchZipcode> {
+
+	public void initialize(FrenchZipcode parameters) {
+	}
+
+	public boolean isValid(Object object, ConstraintContext constraintContext) {
+		return true;
+	}
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/FrenchZipcodeConstraint.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,43 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.composition;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.ConstraintValidator;
+
+/**
+ * Constraint used to test nested composing constraints.
+ *
+ * @author Hardy Ferentschik
+ */
+ at FrenchZipcode
+ at ConstraintValidator(GermanZipcodeConstraint.class)
+ at Documented
+ at Target({ METHOD, FIELD, TYPE })
+ at Retention(RUNTIME)
+public @interface GermanZipcode {
+	public abstract String message() default "Falsche Postnummer.";
+
+	public abstract Class<?>[] groups() default { };
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcode.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcodeConstraint.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcodeConstraint.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcodeConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,34 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.composition;
+
+import javax.validation.Constraint;
+import javax.validation.ConstraintContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class GermanZipcodeConstraint implements Constraint<GermanZipcode> {
+
+	public void initialize(GermanZipcode parameters) {
+	}
+
+	public boolean isValid(Object object, ConstraintContext constraintContext) {
+		return true;
+	}
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/GermanZipcodeConstraint.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcode.java (from rev 15756, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcode.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcode.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcode.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,44 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.composition;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.ConstraintValidator;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at NotNull
+ at Size(min = 5, max = 5)
+ at ConstraintValidator(UKZipcodeConstraint.class)
+ at Documented
+ at Target({ METHOD, FIELD, TYPE })
+ at Retention(RUNTIME)
+public @interface UKZipcode {
+	public abstract String message() default "Wrong zipcode";
+
+	public abstract Class<?>[] groups() default { };
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcode.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:mergeinfo
   + 

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcodeConstraint.java (from rev 15756, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcodeConstraint.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcodeConstraint.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcodeConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,34 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.composition;
+
+import javax.validation.Constraint;
+import javax.validation.ConstraintContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class UKZipcodeConstraint implements Constraint<UKZipcode> {
+
+	public void initialize(UKZipcode parameters) {
+	}
+
+	public boolean isValid(Object object, ConstraintContext constraintContext) {
+		return false;
+	}
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/composition/UKZipcodeConstraint.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:mergeinfo
   + 

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroups.java (from rev 15751, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroups.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroups.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroups.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,39 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.incomplete;
+
+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;
+import javax.validation.ConstraintValidator;
+
+import org.hibernate.validation.constraints.incomplete.NoGroupsConstraint;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Documented
+ at ConstraintValidator(NoGroupsConstraint.class)
+ at Target({ METHOD, FIELD })
+ at Retention(RUNTIME)
+public @interface NoGroups {
+	String message() default "default message";
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroups.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroupsConstraint.java (from rev 15750, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroupsConstraint.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroupsConstraint.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroupsConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,36 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.incomplete;
+
+import javax.validation.Constraint;
+import javax.validation.ConstraintContext;
+
+import org.hibernate.validation.constraints.incomplete.NoGroups;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class NoGroupsConstraint implements Constraint<NoGroups> {
+
+	public void initialize(NoGroups parameters) {
+	}
+
+	public boolean isValid(Object object, ConstraintContext constraintContext) {
+		return false;
+	}
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoGroupsConstraint.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessage.java (from rev 15751, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessage.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessage.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessage.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,37 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.incomplete;
+
+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;
+import javax.validation.ConstraintValidator;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Documented
+ at ConstraintValidator(NoMessageConstraint.class)
+ at Target({ METHOD, FIELD })
+ at Retention(RUNTIME)
+public @interface NoMessage {
+	Class<?>[] groups() default { };
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessage.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessageConstraint.java (from rev 15750, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessageConstraint.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessageConstraint.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessageConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,34 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.incomplete;
+
+import javax.validation.Constraint;
+import javax.validation.ConstraintContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class NoMessageConstraint implements Constraint<NoMessage> {
+
+	public void initialize(NoMessage parameters) {
+	}
+
+	public boolean isValid(Object object, ConstraintContext constraintContext) {
+		return false;
+	}
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/NoMessageConstraint.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/ValidProperty.java (from rev 15751, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/ValidProperty.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/ValidProperty.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/ValidProperty.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,41 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.constraints.incomplete;
+
+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;
+import javax.validation.ConstraintValidator;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Documented
+ at ConstraintValidator(NoGroupsConstraint.class)
+ at Target({ METHOD, FIELD })
+ at Retention(RUNTIME)
+public @interface ValidProperty {
+	String message() default "default message";
+
+	Class<?>[] groups() default { };
+
+	int validLength() default 0;
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/incomplete/ValidProperty.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:mergeinfo
   + 

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/All.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/All.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/All.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,8 +0,0 @@
-package org.hibernate.validation.eg;
-
-/**
- * Groups including all validations
- * @author Emmanuel Bernard
- */
-public interface All {
-}

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Animal.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Animal.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Animal.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -20,6 +20,8 @@
 import javax.validation.constraints.NotNull;
 
 import org.hibernate.validation.constraints.NotEmpty;
+import org.hibernate.validation.eg.groups.First;
+import org.hibernate.validation.eg.groups.Second;
 
 /**
  * @author Hardy Ferentschik

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Author.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Author.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Author.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -21,6 +21,8 @@
 
 import org.hibernate.validation.constraints.Length;
 import org.hibernate.validation.constraints.NotEmpty;
+import org.hibernate.validation.eg.groups.First;
+import org.hibernate.validation.eg.groups.Last;
 
 /**
  * @author Hardy Ferentschik

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Book.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Book.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Book.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -24,6 +24,9 @@
 
 import org.hibernate.validation.constraints.Length;
 import org.hibernate.validation.constraints.NotEmpty;
+import org.hibernate.validation.eg.groups.First;
+import org.hibernate.validation.eg.groups.Second;
+import org.hibernate.validation.eg.groups.Last;
 
 /**
  * @author Hardy Ferentschik

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Dictonary.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Dictonary.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Dictonary.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -23,6 +23,7 @@
 import javax.validation.constraints.NotNull;
 
 import org.hibernate.validation.constraints.NotEmpty;
+import org.hibernate.validation.eg.groups.All;
 
 /**
  * @author Hardy Ferentschik

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/EnglishDictonary.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/EnglishDictonary.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/EnglishDictonary.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -21,6 +21,8 @@
 import javax.validation.GroupSequences;
 import javax.validation.groups.Default;
 
+import org.hibernate.validation.eg.groups.First;
+
 /**
  * @author Hardy Ferentschik
  */

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/First.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/First.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/First.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.eg;
-
-/**
- * Group executed first in the validation
- * 
- * @author Emmanuel Bernard
- */
-public interface First {
-}

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/FrenchAddress.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/FrenchAddress.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/FrenchAddress.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -17,11 +17,8 @@
 */
 package org.hibernate.validation.eg;
 
-import javax.validation.constraints.NotNull;
+import org.hibernate.validation.constraints.composition.FrenchZipcode;
 
-import org.hibernate.validation.constraints.Length;
-import org.hibernate.validation.eg.constraint.FrenchZipcode;
-
 /**
  * @author Hardy Ferentschik
  */

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/GermanAddress.java (from rev 15756, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/FrenchAddress.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/GermanAddress.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/GermanAddress.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,32 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed 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.hibernate.validation.eg;
+
+import org.hibernate.validation.constraints.composition.GermanZipcode;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class GermanAddress extends Address {
+
+	@GermanZipcode
+	public String getZipCode() {
+		return super.getZipCode();
+	}
+
+}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Last.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Last.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Last.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.eg;
-
-/**
- * Group executed Last in the validation
- * 
- * @author Emmanuel Bernard
- */
-public interface Last {
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Second.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Second.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Second.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.eg;
-
-/**
- * Group executed second during the validation
- * 
- * @author Emmanuel Bernard
- */
-public interface Second {
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcode.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcode.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcode.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,63 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.ConstraintValidator;
-import javax.validation.OverridesParameter;
-import javax.validation.OverridesParameters;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-import org.hibernate.validation.constraints.Pattern;
-import org.hibernate.validation.constraints.Patterns;
-
-/**
- * @author Hardy Ferentschik
- */
- at NotNull
- at Size
- at Patterns({ @Pattern(regex = "....."), @Pattern(regex = "bar") })
- at ConstraintValidator(FrenchZipcodeConstraint.class)
- at Documented
- at Target({ METHOD, FIELD, TYPE })
- at Retention(RUNTIME)
-public @interface FrenchZipcode {
-	String message() default "Wrong zipcode";
-
-	Class<?>[] groups() default { };
-
-	@OverridesParameters({
-			@OverridesParameter(constraint = Size.class, parameter = "min"),
-			@OverridesParameter(constraint = Size.class, parameter = "max")
-	})
-	int size() default 5;
-
-	@OverridesParameter(constraint = Size.class, parameter = "message")
-    String sizeMessage() default "A french zip code has a length of 5";
-
-
-	@OverridesParameter(constraint = Pattern.class, parameter = "regex", index=2)
-	String regex() default "\\d*";
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcodeConstraint.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcodeConstraint.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/FrenchZipcodeConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,34 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class FrenchZipcodeConstraint implements Constraint<FrenchZipcode> {
-
-	public void initialize(FrenchZipcode parameters) {
-	}
-
-	public boolean isValid(Object object, ConstraintContext constraintContext) {
-		return true;
-	}
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroups.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroups.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroups.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,37 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-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;
-import javax.validation.ConstraintValidator;
-
-/**
- * @author Hardy Ferentschik
- */
- at Documented
- at ConstraintValidator(NoGroupsConstraint.class)
- at Target({ METHOD, FIELD })
- at Retention(RUNTIME)
-public @interface NoGroups {
-	String message() default "default message";
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroupsConstraint.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroupsConstraint.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoGroupsConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,34 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class NoGroupsConstraint implements Constraint<NoGroups> {
-
-	public void initialize(NoGroups parameters) {
-	}
-
-	public boolean isValid(Object object, ConstraintContext constraintContext) {
-		return false;
-	}
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessage.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessage.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessage.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,37 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-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;
-import javax.validation.ConstraintValidator;
-
-/**
- * @author Hardy Ferentschik
- */
- at Documented
- at ConstraintValidator(NoMessageConstraint.class)
- at Target({ METHOD, FIELD })
- at Retention(RUNTIME)
-public @interface NoMessage {
-	Class<?>[] groups() default { };
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessageConstraint.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessageConstraint.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/NoMessageConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,34 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class NoMessageConstraint implements Constraint<NoMessage> {
-
-	public void initialize(NoMessage parameters) {
-	}
-
-	public boolean isValid(Object object, ConstraintContext constraintContext) {
-		return false;
-	}
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcode.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcode.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcode.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,44 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.ConstraintValidator;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-
-/**
- * @author Hardy Ferentschik
- */
- at NotNull
- at Size(min = 5, max = 5)
- at ConstraintValidator(UKZipcodeConstraint.class)
- at Documented
- at Target({ METHOD, FIELD, TYPE })
- at Retention(RUNTIME)
-public @interface UKZipcode {
-	public abstract String message() default "Wrong zipcode";
-
-	public abstract Class<?>[] groups() default { };
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcodeConstraint.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcodeConstraint.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/UKZipcodeConstraint.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,34 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintContext;
-
-/**
- * @author Hardy Ferentschik
- */
-public class UKZipcodeConstraint implements Constraint<UKZipcode> {
-
-	public void initialize(UKZipcode parameters) {
-	}
-
-	public boolean isValid(Object object, ConstraintContext constraintContext) {
-		return false;
-	}
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/ValidProperty.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/ValidProperty.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/constraint/ValidProperty.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -1,41 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed 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.hibernate.validation.eg.constraint;
-
-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;
-import javax.validation.ConstraintValidator;
-
-/**
- * @author Hardy Ferentschik
- */
- at Documented
- at ConstraintValidator(NoGroupsConstraint.class)
- at Target({ METHOD, FIELD })
- at Retention(RUNTIME)
-public @interface ValidProperty {
-	String message() default "default message";
-
-	Class<?>[] groups() default { };
-
-	int validLength() default 0;
-}
\ No newline at end of file

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/All.java (from rev 15765, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/All.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/All.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/All.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,8 @@
+package org.hibernate.validation.eg.groups;
+
+/**
+ * Groups including all validations
+ * @author Emmanuel Bernard
+ */
+public interface All {
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/All.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/First.java (from rev 15765, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/First.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/First.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/First.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.eg.groups;
+
+/**
+ * Group executed first in the validation
+ * 
+ * @author Emmanuel Bernard
+ */
+public interface First {
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/First.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Last.java (from rev 15765, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Last.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Last.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Last.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.eg.groups;
+
+/**
+ * Group executed Last in the validation
+ * 
+ * @author Emmanuel Bernard
+ */
+public interface Last {
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Last.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java (from rev 15765, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Second.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.eg.groups;
+
+/**
+ * Group executed second during the validation
+ * 
+ * @author Emmanuel Bernard
+ */
+public interface Second {
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -24,7 +24,7 @@
 import static org.junit.Assert.fail;
 import org.junit.Test;
 
-import static org.hibernate.validation.util.TestUtil.getHibernateValidator;
+import static org.hibernate.validation.util.TestUtil.getValidator;
 import static org.hibernate.validation.util.TestUtil.assertNumberOfViolations;
 import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;
 
@@ -32,9 +32,10 @@
 import org.hibernate.validation.constraints.SizeConstraint;
 import org.hibernate.validation.constraints.PatternConstraint;
 import org.hibernate.validation.eg.FrenchAddress;
+import org.hibernate.validation.eg.GermanAddress;
 
 /**
- * Tests for the implementation of <code>Validator</code>.
+ * Tests for composing constraints.
  *
  * @author Hardy Ferentschik
  */
@@ -42,7 +43,7 @@
 
 	@Test
 	public void testComposition() {
-		Validator validator = getHibernateValidator();
+		Validator validator = getValidator();
 
 		FrenchAddress address = new FrenchAddress();
 		address.setAddressline1( "10 rue des Treuils" );
@@ -87,7 +88,7 @@
 			else if ( violation.getInterpolatedMessage().equals( "must match \".....\"" ) ) {
 				assertConstraintViolation(
 						violation,
-						"must match \".....\"" ,
+						"must match \".....\"",
 						PatternConstraint.class,
 						FrenchAddress.class,
 						"abc",
@@ -117,7 +118,7 @@
 			else if ( violation.getInterpolatedMessage().equals( "must match \".....\"" ) ) {
 				assertConstraintViolation(
 						violation,
-						"must match \".....\"" ,
+						"must match \".....\"",
 						PatternConstraint.class,
 						FrenchAddress.class,
 						"123",
@@ -133,4 +134,24 @@
 		constraintViolations = validator.validate( address );
 		assertNumberOfViolations( constraintViolations, 0 );
 	}
+
+	@Test
+	public void testNestedComposition() {
+		Validator validator = getValidator();
+
+		GermanAddress address = new GermanAddress();
+		address.setAddressline1( "Rathausstrasse 5" );
+		address.setAddressline2( "3ter Stock" );
+		address.setCity( "Karlsruhe" );
+		Set<ConstraintViolation<GermanAddress>> constraintViolations = validator.validate( address );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation(
+				constraintViolations.iterator().next(),
+				"may not be null",
+				NotNullConstraint.class,
+				GermanAddress.class,
+				null,
+				"zipCode"
+		);
+	}
 }
\ No newline at end of file

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -41,10 +41,10 @@
 import org.hibernate.validation.eg.Dictonary;
 import org.hibernate.validation.eg.Engine;
 import org.hibernate.validation.eg.EnglishDictonary;
-import org.hibernate.validation.eg.First;
-import org.hibernate.validation.eg.Last;
+import org.hibernate.validation.eg.groups.First;
+import org.hibernate.validation.eg.groups.Second;
+import org.hibernate.validation.eg.groups.Last;
 import org.hibernate.validation.eg.Order;
-import org.hibernate.validation.eg.Second;
 import org.hibernate.validation.eg.Unconstraint;
 import org.hibernate.validation.util.TestUtil;
 
@@ -59,7 +59,7 @@
 	@Test
 	public void testWrongMethodName() {
 		try {
-			TestUtil.getHibernateValidator().getConstraintsForClass( Boy.class ).hasConstraints();
+			TestUtil.getValidator().getConstraintsForClass( Boy.class ).hasConstraints();
 			fail();
 		}
 		catch ( ValidationException e ) {
@@ -74,36 +74,36 @@
 
 	@Test(expected = IllegalArgumentException.class)
 	public void testNullParamterToValidatorImplConstructor() {
-		TestUtil.getHibernateValidator().getConstraintsForClass( null );
+		TestUtil.getValidator().getConstraintsForClass( null );
 	}
 
 	@Test
 	public void testUnconstraintClass() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 		assertTrue( "There should be no constraints", !validator.getConstraintsForClass( Unconstraint.class ).hasConstraints() );
 	}
 
 	@Test
 	public void testHasConstraints() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 		assertTrue( "There should be constraints", validator.getConstraintsForClass( Customer.class ).hasConstraints() );
 	}
 
 	@Test(expected = IllegalArgumentException.class)
 	public void testValidateWithNull() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 		validator.validate( null );
 	}
 
 	@Test(expected = IllegalArgumentException.class)
 	public void testValidateWithNullProperty() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 		validator.validateProperty( null, "firstName" );
 	}
 
 	@Test
 	public void testGroups() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Author author = new Author();
 		author.setLastName( "" );
@@ -156,7 +156,7 @@
 
 	@Test
 	public void testDefaultGroupSequence() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Author author = new Author();
 		author.setLastName( "" );
@@ -198,7 +198,7 @@
 
 	@Test
 	public void testBasicValidation() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Customer customer = new Customer();
 		customer.setFirstName( "John" );
@@ -214,7 +214,7 @@
 
 	@Test
 	public void testGroupSequences() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Dictonary dictonary = new Dictonary();
 		dictonary.setTitle( "English - German" );
@@ -230,7 +230,7 @@
 
 	@Test
 	public void testValidationFailureInMultipleGroups() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 		Animal elepfant = new Animal();
 		elepfant.setName( "" );
 		elepfant.setDomain( Animal.Domain.EUKARYOTA );
@@ -255,13 +255,13 @@
 
 	@Test(expected = ValidationException.class)
 	public void testInvalidSequenceName() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 		validator.getConstraintsForClass( EnglishDictonary.class ).hasConstraints();
 	}
 
 	@Test
 	public void testValidationMethod() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Address address = new Address();
 		address.setAddressline1( null );
@@ -299,7 +299,7 @@
 
 	@Test
 	public void testValidateList() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Customer customer = new Customer();
 		customer.setFirstName( "John" );
@@ -324,7 +324,7 @@
 	@Test
 	@SpecAssertion( section = {"2.2"} )
 	public void testMultiValueConstraint() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Engine engine = new Engine();
 		engine.setSerialNumber( "mail at foobar.com" );
@@ -343,7 +343,7 @@
 	@Test
 	@SpecAssertion( section = {"3.5.1"} )
 	public void testGraphValidation() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Actor clint = new Actor( "Clint", "Eastwood" );
 		Actor morgan = new Actor( "Morgan", "" );
@@ -368,7 +368,7 @@
 
 	@Test
 	public void testValidateValue() {
-		Validator validator = TestUtil.getHibernateValidator();
+		Validator validator = TestUtil.getValidator();
 
 		Order order = new Order();
 

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/ReflectionHelperTest.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -37,11 +37,11 @@
 
 import org.hibernate.validation.constraints.Pattern;
 import org.hibernate.validation.constraints.Patterns;
+import org.hibernate.validation.constraints.incomplete.NoGroups;
+import org.hibernate.validation.constraints.incomplete.NoMessage;
 import org.hibernate.validation.eg.Engine;
 import org.hibernate.validation.eg.Order;
-import org.hibernate.validation.eg.constraint.NoGroups;
-import org.hibernate.validation.eg.constraint.NoMessage;
-import org.hibernate.validation.eg.constraint.ValidProperty;
+import org.hibernate.validation.constraints.incomplete.ValidProperty;
 import org.hibernate.tck.annotations.SpecAssertion;
 
 /**

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/TestUtil.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/TestUtil.java	2009-01-09 21:30:33 UTC (rev 15766)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/util/TestUtil.java	2009-01-12 14:03:45 UTC (rev 15767)
@@ -38,7 +38,7 @@
 	private TestUtil() {
 	}
 
-	public static Validator getHibernateValidator() {
+	public static Validator getValidator() {
 		if ( hibernateValidator == null ) {
 			HibernateValidatorFactoryBuilder builder = Validation
 					.builderType( HibernateValidatorFactoryBuilder.class )




More information about the hibernate-commits mailing list