[hibernate-commits] Hibernate SVN: r16156 - in validator/trunk/hibernate-validator/src/test: java/org/hibernate/validation/eg and 7 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Mar 13 05:46:38 EDT 2009


Author: hardy.ferentschik
Date: 2009-03-13 05:46:38 -0400 (Fri, 13 Mar 2009)
New Revision: 16156

Added:
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Actor.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Address.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Boy.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/DefaultAlias.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Engine.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Order.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Person.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/ConstraintCompositionTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/FrenchAddress.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/GermanAddress.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Animal.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Author.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Book.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Dictonary.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/UnconstraintEntity.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/MultipleMinMax.java
Removed:
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Account.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Actor.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Address.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/Boy.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Customer.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/DefaultAlias.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/Engine.java
   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
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/MultipleMinMax.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Order.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Person.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/UnconstraintEntity.java
   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
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/BeanDescriptorImplTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java
Modified:
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintHelperTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
   validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java
   validator/trunk/hibernate-validator/src/test/resources/log4j.properties
Log:
refactored test entities

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -23,7 +23,6 @@
 import java.util.Locale;
 import java.util.Set;
 import javax.validation.Configuration;
-import javax.validation.ConstraintDescriptor;
 import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorContext;
 import javax.validation.ConstraintValidatorFactory;
@@ -46,7 +45,7 @@
 
 import org.hibernate.validation.HibernateValidationProvider;
 import org.hibernate.validation.constraints.NotNullValidator;
-import org.hibernate.validation.eg.Customer;
+import org.hibernate.validation.engine.metadata.Customer;
 import org.hibernate.validation.engine.ConfigurationImpl;
 import org.hibernate.validation.engine.ConstraintValidatorFactoryImpl;
 import org.hibernate.validation.engine.HibernateValidatorConfiguration;

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Account.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Account.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Account.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,45 +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;
-
-import javax.validation.Valid;
-
-/**
- * Class with no constraints but with a cascade @Valid annotation
- */
-public class Account {
-	private String accountLogin;
-	private Customer customer;
-
-	public String getAccountLogin() {
-		return accountLogin;
-	}
-
-	public void setAccountLogin(String accountLogin) {
-		this.accountLogin = accountLogin;
-	}
-
-	@Valid
-	public Customer getCustomer() {
-		return customer;
-	}
-
-	public void setCustomer(Customer customer) {
-		this.customer = customer;
-	}
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Actor.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Actor.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Actor.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,89 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.validation.Valid;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Actor implements Person {
-
-	private String firstName;
-	private String middleName;
-	private String lastName;
-
-	@Valid
-	private List<Actor> playedWith = new ArrayList<Actor>();
-
-	public Actor() {
-
-	}
-
-	public Actor(String firstName, String lastName) {
-		this.firstName = firstName;
-		this.lastName = lastName;
-	}
-
-	public List<Actor> getPlayedWith() {
-		return playedWith;
-	}
-
-	public void setPlayedWith(List<Actor> playedWith) {
-		this.playedWith = playedWith;
-	}
-
-	public void addPlayedWith(Actor playedWith) {
-		this.playedWith.add( playedWith );
-	}
-
-	public String getFirstName() {
-		return firstName;
-	}
-
-	public void setFirstName(String firstName) {
-		this.firstName = firstName;
-	}
-
-	public String getMiddleName() {
-		return middleName;
-	}
-
-	public void setMiddleName(String middleName) {
-		this.middleName = middleName;
-	}
-
-	public String getLastName() {
-		return lastName;
-	}
-
-	public void setLastName(String lastName) {
-		this.lastName = lastName;
-	}
-
-	@Override
-	public String toString() {
-		return "Actor{" +
-				"firstName='" + firstName + '\'' +
-				", middleName='" + middleName + '\'' +
-				", lastName='" + lastName + '\'' +
-				'}';
-	}
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Address.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Address.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Address.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,74 +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;
-
-import javax.validation.constraints.NotNull;
-
-import org.hibernate.validation.constraints.Length;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Address {
-	@NotNull
-	@Length(max = 30)
-	private String addressline1;
-
-	@NotNull
-	@Length(max = 30)
-	private String addressline2;
-
-	private String zipCode;
-
-	private String city;
-
-	public String getAddressline1() {
-		return addressline1;
-	}
-
-	public void setAddressline1(String addressline1) {
-		this.addressline1 = addressline1;
-	}
-
-	public String getAddressline2() {
-		return addressline2;
-	}
-
-	public void setAddressline2(String addressline2) {
-		this.addressline2 = addressline2;
-	}
-
-	public String getZipCode() {
-		return zipCode;
-	}
-
-	public void setZipCode(String zipCode) {
-		this.zipCode = zipCode;
-	}
-
-	@Length(max = 30)
-	@NotNull
-	public String getCity() {
-		return city;
-	}
-
-	public void setCity(String city) {
-		this.city = city;
-	}
-}
-

Deleted: 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-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Animal.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,55 +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;
-
-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
- */
-public class Animal {
-	public enum Domain {
-		PROKARYOTA, EUKARYOTA
-	}
-
-	@NotEmpty(groups = { First.class, Second.class })
-	private String name;
-
-	@NotNull(groups = First.class)
-	private Domain domain;
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public Domain getDomain() {
-		return domain;
-	}
-
-	public void setDomain(Domain domain) {
-		this.domain = domain;
-	}
-}
\ No newline at end of file

Deleted: 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-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Author.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,65 +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;
-
-import javax.validation.constraints.NotNull;
-
-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
- */
-public class Author {
-
-	@NotEmpty(groups = Last.class)
-	private String firstName;
-
-	@NotNull(groups = First.class)
-	@NotEmpty(groups = First.class)
-	private String lastName;
-
-	@Length(max = 20, groups = Last.class)
-	private String company;
-
-	public String getFirstName() {
-		return firstName;
-	}
-
-	public void setFirstName(String firstName) {
-		this.firstName = firstName;
-	}
-
-	public String getLastName() {
-		return lastName;
-	}
-
-	public void setLastName(String lastName) {
-		this.lastName = lastName;
-	}
-
-	public String getCompany() {
-		return company;
-	}
-
-	public void setCompany(String company) {
-		this.company = company;
-	}
-}

Deleted: 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-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Book.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,72 +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;
-
-import javax.validation.GroupSequence;
-import javax.validation.Valid;
-import javax.validation.constraints.NotNull;
-
-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;
-import org.hibernate.validation.eg.groups.Second;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Book {
-	@NotNull(groups = First.class)
-	@NotEmpty(groups = First.class)
-	private String title;
-
-	@Length(max = 30, groups = Second.class)
-	private String subtitle;
-
-	@Valid
-	@NotNull(groups = First.class)
-	private Author author;
-
-	public String getTitle() {
-		return title;
-	}
-
-	public void setTitle(String title) {
-		this.title = title;
-	}
-
-	public String getSubtitle() {
-		return subtitle;
-	}
-
-	public void setSubtitle(String subtitle) {
-		this.subtitle = subtitle;
-	}
-
-	public Author getAuthor() {
-		return author;
-	}
-
-	public void setAuthor(Author author) {
-		this.author = author;
-	}
-
-	@GroupSequence(value = { First.class, Second.class, Last.class })
-	public interface All {
-	}
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Boy.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Boy.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Boy.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,65 +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;
-
-import javax.validation.constraints.NotNull;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class Boy implements Person {
-
-	private String firstName;
-	private String middleName;
-	private String lastName;
-	private Integer age;
-
-	public String getFirstName() {
-		return firstName;
-	}
-
-	public void setFirstName(String firstName) {
-		this.firstName = firstName;
-	}
-
-	public String getMiddleName() {
-		return middleName;
-	}
-
-	public void setMiddleName(String middleName) {
-		this.middleName = middleName;
-	}
-
-	public String getLastName() {
-		return lastName;
-	}
-
-	public void setLastName(String lastName) {
-		this.lastName = lastName;
-	}
-
-	public void setAge(Integer age) {
-		this.age = age;
-	}
-
-	@NotNull
-	public Integer age() {
-		return age;
-	}
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Customer.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Customer.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Customer.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,67 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.validation.Valid;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Customer implements Person {
-
-	private String firstName;
-	private String middleName;
-	private String lastName;
-
-	@Valid
-	private List<Order> orderList = new ArrayList<Order>();
-
-	public void addOrder(Order order) {
-		orderList.add( order );
-	}
-
-	public List<Order> getOrderList() {
-		return orderList;
-	}
-
-	public String getFirstName() {
-		return firstName;
-	}
-
-	public void setFirstName(String firstName) {
-		this.firstName = firstName;
-	}
-
-	public String getMiddleName() {
-		return middleName;
-	}
-
-	public void setMiddleName(String middleName) {
-		this.middleName = middleName;
-	}
-
-	public String getLastName() {
-		return lastName;
-	}
-
-	public void setLastName(String lastName) {
-		this.lastName = lastName;
-	}
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/DefaultAlias.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/DefaultAlias.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/DefaultAlias.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,7 +0,0 @@
-package org.hibernate.validation.eg;
-
-/**
- * @author Emmanuel Bernard
- */
-public interface DefaultAlias {
-}

Deleted: 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-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Dictonary.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,59 +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;
-
-import javax.validation.GroupSequence;
-import javax.validation.constraints.NotNull;
-import javax.validation.groups.Default;
-
-import org.hibernate.validation.constraints.NotEmpty;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Dictonary extends Book {
-	@NotNull(groups = Translate.class)
-	@NotEmpty(groups = Translate.class)
-	private String translatesTo;
-
-	@NotNull(groups = Translate.class)
-	@NotEmpty(groups = Translate.class)
-	private String translatesFrom;
-
-	public String getTranslatesTo() {
-		return translatesTo;
-	}
-
-	public void setTranslatesTo(String translatesTo) {
-		this.translatesTo = translatesTo;
-	}
-
-	public String getTranslatesFrom() {
-		return translatesFrom;
-	}
-
-	public void setTranslatesFrom(String translatesFrom) {
-		this.translatesFrom = translatesFrom;
-	}
-
-	/**
-	 * Translator related constraints
-	 */
-	public interface Translate {
-	}
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Engine.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Engine.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Engine.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -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;
-
-import javax.validation.constraints.Pattern;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class Engine {
-	@Pattern.List({
-			@Pattern(regexp = "^[A-Z0-9-]+$",
-					message = "must contain alphabetical characters only"),
-			@Pattern(regexp = "^....-....-....$", message = "must match ....-....-....")
-	})
-	private String serialNumber;
-
-	public String getSerialNumber() {
-		return serialNumber;
-	}
-
-	public void setSerialNumber(String serialNumber) {
-		this.serialNumber = serialNumber;
-	}
-}

Deleted: 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-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/FrenchAddress.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,32 +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;
-
-import org.hibernate.validation.constraints.composition.FrenchZipcode;
-
-/**
- * @author Hardy Ferentschik
- */
-public class FrenchAddress extends Address {
-
-	@FrenchZipcode
-	public String getZipCode() {
-		return super.getZipCode();
-	}
-
-}
\ No newline at end of file

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/GermanAddress.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/GermanAddress.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/GermanAddress.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,32 +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;
-
-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/MultipleMinMax.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/MultipleMinMax.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/MultipleMinMax.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,39 +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;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-
-/**
- * @author Hardy Ferentschik
- */
-public class MultipleMinMax {
-	@Min(10l)
-	@Max(20l)
-	Number number;
-
-	@Min(10l)
-	@Max(20l)
-	String stringNumber;
-
-	public MultipleMinMax(String stringNumber, Number number) {
-		this.stringNumber = stringNumber;
-		this.number = number;
-	}
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Order.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Order.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Order.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,36 +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;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Order {
-	@NotNull
-	Integer orderNumber;
-
-	public Integer getOrderNumber() {
-		return orderNumber;
-	}
-
-	public void setOrderNumber(Integer orderNumber) {
-		this.orderNumber = orderNumber;
-	}
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Person.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Person.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Person.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -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;
-
-import javax.validation.constraints.NotNull;
-
-import org.hibernate.validation.constraints.NotEmpty;
-
-/**
- * @author Hardy Ferentschik
- */
-public interface Person {
-	@NotNull
-	@NotEmpty
-	String getFirstName();
-
-	String getMiddleName();
-
-	@NotNull
-	@NotEmpty
-	String getLastName();
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/UnconstraintEntity.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/UnconstraintEntity.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/UnconstraintEntity.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,26 +0,0 @@
-// : Person.java 69 2008-09-08 11:05:07Z hardy.ferentschik $
-/*
-* 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;
-
-/**
- * Empty un-constraint test class.
- *
- * @author Hardy Ferentschik
- */
-public class UnconstraintEntity {
-}

Deleted: 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/All.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/All.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,8 +0,0 @@
-package org.hibernate.validation.eg.groups;
-
-/**
- * Groups including all validations
- * @author Emmanuel Bernard
- */
-public interface All {
-}

Deleted: 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/First.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/First.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.eg.groups;
-
-/**
- * Group executed first in the validation
- * 
- * @author Emmanuel Bernard
- */
-public interface First {
-}

Deleted: 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/Last.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Last.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.eg.groups;
-
-/**
- * Group executed Last in the validation
- * 
- * @author Emmanuel Bernard
- */
-public interface Last {
-}

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.eg.groups;
-
-/**
- * Group executed second during the validation
- * 
- * @author Emmanuel Bernard
- */
-public interface Second {
-}

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Actor.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Actor.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Actor.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Actor.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,89 @@
+// $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.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.validation.Valid;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Actor implements Person {
+
+	private String firstName;
+	private String middleName;
+	private String lastName;
+
+	@Valid
+	private List<Actor> playedWith = new ArrayList<Actor>();
+
+	public Actor() {
+
+	}
+
+	public Actor(String firstName, String lastName) {
+		this.firstName = firstName;
+		this.lastName = lastName;
+	}
+
+	public List<Actor> getPlayedWith() {
+		return playedWith;
+	}
+
+	public void setPlayedWith(List<Actor> playedWith) {
+		this.playedWith = playedWith;
+	}
+
+	public void addPlayedWith(Actor playedWith) {
+		this.playedWith.add( playedWith );
+	}
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	public String getMiddleName() {
+		return middleName;
+	}
+
+	public void setMiddleName(String middleName) {
+		this.middleName = middleName;
+	}
+
+	public String getLastName() {
+		return lastName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+
+	@Override
+	public String toString() {
+		return "Actor{" +
+				"firstName='" + firstName + '\'' +
+				", middleName='" + middleName + '\'' +
+				", lastName='" + lastName + '\'' +
+				'}';
+	}
+}
\ No newline at end of file


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Address.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Address.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Address.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Address.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,74 @@
+// $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.engine;
+
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validation.constraints.Length;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Address {
+	@NotNull
+	@Length(max = 30)
+	private String addressline1;
+
+	@NotNull
+	@Length(max = 30)
+	private String addressline2;
+
+	private String zipCode;
+
+	private String city;
+
+	public String getAddressline1() {
+		return addressline1;
+	}
+
+	public void setAddressline1(String addressline1) {
+		this.addressline1 = addressline1;
+	}
+
+	public String getAddressline2() {
+		return addressline2;
+	}
+
+	public void setAddressline2(String addressline2) {
+		this.addressline2 = addressline2;
+	}
+
+	public String getZipCode() {
+		return zipCode;
+	}
+
+	public void setZipCode(String zipCode) {
+		this.zipCode = zipCode;
+	}
+
+	@Length(max = 30)
+	@NotNull
+	public String getCity() {
+		return city;
+	}
+
+	public void setCity(String city) {
+		this.city = city;
+	}
+}
+


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/All.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,8 @@
+package org.hibernate.validation.engine;
+
+/**
+ * Groups including all validations
+ * @author Emmanuel Bernard
+ */
+public interface All {
+}


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

Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/BeanDescriptorImplTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/BeanDescriptorImplTest.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/BeanDescriptorImplTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,147 +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.engine;
-
-import java.util.Set;
-import javax.validation.BeanDescriptor;
-import javax.validation.ConstraintDescriptor;
-import javax.validation.ElementDescriptor;
-import javax.validation.PropertyDescriptor;
-import javax.validation.Validator;
-
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.fail;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-
-import org.hibernate.validation.eg.Account;
-import org.hibernate.validation.eg.Customer;
-import org.hibernate.validation.eg.Order;
-import org.hibernate.validation.eg.UnconstraintEntity;
-import org.hibernate.validation.util.TestUtil;
-
-
-/**
- * @author Hardy Ferentschik
- */
-public class BeanDescriptorImplTest {
-
-	@Test
-	public void testHasConstraintsAndIsBeanConstrained() {
-		Validator validator = TestUtil.getValidator();
-		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Customer.class );
-
-		assertFalse( "There should be no direct constraints on the specified bean.", beanDescriptor.hasConstraints() );
-		assertTrue( "Bean should be constrainted due to @valid ", beanDescriptor.isBeanConstrained() );
-
-		beanDescriptor = validator.getConstraintsForClass( Account.class );
-		assertTrue(
-				"Bean should be constrainted due to @valid", beanDescriptor.isBeanConstrained()
-		);
-	}
-
-	@Test
-	public void testUnconstraintClass() {
-		Validator validator = TestUtil.getValidator();
-		assertFalse(
-				"There should be no constraints",
-				validator.getConstraintsForClass( UnconstraintEntity.class ).hasConstraints()
-		);
-	}
-
-	@Test
-	public void testGetConstraintsForProperty() {
-		Validator validator = TestUtil.getValidator();
-		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
-		PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty( "orderNumber" );
-		assertEquals(
-				"There should be one constraint descriptor", 1, propertyDescriptor.getConstraintDescriptors().size()
-		);
-
-		assertNull( "There should be no descriptor", beanDescriptor.getConstraintsForProperty( "foobar" ) );
-
-		// TODO Is this corect or should we get a IllegalArgumentException
-		assertNull( "There should be no descriptor", beanDescriptor.getConstraintsForProperty( null ) );
-
-		beanDescriptor = validator.getConstraintsForClass( Customer.class );
-		propertyDescriptor = beanDescriptor.getConstraintsForProperty( "orderList" );
-		assertEquals(
-				"There should be no constraint descriptors", 0, propertyDescriptor.getConstraintDescriptors().size()
-		);
-		assertTrue( "The property should be cascaded", propertyDescriptor.isCascaded() );
-	}
-
-	/**
-	 * HV-95
-	 */
-	@Test
-	public void testGetConstrainedProperties() {
-		Validator validator = TestUtil.getValidator();
-		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
-		Set<String> constraintProperties = beanDescriptor.getConstrainedProperties();
-		assertEquals( "There should be only one property", 1, constraintProperties.size() );
-		assertTrue( "Wrong property", constraintProperties.contains( "orderNumber" ) );
-
-		try {
-			constraintProperties.add( "foobar" );
-			fail( "Set should be immutable" );
-		}
-		catch ( UnsupportedOperationException e ) {
-
-		}
-
-		try {
-			constraintProperties.remove( "orderNumber" );
-			fail( "Set should be immutable" );
-		}
-		catch ( UnsupportedOperationException e ) {
-
-		}
-	}
-
-	/**
-	 * HV-95
-	 */
-	@Test
-	public void testElementDescriptorImmutable() {
-		Validator validator = TestUtil.getValidator();
-		ElementDescriptor elementDescriptor = validator.getConstraintsForClass( Order.class )
-				.getConstraintsForProperty( "orderNumber" );
-		Set<ConstraintDescriptor<?>> constraintDescriptors = elementDescriptor.getConstraintDescriptors();
-		assertTrue( "There should be a ConstraintDescriptor", constraintDescriptors.size() == 1 );
-		ConstraintDescriptor<?> descriptor = constraintDescriptors.iterator().next();
-
-		try {
-			constraintDescriptors.add( descriptor );
-			fail( "Set should be immutable" );
-		}
-		catch ( UnsupportedOperationException e ) {
-
-		}
-
-		try {
-			constraintDescriptors.remove( descriptor );
-			fail( "Set should be immutable" );
-		}
-		catch ( UnsupportedOperationException e ) {
-
-		}
-	}
-}

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Boy.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Boy.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Boy.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Boy.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,65 @@
+// $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.engine;
+
+import javax.validation.constraints.NotNull;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Boy implements Person {
+
+	private String firstName;
+	private String middleName;
+	private String lastName;
+	private Integer age;
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	public String getMiddleName() {
+		return middleName;
+	}
+
+	public void setMiddleName(String middleName) {
+		this.middleName = middleName;
+	}
+
+	public String getLastName() {
+		return lastName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+
+	public void setAge(Integer age) {
+		this.age = age;
+	}
+
+	@NotNull
+	public Integer age() {
+		return age;
+	}
+}
\ No newline at end of file


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

Deleted: 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-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -1,167 +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.engine;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import static org.junit.Assert.fail;
-import org.junit.Test;
-
-import org.hibernate.validation.eg.FrenchAddress;
-import org.hibernate.validation.eg.GermanAddress;
-import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;
-import static org.hibernate.validation.util.TestUtil.assertNumberOfViolations;
-import static org.hibernate.validation.util.TestUtil.getValidator;
-
-/**
- * Tests for composing constraints.
- *
- * @author Hardy Ferentschik
- */
-public class ConstraintCompositionTest {
-
-	@Test
-	public void testComposition() {
-		Validator validator = getValidator();
-
-		FrenchAddress address = new FrenchAddress();
-		address.setAddressline1( "10 rue des Treuils" );
-		address.setAddressline2( "BP 12 " );
-		address.setCity( "Bordeaux" );
-		Set<ConstraintViolation<FrenchAddress>> constraintViolations = validator.validate( address );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertConstraintViolation(
-				constraintViolations.iterator().next(),
-				"may not be null",
-				FrenchAddress.class,
-				null,
-				"zipCode"
-		);
-
-
-		address.setZipCode( "abc" );
-		constraintViolations = validator.validate( address );
-		assertNumberOfViolations( constraintViolations, 3 );
-		for ( ConstraintViolation violation : constraintViolations ) {
-			if ( violation.getMessage().equals( "A french zip code has a length of 5" ) ) {
-				assertConstraintViolation(
-						violation,
-						"A french zip code has a length of 5",
-						FrenchAddress.class,
-						"abc",
-						"zipCode"
-				);
-			}
-			else if ( violation.getMessage().equals( "must match \"d*\"" ) ) {
-				assertConstraintViolation(
-						violation,
-						"must match \"d*\"",
-						FrenchAddress.class,
-						"abc",
-						"zipCode"
-				);
-			}
-			else if ( violation.getMessage().equals( "must match \".....\"" ) ) {
-				assertConstraintViolation(
-						violation,
-						"must match \".....\"",
-						FrenchAddress.class,
-						"abc",
-						"zipCode"
-				);
-			}
-			else {
-				fail( "Wrong violation found." );
-			}
-		}
-
-
-		address.setZipCode( "123" );
-		constraintViolations = validator.validate( address );
-		assertNumberOfViolations( constraintViolations, 2 );
-		for ( ConstraintViolation violation : constraintViolations ) {
-			if ( violation.getMessage().equals( "A french zip code has a length of 5" ) ) {
-				assertConstraintViolation(
-						violation,
-						"A french zip code has a length of 5",
-						FrenchAddress.class,
-						"123",
-						"zipCode"
-				);
-			}
-			else if ( violation.getMessage().equals( "must match \".....\"" ) ) {
-				assertConstraintViolation(
-						violation,
-						"must match \".....\"",
-						FrenchAddress.class,
-						"123",
-						"zipCode"
-				);
-			}
-			else {
-				fail( "Wrong violation found." );
-			}
-		}
-
-		address.setZipCode( "33023" );
-		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(),
-				"Falsche Postnummer.",
-				GermanAddress.class,
-				null,
-				"zipCode"
-		);
-	}
-
-	@Test
-	public void testOnlySingleConstraintViolation() {
-		Validator validator = getValidator();
-
-		GermanAddress address = new GermanAddress();
-		address.setAddressline1( "Rathausstrasse 5" );
-		address.setAddressline2( "3ter Stock" );
-		address.setCity( "Karlsruhe" );
-		address.setZipCode( "abc" );
-		// actually three composing constraints fail, but due to @ReportAsSingleViolation only one will be reported.
-		Set<ConstraintViolation<GermanAddress>> constraintViolations = validator.validate( address );
-		assertNumberOfViolations( constraintViolations, 1 );
-		assertConstraintViolation(
-				constraintViolations.iterator().next(),
-				"Falsche Postnummer.",
-				GermanAddress.class,
-				"abc",
-				"zipCode"
-		);
-	}
-}
\ No newline at end of file

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintHelperTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintHelperTest.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintHelperTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -32,8 +32,8 @@
 import org.hibernate.validation.constraints.invalidvalidators.NoGroups;
 import org.hibernate.validation.constraints.invalidvalidators.NoMessage;
 import org.hibernate.validation.constraints.invalidvalidators.ValidProperty;
-import org.hibernate.validation.eg.Engine;
-import org.hibernate.validation.eg.Order;
+import org.hibernate.validation.engine.Engine;
+import org.hibernate.validation.engine.Order;
 import org.hibernate.validation.util.ReflectionHelper;
 
 /**

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/DefaultAlias.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/DefaultAlias.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/DefaultAlias.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/DefaultAlias.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,7 @@
+package org.hibernate.validation.engine;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public interface DefaultAlias {
+}


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Engine.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Engine.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Engine.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Engine.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -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.engine;
+
+import javax.validation.constraints.Pattern;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Engine {
+	@Pattern.List({
+			@Pattern(regexp = "^[A-Z0-9-]+$",
+					message = "must contain alphabetical characters only"),
+			@Pattern(regexp = "^....-....-....$", message = "must match ....-....-....")
+	})
+	private String serialNumber;
+
+	public String getSerialNumber() {
+		return serialNumber;
+	}
+
+	public void setSerialNumber(String serialNumber) {
+		this.serialNumber = serialNumber;
+	}
+}


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/First.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.engine;
+
+/**
+ * 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/engine/First.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Last.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.engine;
+
+/**
+ * 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/engine/Last.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Order.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Order.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Order.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Order.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -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.engine;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Order {
+	@NotNull
+	Integer orderNumber;
+
+	public Integer getOrderNumber() {
+		return orderNumber;
+	}
+
+	public void setOrderNumber(Integer orderNumber) {
+		this.orderNumber = orderNumber;
+	}
+}


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Person.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Person.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Person.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Person.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -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.engine;
+
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validation.constraints.NotEmpty;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface Person {
+	@NotNull
+	@NotEmpty
+	String getFirstName();
+
+	String getMiddleName();
+
+	@NotNull
+	@NotEmpty
+	String getLastName();
+}


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/groups/Second.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.engine;
+
+/**
+ * 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/engine/Second.java
___________________________________________________________________
Name: svn:keywords
   + Id

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-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -32,16 +32,16 @@
 import org.junit.Test;
 import org.slf4j.Logger;
 
-import org.hibernate.validation.eg.Actor;
-import org.hibernate.validation.eg.Address;
-import org.hibernate.validation.eg.Boy;
-import org.hibernate.validation.eg.Customer;
-import org.hibernate.validation.eg.Engine;
-import org.hibernate.validation.eg.Order;
-import org.hibernate.validation.eg.Person;
-import org.hibernate.validation.eg.groups.First;
-import org.hibernate.validation.eg.groups.Last;
-import org.hibernate.validation.eg.groups.Second;
+import org.hibernate.validation.engine.Actor;
+import org.hibernate.validation.engine.Address;
+import org.hibernate.validation.engine.Boy;
+import org.hibernate.validation.engine.metadata.Customer;
+import org.hibernate.validation.engine.Engine;
+import org.hibernate.validation.engine.Order;
+import org.hibernate.validation.engine.Person;
+import org.hibernate.validation.engine.First;
+import org.hibernate.validation.engine.Last;
+import org.hibernate.validation.engine.Second;
 import org.hibernate.validation.util.LoggerFactory;
 import org.hibernate.validation.util.TestUtil;
 import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/ConstraintCompositionTest.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ConstraintCompositionTest.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/ConstraintCompositionTest.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/ConstraintCompositionTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,167 @@
+// $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.engine.constraintcomposition;
+
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import static org.junit.Assert.fail;
+import org.junit.Test;
+
+import org.hibernate.validation.engine.constraintcomposition.FrenchAddress;
+import org.hibernate.validation.engine.constraintcomposition.GermanAddress;
+import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;
+import static org.hibernate.validation.util.TestUtil.assertNumberOfViolations;
+import static org.hibernate.validation.util.TestUtil.getValidator;
+
+/**
+ * Tests for composing constraints.
+ *
+ * @author Hardy Ferentschik
+ */
+public class ConstraintCompositionTest {
+
+	@Test
+	public void testComposition() {
+		Validator validator = getValidator();
+
+		FrenchAddress address = new FrenchAddress();
+		address.setAddressline1( "10 rue des Treuils" );
+		address.setAddressline2( "BP 12 " );
+		address.setCity( "Bordeaux" );
+		Set<ConstraintViolation<FrenchAddress>> constraintViolations = validator.validate( address );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation(
+				constraintViolations.iterator().next(),
+				"may not be null",
+				FrenchAddress.class,
+				null,
+				"zipCode"
+		);
+
+
+		address.setZipCode( "abc" );
+		constraintViolations = validator.validate( address );
+		assertNumberOfViolations( constraintViolations, 3 );
+		for ( ConstraintViolation violation : constraintViolations ) {
+			if ( violation.getMessage().equals( "A french zip code has a length of 5" ) ) {
+				assertConstraintViolation(
+						violation,
+						"A french zip code has a length of 5",
+						FrenchAddress.class,
+						"abc",
+						"zipCode"
+				);
+			}
+			else if ( violation.getMessage().equals( "must match \"d*\"" ) ) {
+				assertConstraintViolation(
+						violation,
+						"must match \"d*\"",
+						FrenchAddress.class,
+						"abc",
+						"zipCode"
+				);
+			}
+			else if ( violation.getMessage().equals( "must match \".....\"" ) ) {
+				assertConstraintViolation(
+						violation,
+						"must match \".....\"",
+						FrenchAddress.class,
+						"abc",
+						"zipCode"
+				);
+			}
+			else {
+				fail( "Wrong violation found." );
+			}
+		}
+
+
+		address.setZipCode( "123" );
+		constraintViolations = validator.validate( address );
+		assertNumberOfViolations( constraintViolations, 2 );
+		for ( ConstraintViolation violation : constraintViolations ) {
+			if ( violation.getMessage().equals( "A french zip code has a length of 5" ) ) {
+				assertConstraintViolation(
+						violation,
+						"A french zip code has a length of 5",
+						FrenchAddress.class,
+						"123",
+						"zipCode"
+				);
+			}
+			else if ( violation.getMessage().equals( "must match \".....\"" ) ) {
+				assertConstraintViolation(
+						violation,
+						"must match \".....\"",
+						FrenchAddress.class,
+						"123",
+						"zipCode"
+				);
+			}
+			else {
+				fail( "Wrong violation found." );
+			}
+		}
+
+		address.setZipCode( "33023" );
+		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(),
+				"Falsche Postnummer.",
+				GermanAddress.class,
+				null,
+				"zipCode"
+		);
+	}
+
+	@Test
+	public void testOnlySingleConstraintViolation() {
+		Validator validator = getValidator();
+
+		GermanAddress address = new GermanAddress();
+		address.setAddressline1( "Rathausstrasse 5" );
+		address.setAddressline2( "3ter Stock" );
+		address.setCity( "Karlsruhe" );
+		address.setZipCode( "abc" );
+		// actually three composing constraints fail, but due to @ReportAsSingleViolation only one will be reported.
+		Set<ConstraintViolation<GermanAddress>> constraintViolations = validator.validate( address );
+		assertNumberOfViolations( constraintViolations, 1 );
+		assertConstraintViolation(
+				constraintViolations.iterator().next(),
+				"Falsche Postnummer.",
+				GermanAddress.class,
+				"abc",
+				"zipCode"
+		);
+	}
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/ConstraintCompositionTest.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:mergeinfo
   + 

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/FrenchAddress.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/FrenchAddress.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/FrenchAddress.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/FrenchAddress.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,33 @@
+// $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.engine.constraintcomposition;
+
+import org.hibernate.validation.constraints.composition.FrenchZipcode;
+import org.hibernate.validation.engine.Address;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class FrenchAddress extends Address {
+
+	@FrenchZipcode
+	public String getZipCode() {
+		return super.getZipCode();
+	}
+
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/FrenchAddress.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:mergeinfo
   + 

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/GermanAddress.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/GermanAddress.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/GermanAddress.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/GermanAddress.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,33 @@
+// $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.engine.constraintcomposition;
+
+import org.hibernate.validation.constraints.composition.GermanZipcode;
+import org.hibernate.validation.engine.Address;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class GermanAddress extends Address {
+
+	@GermanZipcode
+	public String getZipCode() {
+		return super.getZipCode();
+	}
+
+}
\ No newline at end of file


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/constraintcomposition/GermanAddress.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:mergeinfo
   + 

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Animal.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Animal.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Animal.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Animal.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,55 @@
+// $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.engine.groups;
+
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validation.constraints.NotEmpty;
+import org.hibernate.validation.engine.First;
+import org.hibernate.validation.engine.Second;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Animal {
+	public enum Domain {
+		PROKARYOTA, EUKARYOTA
+	}
+
+	@NotEmpty(groups = { First.class, Second.class })
+	private String name;
+
+	@NotNull(groups = First.class)
+	private Domain domain;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Domain getDomain() {
+		return domain;
+	}
+
+	public void setDomain(Domain domain) {
+		this.domain = domain;
+	}
+}
\ No newline at end of file


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Author.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Author.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Author.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Author.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,65 @@
+// $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.engine.groups;
+
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validation.constraints.Length;
+import org.hibernate.validation.constraints.NotEmpty;
+import org.hibernate.validation.engine.First;
+import org.hibernate.validation.engine.Last;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Author {
+
+	@NotEmpty(groups = Last.class)
+	private String firstName;
+
+	@NotNull(groups = First.class)
+	@NotEmpty(groups = First.class)
+	private String lastName;
+
+	@Length(max = 20, groups = Last.class)
+	private String company;
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	public String getLastName() {
+		return lastName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+
+	public String getCompany() {
+		return company;
+	}
+
+	public void setCompany(String company) {
+		this.company = company;
+	}
+}


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Book.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Book.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Book.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Book.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,73 @@
+// $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.engine.groups;
+
+import javax.validation.GroupSequence;
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validation.constraints.Length;
+import org.hibernate.validation.constraints.NotEmpty;
+import org.hibernate.validation.engine.First;
+import org.hibernate.validation.engine.Last;
+import org.hibernate.validation.engine.Second;
+import org.hibernate.validation.engine.groups.Author;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Book {
+	@NotNull(groups = First.class)
+	@NotEmpty(groups = First.class)
+	private String title;
+
+	@Length(max = 30, groups = Second.class)
+	private String subtitle;
+
+	@Valid
+	@NotNull(groups = First.class)
+	private Author author;
+
+	public String getTitle() {
+		return title;
+	}
+
+	public void setTitle(String title) {
+		this.title = title;
+	}
+
+	public String getSubtitle() {
+		return subtitle;
+	}
+
+	public void setSubtitle(String subtitle) {
+		this.subtitle = subtitle;
+	}
+
+	public Author getAuthor() {
+		return author;
+	}
+
+	public void setAuthor(Author author) {
+		this.author = author;
+	}
+
+	@GroupSequence(value = { First.class, Second.class, Last.class })
+	public interface All {
+	}
+}


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

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Dictonary.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Dictonary.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Dictonary.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Dictonary.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,58 @@
+// $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.engine.groups;
+
+import javax.validation.constraints.NotNull;
+
+import org.hibernate.validation.constraints.NotEmpty;
+import org.hibernate.validation.engine.groups.Book;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Dictonary extends Book {
+	@NotNull(groups = Translate.class)
+	@NotEmpty(groups = Translate.class)
+	private String translatesTo;
+
+	@NotNull(groups = Translate.class)
+	@NotEmpty(groups = Translate.class)
+	private String translatesFrom;
+
+	public String getTranslatesTo() {
+		return translatesTo;
+	}
+
+	public void setTranslatesTo(String translatesTo) {
+		this.translatesTo = translatesTo;
+	}
+
+	public String getTranslatesFrom() {
+		return translatesFrom;
+	}
+
+	public void setTranslatesFrom(String translatesFrom) {
+		this.translatesFrom = translatesFrom;
+	}
+
+	/**
+	 * Translator related constraints
+	 */
+	public interface Translate {
+	}
+}


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

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -28,9 +28,9 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import org.hibernate.validation.eg.groups.First;
-import org.hibernate.validation.eg.groups.Last;
-import org.hibernate.validation.eg.groups.Second;
+import org.hibernate.validation.engine.First;
+import org.hibernate.validation.engine.Last;
+import org.hibernate.validation.engine.Second;
 
 /**
  * @author Hardy Ferentschik

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -29,14 +29,14 @@
 import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 
-import org.hibernate.validation.eg.Animal;
-import org.hibernate.validation.eg.Author;
-import org.hibernate.validation.eg.Book;
-import org.hibernate.validation.eg.DefaultAlias;
-import org.hibernate.validation.eg.Dictonary;
-import org.hibernate.validation.eg.groups.First;
-import org.hibernate.validation.eg.groups.Last;
-import org.hibernate.validation.eg.groups.Second;
+import org.hibernate.validation.engine.groups.Animal;
+import org.hibernate.validation.engine.groups.Author;
+import org.hibernate.validation.engine.groups.Book;
+import org.hibernate.validation.engine.DefaultAlias;
+import org.hibernate.validation.engine.First;
+import org.hibernate.validation.engine.groups.Dictonary;
+import org.hibernate.validation.engine.Last;
+import org.hibernate.validation.engine.Second;
 import org.hibernate.validation.util.TestUtil;
 import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;
 

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Account.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,47 @@
+// $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.engine.metadata;
+
+import javax.validation.Valid;
+
+import org.hibernate.validation.engine.metadata.Customer;
+
+/**
+ * Class with no constraints but with a cascade @Valid annotation
+ */
+public class Account {
+	private String accountLogin;
+	private Customer customer;
+
+	public String getAccountLogin() {
+		return accountLogin;
+	}
+
+	public void setAccountLogin(String accountLogin) {
+		this.accountLogin = accountLogin;
+	}
+
+	@Valid
+	public Customer getCustomer() {
+		return customer;
+	}
+
+	public void setCustomer(Customer customer) {
+		this.customer = customer;
+	}
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Account.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/BeanDescriptorImplTest.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,147 @@
+// $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.engine.metadata;
+
+import java.util.Set;
+import javax.validation.BeanDescriptor;
+import javax.validation.ConstraintDescriptor;
+import javax.validation.ElementDescriptor;
+import javax.validation.PropertyDescriptor;
+import javax.validation.Validator;
+
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+
+import org.hibernate.validation.engine.metadata.Account;
+import org.hibernate.validation.engine.metadata.Customer;
+import org.hibernate.validation.engine.Order;
+import org.hibernate.validation.engine.metadata.UnconstraintEntity;
+import org.hibernate.validation.util.TestUtil;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class BeanDescriptorImplTest {
+
+	@Test
+	public void testHasConstraintsAndIsBeanConstrained() {
+		Validator validator = TestUtil.getValidator();
+		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Customer.class );
+
+		assertFalse( "There should be no direct constraints on the specified bean.", beanDescriptor.hasConstraints() );
+		assertTrue( "Bean should be constrainted due to @valid ", beanDescriptor.isBeanConstrained() );
+
+		beanDescriptor = validator.getConstraintsForClass( Account.class );
+		assertTrue(
+				"Bean should be constrainted due to @valid", beanDescriptor.isBeanConstrained()
+		);
+	}
+
+	@Test
+	public void testUnconstraintClass() {
+		Validator validator = TestUtil.getValidator();
+		assertFalse(
+				"There should be no constraints",
+				validator.getConstraintsForClass( UnconstraintEntity.class ).hasConstraints()
+		);
+	}
+
+	@Test
+	public void testGetConstraintsForProperty() {
+		Validator validator = TestUtil.getValidator();
+		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
+		PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty( "orderNumber" );
+		assertEquals(
+				"There should be one constraint descriptor", 1, propertyDescriptor.getConstraintDescriptors().size()
+		);
+
+		assertNull( "There should be no descriptor", beanDescriptor.getConstraintsForProperty( "foobar" ) );
+
+		// TODO Is this corect or should we get a IllegalArgumentException
+		assertNull( "There should be no descriptor", beanDescriptor.getConstraintsForProperty( null ) );
+
+		beanDescriptor = validator.getConstraintsForClass( Customer.class );
+		propertyDescriptor = beanDescriptor.getConstraintsForProperty( "orderList" );
+		assertEquals(
+				"There should be no constraint descriptors", 0, propertyDescriptor.getConstraintDescriptors().size()
+		);
+		assertTrue( "The property should be cascaded", propertyDescriptor.isCascaded() );
+	}
+
+	/**
+	 * HV-95
+	 */
+	@Test
+	public void testGetConstrainedProperties() {
+		Validator validator = TestUtil.getValidator();
+		BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
+		Set<String> constraintProperties = beanDescriptor.getConstrainedProperties();
+		assertEquals( "There should be only one property", 1, constraintProperties.size() );
+		assertTrue( "Wrong property", constraintProperties.contains( "orderNumber" ) );
+
+		try {
+			constraintProperties.add( "foobar" );
+			fail( "Set should be immutable" );
+		}
+		catch ( UnsupportedOperationException e ) {
+
+		}
+
+		try {
+			constraintProperties.remove( "orderNumber" );
+			fail( "Set should be immutable" );
+		}
+		catch ( UnsupportedOperationException e ) {
+
+		}
+	}
+
+	/**
+	 * HV-95
+	 */
+	@Test
+	public void testElementDescriptorImmutable() {
+		Validator validator = TestUtil.getValidator();
+		ElementDescriptor elementDescriptor = validator.getConstraintsForClass( Order.class )
+				.getConstraintsForProperty( "orderNumber" );
+		Set<ConstraintDescriptor<?>> constraintDescriptors = elementDescriptor.getConstraintDescriptors();
+		assertTrue( "There should be a ConstraintDescriptor", constraintDescriptors.size() == 1 );
+		ConstraintDescriptor<?> descriptor = constraintDescriptors.iterator().next();
+
+		try {
+			constraintDescriptors.add( descriptor );
+			fail( "Set should be immutable" );
+		}
+		catch ( UnsupportedOperationException e ) {
+
+		}
+
+		try {
+			constraintDescriptors.remove( descriptor );
+			fail( "Set should be immutable" );
+		}
+		catch ( UnsupportedOperationException e ) {
+
+		}
+	}
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/BeanDescriptorImplTest.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/Customer.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,70 @@
+// $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.engine.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.validation.Valid;
+
+import org.hibernate.validation.engine.Person;
+import org.hibernate.validation.engine.Order;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Customer implements Person {
+
+	private String firstName;
+	private String middleName;
+	private String lastName;
+
+	@Valid
+	private List<Order> orderList = new ArrayList<Order>();
+
+	public void addOrder(Order order) {
+		orderList.add( order );
+	}
+
+	public List<Order> getOrderList() {
+		return orderList;
+	}
+
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+
+	public String getMiddleName() {
+		return middleName;
+	}
+
+	public void setMiddleName(String middleName) {
+		this.middleName = middleName;
+	}
+
+	public String getLastName() {
+		return lastName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/Customer.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/UnconstraintEntity.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/UnconstraintEntity.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/UnconstraintEntity.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/UnconstraintEntity.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -0,0 +1,26 @@
+// : Person.java 69 2008-09-08 11:05:07Z hardy.ferentschik $
+/*
+* 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.engine.metadata;
+
+/**
+ * Empty un-constraint test class.
+ *
+ * @author Hardy Ferentschik
+ */
+public class UnconstraintEntity {
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/metadata/UnconstraintEntity.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/MultipleMinMax.java (from rev 16153, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/eg/MultipleMinMax.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/MultipleMinMax.java	                        (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/MultipleMinMax.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -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.engine.validatorresolution;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class MultipleMinMax {
+	@Min(10l)
+	@Max(20l)
+	Number number;
+
+	@Min(10l)
+	@Max(20l)
+	String stringNumber;
+
+	public MultipleMinMax(String stringNumber, Number number) {
+		this.stringNumber = stringNumber;
+		this.number = number;
+	}
+}


Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/MultipleMinMax.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/validatorresolution/ValidatorResolutionTest.java	2009-03-13 09:46:38 UTC (rev 16156)
@@ -29,7 +29,7 @@
 import static org.junit.Assert.fail;
 import org.junit.Test;
 
-import org.hibernate.validation.eg.MultipleMinMax;
+import org.hibernate.validation.engine.validatorresolution.MultipleMinMax;
 import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;
 import static org.hibernate.validation.util.TestUtil.assertNumberOfViolations;
 import static org.hibernate.validation.util.TestUtil.getValidator;

Modified: validator/trunk/hibernate-validator/src/test/resources/log4j.properties
===================================================================
--- validator/trunk/hibernate-validator/src/test/resources/log4j.properties	2009-03-13 09:27:14 UTC (rev 16155)
+++ validator/trunk/hibernate-validator/src/test/resources/log4j.properties	2009-03-13 09:46:38 UTC (rev 16156)
@@ -18,7 +18,7 @@
 
 
 ### set log levels - for more verbose logging change 'info' to 'debug' ###
-log4j.rootLogger=debug, stdout
+log4j.rootLogger=debug, stdout, socket
 
 log4j.logger.org.hibernate.validation.engine.ValidatorImpl=trace
 log4j.logger.org.hibernate.validation.engine.ConstraintTree=trace




More information about the hibernate-commits mailing list