[hibernate-commits] Hibernate SVN: r17519 - in beanvalidation/trunk/validation-tck/src/main: resources and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Sep 15 15:03:34 EDT 2009


Author: hardy.ferentschik
Date: 2009-09-15 15:03:34 -0400 (Tue, 15 Sep 2009)
New Revision: 17519

Modified:
   beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/GroupSequenceIsolationTest.java
   beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
Log:
HV-225

Modified: beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/GroupSequenceIsolationTest.java
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/GroupSequenceIsolationTest.java	2009-09-15 18:01:59 UTC (rev 17518)
+++ beanvalidation/trunk/validation-tck/src/main/java/org/hibernate/jsr303/tck/tests/constraints/groups/groupsequenceisolation/GroupSequenceIsolationTest.java	2009-09-15 19:03:34 UTC (rev 17519)
@@ -47,7 +47,8 @@
 	@SpecAssertions({
 			@SpecAssertion(section = "3.4.3", id = "a"),
 			@SpecAssertion(section = "3.4.3", id = "b"),
-			@SpecAssertion(section = "3.4.3", id = "c")
+			@SpecAssertion(section = "3.4.3", id = "c"),
+			@SpecAssertion(section = "3.4.5", id = "a")
 	})
 	public void testCorrectDefaultSequenceInheritance() {
 		Validator validator = TestUtil.getValidatorUnderTest();
@@ -84,7 +85,8 @@
 	@SpecAssertions({
 			@SpecAssertion(section = "3.4.3", id = "a"),
 			@SpecAssertion(section = "3.4.3", id = "b"),
-			@SpecAssertion(section = "3.4.3", id = "c")
+			@SpecAssertion(section = "3.4.3", id = "c"),
+			@SpecAssertion(section = "3.4.5", id = "a")
 	})
 	public void testCorrectDefaultSequenceInheritance2() {
 		Validator validator = TestUtil.getValidatorUnderTest();
@@ -123,6 +125,7 @@
 	}
 
 	@Test
+	@SpecAssertion(section = "3.4.5", id = "b")
 	public void testCorrectDefaultSequenceInheritance3() {
 		Validator validator = TestUtil.getValidatorUnderTest();
 		B3 b = new B3();
@@ -135,14 +138,28 @@
 		assertCorrectNumberOfViolations( violations, 2 );
 		assertCorrectConstraintTypes( violations, Max.class, Size.class );
 		assertCorrectPropertyPaths( violations, "size", "nickname" );
+
+		b.nickname = "nick";
+		violations = validator.validate( b );
+		assertCorrectNumberOfViolations( violations, 1 );
+		assertCorrectConstraintTypes( violations, Max.class );
+		assertCorrectPropertyPaths( violations, "size" );
+
+		b.size = 10;
+		violations = validator.validate( b );
+		assertCorrectNumberOfViolations( violations, 1 );
+		assertCorrectConstraintTypes( violations, Size.class );
+		assertCorrectPropertyPaths( violations, "name" );
+
+		b.nickname = "and this nickname as well";
+		violations = validator.validate( b );
+		assertCorrectNumberOfViolations( violations, 2 );
+		assertCorrectConstraintTypes( violations, Size.class, Size.class );
+		assertCorrectPropertyPaths( violations, "name", "nickname" );
 	}
 
 	@Test
-	@SpecAssertions({
-			@SpecAssertion(section = "3.4.3", id = "a"),
-			@SpecAssertion(section = "3.4.3", id = "b"),
-			@SpecAssertion(section = "3.4.3", id = "c")
-	})
+	@SpecAssertion(section = "3.5.1", id = "e")
 	public void testCorrectDefaultSequenceContainedCaseWithoutGroupRedefinitionOnContainedEntity() {
 		Validator validator = TestUtil.getValidatorUnderTest();
 		C c = new C();
@@ -174,6 +191,7 @@
 	}
 
 	@Test
+	@SpecAssertion(section = "3.5.1", id = "e")
 	public void testCorrectDefaultSequenceContainedCaseWithGroupRedefinitionOnContainedEntity() {
 		Validator validator = TestUtil.getValidatorUnderTest();
 		E e = new E();

Modified: beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml	2009-09-15 18:01:59 UTC (rev 17518)
+++ beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml	2009-09-15 19:03:34 UTC (rev 17519)
@@ -137,7 +137,7 @@
         </assertion>
         <assertion id="p">
             <text>Any payload definition on a composing annotation is ignored</text>
-        </assertion>      
+        </assertion>
     </section>
     <section id="2.4" title="Constraint validation implementation">
         <assertion id="a">
@@ -207,8 +207,8 @@
                 builder fluent API.</text>
         </assertion>
         <assertion id="r">
-            <text>If disableDefaultError is called, no custom error is added (using the error builder)
-                and if the constraint is not valid, a ValidationException is raised.</text>
+            <text>If disableDefaultError is called, no custom error is added (using the error
+                builder) and if the constraint is not valid, a ValidationException is raised.</text>
         </assertion>
     </section>
     <section id="2.5" title="The ConstraintValidatorFactory">
@@ -428,6 +428,18 @@
                 (implicitly or explicitly) belongs to the group Z</text>
         </assertion>
     </section>
+    <section id="3.4.5" title="Formal group definitions">
+        <assertion id="a">
+            <text>If a class does have a @GroupSequence annotation, the group Default contains every
+                constraint belonging to every group declared by the @GroupSequence
+                annotation.</text>
+        </assertion>
+        <assertion id="b">
+            <text>If class X has no @GroupSequence annotation, the group Default contains every
+                constraint in the group X and if X has a direct superclass Y, every constraint in
+                the group Default of Y this rule</text>
+        </assertion>
+    </section>
     <section id="3.5" title="Validation routine">
         <assertion id="a" testable="false">
             <text>For a given group to validate, the validation routine applied on a given bean
@@ -460,6 +472,11 @@
                 cascading operation if the associated object instance has already been validated in
                 the current navigation path (starting from the root object)</text>
         </assertion>
+        <assertion id="e">
+            <text>@Valid is an orthogonal concept to the notion of group. If two groups are in
+                sequence, the first group must pass for all associated objects before the second
+                group is evaluated.</text>
+        </assertion>
     </section>
     <section id="3.5.2" title="Traversable property">
         <assertion id="a">
@@ -943,7 +960,7 @@
         <assertion id="c">
             <text>getConstraintsForProperty throws an IllegalArgumentException if the propertyName
                 parameter is null</text>
-        </assertion>        
+        </assertion>
     </section>
     <section id="5.4" title="PropertyDescriptor">
         <assertion id="a">
@@ -951,7 +968,7 @@
         </assertion>
         <assertion id="b">
             <text>getPropertyName returns the property name</text>
-        </assertion>        
+        </assertion>
     </section>
     <section id="5.5" title="ConstraintDescriptor">
         <assertion id="a">
@@ -1165,8 +1182,8 @@
                 constraints.</text>
         </assertion>
         <assertion id="e">
-            <text>The only way to disable cascading on a property marked as @Valid is to
-                use ignore-annotations=true</text>
+            <text>The only way to disable cascading on a property marked as @Valid is to use
+                ignore-annotations=true</text>
         </assertion>
         <assertion id="f">
             <text>If the name of the property does not correspond to a property in the given bean a
@@ -1235,8 +1252,8 @@
         <assertion id="a">
             <text>Every (runtime) exception raised either at initialization time or execution time
                 by any of the extension interfaces (ConstraintValidator, ConstraintValidatorFactory,
-                MessageInterpolator, TraversableResolver, ValidationProviderResolver) is wrapped
-                in a ValidationException</text>
+                MessageInterpolator, TraversableResolver, ValidationProviderResolver) is wrapped in
+                a ValidationException</text>
         </assertion>
     </section>
     <section id="8.2" title="ConstraintDefinitionException">



More information about the hibernate-commits mailing list