Revision: 9856
Author: ncha...@google.com
Date: Tue Mar 15 04:56:41 2011
Log: Test for compile failure if attributes don't match.
[JSR 303 TCK Result] 117 of 257 (45.53%) Pass with 14 Failures and 8 Errors.
Review at http://gwt-code-reviews.appspot.com/1384803
Review by: rchan...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=9856
Added:
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeTest.gwt.xml
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeValidatorFactory.java
Modified:
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionCompileTest.java
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
/trunk/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
=======================================
--- /dev/null
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeTest.gwt.xml
Tue Mar 15 04:56:41 2011
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit
2.0.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.1/distro-source/core/src/gwt-module.dtd">
+<!--
+ Copyright 2010 Google Inc.
+
+ 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.
+-->
+<module>
+ <inherits name="org.hibernate.jsr303.tck.tests.ValidationTck" />
+ <source path="">
+ <include name="*.java" />
+ <exclude name="*CompileTest.java" />
+ </source>
+ <replace-with
class="org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.OverriddenAttributesMustMatchInTypeValidatorFactory">
+ <when-type-is class="javax.validation.ValidatorFactory"/>
+ </replace-with>
+</module>
=======================================
--- /dev/null
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/OverriddenAttributesMustMatchInTypeValidatorFactory.java
Tue Mar 15 04:56:41 2011
@@ -0,0 +1,32 @@
+package org.hibernate.jsr303.tck.tests.constraints.constraintcomposition;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.validation.client.AbstractGwtValidatorFactory;
+import com.google.gwt.validation.client.GwtValidation;
+import com.google.gwt.validation.client.impl.AbstractGwtValidator;
+
+import
org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.ConstraintCompositionTest.DummyEntityWithZipCode;
+
+import javax.validation.Validator;
+
+/**
+ * {@link AbstractGwtValidatorFactory} implementation that uses
+ * {@link com.google.gwt.validation.client.GwtValidation GwtValidation}.
+ */
+public final class OverriddenAttributesMustMatchInTypeValidatorFactory
extends
+ AbstractGwtValidatorFactory {
+
+ /**
+ * Validator for
+ * {@link
ConstraintCompositionTest#testOverriddenAttributesMustMatchInType()}
+ */
+ @GwtValidation(value = {DummyEntityWithZipCode.class})
+ public static interface OverriddenAttributesMustMatchInTypeValidator
extends
+ Validator {
+ }
+
+ @Override
+ public AbstractGwtValidator createValidator() {
+ return GWT.create(OverriddenAttributesMustMatchInTypeValidator.class);
+ }
+}
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionCompileTest.java
Mon Feb 28 07:12:19 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionCompileTest.java
Tue Mar 15 04:56:41 2011
@@ -24,6 +24,7 @@
import org.hibernate.jsr303.tck.util.TckCompileTestCase;
+import javax.validation.ConstraintDefinitionException;
import javax.validation.UnexpectedTypeException;
/**
@@ -53,4 +54,30 @@
MustBeApplicableValidatorFactory.MustBeApplicableValidator.class,
Shoe.class);
}
-}
+
+ /**
+ * Replacement for
+ * {@link
ConstraintCompositionTest#testOverriddenAttributesMustMatchInType()}
+ *
+ * @throws UnableToCompleteException
+ */
+ public void testOverriddenAttributesMustMatchInType()
+ throws UnableToCompleteException {
+ UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
+ builder.expect(Type.ERROR, "Unable to create a validator for "
+
+ "org.hibernate.jsr303.tck.tests.constraints.constraintcomposition."
+ + "ConstraintCompositionTest.DummyEntityWithZipCode "
+ + "because The overriding type of a composite constraint must be "
+ + "identical to the overridden one. "
+ + "Expected int found class java.lang.String",
+ ConstraintDefinitionException.class);
+ builder.setLowestLogLevel(Type.INFO);
+ UnitTestTreeLogger testLogger = builder.createLogger();
+ assertModuleFails(
+ testLogger,
+ getFullyQaulifiedModuleName(getClass(),
+ "OverriddenAttributesMustMatchInTypeTest"),
+
OverriddenAttributesMustMatchInTypeValidatorFactory.OverriddenAttributesMustMatchInTypeValidator.class);
+ }
+
+}
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
Thu Mar 10 05:54:28 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/ConstraintCompositionGwtTest.java
Tue Mar 15 04:56:41 2011
@@ -55,11 +55,6 @@
public void testOnlySingleConstraintViolation() {
delegate.testOnlySingleConstraintViolation();
}
-
- @Failing(issue = 5799)
- public void testOverriddenAttributesMustMatchInType() {
- delegate.testOverriddenAttributesMustMatchInType();
- }
public void testPayloadPropagationInComposedConstraints() {
delegate.testPayloadPropagationInComposedConstraints();
=======================================
--- /trunk/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
Mon Feb 28 07:12:19 2011
+++ /trunk/user/test/org/hibernate/jsr303/tck/util/TckCompileTestCase.java
Tue Mar 15 04:56:41 2011
@@ -39,7 +39,7 @@
@Override
protected void gwtTearDown() throws Exception {
- BeanHelper.clearBeanHelpersForTests();
+ BeanHelper.clearBeanHelpersForTests();
super.gwtTearDown();
}
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors