Add more TCK tests [JSR 303 TCK Result] 125 of 257 (48.64%) Pass with 8 Failures and 9 Errors. Review at http://gwt-code-reviews.appspot.com/1451817 Review by: rchandia@google.com git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10325 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java b/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java index 3099b34..0c14f03 100644 --- a/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java +++ b/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
@@ -121,7 +121,7 @@ } private void writeContext(SourceWriter sw, BeanHelper bean, String objectName) { - // GwtValidationContext<T> context = new GwtValidationContext<T>( + // GwtValidationContext<MyBean> context = new GwtValidationContext<MyBean>( sw.print(GwtValidationContext.class.getSimpleName()); sw.print("<T> context = new "); sw.print(GwtValidationContext.class.getSimpleName());
diff --git a/user/test/com/google/gwt/validation/tck/ConstraintCompositionGwtSuite.java b/user/test/com/google/gwt/validation/tck/ConstraintCompositionGwtSuite.java index 6f75797..4ee69a1 100644 --- a/user/test/com/google/gwt/validation/tck/ConstraintCompositionGwtSuite.java +++ b/user/test/com/google/gwt/validation/tck/ConstraintCompositionGwtSuite.java
@@ -19,6 +19,7 @@ import org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.ConstraintCompositionCompileTest; import org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.ConstraintCompositionGwtTest; +import org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition.NestedConstraintCompositionTest; import org.hibernate.jsr303.tck.util.TckTestSuiteWrapper; /** @@ -30,6 +31,7 @@ "TCK for GWT Validation, constraints composition package"); suite.addTestSuite(ConstraintCompositionCompileTest.class); suite.addTestSuite(ConstraintCompositionGwtTest.class); + suite.addTestSuite(NestedConstraintCompositionTest.class); return suite; } }
diff --git a/user/test/com/google/gwt/validation/tck/ConstraintDefinitionsGwtSuite.java b/user/test/com/google/gwt/validation/tck/ConstraintDefinitionsGwtSuite.java new file mode 100644 index 0000000..b86fc35 --- /dev/null +++ b/user/test/com/google/gwt/validation/tck/ConstraintDefinitionsGwtSuite.java
@@ -0,0 +1,33 @@ +/* + * 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. + */ +package com.google.gwt.validation.tck; + +import junit.framework.Test; + +import org.hibernate.jsr303.tck.tests.constraints.constraintdefinition.ConstraintDefinitionsGwtTest; +import org.hibernate.jsr303.tck.util.TckTestSuiteWrapper; + +/** + * Tck Tests for the {@code constraints definition} package. + */ +public class ConstraintDefinitionsGwtSuite { + public static Test suite() { + TckTestSuiteWrapper suite = new TckTestSuiteWrapper( + "TCK for GWT Validation, constraints definition package"); + suite.addTestSuite(ConstraintDefinitionsGwtTest.class); + return suite; + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/NestedConstraintCompositionGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/NestedConstraintCompositionGwtTest.java new file mode 100644 index 0000000..52f1d40 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/NestedConstraintCompositionGwtTest.java
@@ -0,0 +1,48 @@ +/* + * 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. + */ +package org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition; + +import com.google.gwt.junit.client.GWTTestCase; + +/** + * Test wrapper for {@link NestedConstraintCompositionTest}. + */ +public class NestedConstraintCompositionGwtTest extends GWTTestCase { + + private NestedConstraintCompositionTest delegate = new NestedConstraintCompositionTest(); + + + @Override + public String getModuleName() { + return "org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition.TckTest"; + } + + public void testCompositeConstraint1WithNestedConstraintSingleViolation() { + delegate.testCompositeConstraint1WithNestedConstraintSingleViolation(); + } + + public void testCompositeConstraint2WithNestedConstraintSingleViolation() { + delegate.testCompositeConstraint2WithNestedConstraintSingleViolation(); + } + + public void testCompositeConstraint3WithNestedConstraint() { + delegate.testCompositeConstraint3WithNestedConstraint(); + } + + public void testCompositeConstraint4WithNestedConstraintSingleViolation() { + delegate.testCompositeConstraint4WithNestedConstraintSingleViolation(); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/TckTest.gwt.xml b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/TckTest.gwt.xml new file mode 100644 index 0000000..00310d5 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/TckTest.gwt.xml
@@ -0,0 +1,26 @@ +<?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" /> + </source> + <replace-with class="org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition.TckTestValidatorFactory"> + <when-type-is class="javax.validation.ValidatorFactory"/> + </replace-with> +</module> \ No newline at end of file
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/TckTestValidatorFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/TckTestValidatorFactory.java new file mode 100644 index 0000000..4fd690d --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintcomposition/nestedconstraintcomposition/TckTestValidatorFactory.java
@@ -0,0 +1,50 @@ +/* + * 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. + */ +package org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition; + +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.nestedconstraintcomposition.NestedConstraintCompositionTest.DummyEntity1; +import org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition.NestedConstraintCompositionTest.DummyEntity2; +import org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition.NestedConstraintCompositionTest.DummyEntity3; +import org.hibernate.jsr303.tck.tests.constraints.constraintcomposition.nestedconstraintcomposition.NestedConstraintCompositionTest.DummyEntity4; + +import javax.validation.Validator; + +/** + * {@link AbstractGwtValidatorFactory} implementation that uses + * {@link com.google.gwt.validation.client.GwtValidation GwtValidation}. + */ +public final class TckTestValidatorFactory extends AbstractGwtValidatorFactory { + /** + * Marker Interface for {@link GWT#create(Class)}. + */ + @GwtValidation(value = { + DummyEntity1.class, DummyEntity2.class, DummyEntity3.class, + DummyEntity4.class + + }) + public static interface GwtValidator extends Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(GwtValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsGwtTest.java new file mode 100644 index 0000000..193eb29 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/ConstraintDefinitionsGwtTest.java
@@ -0,0 +1,52 @@ +/* + * 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. + */ +package org.hibernate.jsr303.tck.tests.constraints.constraintdefinition; + +import com.google.gwt.junit.client.GWTTestCase; + +import org.hibernate.jsr303.tck.util.client.Failing; +import org.hibernate.jsr303.tck.util.client.NonTckTest; + +/** + * Test wrapper for {@link ConstraintDefinitionsTest}. + */ +public class ConstraintDefinitionsGwtTest extends GWTTestCase { + + // TODO(nchalko) Generating Person validator fails. + // see http://code.google.com/p/google-web-toolkit/issues/detail?id=6284 + // private ConstraintDefinitionsTest deleagete = new + // ConstraintDefinitionsTest(); + + @Override + public String getModuleName() { + return "org.hibernate.jsr303.tck.tests.constraints.constraintdefinition.TckTest"; + } + + @Failing(issue = 6284) + public void testConstraintWithCustomAttributes() { + fail(); + // deleagete.testConstraintWithCustomAttributes(); + } + + @Failing(issue = 6284) + public void testDefaultGroupAssumedWhenNoGroupsSpecified() { + fail(); + // deleagete.testDefaultGroupAssumedWhenNoGroupsSpecified(); + } + + @NonTckTest + public void testThereMustBeOnePassingTest(){} +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/TckTest.gwt.xml b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/TckTest.gwt.xml new file mode 100644 index 0000000..5d35b77 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/TckTest.gwt.xml
@@ -0,0 +1,26 @@ +<?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" /> + </source> + <replace-with class="org.hibernate.jsr303.tck.tests.constraints.constraintdefinition.TckTestValidatorFactory"> + <when-type-is class="javax.validation.ValidatorFactory"/> + </replace-with> +</module> \ No newline at end of file
diff --git a/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/TckTestValidatorFactory.java b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/TckTestValidatorFactory.java new file mode 100644 index 0000000..0bc110e --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/constraints/constraintdefinition/TckTestValidatorFactory.java
@@ -0,0 +1,41 @@ +/* + * 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. + */ +package org.hibernate.jsr303.tck.tests.constraints.constraintdefinition; + +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 javax.validation.Validator; + +/** + * {@link AbstractGwtValidatorFactory} implementation that uses + * {@link com.google.gwt.validation.client.GwtValidation GwtValidation}. + */ +public final class TckTestValidatorFactory extends AbstractGwtValidatorFactory { + /** + * Marker Interface for {@link GWT#create(Class)}. + */ + @GwtValidation(value = {Person.class}) + public static interface GwtValidator extends Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(GwtValidator.class); + } +}