Hibernate SVN: r16814 - core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-17 05:09:25 -0400 (Wed, 17 Jun 2009)
New Revision: 16814
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java
Log:
Updated the imports since the XYZDescitpor classes have moved into the metadata package.
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java 2009-06-17 08:42:08 UTC (rev 16813)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java 2009-06-17 09:09:25 UTC (rev 16814)
@@ -9,9 +9,9 @@
import java.util.Set;
import java.util.StringTokenizer;
import java.util.Collection;
-import javax.validation.BeanDescriptor;
-import javax.validation.ConstraintDescriptor;
-import javax.validation.PropertyDescriptor;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.PropertyDescriptor;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import javax.validation.constraints.Digits;
15 years, 5 months
Hibernate SVN: r16813 - validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-17 04:42:08 -0400 (Wed, 17 Jun 2009)
New Revision: 16813
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java
Log:
Reverted some changes. Cache should not be static
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java 2009-06-16 20:12:49 UTC (rev 16812)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/ConstraintHelper.java 2009-06-17 08:42:08 UTC (rev 16813)
@@ -82,10 +82,13 @@
*/
public class ConstraintHelper {
- private final static Map<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<?, ?>>>> builtinConstraints =
+ private final Map<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<?, ?>>>> builtinConstraints =
new ConcurrentHashMap<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<?, ?>>>>();
- static {
+ private final Map<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>>> constraintValidatorDefinitons =
+ new ConcurrentHashMap<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>>>();
+
+ public ConstraintHelper() {
List<Class<? extends ConstraintValidator<?, ?>>> constraintList =
new ArrayList<Class<? extends ConstraintValidator<?, ?>>>();
constraintList.add( AssertFalseValidator.class );
@@ -157,9 +160,6 @@
builtinConstraints.put( Size.class, constraintList );
}
- private final Map<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>>> constraintValidatorDefinitons =
- new ConcurrentHashMap<Class<? extends Annotation>, List<Class<? extends ConstraintValidator<? extends Annotation, ?>>>>();
-
public List<Class<? extends ConstraintValidator<? extends Annotation, ?>>> getBuiltInConstraints(Class<? extends Annotation> annotationType) {
final List<Class<? extends ConstraintValidator<?, ?>>> builtInList = getBuiltInFromAnnotationType(
annotationType
15 years, 5 months
Hibernate SVN: r16812 - in validator/trunk/hibernate-validator/src/test: java/org/hibernate/validation/constraints/impl and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-16 16:12:49 -0400 (Tue, 16 Jun 2009)
New Revision: 16812
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/DateHolder.java
Removed:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/DateHolder.java
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java
validator/trunk/hibernate-validator/src/test/suite/unit-tests.xml
Log:
some cleanup
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/DateHolder.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/DateHolder.java 2009-06-16 20:07:56 UTC (rev 16811)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/DateHolder.java 2009-06-16 20:12:49 UTC (rev 16812)
@@ -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.constraints;
-
-import java.util.Calendar;
-import java.util.Date;
-import javax.validation.constraints.Past;
-import javax.validation.constraints.Future;
-
-/**
- * @author Hardy Ferentschik
- */
-public class DateHolder {
-
- @Past
- private Calendar calendarWithPastDate;
-
- @Future
- private Calendar calendarWithFutureDate;
-
- @Past
- private Date past;
-
- @Past
- private Date future;
-
- public DateHolder() {
- calendarWithPastDate = Calendar.getInstance();
- calendarWithPastDate.add( Calendar.YEAR, -1 );
- past = calendarWithPastDate.getTime();
-
- calendarWithFutureDate = Calendar.getInstance();
- calendarWithFutureDate.add( Calendar.YEAR, 1 );
- future = calendarWithFutureDate.getTime();
- }
-
- public Calendar getCalendarWithPastDate() {
- return calendarWithPastDate;
- }
-
- public Calendar getCalendarWithFutureDate() {
- return calendarWithFutureDate;
- }
-
- public Date getPast() {
- return past;
- }
-
- public Date getFuture() {
- return future;
- }
-}
Copied: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/DateHolder.java (from rev 16790, validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/DateHolder.java)
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/DateHolder.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/DateHolder.java 2009-06-16 20:12:49 UTC (rev 16812)
@@ -0,0 +1,67 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validation.constraints.impl;
+
+import java.util.Calendar;
+import java.util.Date;
+import javax.validation.constraints.Future;
+import javax.validation.constraints.Past;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DateHolder {
+
+ @Past
+ private Calendar calendarWithPastDate;
+
+ @Future
+ private Calendar calendarWithFutureDate;
+
+ @Past
+ private Date past;
+
+ @Past
+ private Date future;
+
+ public DateHolder() {
+ calendarWithPastDate = Calendar.getInstance();
+ calendarWithPastDate.add( Calendar.YEAR, -1 );
+ past = calendarWithPastDate.getTime();
+
+ calendarWithFutureDate = Calendar.getInstance();
+ calendarWithFutureDate.add( Calendar.YEAR, 1 );
+ future = calendarWithFutureDate.getTime();
+ }
+
+ public Calendar getCalendarWithPastDate() {
+ return calendarWithPastDate;
+ }
+
+ public Calendar getCalendarWithFutureDate() {
+ return calendarWithFutureDate;
+ }
+
+ public Date getPast() {
+ return past;
+ }
+
+ public Date getFuture() {
+ return future;
+ }
+}
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java 2009-06-16 20:07:56 UTC (rev 16811)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java 2009-06-16 20:12:49 UTC (rev 16812)
@@ -24,7 +24,6 @@
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
-import org.hibernate.validation.constraints.DateHolder;
import org.hibernate.validation.util.TestUtil;
/**
Modified: validator/trunk/hibernate-validator/src/test/suite/unit-tests.xml
===================================================================
--- validator/trunk/hibernate-validator/src/test/suite/unit-tests.xml 2009-06-16 20:07:56 UTC (rev 16811)
+++ validator/trunk/hibernate-validator/src/test/suite/unit-tests.xml 2009-06-16 20:12:49 UTC (rev 16812)
@@ -5,15 +5,9 @@
<packages>
<package name="org.hibernate.validation.bootstrap"/>
<package name="org.hibernate.validation.constraints.impl"/>
- <package name="org.hibernate.validation.constraints.custom"/>
<package name="org.hibernate.validation.engine"/>
- <package name="org.hibernate.validation.engine.constraintcomposition"/>
- <package name="org.hibernate.validation.engine.graphnavigation"/>
<package name="org.hibernate.validation.engine.groups"/>
- <package name="org.hibernate.validation.metadata"/>
- <package name="org.hibernate.validation.engine.inheritance"/>
- <package name="org.hibernate.validation.engine.resolver"/>
- <package name="org.hibernate.validation.xml"/>
+ <package name="org.hibernate.validation.engine.traversableresolver"/>
<package name="org.hibernate.validation.util"/>
<package name="org.hibernate.validation.util.annotationfactory"/>
</packages>
15 years, 5 months
Hibernate SVN: r16811 - validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-16 16:07:56 -0400 (Tue, 16 Jun 2009)
New Revision: 16811
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Customer.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Order.java
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java
Log:
Added missing test entities
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Customer.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Customer.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Customer.java 2009-06-16 20:07:56 UTC (rev 16811)
@@ -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.bootstrap;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.Valid;
+
+import org.hibernate.validation.constraints.NotEmpty;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Customer {
+ @NotEmpty
+ private String firstName;
+ private String middleName;
+ @NotEmpty
+ private String lastName;
+
+ @Valid
+ private Set<Order> orders = new HashSet<Order>();
+
+ public void addOrder(Order order) {
+ orders.add( order );
+ }
+
+ public Set<Order> getOrders() {
+ return orders;
+ }
+
+ 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;
+ }
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Customer.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Order.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Order.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Order.java 2009-06-16 20:07:56 UTC (rev 16811)
@@ -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.bootstrap;
+
+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;
+ }
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/Order.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
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-06-16 20:04:55 UTC (rev 16810)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/bootstrap/ValidationTest.java 2009-06-16 20:07:56 UTC (rev 16811)
@@ -37,7 +37,6 @@
import org.hibernate.validation.engine.ConstraintValidatorFactoryImpl;
import org.hibernate.validation.engine.HibernateValidatorConfiguration;
import org.hibernate.validation.engine.ValidatorFactoryImpl;
-import org.hibernate.validation.engine.Customer;
import org.hibernate.validation.HibernateValidationProvider;
/**
15 years, 5 months
Hibernate SVN: r16810 - validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-16 16:04:55 -0400 (Tue, 16 Jun 2009)
New Revision: 16810
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/First.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Last.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Second.java
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java
Log:
Added missing group interfaced for group chain generator tests
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/First.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/First.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/First.java 2009-06-16 20:04:55 UTC (rev 16810)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.engine.groups;
+
+/**
+ * Group executed first in the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface First {
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/First.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
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-06-16 20:02:14 UTC (rev 16809)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/GroupChainGeneratorTest.java 2009-06-16 20:04:55 UTC (rev 16810)
@@ -28,10 +28,6 @@
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-import org.hibernate.validation.engine.First;
-import org.hibernate.validation.engine.Last;
-import org.hibernate.validation.engine.Second;
-
/**
* @author Hardy Ferentschik
*/
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Last.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Last.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Last.java 2009-06-16 20:04:55 UTC (rev 16810)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.engine.groups;
+
+/**
+ * Group executed Last in the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface Last {
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Last.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Second.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Second.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Second.java 2009-06-16 20:04:55 UTC (rev 16810)
@@ -0,0 +1,9 @@
+package org.hibernate.validation.engine.groups;
+
+/**
+ * Group executed second during the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface Second {
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/groups/Second.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
15 years, 5 months
Hibernate SVN: r16809 - validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-16 16:02:14 -0400 (Tue, 16 Jun 2009)
New Revision: 16809
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java
Log:
made sure all java files have svn:keywords set to Id
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java 2009-06-16 20:01:43 UTC (rev 16808)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java 2009-06-16 20:02:14 UTC (rev 16809)
@@ -1,4 +1,4 @@
-// $Id: FutureValidatorTest.java 16528 2009-05-11 12:18:22Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/impl/FutureValidatorTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
15 years, 5 months
Hibernate SVN: r16808 - in beanvalidation/trunk: validation-api/src/main/java/javax/validation/constraints and 6 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-16 16:01:43 -0400 (Tue, 16 Jun 2009)
New Revision: 16808
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintPayload.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/bootstrap/validationxml/ValidationXmlBootstrapTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/Address.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchAddress.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanAddress.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValidList.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/Person.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Account.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountValidator.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/BeanDescriptorTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Customer.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ElementDescriptorTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/PropertyDescriptorTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/UnconstraintEntity.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/StandaloneContainersImpl.java
Log:
made sure all java files have svn:keywords set to Id
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Configuration.java 16026 2009-02-24 20:02:35Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDeclarationException.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Configuration.java 16026 2009-02-24 20:02:35Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDefinitionException.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintPayload.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Configuration.java 16026 2009-02-24 20:02:35Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintViolationException.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Configuration.java 16026 2009-02-24 20:02:35Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-api/src/main/java/javax/validation/GroupDefinitionException.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Max.java 16152 2009-03-12 21:33:48Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/DecimalMin.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java
===================================================================
--- beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Past.java 16368 2009-04-21 09:51:00Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-api/src/main/java/javax/validation/constraints/Pattern.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/bootstrap/validationxml/ValidationXmlBootstrapTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/Address.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/Address.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/Address.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Address.java 16156 2009-03-13 09:46:38Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/Address.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionTest.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionTest.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: ConstraintCompositionTest.java 16249 2009-04-02 12:10:40Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchAddress.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchAddress.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchAddress.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: FrenchAddress.java 16156 2009-03-13 09:46:38Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchAddress.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: FrenchZipcode.java 16264 2009-04-06 15:10:53Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcode.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: FrenchZipcodeConstraintValidator.java 15829 2009-01-29 05:20:27Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/FrenchZipcodeConstraintValidator.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanAddress.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanAddress.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanAddress.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: GermanAddress.java 16156 2009-03-13 09:46:38Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanAddress.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: GermanZipcode.java 15875 2009-02-03 23:25:10Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/GermanZipcode.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: ValidProperty.java 16691 2009-06-04 09:18:14Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValid.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/AlwaysValidList.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsTest.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsTest.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: InvalidConstraintDefinitionsTest.java 16693 2009-06-04 10:59:42Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/Person.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Account.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Account.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Account.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Account.java 16264 2009-04-06 15:10:53Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Account.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: AccountChecker.java 16264 2009-04-06 15:10:53Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountChecker.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountValidator.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountValidator.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountValidator.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: AccountValidator.java 16264 2009-04-06 15:10:53Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/AccountValidator.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/BeanDescriptorTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/BeanDescriptorTest.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/BeanDescriptorTest.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: BeanDescriptorTest.java 16264 2009-04-06 15:10:53Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/BeanDescriptorTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: ConstraintDescriptorTest.java 16748 2009-06-10 18:41:22Z epbernard $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ConstraintDescriptorTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Customer.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Customer.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Customer.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: Customer.java 16264 2009-04-06 15:10:53Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/Customer.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ElementDescriptorTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ElementDescriptorTest.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ElementDescriptorTest.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: ElementDescriptorTest.java 16264 2009-04-06 15:10:53Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/ElementDescriptorTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/PropertyDescriptorTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/PropertyDescriptorTest.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/PropertyDescriptorTest.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -1,4 +1,4 @@
-// $Id: PropertyDescriptorTest.java 16264 2009-04-06 15:10:53Z hardy.ferentschik $
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2008, Red Hat Middleware LLC, and individual contributors
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/PropertyDescriptorTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/metadata/UnconstraintEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java 2009-06-16 19:59:10 UTC (rev 16807)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java 2009-06-16 20:01:43 UTC (rev 16808)
@@ -18,15 +18,18 @@
package org.hibernate.jsr303.tck.tests.validation;
import java.util.Set;
-import javax.validation.metadata.BeanDescriptor;
-import javax.validation.metadata.ConstraintDescriptor;
import javax.validation.ConstraintViolation;
-import javax.validation.metadata.PropertyDescriptor;
import javax.validation.ValidationException;
import javax.validation.Validator;
import javax.validation.groups.Default;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.PropertyDescriptor;
-
+import org.jboss.testharness.AbstractTest;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ArtifactType;
+import org.jboss.testharness.impl.packaging.Classes;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
@@ -39,7 +42,9 @@
*
* @author Hardy Ferentschik
*/
-public class ValidatorImplTest {
+@Artifact(artifactType = ArtifactType.JSR303)
+(a)Classes(TestUtil.class)
+public class ValidatorImplTest extends AbstractTest {
@Test
@@ -378,7 +383,7 @@
Order order = new Order();
customer.addOrder( order );
- Set<ConstraintViolation<Person>> constraintViolations = validator.validate( (Person) customer );
+ Set<ConstraintViolation<Person>> constraintViolations = validator.validate( ( Person ) customer );
assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
TestUtil.assertConstraintViolation(
@@ -390,7 +395,7 @@
order.setOrderNumber( 123 );
- constraintViolations = validator.validate( (Person) customer );
+ constraintViolations = validator.validate( ( Person ) customer );
assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
}
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/StandaloneContainersImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id
15 years, 5 months
Hibernate SVN: r16807 - in beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck: tests/validation/traversableresolver and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-16 15:59:10 -0400 (Tue, 16 Jun 2009)
New Revision: 16807
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Actor.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Address.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Boy.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Customer.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Engine.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/First.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Last.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Order.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Person.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Second.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/messageinterpolation/
Removed:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java
Log:
Added basic validation tests
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Actor.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Actor.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Actor.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -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.jsr303.tck.tests.validation;
+
+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: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Actor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Address.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Address.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Address.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -0,0 +1,72 @@
+// $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.jsr303.tck.tests.validation;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Address {
+ @NotNull
+ @Size(max = 30)
+ private String addressline1;
+
+ @NotNull
+ @Size(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;
+ }
+
+ @Size(max = 30)
+ @NotNull
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Address.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Boy.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Boy.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Boy.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -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.jsr303.tck.tests.validation;
+
+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: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Boy.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Customer.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Customer.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Customer.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -0,0 +1,67 @@
+// $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.jsr303.tck.tests.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.Valid;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Customer implements Person {
+
+ private String firstName;
+ private String middleName;
+ private String lastName;
+
+ @Valid
+ private Set<Order> orders = new HashSet<Order>();
+
+ public void addOrder(Order order) {
+ orders.add( order );
+ }
+
+ public Set<Order> getOrders() {
+ return orders;
+ }
+
+ 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;
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Customer.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Engine.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Engine.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Engine.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -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.jsr303.tck.tests.validation;
+
+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;
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Engine.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/First.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/First.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/First.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -0,0 +1,9 @@
+package org.hibernate.jsr303.tck.tests.validation;
+
+/**
+ * Group executed first in the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface First {
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/First.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Last.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Last.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Last.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -0,0 +1,9 @@
+package org.hibernate.jsr303.tck.tests.validation;
+
+/**
+ * Group executed Last in the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface Last {
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Last.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Order.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Order.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Order.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -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.jsr303.tck.tests.validation;
+
+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;
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Order.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Person.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Person.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Person.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -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.jsr303.tck.tests.validation;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface Person {
+ @NotNull
+ String getFirstName();
+
+ String getMiddleName();
+
+ @NotNull
+ String getLastName();
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Person.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Second.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Second.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Second.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -0,0 +1,9 @@
+package org.hibernate.jsr303.tck.tests.validation;
+
+/**
+ * Group executed second during the validation
+ *
+ * @author Emmanuel Bernard
+ */
+public interface Second {
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/Second.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -0,0 +1,437 @@
+// $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.jsr303.tck.tests.validation;
+
+import java.util.Set;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.ConstraintViolation;
+import javax.validation.metadata.PropertyDescriptor;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.groups.Default;
+
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+import org.hibernate.jsr303.tck.util.TestUtil;
+
+/**
+ * Tests for the implementation of <code>Validator</code>.
+ *
+ * @author Hardy Ferentschik
+ */
+public class ValidatorImplTest {
+
+
+ @Test
+ public void testWrongMethodName() {
+ try {
+ Boy boy = new Boy();
+ TestUtil.getDefaultValidator().validate( boy );
+ fail();
+ }
+ catch ( ValidationException e ) {
+ assertEquals(
+ "Annotated methods must follow the JavaBeans naming convention. age() does not.",
+ e.getMessage(),
+ "Wrong error message"
+ );
+ }
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testNullParamterToValidatorImplConstructor() {
+ TestUtil.getDefaultValidator().getConstraintsForClass( null );
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void testValidateWithNull() {
+ Validator validator = TestUtil.getDefaultValidator();
+ validator.validate( null );
+ }
+
+ @Test
+ @SuppressWarnings("NullArgumentToVariableArgMethod")
+ public void testPassingNullAsGroup() {
+ Validator validator = TestUtil.getDefaultValidator();
+ Customer customer = new Customer();
+ try {
+ validator.validate( customer, null );
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+
+ try {
+ validator.validateProperty( customer, "firstName", null );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+
+ try {
+ validator.validateValue( Customer.class, "firstName", "foobar", null );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+ }
+
+ @Test
+ public void testValidateWithNullProperty() {
+ Validator validator = TestUtil.getDefaultValidator();
+ try {
+ validator.validate( null );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+
+ try {
+ validator.validateProperty( null, "firstName" );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+
+ try {
+ validator.validateValue( null, "firstName", "foobar" );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+ }
+
+ @Test
+ public void testBasicValidation() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Customer customer = new Customer();
+ customer.setFirstName( "John" );
+
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+
+ customer.setLastName( "Doe" );
+
+ constraintViolations = validator.validate( customer );
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
+ }
+
+ @Test
+ public void testMultipleValidationMethods() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Address address = new Address();
+ address.setAddressline1( null );
+ address.setAddressline2( null );
+ address.setCity( "Llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch" ); //town in North Wales
+
+ Set<ConstraintViolation<Address>> constraintViolations = validator.validate( address );
+ assertEquals(
+ constraintViolations.size(),
+ 3,
+ "we should have been 2 not null violation for addresslines and one length violation for city"
+ );
+
+ constraintViolations = validator.validateProperty( address, "city" );
+ assertEquals(
+ constraintViolations.size(),
+ 1,
+ "only city should be validated"
+ );
+
+ constraintViolations = validator.validateProperty( address, "city" );
+ assertEquals(
+ constraintViolations.size(),
+ 1,
+ "only city should be validated"
+ );
+
+ constraintViolations = validator.validateValue( Address.class, "city", "Paris" );
+ assertEquals(
+ constraintViolations.size(),
+ 0,
+ "Paris should be a valid city name."
+ );
+ }
+
+ @Test
+ public void testValidateSet() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Customer customer = new Customer();
+ customer.setFirstName( "John" );
+ customer.setLastName( "Doe" );
+
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
+
+ Order order = new Order();
+ customer.addOrder( order );
+
+ constraintViolations = validator.validate( customer );
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+ assertEquals( "may not be null", constraintViolation.getMessage(), "Wrong message" );
+ org.testng.Assert.assertEquals( constraintViolation.getRootBean(), customer, "Wrong root entity" );
+ org.testng.Assert.assertEquals( constraintViolation.getInvalidValue(), order.getOrderNumber(), "Wrong value" );
+ assertEquals( "orders[].orderNumber", constraintViolation.getPropertyPath(), "Wrong propertyName" );
+ }
+
+ @Test
+ public void testMultiValueConstraint() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Engine engine = new Engine();
+ engine.setSerialNumber( "mail(a)foobar.com" );
+ Set<ConstraintViolation<Engine>> constraintViolations = validator.validate( engine );
+ assertEquals( constraintViolations.size(), 2, "Wrong number of constraints" );
+
+ engine.setSerialNumber( "ABCDEFGH1234" );
+ constraintViolations = validator.validate( engine );
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+
+ engine.setSerialNumber( "ABCD-EFGH-1234" );
+ constraintViolations = validator.validate( engine );
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
+ }
+
+ @Test
+ public void testGraphValidation() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Actor clint = new Actor( "Clint", "Eastwood" );
+ Actor morgan = new Actor( "Morgan", null );
+ Actor charlie = new Actor( "Charlie", "Sheen" );
+
+ clint.addPlayedWith( charlie );
+ charlie.addPlayedWith( clint );
+ charlie.addPlayedWith( morgan );
+ morgan.addPlayedWith( charlie );
+ morgan.addPlayedWith( clint );
+ clint.addPlayedWith( morgan );
+
+
+ Set<ConstraintViolation<Actor>> constraintViolations = validator.validate( clint );
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( "may not be null", constraintViolation.getMessage(), "Wrong message" );
+ org.testng.Assert.assertEquals( constraintViolation.getRootBean(), clint, "Wrong root entity" );
+ org.testng.Assert.assertEquals( constraintViolation.getInvalidValue(), morgan.getLastName(), "Wrong value" );
+ assertEquals(
+ constraintViolation.getPropertyPath(), "playedWith[0].playedWith[1].lastName", "Wrong propertyName"
+ );
+ }
+
+ @Test
+ public void testValidateValue() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validateValue(
+ Customer.class, "orders[0].orderNumber", null
+ );
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+ assertEquals( "may not be null", constraintViolation.getMessage(), "Wrong message" );
+ assertEquals( constraintViolation.getRootBean(), null, "Wrong root entity" );
+ assertEquals( constraintViolation.getRootBeanClass(), Customer.class, "Wrong root bean class" );
+ assertEquals( constraintViolation.getInvalidValue(), null, "Wrong value" );
+ assertEquals( "orders[0].orderNumber", constraintViolation.getPropertyPath(), "Wrong propertyName" );
+
+ constraintViolations = validator.validateValue( Customer.class, "orders[0].orderNumber", 1234 );
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
+ }
+
+ @Test
+ public void testValidateValueWithInvalidPropertyPath() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ try {
+ validator.validateValue( Customer.class, "", null );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ assertEquals( "Invalid property path.", e.getMessage() );
+ }
+
+ try {
+ validator.validateValue( Customer.class, "foobar", null );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ assertEquals( "Invalid property path.", e.getMessage() );
+ }
+
+ try {
+ validator.validateValue( Customer.class, "orders[0].foobar", null );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ assertEquals( "Invalid property path.", e.getMessage() );
+ }
+ }
+
+ @Test
+ public void testValidateProperty() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Customer customer = new Customer();
+ Order order = new Order();
+ customer.addOrder( order );
+
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validateProperty(
+ customer, "orders[0].orderNumber"
+ );
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+
+ ConstraintViolation constraintViolation = constraintViolations.iterator().next();
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+ assertEquals( "may not be null", constraintViolation.getMessage(), "Wrong message" );
+ org.testng.Assert.assertEquals( constraintViolation.getRootBean(), customer, "Wrong root entity" );
+ org.testng.Assert.assertEquals( constraintViolation.getInvalidValue(), order.getOrderNumber(), "Wrong value" );
+ assertEquals( "orders[0].orderNumber", constraintViolation.getPropertyPath(), "Wrong propertyName" );
+
+ order.setOrderNumber( 1234 );
+ constraintViolations = validator.validateProperty( customer, "orderList[0].orderNumber" );
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
+ }
+
+ @Test
+ public void testValidatePropertyWithInvalidPropertyPath() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Customer customer = new Customer();
+ Order order = new Order();
+ customer.addOrder( order );
+
+ try {
+ validator.validateProperty( customer, "orders[].orderNumber" );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+
+ try {
+ validator.validateProperty( customer, "" );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+
+ try {
+ validator.validateProperty( customer, "foobar" );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+
+ try {
+ validator.validateProperty( customer, "orders[].foobar" );
+ fail();
+ }
+ catch ( IllegalArgumentException e ) {
+ // success
+ }
+ }
+
+ /**
+ * HV-108
+ */
+ @Test
+ public void testValidationIsPolymorphic() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Customer customer = new Customer();
+ customer.setFirstName( "Foo" );
+ customer.setLastName( "Bar" );
+
+ Order order = new Order();
+ customer.addOrder( order );
+
+ Set<ConstraintViolation<Person>> constraintViolations = validator.validate( (Person) customer );
+ assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
+
+ TestUtil.assertConstraintViolation(
+ constraintViolations.iterator().next(),
+ Customer.class,
+ null,
+ "orders[].orderNumber"
+ );
+
+ order.setOrderNumber( 123 );
+
+ constraintViolations = validator.validate( (Person) customer );
+ assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
+ }
+
+ @Test
+ public void testObjectTraversion() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ Customer customer = new Customer();
+ customer.setFirstName( "John" );
+ customer.setLastName( "Doe" );
+
+ for ( int i = 0; i < 100; i++ ) {
+ Order order = new Order();
+ customer.addOrder( order );
+ }
+
+ Set<ConstraintViolation<Customer>> constraintViolations = validator.validate(
+ customer, Default.class, First.class, Second.class, Last.class
+ );
+ assertEquals( constraintViolations.size(), 100, "Wrong number of constraints" );
+ }
+
+ /**
+ * HV-120
+ */
+ @Test
+ public void testConstraintDescriptorWithoutExplicitGroup() {
+ Validator validator = TestUtil.getDefaultValidator();
+
+ BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
+ PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty( "orderNumber" );
+ Set<ConstraintDescriptor<?>> descriptors = propertyDescriptor.getConstraintDescriptors();
+
+ assertEquals( descriptors.size(), 1, "There should be only one constraint descriptor" );
+ ConstraintDescriptor<?> descriptor = descriptors.iterator().next();
+ Set<Class<?>> groups = descriptor.getGroups();
+ assertTrue( groups.size() == 1, "There should be only one group" );
+ assertEquals(
+ groups.iterator().next(),
+ Default.class,
+ "The declared constraint does not explicitly define a group, hence Default is expected"
+ );
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/ValidatorImplTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java 2009-06-16 19:58:17 UTC (rev 16806)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -1,137 +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.jsr303.tck.tests.validation.traversableresolver;
-
-import java.lang.annotation.ElementType;
-import java.util.HashSet;
-import java.util.Set;
-import javax.validation.Configuration;
-import javax.validation.TraversableResolver;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-import javax.validation.groups.Default;
-
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-/**
- * @author Emmanuel Bernard
- */
-//this test is specific to Hibernate Validator
-public class CachedTraversableResolverTest {
- @Test
- public void testCache() {
- TraversableResolver resolver = new AskOnceTR();
- Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider()
- .configure()
- .traversableResolver( resolver );
- ValidatorFactory factory = config.buildValidatorFactory();
- Suit suit = new Suit();
- suit.setTrousers( new Trousers() );
- suit.setJacket( new Jacket() );
- suit.setSize( 3333 );
- suit.getTrousers().setLength( 32321 );
- suit.getJacket().setWidth( 432432 );
- Validator v = factory.getValidator();
- try {
- v.validate( suit, Default.class, Cloth.class );
- }
- catch ( IllegalStateException e ) {
- fail( "Traversable Called several times for a given object" );
- }
-
- v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
- try {
- v.validateProperty( suit, "size", Default.class, Cloth.class );
- }
- catch ( IllegalStateException e ) {
- fail( "Traversable Called several times for a given object" );
- }
-
- v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
- try {
- v.validateValue( Suit.class, "size", 2, Default.class, Cloth.class );
- }
- catch ( IllegalStateException e ) {
- fail( "Traversable Called several times for a given object" );
- }
- }
-
- private static class AskOnceTR implements TraversableResolver {
- private Set<Holder> askedReach = new HashSet<Holder>();
- private Set<Holder> askedCascade = new HashSet<Holder>();
-
- private boolean isTraversable(Set<Holder> asked, Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
- Holder h = new Holder( traversableObject, traversableProperty );
- if ( asked.contains( h ) ) {
- throw new IllegalStateException( "Called twice" );
- }
- asked.add( h );
- return true;
- }
-
- public boolean isReachable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
- return isTraversable(
- askedReach,
- traversableObject,
- traversableProperty,
- rootBeanType,
- pathToTraversableObject,
- elementType
- );
- }
-
- public boolean isCascadable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
- return isTraversable(
- askedCascade,
- traversableObject,
- traversableProperty,
- rootBeanType,
- pathToTraversableObject,
- elementType
- );
- }
-
- public static class Holder {
- Object NULL = new Object();
- Object to;
- String tp;
-
- public Holder(Object traversableObject, String traversableProperty) {
- to = traversableObject == null ? NULL : traversableObject;
- tp = traversableProperty;
- }
-
- @Override
- public int hashCode() {
- return to.hashCode() + tp.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if ( !( obj instanceof Holder ) ) {
- return false;
- }
- Holder that = ( Holder ) obj;
-
- return to != NULL && to == that.to && tp.equals( that.tp );
- }
- }
- }
-}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java 2009-06-16 19:58:17 UTC (rev 16806)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -25,11 +25,19 @@
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ArtifactType;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.AbstractTest;
+import org.hibernate.jsr303.tck.util.TestUtil;
+
/**
* @author Emmanuel Bernard
*/
-public class TraversableResolverTest {
+@Artifact(artifactType = ArtifactType.JSR303)
+(a)Classes(TestUtil.class)
+public class TraversableResolverTest extends AbstractTest {
@Test
public void testCorrectPathsAreRequested() {
Suit suit = new Suit();
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java 2009-06-16 19:58:17 UTC (rev 16806)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/util/TestUtil.java 2009-06-16 19:59:10 UTC (rev 16807)
@@ -93,7 +93,7 @@
}
}
- public static <T> void assertConstraintViolation(ConstraintViolation<T> violation, Class<T> rootBean, Object invalidValue, String propertyPath) {
+ public static <T> void assertConstraintViolation(ConstraintViolation<T> violation, Class<?> rootBean, Object invalidValue, String propertyPath) {
assertEquals(
violation.getPropertyPath(),
propertyPath,
15 years, 5 months
Hibernate SVN: r16806 - in validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine: traversableresolver and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-16 15:58:17 -0400 (Tue, 16 Jun 2009)
New Revision: 16806
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/CachedTraversableResolverTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Cloth.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Jacket.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Suit.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Trousers.java
Removed:
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/Customer.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/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/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/ValidatorImplTest.java
Log:
moved basic validation tests into the TCK
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Actor.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Actor.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Actor.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -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.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
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Address.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Address.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Address.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -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.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;
- }
-}
-
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/All.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.engine;
-
-/**
- * Groups including all validations
- *
- * @author Emmanuel Bernard
- */
-public interface All {
-}
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Boy.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Boy.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Boy.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -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.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
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Customer.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Customer.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Customer.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -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.engine;
-
-import java.util.HashSet;
-import java.util.Set;
-import javax.validation.Valid;
-
-/**
- * @author Hardy Ferentschik
- */
-public class Customer implements Person {
-
- private String firstName;
- private String middleName;
- private String lastName;
-
- @Valid
- private Set<Order> orders = new HashSet<Order>();
-
- public void addOrder(Order order) {
- orders.add( order );
- }
-
- public Set<Order> getOrders() {
- return orders;
- }
-
- 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;
- }
-}
\ No newline at end of file
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/DefaultAlias.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/DefaultAlias.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/DefaultAlias.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -1,7 +0,0 @@
-package org.hibernate.validation.engine;
-
-/**
- * @author Emmanuel Bernard
- */
-public interface DefaultAlias {
-}
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/First.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.engine;
-
-/**
- * Group executed first in the validation
- *
- * @author Emmanuel Bernard
- */
-public interface First {
-}
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Last.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.engine;
-
-/**
- * Group executed Last in the validation
- *
- * @author Emmanuel Bernard
- */
-public interface Last {
-}
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Person.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Person.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Person.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -1,33 +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 org.hibernate.validation.constraints.NotEmpty;
-
-/**
- * @author Hardy Ferentschik
- */
-public interface Person {
- @NotEmpty
- String getFirstName();
-
- String getMiddleName();
-
- @NotEmpty
- String getLastName();
-}
Deleted: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java 2009-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/Second.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -1,9 +0,0 @@
-package org.hibernate.validation.engine;
-
-/**
- * Group executed second during the validation
- *
- * @author Emmanuel Bernard
- */
-public interface Second {
-}
Deleted: 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-06-16 19:33:09 UTC (rev 16805)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/ValidatorImplTest.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -1,444 +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.metadata.BeanDescriptor;
-import javax.validation.metadata.ConstraintDescriptor;
-import javax.validation.ConstraintViolation;
-import javax.validation.metadata.PropertyDescriptor;
-import javax.validation.ValidationException;
-import javax.validation.Validator;
-import javax.validation.groups.Default;
-
-import org.slf4j.Logger;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import org.testng.annotations.Test;
-
-import org.hibernate.validation.util.LoggerFactory;
-import org.hibernate.validation.util.TestUtil;
-import static org.hibernate.validation.util.TestUtil.assertConstraintViolation;
-
-/**
- * Tests for the implementation of <code>Validator</code>.
- *
- * @author Hardy Ferentschik
- */
-public class ValidatorImplTest {
-
- private static final Logger log = LoggerFactory.make();
-
- @Test
- public void testWrongMethodName() {
- try {
- Boy boy = new Boy();
- TestUtil.getValidator().validate( boy );
- fail();
- }
- catch ( ValidationException e ) {
- assertEquals(
- "Annotated methods must follow the JavaBeans naming convention. age() does not.",
- e.getMessage(),
- "Wrong error message"
- );
- }
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testNullParamterToValidatorImplConstructor() {
- TestUtil.getValidator().getConstraintsForClass( null );
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testValidateWithNull() {
- Validator validator = TestUtil.getValidator();
- validator.validate( null );
- }
-
- @Test
- @SuppressWarnings("NullArgumentToVariableArgMethod")
- public void testPassingNullAsGroup() {
- Validator validator = TestUtil.getValidator();
- Customer customer = new Customer();
- try {
- validator.validate( customer, null );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- log.trace( "success" );
- }
-
- try {
- validator.validateProperty( customer, "firstName", null );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- log.trace( "success" );
- }
-
- try {
- validator.validateValue( Customer.class, "firstName", "foobar", null );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- log.trace( "success" );
- }
- }
-
- @Test
- public void testValidateWithNullProperty() {
- Validator validator = TestUtil.getValidator();
- try {
- validator.validate( null );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- log.trace( "success" );
- }
-
- try {
- validator.validateProperty( null, "firstName" );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- log.trace( "success" );
- }
-
- try {
- validator.validateValue( null, "firstName", "foobar" );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- log.trace( "success" );
- }
- }
-
- @Test
- public void testBasicValidation() {
- Validator validator = TestUtil.getValidator();
-
- Customer customer = new Customer();
- customer.setFirstName( "John" );
-
- Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
-
- customer.setLastName( "Doe" );
-
- constraintViolations = validator.validate( customer );
- assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
- }
-
- @Test
- public void testMultipleValidationMethods() {
- Validator validator = TestUtil.getValidator();
-
- Address address = new Address();
- address.setAddressline1( null );
- address.setAddressline2( null );
- address.setCity( "Llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch" ); //town in North Wales
-
- Set<ConstraintViolation<Address>> constraintViolations = validator.validate( address );
- assertEquals(
- constraintViolations.size(),
- 3,
- "we should have been 2 not null violation for addresslines and one length violation for city"
- );
-
- constraintViolations = validator.validateProperty( address, "city" );
- assertEquals(
- constraintViolations.size(),
- 1,
- "only city should be validated"
- );
-
- constraintViolations = validator.validateProperty( address, "city" );
- assertEquals(
- constraintViolations.size(),
- 1,
- "only city should be validated"
- );
-
- constraintViolations = validator.validateValue( Address.class, "city", "Paris" );
- assertEquals(
- constraintViolations.size(),
- 0,
- "Paris should be a valid city name."
- );
- }
-
- @Test
- public void testValidateSet() {
- Validator validator = TestUtil.getValidator();
-
- Customer customer = new Customer();
- customer.setFirstName( "John" );
- customer.setLastName( "Doe" );
-
- Set<ConstraintViolation<Customer>> constraintViolations = validator.validate( customer );
- assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
-
- Order order = new Order();
- customer.addOrder( order );
-
- constraintViolations = validator.validate( customer );
- ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
- assertEquals( "may not be null", constraintViolation.getMessage(), "Wrong message" );
- assertEquals( constraintViolation.getRootBean(), customer, "Wrong root entity" );
- assertEquals( constraintViolation.getInvalidValue(), order.getOrderNumber(), "Wrong value" );
- assertEquals( "orders[].orderNumber", constraintViolation.getPropertyPath(), "Wrong propertyName" );
- }
-
- @Test
- public void testMultiValueConstraint() {
- Validator validator = TestUtil.getValidator();
-
- Engine engine = new Engine();
- engine.setSerialNumber( "mail(a)foobar.com" );
- Set<ConstraintViolation<Engine>> constraintViolations = validator.validate( engine );
- assertEquals( constraintViolations.size(), 2, "Wrong number of constraints" );
-
- engine.setSerialNumber( "ABCDEFGH1234" );
- constraintViolations = validator.validate( engine );
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
-
- engine.setSerialNumber( "ABCD-EFGH-1234" );
- constraintViolations = validator.validate( engine );
- assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
- }
-
- @Test
- public void testGraphValidation() {
- Validator validator = TestUtil.getValidator();
-
- Actor clint = new Actor( "Clint", "Eastwood" );
- Actor morgan = new Actor( "Morgan", "" );
- Actor charlie = new Actor( "Charlie", "Sheen" );
-
- clint.addPlayedWith( charlie );
- charlie.addPlayedWith( clint );
- charlie.addPlayedWith( morgan );
- morgan.addPlayedWith( charlie );
- morgan.addPlayedWith( clint );
- clint.addPlayedWith( morgan );
-
-
- Set<ConstraintViolation<Actor>> constraintViolations = validator.validate( clint );
- ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
- assertEquals( "may not be empty", constraintViolation.getMessage(), "Wrong message" );
- assertEquals( constraintViolation.getRootBean(), clint, "Wrong root entity" );
- assertEquals( constraintViolation.getInvalidValue(), morgan.getLastName(), "Wrong value" );
- assertEquals(
- constraintViolation.getPropertyPath(), "playedWith[0].playedWith[1].lastName", "Wrong propertyName"
- );
- }
-
- @Test
- public void testValidateValue() {
- Validator validator = TestUtil.getValidator();
-
- Set<ConstraintViolation<Customer>> constraintViolations = validator.validateValue(
- Customer.class, "orders[0].orderNumber", null
- );
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
-
- ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
- assertEquals( "may not be null", constraintViolation.getMessage(), "Wrong message" );
- assertEquals( constraintViolation.getRootBean(), null, "Wrong root entity" );
- assertEquals( constraintViolation.getRootBeanClass(), Customer.class, "Wrong root bean class" );
- assertEquals( constraintViolation.getInvalidValue(), null, "Wrong value" );
- assertEquals( "orders[0].orderNumber", constraintViolation.getPropertyPath(), "Wrong propertyName" );
-
- constraintViolations = validator.validateValue( Customer.class, "orders[0].orderNumber", 1234 );
- assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
- }
-
- @Test
- public void testValidateValueWithInvalidPropertyPath() {
- Validator validator = TestUtil.getValidator();
-
- try {
- validator.validateValue( Customer.class, "", null );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- assertEquals( "Invalid property path.", e.getMessage() );
- }
-
- try {
- validator.validateValue( Customer.class, "foobar", null );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- assertEquals( "Invalid property path.", e.getMessage() );
- }
-
- try {
- validator.validateValue( Customer.class, "orders[0].foobar", null );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- assertEquals( "Invalid property path.", e.getMessage() );
- }
- }
-
- @Test
- public void testValidateProperty() {
- Validator validator = TestUtil.getValidator();
-
- Customer customer = new Customer();
- Order order = new Order();
- customer.addOrder( order );
-
- Set<ConstraintViolation<Customer>> constraintViolations = validator.validateProperty(
- customer, "orders[0].orderNumber"
- );
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
-
- ConstraintViolation constraintViolation = constraintViolations.iterator().next();
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
- assertEquals( "may not be null", constraintViolation.getMessage(), "Wrong message" );
- assertEquals( constraintViolation.getRootBean(), customer, "Wrong root entity" );
- assertEquals( constraintViolation.getInvalidValue(), order.getOrderNumber(), "Wrong value" );
- assertEquals( "orders[0].orderNumber", constraintViolation.getPropertyPath(), "Wrong propertyName" );
-
- order.setOrderNumber( 1234 );
- constraintViolations = validator.validateProperty( customer, "orderList[0].orderNumber" );
- assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
- }
-
- @Test
- public void testValidatePropertyWithInvalidPropertyPath() {
- Validator validator = TestUtil.getValidator();
-
- Customer customer = new Customer();
- Order order = new Order();
- customer.addOrder( order );
-
- try {
- validator.validateProperty( customer, "orders[].orderNumber" );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- // success
- }
-
- try {
- validator.validateProperty( customer, "" );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- // success
- }
-
- try {
- validator.validateProperty( customer, "foobar" );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- // success
- }
-
- try {
- validator.validateProperty( customer, "orders[].foobar" );
- fail();
- }
- catch ( IllegalArgumentException e ) {
- // success
- }
- }
-
- /**
- * HV-108
- */
- @Test
- public void testValidationIsPolymorphic() {
- Validator validator = TestUtil.getValidator();
-
- Customer customer = new Customer();
- customer.setFirstName( "Foo" );
- customer.setLastName( "Bar" );
-
- Order order = new Order();
- customer.addOrder( order );
-
- Person person = customer;
-
- Set<ConstraintViolation<Person>> constraintViolations = validator.validate( person );
- assertEquals( constraintViolations.size(), 1, "Wrong number of constraints" );
-
- assertConstraintViolation(
- constraintViolations.iterator().next(),
- "may not be null",
- Customer.class,
- null,
- "orders[].orderNumber"
- );
-
- order.setOrderNumber( 123 );
-
- constraintViolations = validator.validate( person );
- assertEquals( constraintViolations.size(), 0, "Wrong number of constraints" );
- }
-
- @Test
- public void testObjectTraversion() {
- Validator validator = TestUtil.getValidator();
-
- Customer customer = new Customer();
- customer.setFirstName( "John" );
- customer.setLastName( "Doe" );
-
- for ( int i = 0; i < 100; i++ ) {
- Order order = new Order();
- customer.addOrder( order );
- }
-
- Set<ConstraintViolation<Customer>> constraintViolations = validator.validate(
- customer, Default.class, First.class, Second.class, Last.class
- );
- assertEquals( constraintViolations.size(), 100, "Wrong number of constraints" );
- }
-
- /**
- * HV-120
- */
- @Test
- public void testConstraintDescriptorWithoutExplicitGroup() {
- Validator validator = TestUtil.getValidator();
-
- BeanDescriptor beanDescriptor = validator.getConstraintsForClass( Order.class );
- PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty( "orderNumber" );
- Set<ConstraintDescriptor<?>> descriptors = propertyDescriptor.getConstraintDescriptors();
-
- assertEquals( descriptors.size(), 1, "There should be only one constraint descriptor" );
- ConstraintDescriptor<?> descriptor = descriptors.iterator().next();
- Set<Class<?>> groups = descriptor.getGroups();
- assertTrue( groups.size() == 1, "There should be only one group" );
- assertEquals(
- groups.iterator().next(),
- Default.class,
- "The declared constraint does not explicitly define a group, hence Default is expected"
- );
- }
-}
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/CachedTraversableResolverTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/CachedTraversableResolverTest.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/CachedTraversableResolverTest.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -0,0 +1,137 @@
+// $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.traversableresolver;
+
+import java.lang.annotation.ElementType;
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.TraversableResolver;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
+
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * @author Emmanuel Bernard
+ */
+//this test is specific to Hibernate Validator
+public class CachedTraversableResolverTest {
+ @Test
+ public void testCache() {
+ TraversableResolver resolver = new AskOnceTR();
+ Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider()
+ .configure()
+ .traversableResolver( resolver );
+ ValidatorFactory factory = config.buildValidatorFactory();
+ Suit suit = new Suit();
+ suit.setTrousers( new Trousers() );
+ suit.setJacket( new Jacket() );
+ suit.setSize( 3333 );
+ suit.getTrousers().setLength( 32321 );
+ suit.getJacket().setWidth( 432432 );
+ Validator v = factory.getValidator();
+ try {
+ v.validate( suit, Default.class, Cloth.class );
+ }
+ catch ( IllegalStateException e ) {
+ fail( "Traversable Called several times for a given object" );
+ }
+
+ v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
+ try {
+ v.validateProperty( suit, "size", Default.class, Cloth.class );
+ }
+ catch ( IllegalStateException e ) {
+ fail( "Traversable Called several times for a given object" );
+ }
+
+ v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
+ try {
+ v.validateValue( Suit.class, "size", 2, Default.class, Cloth.class );
+ }
+ catch ( IllegalStateException e ) {
+ fail( "Traversable Called several times for a given object" );
+ }
+ }
+
+ private static class AskOnceTR implements TraversableResolver {
+ private Set<Holder> askedReach = new HashSet<Holder>();
+ private Set<Holder> askedCascade = new HashSet<Holder>();
+
+ private boolean isTraversable(Set<Holder> asked, Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ Holder h = new Holder( traversableObject, traversableProperty );
+ if ( asked.contains( h ) ) {
+ throw new IllegalStateException( "Called twice" );
+ }
+ asked.add( h );
+ return true;
+ }
+
+ public boolean isReachable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ return isTraversable(
+ askedReach,
+ traversableObject,
+ traversableProperty,
+ rootBeanType,
+ pathToTraversableObject,
+ elementType
+ );
+ }
+
+ public boolean isCascadable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ return isTraversable(
+ askedCascade,
+ traversableObject,
+ traversableProperty,
+ rootBeanType,
+ pathToTraversableObject,
+ elementType
+ );
+ }
+
+ public static class Holder {
+ Object NULL = new Object();
+ Object to;
+ String tp;
+
+ public Holder(Object traversableObject, String traversableProperty) {
+ to = traversableObject == null ? NULL : traversableObject;
+ tp = traversableProperty;
+ }
+
+ @Override
+ public int hashCode() {
+ return to.hashCode() + tp.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( !( obj instanceof Holder ) ) {
+ return false;
+ }
+ Holder that = ( Holder ) obj;
+
+ return to != NULL && to == that.to && tp.equals( that.tp );
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/CachedTraversableResolverTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Cloth.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Cloth.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Cloth.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -0,0 +1,24 @@
+// $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.traversableresolver;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public interface Cloth {
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Cloth.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Jacket.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Jacket.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Jacket.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -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.traversableresolver;
+
+import javax.validation.constraints.Max;
+
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Jacket {
+ Integer width;
+
+ @Max(30)
+ public Integer getWidth() {
+ return width;
+ }
+
+ public void setWidth(Integer width) {
+ this.width = width;
+ }
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Jacket.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Suit.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Suit.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Suit.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -0,0 +1,61 @@
+// $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.traversableresolver;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.Valid;
+import javax.validation.GroupSequence;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@GroupSequence( {Suit.class, Cloth.class })
+public class Suit {
+ @Max(value=50, groups = { Default.class, Cloth.class})
+ @Min(1)
+ private Integer size;
+ @Valid private Trousers trousers;
+ private Jacket jacket;
+
+ public Trousers getTrousers() {
+ return trousers;
+ }
+
+ public void setTrousers(Trousers trousers) {
+ this.trousers = trousers;
+ }
+
+ @Valid
+ public Jacket getJacket() {
+ return jacket;
+ }
+
+ public void setJacket(Jacket jacket) {
+ this.jacket = jacket;
+ }
+
+ public Integer getSize() {
+ return size;
+ }
+
+ public void setSize(Integer size) {
+ this.size = size;
+ }
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Suit.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Trousers.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Trousers.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Trousers.java 2009-06-16 19:58:17 UTC (rev 16806)
@@ -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.traversableresolver;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Max;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Trousers {
+ @Min(value=70, groups = {Default.class, Cloth.class})
+ @Max(value=220)
+ private Integer length;
+
+ public Integer getLength() {
+ return length;
+ }
+
+ public void setLength(Integer length) {
+ this.length = length;
+ }
+}
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/engine/traversableresolver/Trousers.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
15 years, 5 months
Hibernate SVN: r16805 - in beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation: traversableresolver and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-06-16 15:33:09 -0400 (Tue, 16 Jun 2009)
New Revision: 16805
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java
Log:
Added traversable resolver tests
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java 2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,137 @@
+// $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.jsr303.tck.tests.validation.traversableresolver;
+
+import java.lang.annotation.ElementType;
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.TraversableResolver;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
+
+import static org.testng.Assert.fail;
+import org.testng.annotations.Test;
+
+/**
+ * @author Emmanuel Bernard
+ */
+//this test is specific to Hibernate Validator
+public class CachedTraversableResolverTest {
+ @Test
+ public void testCache() {
+ TraversableResolver resolver = new AskOnceTR();
+ Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider()
+ .configure()
+ .traversableResolver( resolver );
+ ValidatorFactory factory = config.buildValidatorFactory();
+ Suit suit = new Suit();
+ suit.setTrousers( new Trousers() );
+ suit.setJacket( new Jacket() );
+ suit.setSize( 3333 );
+ suit.getTrousers().setLength( 32321 );
+ suit.getJacket().setWidth( 432432 );
+ Validator v = factory.getValidator();
+ try {
+ v.validate( suit, Default.class, Cloth.class );
+ }
+ catch ( IllegalStateException e ) {
+ fail( "Traversable Called several times for a given object" );
+ }
+
+ v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
+ try {
+ v.validateProperty( suit, "size", Default.class, Cloth.class );
+ }
+ catch ( IllegalStateException e ) {
+ fail( "Traversable Called several times for a given object" );
+ }
+
+ v = factory.usingContext().traversableResolver( new AskOnceTR() ).getValidator();
+ try {
+ v.validateValue( Suit.class, "size", 2, Default.class, Cloth.class );
+ }
+ catch ( IllegalStateException e ) {
+ fail( "Traversable Called several times for a given object" );
+ }
+ }
+
+ private static class AskOnceTR implements TraversableResolver {
+ private Set<Holder> askedReach = new HashSet<Holder>();
+ private Set<Holder> askedCascade = new HashSet<Holder>();
+
+ private boolean isTraversable(Set<Holder> asked, Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ Holder h = new Holder( traversableObject, traversableProperty );
+ if ( asked.contains( h ) ) {
+ throw new IllegalStateException( "Called twice" );
+ }
+ asked.add( h );
+ return true;
+ }
+
+ public boolean isReachable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ return isTraversable(
+ askedReach,
+ traversableObject,
+ traversableProperty,
+ rootBeanType,
+ pathToTraversableObject,
+ elementType
+ );
+ }
+
+ public boolean isCascadable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ return isTraversable(
+ askedCascade,
+ traversableObject,
+ traversableProperty,
+ rootBeanType,
+ pathToTraversableObject,
+ elementType
+ );
+ }
+
+ public static class Holder {
+ Object NULL = new Object();
+ Object to;
+ String tp;
+
+ public Holder(Object traversableObject, String traversableProperty) {
+ to = traversableObject == null ? NULL : traversableObject;
+ tp = traversableProperty;
+ }
+
+ @Override
+ public int hashCode() {
+ return to.hashCode() + tp.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( !( obj instanceof Holder ) ) {
+ return false;
+ }
+ Holder that = ( Holder ) obj;
+
+ return to != NULL && to == that.to && tp.equals( that.tp );
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/CachedTraversableResolverTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java 2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,24 @@
+// $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.jsr303.tck.tests.validation.traversableresolver;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public interface Cloth {
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Cloth.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java 2009-06-16 19:33:09 UTC (rev 16805)
@@ -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.jsr303.tck.tests.validation.traversableresolver;
+
+import javax.validation.constraints.Max;
+
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Jacket {
+ Integer width;
+
+ @Max(30)
+ public Integer getWidth() {
+ return width;
+ }
+
+ public void setWidth(Integer width) {
+ this.width = width;
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Jacket.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java 2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,159 @@
+// $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.jsr303.tck.tests.validation.traversableresolver;
+
+import java.lang.annotation.ElementType;
+import java.util.HashSet;
+import java.util.Set;
+import javax.validation.TraversableResolver;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class SnifferTraversableResolver implements TraversableResolver {
+ Set<String> reachPaths = new HashSet<String>();
+ Set<String> cascadePaths = new HashSet<String>();
+ Set<Call> reachCalls = new HashSet<Call>();
+ Set<Call> cascadeCalls = new HashSet<Call>();
+
+ public SnifferTraversableResolver(Suit suit) {
+ reachCalls.add( new Call( suit, "size", Suit.class, "", ElementType.FIELD ) );
+ reachCalls.add( new Call( suit, "trousers", Suit.class, "", ElementType.FIELD ) );
+ cascadeCalls.add( new Call( suit, "trousers", Suit.class, "", ElementType.FIELD ) );
+ reachCalls.add( new Call( suit.getTrousers(), "length", Suit.class, "trousers", ElementType.FIELD ) );
+ reachCalls.add( new Call( suit, "jacket", Suit.class, "", ElementType.METHOD ) );
+ cascadeCalls.add( new Call( suit, "jacket", Suit.class, "", ElementType.METHOD ) );
+ reachCalls.add( new Call( suit.getJacket(), "width", Suit.class, "jacket", ElementType.METHOD ) );
+ }
+
+ public Set<String> getReachPaths() {
+ return reachPaths;
+ }
+
+ public Set<String> getCascadePaths() {
+ return cascadePaths;
+ }
+
+ public boolean isTraversable(Set<Call> calls, Set<String> paths, Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ String path = "";
+ if ( !( pathToTraversableObject == null || pathToTraversableObject.length() == 0 ) ) {
+ path = pathToTraversableObject + ".";
+ }
+ paths.add( path + traversableProperty );
+ Call call = new Call(
+ traversableObject, traversableProperty, rootBeanType, pathToTraversableObject, elementType
+ );
+ if ( !calls.contains( call ) ) {
+
+ throw new IllegalStateException( "Unexpected " + call.toString() );
+ }
+ return true;
+ }
+
+ public boolean isReachable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ return isTraversable(
+ reachCalls,
+ reachPaths,
+ traversableObject,
+ traversableProperty,
+ rootBeanType,
+ pathToTraversableObject,
+ elementType
+ );
+ }
+
+ public boolean isCascadable(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ return isTraversable(
+ cascadeCalls,
+ cascadePaths,
+ traversableObject,
+ traversableProperty,
+ rootBeanType,
+ pathToTraversableObject,
+ elementType
+ );
+ }
+
+ private static final class Call {
+ private Object traversableObject;
+ private String traversableProperty;
+ private Class<?> rootBeanType;
+ private String pathToTraversableObject;
+ private ElementType elementType;
+
+ private Call(Object traversableObject, String traversableProperty, Class<?> rootBeanType, String pathToTraversableObject, ElementType elementType) {
+ this.traversableObject = traversableObject;
+ this.traversableProperty = traversableProperty;
+ this.rootBeanType = rootBeanType;
+ this.pathToTraversableObject = pathToTraversableObject;
+ this.elementType = elementType;
+ }
+
+ @Override
+ @SuppressWarnings("SimplifiableIfStatement")
+ public boolean equals(Object o) {
+ if ( this == o ) {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+
+ Call call = ( Call ) o;
+
+ if ( elementType != call.elementType ) {
+ return false;
+ }
+ if ( !pathToTraversableObject.equals( call.pathToTraversableObject ) ) {
+ return false;
+ }
+ if ( !rootBeanType.equals( call.rootBeanType ) ) {
+ return false;
+ }
+ if ( traversableObject != null ? !( traversableObject == call.traversableObject ) : call.traversableObject != null ) {
+ return false;
+ }
+ if ( !traversableProperty.equals( call.traversableProperty ) ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = traversableObject != null ? traversableObject.hashCode() : 0;
+ result = 31 * result + traversableProperty.hashCode();
+ result = 31 * result + rootBeanType.hashCode();
+ result = 31 * result + pathToTraversableObject.hashCode();
+ result = 31 * result + elementType.hashCode();
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "Call{" +
+ "traversableObject=" + traversableObject +
+ ", traversableProperty='" + traversableProperty + '\'' +
+ ", rootBeanType=" + rootBeanType +
+ ", pathToTraversableObject='" + pathToTraversableObject + '\'' +
+ ", elementType=" + elementType +
+ '}';
+ }
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/SnifferTraversableResolver.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java 2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,61 @@
+// $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.jsr303.tck.tests.validation.traversableresolver;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.Valid;
+import javax.validation.GroupSequence;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@GroupSequence( {Suit.class, Cloth.class })
+public class Suit {
+ @Max(value=50, groups = { Default.class, Cloth.class})
+ @Min(1)
+ private Integer size;
+ @Valid private Trousers trousers;
+ private Jacket jacket;
+
+ public Trousers getTrousers() {
+ return trousers;
+ }
+
+ public void setTrousers(Trousers trousers) {
+ this.trousers = trousers;
+ }
+
+ @Valid
+ public Jacket getJacket() {
+ return jacket;
+ }
+
+ public void setJacket(Jacket jacket) {
+ this.jacket = jacket;
+ }
+
+ public Integer getSize() {
+ return size;
+ }
+
+ public void setSize(Integer size) {
+ this.size = size;
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Suit.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java 2009-06-16 19:33:09 UTC (rev 16805)
@@ -0,0 +1,56 @@
+// $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.jsr303.tck.tests.validation.traversableresolver;
+
+import javax.validation.Configuration;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
+
+import static org.testng.Assert.assertEquals;
+import org.testng.annotations.Test;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class TraversableResolverTest {
+ @Test
+ public void testCorrectPathsAreRequested() {
+ Suit suit = new Suit();
+ suit.setTrousers( new Trousers() );
+ suit.setJacket( new Jacket() );
+ suit.setSize( 3333 );
+ suit.getTrousers().setLength( 32321 );
+ suit.getJacket().setWidth( 432432 );
+
+ SnifferTraversableResolver resolver = new SnifferTraversableResolver( suit );
+
+ // TODO - Investigate why this cast is needed with Java 5. In Java 6 there is no problem.
+ Configuration<?> config = (Configuration<?>) Validation.byDefaultProvider().configure().traversableResolver( resolver );
+
+ ValidatorFactory factory = config.buildValidatorFactory();
+ Validator v = factory.getValidator();
+
+ //Raises an IllegalStateException if something goes wrong
+ v.validate( suit, Default.class, Cloth.class );
+
+ assertEquals( 5, resolver.getReachPaths().size() );
+ assertEquals( 2, resolver.getCascadePaths().size() );
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/TraversableResolverTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java 2009-06-16 19:33:09 UTC (rev 16805)
@@ -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.jsr303.tck.tests.validation.traversableresolver;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Max;
+import javax.validation.groups.Default;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Trousers {
+ @Min(value=70, groups = {Default.class, Cloth.class})
+ @Max(value=220)
+ private Integer length;
+
+ public Integer getLength() {
+ return length;
+ }
+
+ public void setLength(Integer length) {
+ this.length = length;
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/validation/traversableresolver/Trousers.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
15 years, 5 months