Revision: 9834
Author: ncha...@google.com
Date: Wed Mar  9 12:43:13 2011
Log: Handle custom constraint violation messages.
[JSR 303 TCK Result] 110 of 257 (42.80%) Pass with 20 Failures and 9 Errors.

Review at http://gwt-code-reviews.appspot.com/1379801

Review by: rchan...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=9834

Modified:
/trunk/user/src/com/google/gwt/validation/client/impl/ConstraintValidatorContextImpl.java /trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java

=======================================
--- /trunk/user/src/com/google/gwt/validation/client/impl/ConstraintValidatorContextImpl.java Fri Sep 3 12:24:52 2010 +++ /trunk/user/src/com/google/gwt/validation/client/impl/ConstraintValidatorContextImpl.java Wed Mar 9 12:43:13 2011
@@ -58,6 +58,7 @@
     }

     public ConstraintValidatorContext addConstraintViolation() {
+      messages.add(new MessageAndPath(context.basePath, messageTemplate));
       return context;
     }

@@ -180,7 +181,8 @@
   private final ConstraintDescriptor<A> descriptor;

   private boolean disableDefault;
- private Set<ConstraintViolation<T>> violations = new HashSet<ConstraintViolation<T>>(); + private final Set<ConstraintViolation<T>> violations = new HashSet<ConstraintViolation<T>>(); + private final HashSet<MessageAndPath> messages = new HashSet<MessageAndPath>();

   public ConstraintValidatorContextImpl(PathImpl path,
       ConstraintDescriptor<A> descriptor) {
@@ -205,10 +207,10 @@
   }

   public Set<MessageAndPath> getMessageAndPaths() {
-    // TODO handle custom.
-    HashSet<MessageAndPath> messages = new HashSet<MessageAndPath>();
-    messages.add(new MessageAndPath(this.basePath,
-        this.getDefaultConstraintMessageTemplate()));
+    if (!disableDefault) {
+      messages.add(new MessageAndPath(this.basePath, this
+          .getDefaultConstraintMessageTemplate()));
+    }
     return messages;
   }

=======================================
--- /trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java Wed Mar 9 11:40:23 2011 +++ /trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java Wed Mar 9 12:43:13 2011
@@ -43,6 +43,7 @@
     delegate.testComposedConstraintsAreRecursive();
   }

+  @Failing(issue = 5799)
   public void testEachFailingConstraintCreatesConstraintViolation() {
     delegate.testEachFailingConstraintCreatesConstraintViolation();
   }
@@ -65,7 +66,6 @@
     delegate.testPayloadPropagationInComposedConstraints();
   }

-  @Failing(issue = 5799)
   public void testValidationOfMainAnnotationIsAlsoApplied() {
     delegate.testValidationOfMainAnnotationIsAlsoApplied();
   }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to