[hibernate-issues] [Hibernate-JIRA] Commented: (HV-164) Add test for default group sequence isolation

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed May 27 11:15:15 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HV-164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33252#action_33252 ] 

Emmanuel Bernard commented on HV-164:
-------------------------------------

## test 4
@GroupSequence( {Minimal.class, A.class} )
public class A {
  @Max(value = 10, groups = Minimal.class) int size; 
  @Size(max=50) String name; //A group
  @Valid B b;
}

public class B {
  @SafeEncryption(groups = Heavy.class) String encryptionKey;
  @Size(max=50) String nickname; //B group
}

Need to think about this one

> Add test for default group sequence isolation
> ---------------------------------------------
>
>                 Key: HV-164
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-164
>             Project: Hibernate Validator
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 4.0.0.Beta1
>            Reporter: Emmanuel Bernard
>            Assignee: Hardy Ferentschik
>             Fix For: 4.0.0.Beta2
>
>
> public interface Minimal {}
> public interface Heavy {}
> ## test 1 - Rule D
> @GroupSequence( {Minimal.class, A.class} )
> public class A {
>   @Max(value = 10, groups = Minimal.class) int size;
>   @Size(max=50) String name; //A group
> }
> @GroupSequence( {B.class, Heavy.class} )
> public class B extends A {
>   @SafeEncryption(groups = Heavy.class) String encryptionKey;
>   @Size(max=50) String nickname; //B group
> }
> when validating Default.class on B, you need to validate sequentially:
>  - @Size on name and @Size on nickname (A is part of B)
>  - @SafeEncryption on encryptionKey
> note that @Max on size is not validated as it's not part of the sequence nor the group A
> ## test 2 - Rule D
> @GroupSequence( {Minimal.class, A.class} )
> public class A {
>   @Max(value = 10, groups = Minimal.class) int size;
>   @Size(max=50) String name; //A group
> }
> @GroupSequence( {Minimal.class, B.class, Heavy.class} )
> public class B extends A {
>   @SafeEncryption(groups = Heavy.class) String encryptionKey;
>   @Size(max=50) String nickname; //B group
> }
> when validating Default.class on B, you need to validate sequentially:
>  - @Max on size (Minnimal group)
>  - @Size on name and @Size on nickname (A is part of B)
>  - @SafeEncryption on encryptionKey
> ## test 3 Rules C1 and C2
> @GroupSequence( {Minimal.class, A.class} )
> public class A {
>   @Max(value = 10, groups = Minimal.class) int size; 
>   @Size(max=50) String name; //A group
> }
> public class B extends A {
>   @SafeEncryption(groups = Heavy.class) String encryptionKey;
>   @Size(max=50) String nickname; //B group
> }
> when validating Default.class on B, you need to validate sequentially:
>  - @Max on size (Minimal)
>  - @Size on name (A)
> and in // at any time @Size on nickname (B group). Note that B is not constrained by the group sequence defined by A, B contains A. @Size on nickname could fail but @Size on name will be validated. Likewise @Max on size could fail and @Size on nickname (A) will be validated (note that @Size on nickname (B) will not as it has to be validated only if Minimal constraints pass)
> All based on http://people.redhat.com/~ebernard/validation/#constraintdeclarationvalidationprocess-groupsequence-formaldefinition
> particularly
> C1, C2 and D

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list