Hibernate SVN: r17456 - beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-08-31 11:41:29 -0400 (Mon, 31 Aug 2009)
New Revision: 17456
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java
Log:
Import statement cleanup
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java 2009-08-31 15:40:40 UTC (rev 17455)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java 2009-08-31 15:41:29 UTC (rev 17456)
@@ -17,8 +17,6 @@
*/
package org.hibernate.jsr303.tck.tests.constraints.validatorresolution;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.UnexpectedTypeException;
@@ -246,7 +244,7 @@
Foo foo = new Foo( new SerializableBarSubclass() );
try {
validator.validate( foo );
- fail("The test should have failed due to ambiguous validator resolution.");
+ fail( "The test should have failed due to ambiguous validator resolution." );
}
catch ( UnexpectedTypeException e ) {
// success
15 years, 2 months
Hibernate SVN: r17455 - validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-08-31 11:40:40 -0400 (Mon, 31 Aug 2009)
New Revision: 17455
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Coordinate.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/PostCodeList.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Suburb.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ValidatorResolutionTest.java
Removed:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/PostCodeList.java
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Coordinate.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Suburb.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java
Log:
HV-217 Moved the @PostCodeList example into the Hibernate Validator testsuite.
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Coordinate.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Coordinate.java 2009-08-31 15:15:20 UTC (rev 17454)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Coordinate.java 2009-08-31 15:40:40 UTC (rev 17455)
@@ -23,10 +23,10 @@
public class Coordinate {
long longitude;
- long latidute;
+ long latitude;
- public Coordinate(long longitude, long latidute) {
+ public Coordinate(long longitude, long latitude) {
this.longitude = longitude;
- this.latidute = latidute;
+ this.latitude = latitude;
}
}
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/PostCodeList.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/PostCodeList.java 2009-08-31 15:15:20 UTC (rev 17454)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/PostCodeList.java 2009-08-31 15:40:40 UTC (rev 17455)
@@ -1,72 +0,0 @@
-// $Id$
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, Red Hat Middleware LLC, and individual contributors
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-* http://www.apache.org/licenses/LICENSE-2.0
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.hibernate.jsr303.tck.tests.constraints.validatorresolution;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import java.util.Collection;
-import javax.validation.Constraint;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.Payload;
-
-/**
- * A test constraint which can lead to a error when trying to reslove the validator.
- *
- * @author Hardy Ferentschik
- */
-@Constraint(validatedBy = {
- PostCodeList.PostCodeListValidatorForString.class, PostCodeList.PostCodeListValidatorForNumber.class
-})
-@Documented
-@Target({ METHOD, FIELD, TYPE })
-@Retention(RUNTIME)
-public @interface PostCodeList {
- public abstract String message() default "foobar";
-
- public abstract Class<?>[] groups() default { };
-
- public abstract Class<? extends Payload>[] payload() default {};
-
- public class PostCodeListValidatorForNumber
- implements ConstraintValidator<PostCodeList, Collection<? extends Number>> {
- public void initialize(PostCodeList constraintAnnotation) {
- }
-
- public boolean isValid(Collection<? extends Number> value, ConstraintValidatorContext constraintValidatorContext) {
- return true;
- }
- }
-
- public class PostCodeListValidatorForString implements ConstraintValidator<PostCodeList, Collection<String>> {
- public void initialize(PostCodeList constraintAnnotation) {
- }
-
- public boolean isValid(Collection<String> value, ConstraintValidatorContext constraintValidatorContext) {
- if ( value == null ) {
- return true;
- }
- return false;
- }
- }
-}
\ No newline at end of file
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Suburb.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Suburb.java 2009-08-31 15:15:20 UTC (rev 17454)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Suburb.java 2009-08-31 15:40:40 UTC (rev 17455)
@@ -17,7 +17,6 @@
*/
package org.hibernate.jsr303.tck.tests.constraints.validatorresolution;
-import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -44,17 +43,6 @@
@Size(min = 4, max = 1000)
private Coordinate[] boundingBox;
- @PostCodeList
- private Collection<? extends Number> includedPostCodes;
-
- public void setIncludedPostCodes(Collection<? extends Number> includedPostCodes) {
- this.includedPostCodes = includedPostCodes;
- }
-
- public Collection<? extends Number> getIncludedPostcodes() {
- return includedPostCodes;
- }
-
public void setName(String name) {
this.name = name;
}
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java 2009-08-31 15:15:20 UTC (rev 17454)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java 2009-08-31 15:40:40 UTC (rev 17455)
@@ -137,10 +137,6 @@
Suburb suburb = new Suburb();
- List<Integer> postcodes = new ArrayList<Integer>();
- postcodes.add( 12345 );
- suburb.setIncludedPostCodes( postcodes );
-
// all values are null and should pass
Set<ConstraintViolation<Suburb>> constraintViolations = validator.validate( suburb );
assertCorrectNumberOfViolations( constraintViolations, 0 );
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Coordinate.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Coordinate.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Coordinate.java 2009-08-31 15:40:40 UTC (rev 17455)
@@ -0,0 +1,35 @@
+// $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.validator.constraints;
+
+/**
+ * @author Hardy Ferentschik
+ */
+/**
+ * @author Hardy Ferentschik
+ */
+public class Coordinate {
+
+ long longitude;
+ long latitude;
+
+ public Coordinate(long longitude, long latitude) {
+ this.longitude = longitude;
+ this.latitude = latitude;
+ }
+}
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/PostCodeList.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/PostCodeList.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/PostCodeList.java 2009-08-31 15:40:40 UTC (rev 17455)
@@ -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.validator.constraints;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.util.Collection;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * A test constraint which can lead to a error when trying to reslove the validator.
+ *
+ * @author Hardy Ferentschik
+ */
+@Constraint(validatedBy = {
+ PostCodeList.PostCodeListValidatorForString.class, PostCodeList.PostCodeListValidatorForNumber.class
+})
+@Documented
+@Target({ METHOD, FIELD, TYPE })
+@Retention(RUNTIME)
+public @interface PostCodeList {
+ public abstract String message() default "foobar";
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends Payload>[] payload() default {};
+
+ public class PostCodeListValidatorForNumber
+ implements ConstraintValidator<PostCodeList, Collection<? extends Number>> {
+ public void initialize(PostCodeList constraintAnnotation) {
+ }
+
+ public boolean isValid(Collection<? extends Number> value, ConstraintValidatorContext constraintValidatorContext) {
+ return true;
+ }
+ }
+
+ public class PostCodeListValidatorForString implements ConstraintValidator<PostCodeList, Collection<String>> {
+ public void initialize(PostCodeList constraintAnnotation) {
+ }
+
+ public boolean isValid(Collection<String> value, ConstraintValidatorContext constraintValidatorContext) {
+ if ( value == null ) {
+ return true;
+ }
+ return false;
+ }
+ }
+}
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Suburb.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Suburb.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/Suburb.java 2009-08-31 15:40:40 UTC (rev 17455)
@@ -0,0 +1,96 @@
+// $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.validator.constraints;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.validation.constraints.Size;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Suburb {
+ public enum Facility {
+ SHOPPING_MALL, BUS_TERMINAL
+ }
+
+ @Size(min = 5, max = 10, message = "size must be between {min} and {max}")
+ private String name;
+
+ @Size(min = 2, max = 2, message = "size must be between {min} and {max}")
+ private Map<Facility, Boolean> facilities;
+
+ @Size(min = 2, message = "size must be between {min} and {max}")
+ private Set<String> streetNames;
+
+ @Size(min = 4, max = 1000, message = "size must be between {min} and {max}")
+ private Coordinate[] boundingBox;
+
+ @PostCodeList
+ private Collection<? extends Number> includedPostCodes;
+
+ public void setIncludedPostCodes(Collection<? extends Number> includedPostCodes) {
+ this.includedPostCodes = includedPostCodes;
+ }
+
+ public Collection<? extends Number> getIncludedPostcodes() {
+ return includedPostCodes;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Map<Facility, Boolean> getFacilities() {
+ return facilities;
+ }
+
+ public void addFacility(Facility f, Boolean exist) {
+ if ( facilities == null ) {
+ facilities = new HashMap<Facility, Boolean>();
+ }
+ facilities.put( f, exist );
+ }
+
+ public Set<String> getStreetNames() {
+ return streetNames;
+ }
+
+ public void addStreetName(String streetName) {
+ if ( streetNames == null ) {
+ streetNames = new HashSet<String>();
+ }
+ streetNames.add( streetName );
+ }
+
+ public Coordinate[] getBoundingBox() {
+ return boundingBox;
+ }
+
+ public void setBoundingBox(Coordinate[] boundingBox) {
+ this.boundingBox = boundingBox;
+ }
+}
+
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ValidatorResolutionTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ValidatorResolutionTest.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/constraints/ValidatorResolutionTest.java 2009-08-31 15:40:40 UTC (rev 17455)
@@ -0,0 +1,116 @@
+// $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.validator.constraints;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.util.TestUtil;
+import static org.hibernate.validator.util.TestUtil.assertConstraintViolation;
+import static org.hibernate.validator.util.TestUtil.assertNumberOfViolations;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class ValidatorResolutionTest {
+
+ @Test
+ public void testResolutionOfMultipleSizeValidators() {
+ Validator validator = TestUtil.getValidator();
+
+ Suburb suburb = new Suburb();
+
+ List<Integer> postcodes = new ArrayList<Integer>();
+ postcodes.add( 12345 );
+ suburb.setIncludedPostCodes( postcodes );
+
+ // all values are null and should pass
+ Set<ConstraintViolation<Suburb>> constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 0 );
+
+ suburb.setName( "" );
+ constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 1 );
+ assertConstraintViolation(
+ constraintViolations.iterator().next(), "size must be between 5 and 10", Suburb.class, "", "name"
+ );
+
+ suburb.setName( "Hoegsbo" );
+ constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 0 );
+
+ suburb.addFacility( Suburb.Facility.SHOPPING_MALL, false );
+ constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 1 );
+ assertConstraintViolation(
+ constraintViolations.iterator().next(),
+ "size must be between 2 and 2",
+ Suburb.class,
+ suburb.getFacilities(),
+ "facilities"
+ );
+
+ suburb.addFacility( Suburb.Facility.BUS_TERMINAL, true );
+ constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 0 );
+
+ suburb.addStreetName( "Sikelsgatan" );
+ constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 1 );
+ assertConstraintViolation(
+ constraintViolations.iterator().next(),
+ "size must be between 2 and 2147483647",
+ Suburb.class,
+ suburb.getStreetNames(),
+ "streetNames"
+ );
+
+ suburb.addStreetName( "Marklandsgatan" );
+ constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 0 );
+
+ Coordinate[] boundingBox = new Coordinate[3];
+ boundingBox[0] = new Coordinate( 0l, 0l );
+ boundingBox[1] = new Coordinate( 0l, 1l );
+ boundingBox[2] = new Coordinate( 1l, 0l );
+ suburb.setBoundingBox( boundingBox );
+ constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 1 );
+ assertConstraintViolation(
+ constraintViolations.iterator().next(),
+ "size must be between 4 and 1000",
+ Suburb.class,
+ suburb.getBoundingBox(),
+ "boundingBox"
+ );
+
+ boundingBox = new Coordinate[4];
+ boundingBox[0] = new Coordinate( 0l, 0l );
+ boundingBox[1] = new Coordinate( 0l, 1l );
+ boundingBox[2] = new Coordinate( 1l, 0l );
+ boundingBox[3] = new Coordinate( 1l, 1l );
+ suburb.setBoundingBox( boundingBox );
+ constraintViolations = validator.validate( suburb );
+ assertNumberOfViolations( constraintViolations, 0 );
+ }
+}
15 years, 2 months
Hibernate SVN: r17454 - in beanvalidation/trunk/validation-tck/src/main: java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-08-31 11:15:20 -0400 (Mon, 31 Aug 2009)
New Revision: 17454
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/
Removed:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/ClassLevelOverridingTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/Optional.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/Package.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/PrePosting.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/ValidPackage.java
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingWithAnnotationTest.xml
Log:
Renamed 'classlevel' to 'clazzlevel' due to bug in TCK framework
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel (from rev 17453, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel)
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/ClassLevelOverridingTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ClassLevelOverridingTest.java 2009-08-31 13:54:12 UTC (rev 17453)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/ClassLevelOverridingTest.java 2009-08-31 15:15:20 UTC (rev 17454)
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel;
+package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel;
import java.util.Set;
import javax.validation.Configuration;
@@ -51,7 +51,7 @@
})
public class ClassLevelOverridingTest extends AbstractTest {
- public final static String packageName = "/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/";
+ public final static String packageName = "/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/";
public final static String mappingFile1 = "package-constraints-ClassLevelOverridingTest.xml";
public final static String mappingFile2 = "package-constraints-ClassLevelOverridingImplicitOverrideTest.xml";
public final static String mappingFile3 = "package-constraints-ClassLevelOverridingWithAnnotationTest.xml";
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/Optional.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Optional.java 2009-08-31 13:54:12 UTC (rev 17453)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/Optional.java 2009-08-31 15:15:20 UTC (rev 17454)
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel;
+package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel;
/**
* @author Hardy Ferentschik
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/Package.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Package.java 2009-08-31 13:54:12 UTC (rev 17453)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/Package.java 2009-08-31 15:15:20 UTC (rev 17454)
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel;
+package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel;
import javax.validation.GroupSequence;
import javax.validation.constraints.Max;
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/PrePosting.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java 2009-08-31 13:54:12 UTC (rev 17453)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/PrePosting.java 2009-08-31 15:15:20 UTC (rev 17454)
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel;
+package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel;
/**
* @author Hardy Ferentschik
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/ValidPackage.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java 2009-08-31 13:54:12 UTC (rev 17453)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/ValidPackage.java 2009-08-31 15:15:20 UTC (rev 17454)
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel;
+package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel;
import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.FIELD;
Copied: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel (from rev 17453, beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel)
Modified: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml 2009-08-31 13:54:12 UTC (rev 17453)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml 2009-08-31 15:15:20 UTC (rev 17454)
@@ -1,10 +1,10 @@
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
- <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel</default-package>
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel</default-package>
<bean class="Package" ignore-annotations="true">
<class>
- <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel.ValidPackage">
+ <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel.ValidPackage">
<message>ValidPackage defined in XML</message>
</constraint>
</class>
Modified: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingTest.xml 2009-08-31 13:54:12 UTC (rev 17453)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingTest.xml 2009-08-31 15:15:20 UTC (rev 17454)
@@ -1,10 +1,10 @@
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
- <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel</default-package>
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel</default-package>
<bean class="Package">
<class ignore-annotations="true">
- <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel.ValidPackage">
+ <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel.ValidPackage">
<message>ValidPackage defined in XML</message>
</constraint>
</class>
Modified: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingWithAnnotationTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingWithAnnotationTest.xml 2009-08-31 13:54:12 UTC (rev 17453)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/clazzlevel/package-constraints-ClassLevelOverridingWithAnnotationTest.xml 2009-08-31 15:15:20 UTC (rev 17454)
@@ -1,13 +1,13 @@
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
- <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel</default-package>
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel</default-package>
<bean class="Package">
<class ignore-annotations="false">
- <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel.ValidPackage">
+ <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel.ValidPackage">
<message>ValidPackage defined in XML</message>
<groups>
- <value>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel.PrePosting
+ <value>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.clazzlevel.PrePosting
</value>
</groups>
</constraint>
15 years, 2 months
Hibernate SVN: r17453 - in beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration: classlevel and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-08-31 09:54:12 -0400 (Mon, 31 Aug 2009)
New Revision: 17453
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java
Removed:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingImplicitOverrideTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingWithAnnotationTest.java
Log:
Test package refactoring to further structure TCK tests
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingImplicitOverrideTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingImplicitOverrideTest.java 2009-08-31 13:53:12 UTC (rev 17452)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingImplicitOverrideTest.java 2009-08-31 13:54:12 UTC (rev 17453)
@@ -1,57 +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.xmlconfiguration.constraintdeclaration;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.jboss.test.audit.annotations.SpecAssertion;
-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 org.jboss.testharness.impl.packaging.Resource;
-import org.jboss.testharness.impl.packaging.jsr303.ValidationXml;
-import org.testng.annotations.Test;
-
-import org.hibernate.jsr303.tck.util.TestUtil;
-import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectConstraintViolationMessages;
-import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-@Artifact(artifactType = ArtifactType.JSR303)
-@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
-@ValidationXml(value = "validation-ClassLevelOverridingImplicitOverrideTest.xml")
-@Resource(source = "package-constraints-ClassLevelOverridingImplicitOverrideTest.xml",
- destination = "WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml")
-public class ClassLevelOverridingImplicitOverrideTest extends AbstractTest {
-
- @Test
- @SpecAssertion(section = "7.1.1.1", id = "b")
- public void testIgnoreAnnotationsFromEnclosingBeanIsApplied() {
- Validator validator = TestUtil.getValidatorUnderTest();
- Package p = new Package();
- Set<ConstraintViolation<Package>> violations = validator.validate( p );
-
- assertCorrectNumberOfViolations( violations, 1 );
- assertCorrectConstraintViolationMessages( violations, "ValidPackage defined in XML" );
- }
-}
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingWithAnnotationTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingWithAnnotationTest.java 2009-08-31 13:53:12 UTC (rev 17452)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingWithAnnotationTest.java 2009-08-31 13:54:12 UTC (rev 17453)
@@ -1,64 +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.xmlconfiguration.constraintdeclaration;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-import javax.validation.groups.Default;
-
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-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 org.jboss.testharness.impl.packaging.Resource;
-import org.jboss.testharness.impl.packaging.jsr303.ValidationXml;
-import org.testng.annotations.Test;
-
-import org.hibernate.jsr303.tck.util.TestUtil;
-import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectConstraintViolationMessages;
-import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-@Artifact(artifactType = ArtifactType.JSR303)
-@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
-@ValidationXml(value = "validation-ClassLevelOverridingWithAnnotationTest.xml")
-@Resource(source = "package-constraints-ClassLevelOverridingWithAnnotationTest.xml",
- destination = "WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingWithAnnotationTest.xml")
-public class ClassLevelOverridingWithAnnotationTest extends AbstractTest {
-
- @Test
- @SpecAssertions({
- @SpecAssertion(section = "7.1.1.1", id = "a"),
- @SpecAssertion(section = "7.1.1.1", id = "d")
- })
- public void testClassLevelAnnotationsApplied() {
- Validator validator = TestUtil.getValidatorUnderTest();
- Package p = new Package();
- Set<ConstraintViolation<Package>> violations = validator.validate( p );
-
- assertCorrectNumberOfViolations( violations, 2 );
- assertCorrectConstraintViolationMessages(
- violations, "ValidPackage defined in XML", "ValidPackage defined as annotation"
- );
- }
-}
\ No newline at end of file
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java (from rev 17449, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/PrePosting.java 2009-08-31 13:54:12 UTC (rev 17453)
@@ -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.xmlconfiguration.constraintdeclaration.classlevel;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface PrePosting {
+}
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java (from rev 17449, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java 2009-08-31 13:54:12 UTC (rev 17453)
@@ -0,0 +1,55 @@
+// $Id$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.Payload;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Constraint(validatedBy = ValidPackage.ValidPackageValidator.class)
+@Documented
+@Target({ METHOD, FIELD, TYPE })
+@Retention(RUNTIME)
+public @interface ValidPackage {
+ public abstract String message() default "User information is not consistent.";
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends Payload>[] payload() default { };
+
+ public class ValidPackageValidator implements ConstraintValidator<ValidPackage, Package> {
+
+ public void initialize(ValidPackage parameters) {
+ }
+
+ public boolean isValid(Package p, ConstraintValidatorContext constraintValidatorContext) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ValidPackage.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
15 years, 2 months
Hibernate SVN: r17452 - in beanvalidation/trunk/validation-tck/src/main: java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-08-31 09:53:12 -0400 (Mon, 31 Aug 2009)
New Revision: 17452
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ClassLevelOverridingTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Optional.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Package.java
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingWithAnnotationTest.xml
Removed:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingTest.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingWithAnnotationTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingImplicitOverrideTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingTest.xml
beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingWithAnnotationTest.xml
Log:
Test package refactoring to further structure TCK tests
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingTest.java 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingTest.java 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,61 +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.xmlconfiguration.constraintdeclaration;
-
-import java.util.Set;
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-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 org.jboss.testharness.impl.packaging.Resource;
-import org.jboss.testharness.impl.packaging.jsr303.ValidationXml;
-import org.testng.annotations.Test;
-
-import org.hibernate.jsr303.tck.util.TestUtil;
-import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectConstraintViolationMessages;
-import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectNumberOfViolations;
-
-/**
- * @author Hardy Ferentschik
- */
-@Artifact(artifactType = ArtifactType.JSR303)
-@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
-@ValidationXml(value = "validation-ClassLevelOverridingTest.xml")
-@Resource(source = "package-constraints-ClassLevelOverridingTest.xml",
- destination = "WEB-INF/classes/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingTest.xml")
-public class ClassLevelOverridingTest extends AbstractTest {
-
- @Test
- @SpecAssertions({
- @SpecAssertion(section = "7.1.1.1", id = "a"),
- @SpecAssertion(section = "7.1.1.1", id = "c")
- })
- public void testIgnoreClassLevelAnnotations() {
- Validator validator = TestUtil.getValidatorUnderTest();
- Package p = new Package();
- Set<ConstraintViolation<Package>> violations = validator.validate( p );
-
- assertCorrectNumberOfViolations( violations, 1 );
- assertCorrectConstraintViolationMessages( violations, "ValidPackage defined in XML" );
- }
-}
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,24 +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.xmlconfiguration.constraintdeclaration;
-
-/**
- * @author Hardy Ferentschik
- */
-public interface PrePosting {
-}
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/PrePosting.java 2009-08-31 13:53:12 UTC (rev 17452)
@@ -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.xmlconfiguration.constraintdeclaration;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface PrePosting {
+}
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,56 +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.xmlconfiguration.constraintdeclaration;
-
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.Payload;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-
-
-/**
- * @author Hardy Ferentschik
- */
-@Constraint(validatedBy = ValidPackage.ValidPackageValidator.class)
-@Documented
-@Target({ METHOD, FIELD, TYPE })
-@Retention(RUNTIME)
-public @interface ValidPackage {
- public abstract String message() default "User information is not consistent.";
-
- public abstract Class<?>[] groups() default { };
-
- public abstract Class<? extends Payload>[] payload() default { };
-
- public class ValidPackageValidator implements ConstraintValidator<ValidPackage, Package> {
-
- public void initialize(ValidPackage parameters) {
- }
-
- public boolean isValid(Package p, ConstraintValidatorContext constraintValidatorContext) {
- return false;
- }
- }
-}
\ No newline at end of file
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ValidPackage.java 2009-08-31 13:53:12 UTC (rev 17452)
@@ -0,0 +1,55 @@
+// $Id: ValidPackage.java 17427 2009-08-27 09:47:28Z hardy.ferentschik $
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration;
+
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.Payload;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Constraint(validatedBy = ValidPackage.ValidPackageValidator.class)
+@Documented
+@Target({ METHOD, FIELD, TYPE })
+@Retention(RUNTIME)
+public @interface ValidPackage {
+ public abstract String message() default "User information is not consistent.";
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends Payload>[] payload() default { };
+
+ public class ValidPackageValidator implements ConstraintValidator<ValidPackage, Package> {
+
+ public void initialize(ValidPackage parameters) {
+ }
+
+ public boolean isValid(Package p, ConstraintValidatorContext constraintValidatorContext) {
+ return false;
+ }
+ }
+}
\ No newline at end of file
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ClassLevelOverridingTest.java (from rev 17449, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/ClassLevelOverridingTest.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ClassLevelOverridingTest.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ClassLevelOverridingTest.java 2009-08-31 13:53:12 UTC (rev 17452)
@@ -0,0 +1,108 @@
+// $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.xmlconfiguration.constraintdeclaration.classlevel;
+
+import java.util.Set;
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecAssertions;
+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 org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.testng.annotations.Test;
+
+import org.hibernate.jsr303.tck.util.TestUtil;
+import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectConstraintViolationMessages;
+import static org.hibernate.jsr303.tck.util.TestUtil.assertCorrectNumberOfViolations;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@Artifact(artifactType = ArtifactType.JSR303)
+@Classes({ TestUtil.class, TestUtil.PathImpl.class, TestUtil.NodeImpl.class })
+@Resources({
+ @Resource(source = ClassLevelOverridingTest.mappingFile1,
+ destination = "WEB-INF/classes" + ClassLevelOverridingTest.packageName + ClassLevelOverridingTest.mappingFile1),
+ @Resource(source = ClassLevelOverridingTest.mappingFile2,
+ destination = "WEB-INF/classes" + ClassLevelOverridingTest.packageName + ClassLevelOverridingTest.mappingFile2),
+ @Resource(source = ClassLevelOverridingTest.mappingFile3,
+ destination = "WEB-INF/classes" + ClassLevelOverridingTest.packageName + ClassLevelOverridingTest.mappingFile3)
+})
+public class ClassLevelOverridingTest extends AbstractTest {
+
+ public final static String packageName = "/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/";
+ public final static String mappingFile1 = "package-constraints-ClassLevelOverridingTest.xml";
+ public final static String mappingFile2 = "package-constraints-ClassLevelOverridingImplicitOverrideTest.xml";
+ public final static String mappingFile3 = "package-constraints-ClassLevelOverridingWithAnnotationTest.xml";
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "7.1.1.1", id = "a"),
+ @SpecAssertion(section = "7.1.1.1", id = "c")
+ })
+ public void testIgnoreClassLevelAnnotations() {
+ Configuration<?> config = TestUtil.getConfigurationUnderTest();
+ config.addMapping( TestUtil.getInputStreamForPath( packageName + mappingFile1 ) );
+ Validator validator = config.buildValidatorFactory().getValidator();
+
+ Package p = new Package();
+ Set<ConstraintViolation<Package>> violations = validator.validate( p );
+
+ assertCorrectNumberOfViolations( violations, 1 );
+ assertCorrectConstraintViolationMessages( violations, "ValidPackage defined in XML" );
+ }
+
+ @Test
+ @SpecAssertion(section = "7.1.1.1", id = "b")
+ public void testIgnoreAnnotationsFromEnclosingBeanIsApplied() {
+ Configuration<?> config = TestUtil.getConfigurationUnderTest();
+ config.addMapping( TestUtil.getInputStreamForPath( packageName + mappingFile2 ) );
+ Validator validator = config.buildValidatorFactory().getValidator();
+
+ Package p = new Package();
+ Set<ConstraintViolation<Package>> violations = validator.validate( p );
+
+ assertCorrectNumberOfViolations( violations, 1 );
+ assertCorrectConstraintViolationMessages( violations, "ValidPackage defined in XML" );
+ }
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section = "7.1.1.1", id = "a"),
+ @SpecAssertion(section = "7.1.1.1", id = "d")
+ })
+ public void testClassLevelAnnotationsApplied() {
+ Configuration<?> config = TestUtil.getConfigurationUnderTest();
+ config.addMapping( TestUtil.getInputStreamForPath( packageName + mappingFile3 ) );
+ Validator validator = config.buildValidatorFactory().getValidator();
+
+ Package p = new Package();
+ Set<ConstraintViolation<Package>> violations = validator.validate( p );
+
+ assertCorrectNumberOfViolations( violations, 2 );
+ assertCorrectConstraintViolationMessages(
+ violations, "ValidPackage defined in XML", "ValidPackage defined as annotation"
+ );
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/ClassLevelOverridingTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Optional.java (from rev 17449, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/Optional.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Optional.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Optional.java 2009-08-31 13:53:12 UTC (rev 17452)
@@ -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.xmlconfiguration.constraintdeclaration.classlevel;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface Optional {
+}
\ No newline at end of file
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Package.java (from rev 17449, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/Package.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Package.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/Package.java 2009-08-31 13:53:12 UTC (rev 17452)
@@ -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.xmlconfiguration.constraintdeclaration.classlevel;
+
+import javax.validation.GroupSequence;
+import javax.validation.constraints.Max;
+
+/**
+ * @author Hardy Ferentschik
+ */
+@GroupSequence(value = { Package.class, PrePosting.class })
+@ValidPackage(message = "ValidPackage defined as annotation", groups = PrePosting.class)
+public class Package {
+ @Max(value = 20, groups = Optional.class, message = "The package is too heavy")
+ private int maxWeight;
+
+ public int getMaxWeight() {
+ return maxWeight;
+ }
+
+ public void setMaxWeight(int maxWeight) {
+ this.maxWeight = maxWeight;
+ }
+}
\ No newline at end of file
Copied: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml (from rev 17449, beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -0,0 +1,12 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+ xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel</default-package>
+ <bean class="Package" ignore-annotations="true">
+ <class>
+ <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel.ValidPackage">
+ <message>ValidPackage defined in XML</message>
+ </constraint>
+ </class>
+ </bean>
+</constraint-mappings>
\ No newline at end of file
Copied: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingTest.xml (from rev 17449, beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingTest.xml)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingTest.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -0,0 +1,12 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+ xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel</default-package>
+ <bean class="Package">
+ <class ignore-annotations="true">
+ <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel.ValidPackage">
+ <message>ValidPackage defined in XML</message>
+ </constraint>
+ </class>
+ </bean>
+</constraint-mappings>
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingTest.xml
___________________________________________________________________
Name: svn:keywords
+ Id
Copied: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingWithAnnotationTest.xml (from rev 17449, beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingWithAnnotationTest.xml)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingWithAnnotationTest.xml (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/classlevel/package-constraints-ClassLevelOverridingWithAnnotationTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -0,0 +1,16 @@
+<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
+ xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
+ <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel</default-package>
+ <bean class="Package">
+ <class ignore-annotations="false">
+ <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel.ValidPackage">
+ <message>ValidPackage defined in XML</message>
+ <groups>
+ <value>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.classlevel.PrePosting
+ </value>
+ </groups>
+ </constraint>
+ </class>
+ </bean>
+</constraint-mappings>
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,12 +0,0 @@
-<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
- xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
- <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration</default-package>
- <bean class="Package" ignore-annotations="true">
- <class>
- <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.ValidPackage">
- <message>ValidPackage defined in XML</message>
- </constraint>
- </class>
- </bean>
-</constraint-mappings>
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingTest.xml 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,12 +0,0 @@
-<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
- xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
- <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration</default-package>
- <bean class="Package">
- <class ignore-annotations="true">
- <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.ValidPackage">
- <message>ValidPackage defined in XML</message>
- </constraint>
- </class>
- </bean>
-</constraint-mappings>
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingWithAnnotationTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingWithAnnotationTest.xml 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingWithAnnotationTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,16 +0,0 @@
-<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
- xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
- <default-package>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration</default-package>
- <bean class="Package">
- <class ignore-annotations="false">
- <constraint annotation="org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.ValidPackage">
- <message>ValidPackage defined in XML</message>
- <groups>
- <value>org.hibernate.jsr303.tck.tests.xmlconfiguration.constraintdeclaration.PrePosting
- </value>
- </groups>
- </constraint>
- </class>
- </bean>
-</constraint-mappings>
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingImplicitOverrideTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingImplicitOverrideTest.xml 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingImplicitOverrideTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
- xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <constraint-mapping>/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingImplicitOverrideTest.xml</constraint-mapping>
-</validation-config>
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingTest.xml 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
- xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <constraint-mapping>/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingTest.xml</constraint-mapping>
-</validation-config>
\ No newline at end of file
Deleted: beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingWithAnnotationTest.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingWithAnnotationTest.xml 2009-08-31 13:14:55 UTC (rev 17451)
+++ beanvalidation/trunk/validation-tck/src/main/resources/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/validation-ClassLevelOverridingWithAnnotationTest.xml 2009-08-31 13:53:12 UTC (rev 17452)
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<validation-config xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
- xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration validation-configuration-1.0.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <constraint-mapping>/org/hibernate/jsr303/tck/tests/xmlconfiguration/constraintdeclaration/package-constraints-ClassLevelOverridingWithAnnotationTest.xml</constraint-mapping>
-</validation-config>
\ No newline at end of file
15 years, 2 months
Hibernate SVN: r17451 - validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-08-31 09:14:55 -0400 (Mon, 31 Aug 2009)
New Revision: 17451
Added:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambiguous.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Dummy.java
Removed:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Bar.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Foo.java
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintTree.java
Log:
Updated poms to work with latest SNAPSHOT dependencies again
Deleted: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java 2009-08-31 12:48:22 UTC (rev 17450)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java 2009-08-31 13:14:55 UTC (rev 17451)
@@ -1,71 +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.constraints.validatorresolution;
-
-import java.io.Serializable;
-import java.lang.annotation.Documented;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-import javax.validation.Constraint;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.Payload;
-
-/**
- * A test constraint which can lead to a error when trying to reslove the validator.
- *
- * @author Hardy Ferentschik
- */
-@Constraint(validatedBy = {
- Ambigious.AmbigiousValidatorForBar.class, Ambigious.AmbigiousValidatorForSerializable.class
-})
-@Documented
-@Target({ METHOD, FIELD, TYPE })
-@Retention(RUNTIME)
-public @interface Ambigious {
- public abstract String message() default "foobar";
-
- public abstract Class<?>[] groups() default { };
-
- public abstract Class<? extends Payload>[] payload() default {};
-
-
- public class AmbigiousValidatorForBar implements ConstraintValidator<Ambigious, Bar> {
-
- public void initialize(Ambigious parameters) {
- }
-
- public boolean isValid(Bar b, ConstraintValidatorContext constraintValidatorContext) {
- return true;
- }
- }
-
- public class AmbigiousValidatorForSerializable implements ConstraintValidator<Ambigious, Serializable> {
-
- public void initialize(Ambigious parameters) {
- }
-
- public boolean isValid(Serializable o, ConstraintValidatorContext constraintValidatorContext) {
- return true;
- }
- }
-}
\ No newline at end of file
Copied: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambiguous.java (from rev 17449, beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambigious.java)
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambiguous.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambiguous.java 2009-08-31 13:14:55 UTC (rev 17451)
@@ -0,0 +1,71 @@
+// $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.constraints.validatorresolution;
+
+import java.io.Serializable;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.Payload;
+
+/**
+ * A test constraint which can lead to a error when trying to resolve the validator.
+ *
+ * @author Hardy Ferentschik
+ */
+@Constraint(validatedBy = {
+ Ambiguous.AmbiguousValidatorForDummy.class, Ambiguous.AmbiguousValidatorForSerializable.class
+})
+@Documented
+@Target({ METHOD, FIELD, TYPE })
+@Retention(RUNTIME)
+public @interface Ambiguous {
+ public abstract String message() default "foobar";
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends Payload>[] payload() default { };
+
+
+ public class AmbiguousValidatorForDummy implements ConstraintValidator<Ambiguous, Dummy> {
+
+ public void initialize(Ambiguous parameters) {
+ }
+
+ public boolean isValid(Dummy d, ConstraintValidatorContext constraintValidatorContext) {
+ return true;
+ }
+ }
+
+ public class AmbiguousValidatorForSerializable implements ConstraintValidator<Ambiguous, Serializable> {
+
+ public void initialize(Ambiguous parameters) {
+ }
+
+ public boolean isValid(Serializable o, ConstraintValidatorContext constraintValidatorContext) {
+ return true;
+ }
+ }
+}
\ No newline at end of file
Property changes on: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Ambiguous.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Bar.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Bar.java 2009-08-31 12:48:22 UTC (rev 17450)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Bar.java 2009-08-31 13:14:55 UTC (rev 17451)
@@ -17,12 +17,13 @@
*/
package org.hibernate.jsr303.tck.tests.constraints.validatorresolution;
+import java.io.Serializable;
import javax.validation.constraints.Size;
/**
* @author Hardy Ferentschik
*/
-public class Bar {
+public class Bar implements Serializable, Dummy {
// validating Bar actually raises an UnexpectedTypeException - @Size is not defined for Integer
@Size
private Integer value = 0;
Added: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Dummy.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Dummy.java (rev 0)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Dummy.java 2009-08-31 13:14:55 UTC (rev 17451)
@@ -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.constraints.validatorresolution;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public interface Dummy {
+}
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Foo.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Foo.java 2009-08-31 12:48:22 UTC (rev 17450)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/Foo.java 2009-08-31 13:14:55 UTC (rev 17451)
@@ -22,7 +22,7 @@
*/
public class Foo {
- @Ambigious
+ @Ambiguous
private Bar bar;
public Foo(Bar bar) {
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java 2009-08-31 12:48:22 UTC (rev 17450)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java 2009-08-31 13:14:55 UTC (rev 17451)
@@ -244,13 +244,13 @@
@SpecAssertion(section = "3.5.3", id = "f"),
@SpecAssertion(section = "8.3", id = "b")
})
- public void testAmbigiousValidatorResolution() {
+ public void testAmbiguousValidatorResolution() {
Validator validator = TestUtil.getValidatorUnderTest();
Foo foo = new Foo( new SerializableBarSubclass() );
try {
validator.validate( foo );
- fail();
+ fail("The test should have failed due to ambiguous validator resolution.");
}
catch ( UnexpectedTypeException e ) {
// success
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintTree.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintTree.java 2009-08-31 12:48:22 UTC (rev 17450)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ConstraintTree.java 2009-08-31 13:14:55 UTC (rev 17451)
@@ -117,7 +117,6 @@
);
}
ConstraintValidator<A, V> validator = getInitializedValidator(
- localExecutionContext.getCurrentValidatedValue(),
type,
executionContext.getConstraintValidatorFactory()
);
@@ -166,15 +165,14 @@
}
/**
- * @param value The value to be validated.
* @param type The type of the value to be validated (the type of the member/class the constraint was placed on).
* @param constraintFactory constraint factory used to instantiate the constraint validator.
*
* @return A initialized constraint validator matching the type of the value to be validated.
*/
@SuppressWarnings("unchecked")
- private <V> ConstraintValidator<A, V> getInitializedValidator(V value, Type type, ConstraintValidatorFactory constraintFactory) {
- Class<? extends ConstraintValidator<?, ?>> validatorClass = findMatchingValidatorClass( value, type );
+ private <V> ConstraintValidator<A, V> getInitializedValidator(Type type, ConstraintValidatorFactory constraintFactory) {
+ Class<? extends ConstraintValidator<?, ?>> validatorClass = findMatchingValidatorClass( type );
ConstraintValidator<A, V> constraintValidator;
@@ -203,22 +201,17 @@
/**
* Runs the validator resolution algorithm.
*
- * @param value The value to be validated.
* @param type The type of the value to be validated (the type of the member/class the constraint was placed on).
*
* @return The class of a matching validator.
*/
- private Class<? extends ConstraintValidator<?, ?>> findMatchingValidatorClass(Object value, Type type) {
+ private Class<? extends ConstraintValidator<?, ?>> findMatchingValidatorClass(Type type) {
Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorTypes =
ValidatorTypeHelper.getValidatorsTypes( descriptor.getConstraintValidatorClasses() );
List<Type> suitableTypes = new ArrayList<Type>();
findSuitableValidatorTypes( type, validatorTypes, suitableTypes );
- if ( value != null ) {
- findSuitableValidatorTypes( value.getClass(), validatorTypes, suitableTypes );
- }
-
resolveAssignableTypes( suitableTypes );
verifyResolveWasUnique( type, suitableTypes );
15 years, 2 months
Hibernate SVN: r17450 - validator/trunk and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-08-31 08:48:22 -0400 (Mon, 31 Aug 2009)
New Revision: 17450
Modified:
beanvalidation/trunk/validation-tck/pom.xml
validator/trunk/hibernate-validator-tck-runner/pom.xml
validator/trunk/pom.xml
Log:
Updated poms to work with latest SNAPSHOT dependencies again
Modified: beanvalidation/trunk/validation-tck/pom.xml
===================================================================
--- beanvalidation/trunk/validation-tck/pom.xml 2009-08-31 00:34:25 UTC (rev 17449)
+++ beanvalidation/trunk/validation-tck/pom.xml 2009-08-31 12:48:22 UTC (rev 17450)
@@ -44,7 +44,7 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.CR5</version>
+ <version>1.0.CR6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.test-audit</groupId>
Modified: validator/trunk/hibernate-validator-tck-runner/pom.xml
===================================================================
--- validator/trunk/hibernate-validator-tck-runner/pom.xml 2009-08-31 00:34:25 UTC (rev 17449)
+++ validator/trunk/hibernate-validator-tck-runner/pom.xml 2009-08-31 12:48:22 UTC (rev 17450)
@@ -32,7 +32,7 @@
<dependency>
<groupId>org.hibernate.jsr303.tck</groupId>
<artifactId>jsr303-tck</artifactId>
- <version>1.0.0.Alpha6</version>
+ <version>1.0.0.Beta1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.test-harness</groupId>
Modified: validator/trunk/pom.xml
===================================================================
--- validator/trunk/pom.xml 2009-08-31 00:34:25 UTC (rev 17449)
+++ validator/trunk/pom.xml 2009-08-31 12:48:22 UTC (rev 17450)
@@ -47,7 +47,7 @@
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
- <version>1.0.CR5</version>
+ <version>1.0.CR6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
15 years, 2 months
Hibernate SVN: r17449 - core/trunk/cache-ehcache.
by hibernate-commits@lists.jboss.org
Author: gregrluck
Date: 2009-08-30 20:34:25 -0400 (Sun, 30 Aug 2009)
New Revision: 17449
Modified:
core/trunk/cache-ehcache/pom.xml
Log:
Upped ehcache dependency to version 1.5
Modified: core/trunk/cache-ehcache/pom.xml
===================================================================
--- core/trunk/cache-ehcache/pom.xml 2009-08-27 17:28:53 UTC (rev 17448)
+++ core/trunk/cache-ehcache/pom.xml 2009-08-31 00:34:25 UTC (rev 17449)
@@ -25,7 +25,7 @@
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
- <version>1.2.3</version>
+ <version>1.5.0</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
15 years, 2 months
Hibernate SVN: r17448 - beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-08-27 13:28:53 -0400 (Thu, 27 Aug 2009)
New Revision: 17448
Modified:
beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java
Log:
fix assertions too strict on the implementation
Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java 2009-08-27 17:03:45 UTC (rev 17447)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/validatorresolution/ValidatorResolutionTest.java 2009-08-27 17:28:53 UTC (rev 17448)
@@ -30,6 +30,7 @@
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;
import org.testng.annotations.Test;
@@ -56,14 +57,13 @@
assertEquals(
CustomConstraint.ValidatorForCustomInterface.callCounter,
0,
- "The validate method of ValidatorForCustomInterface should have been called yet."
+ "The validate method of ValidatorForCustomInterface should not have been called yet."
);
validator.validate( new CustomInterfaceImpl() );
- assertEquals(
- CustomConstraint.ValidatorForCustomInterface.callCounter,
- 1,
+ assertTrue(
+ CustomConstraint.ValidatorForCustomInterface.callCounter > 0,
"The validate method of ValidatorForCustomInterface should have been called."
);
}
@@ -77,14 +77,13 @@
assertEquals(
CustomConstraint.ValidatorForCustomClass.callCounter,
0,
- "The validate method of ValidatorForCustomClass should have been called yet."
+ "The validate method of ValidatorForCustomClass should not have been called yet."
);
validator.validate( new CustomClass() );
- assertEquals(
- CustomConstraint.ValidatorForCustomClass.callCounter,
- 1,
+ assertTrue(
+ CustomConstraint.ValidatorForCustomClass.callCounter > 0,
"The validate method of ValidatorForCustomClass should have been called."
);
}
@@ -98,14 +97,13 @@
assertEquals(
CustomConstraint.ValidatorForSubClassA.callCounter,
0,
- "The validate method of ValidatorForSubClassA should have been called yet."
+ "The validate method of ValidatorForSubClassA should not have been called yet."
);
validator.validate( new SubClassAHolder( new SubClassA() ) );
- assertEquals(
- CustomConstraint.ValidatorForSubClassA.callCounter,
- 1,
+ assertTrue(
+ CustomConstraint.ValidatorForSubClassA.callCounter > 0,
"The validate method of ValidatorForSubClassA should have been called."
);
}
@@ -118,14 +116,13 @@
assertEquals(
CustomConstraint.ValidatorForSubClassB.callCounter,
0,
- "The validate method of ValidatorForSubClassB should have been called yet."
+ "The validate method of ValidatorForSubClassB should not have been called yet."
);
validator.validate( new SubClassBHolder( new SubClassB() ) );
- assertEquals(
- CustomConstraint.ValidatorForSubClassB.callCounter,
- 1,
+ assertTrue(
+ CustomConstraint.ValidatorForSubClassB.callCounter > 0,
"The validate method of ValidatorForSubClassB should have been called."
);
}
15 years, 2 months