Revision: 9262
Author: [email protected]
Date: Fri Nov 19 17:25:09 2010
Log: Public: Improve reporting of TCK failures
Review at http://gwt-code-reviews.appspot.com/1117801
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=9262
Added:
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/ConstraintApplicationGwtSuite.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/TckTest.gwt.xml
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/TckTestValidator.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/AbstractValidationTest.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/PropertyPathTest.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/TckTest.gwt.xml
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/TckTestValidator.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/ValidatePropertyTest.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/ValidateValueTest.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/ValidationGwtSuite.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory/ConstraintApplicationGwtSuite.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory/CustomConstraintValidatorTest.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory/TckTest.gwt.xml
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory/TckTestValidator.java
/trunk/user/src/com/google/gwt/validation/client/AbstractValidator.java
Deleted:
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/TckTestValidator.java
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/TckValidator.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/TckGwtSuite.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/ValidationTckTest.gwt.xml
Modified:
/trunk/samples/validationtck/build.xml
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/Tck.java
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/ValidationTck.gwt.xml
/trunk/samples/validationtck/src/org/hibernate/jsr303/tck/Jsr303Tck.gwt.xml
/trunk/samples/validationtck/src/org/hibernate/jsr303/tck/super/org/hibernate/jsr303/tck/util/TestUtil.java
/trunk/samples/validationtck/src/org/testng/TestNg.gwt.xml
/trunk/samples/validationtck/src/org/testng/super/org/testng/Assert.java
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/ValidationRequirementTest.java
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/ConstraintApplicationGwtSuite.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.sample.validationtck.constraints.application;
+
+import com.google.gwt.junit.tools.GWTTestSuite;
+
+import junit.framework.Test;
+
+/**
+ * Tck Tests for the {...@code constraints application} package.
+ */
+public class ConstraintApplicationGwtSuite {
+ public static Test suite() {
+ GWTTestSuite suite = new GWTTestSuite(
+ "TCK for GWT Validation, constraints application package");
+ suite.addTestSuite(ValidationRequirementTest.class);
+ return suite;
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/TckTest.gwt.xml
Fri Nov 19 17:25:09 2010
@@ -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="com.google.gwt.sample.validationtck.ValidationTck" />
+ <source path="">
+ <include name="*.java" />
+ <exclude name="super" />
+ </source>
+ <replace-with
class="com.google.gwt.sample.validationtck.constraints.application.TckTestValidator">
+ <when-type-is class="javax.validation.Validator"/>
+ </replace-with>
+</module>
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/TckTestValidator.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.sample.validationtck.constraints.application;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.validation.client.AbstractValidator;
+import com.google.gwt.validation.client.GwtValidation;
+
+import org.hibernate.jsr303.tck.tests.constraints.application.Building;
+import org.hibernate.jsr303.tck.tests.constraints.application.SuperWoman;
+import org.hibernate.jsr303.tck.tests.constraints.application.Visibility;
+import org.hibernate.jsr303.tck.tests.constraints.application.Woman;
+
+import javax.validation.Validator;
+
+/**
+ * {...@link Validator} implementation that uses
+ * {...@link com.google.gwt.validation.client.GwtValidation GwtValidation}.
+ */
+public final class TckTestValidator extends AbstractValidator {
+ /**
+ * Marker Interface for {...@link GWT#create(Class)}.
+ */
+ @GwtValidation(value = {
+ Building.class, SuperWoman.class, Visibility.class, Woman.class})
+ public static interface GwtValidator extends Validator {
+ }
+
+ public TckTestValidator() {
+ super((Validator) GWT.create(GwtValidator.class));
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/AbstractValidationTest.java
Fri Nov 19 17:25:09 2010
@@ -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.sample.validationtck.validation;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Abstract Validation test for the {...@code validation} package.
+ */
+public abstract class AbstractValidationTest extends GWTTestCase {
+
+ public AbstractValidationTest() {
+ super();
+ }
+
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.sample.validationtck.validation.TckTest";
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/PropertyPathTest.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.sample.validationtck.validation;
+
+/**
+ * Test wrapper for
+ * {...@link org.hibernate.jsr303.tck.tests.validation.PropertyPathTest}.
+ */
+public class PropertyPathTest extends AbstractValidationTest {
+
+ org.hibernate.jsr303.tck.tests.validation.PropertyPathTest delegate =
+ new org.hibernate.jsr303.tck.tests.validation.PropertyPathTest();
+
+ public void testPropertyPathSet() {
+ delegate.testPropertyPathSet();
+ }
+
+ public void testPropertyPathTraversedObject() {
+ delegate.testPropertyPathTraversedObject();
+ }
+
+ public void testPropertyPathWithArray() {
+ delegate.testPropertyPathWithArray();
+ }
+
+ public void testPropertyPathWithConstraintViolationForRootObject() {
+ delegate.testPropertyPathWithConstraintViolationForRootObject();
+ }
+
+ public void testPropertyPathWithList() {
+ delegate.testPropertyPathWithList();
+ }
+
+ public void testPropertyPathWithMap() {
+ delegate.testPropertyPathWithMap();
+ }
+
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/TckTest.gwt.xml
Fri Nov 19 17:25:09 2010
@@ -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="com.google.gwt.sample.validationtck.ValidationTck" />
+ <source path="">
+ <include name="*.java" />
+ <exclude name="super" />
+ </source>
+ <replace-with
class="com.google.gwt.sample.validationtck.validation.TckTestValidator">
+ <when-type-is class="javax.validation.Validator"/>
+ </replace-with>
+</module>
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/TckTestValidator.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.sample.validationtck.validation;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.validation.client.AbstractValidator;
+import com.google.gwt.validation.client.GwtValidation;
+
+import org.hibernate.jsr303.tck.tests.validation.Actor;
+import org.hibernate.jsr303.tck.tests.validation.BadlyBehavedEntity;
+import org.hibernate.jsr303.tck.tests.validation.Customer;
+import org.hibernate.jsr303.tck.tests.validation.Engine;
+
+import javax.validation.Validator;
+
+/**
+ * {...@link Validator} implementation that uses
+ * {...@link com.google.gwt.validation.client.GwtValidation GwtValidation}.
+ */
+public final class TckTestValidator extends AbstractValidator {
+ /**
+ * Marker Interface for {...@link GWT#create(Class)}.
+ */
+ @GwtValidation(value = {
+ Actor.class, BadlyBehavedEntity.class, Engine.class,
+ Customer.class})
+ public static interface GwtValidator extends Validator {
+ }
+
+ public TckTestValidator() {
+ super((Validator) GWT.create(GwtValidator.class));
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/ValidatePropertyTest.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.sample.validationtck.validation;
+
+import javax.validation.ValidationException;
+
+/**
+ * Test wrapper for
+ * {...@link org.hibernate.jsr303.tck.tests.validation.ValidatePropertyTest}.
+ */
+public class ValidatePropertyTest extends AbstractValidationTest {
+
+ private final
org.hibernate.jsr303.tck.tests.validation.ValidatePropertyTest delegate =
+ new org.hibernate.jsr303.tck.tests.validation.ValidatePropertyTest();
+
+ public void testIllegalArgumentExceptionIsThrownForNullValue() {
+ delegate.testIllegalArgumentExceptionIsThrownForNullValue();
+ }
+
+ public void testPassingNullAsGroup() {
+ delegate.testPassingNullAsGroup();
+ }
+
+ public void
testUnexpectedExceptionsInValidatePropertyGetWrappedInValidationExceptions()
{
+ // Wrap the test to catch the @Test expected exception.
+ try {
+
delegate.testUnexpectedExceptionsInValidatePropertyGetWrappedInValidationExceptions();
+ fail("Expected a " + ValidationException.class);
+ } catch (ValidationException expected) {
+ }
+ }
+
+ public void testValidateProperty() {
+ delegate.testValidateProperty();
+ }
+
+ public void testValidatePropertyWithEmptyProperty() {
+ delegate.testValidatePropertyWithEmptyProperty();
+ }
+
+ public void testValidatePropertyWithInvalidPropertyPath() {
+ delegate.testValidatePropertyWithInvalidPropertyPath();
+ }
+
+ public void testValidatePropertyWithNullProperty() {
+ delegate.testValidatePropertyWithNullProperty();
+ }
+
+ public void testValidIsNotHonoredValidateProperty() {
+ delegate.testValidIsNotHonoredValidateProperty();
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/ValidateValueTest.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,67 @@
+/*
+ * 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.sample.validationtck.validation;
+
+
+/**
+ * Test wrapper for
+ * {...@link org.hibernate.jsr303.tck.tests.validation.ValidateValueTest}.
+ */
+public class ValidateValueTest extends AbstractValidationTest {
+
+ private final
org.hibernate.jsr303.tck.tests.validation.ValidateValueTest delegate =
+ new org.hibernate.jsr303.tck.tests.validation.ValidateValueTest();
+
+ public void testExistingPropertyWoConstraintsNorCascaded() {
+ delegate.testExistingPropertyWoConstraintsNorCascaded();
+ }
+
+ public void testValidateValue() {
+ delegate.testValidateValue();
+ }
+
+ public void testValidateValueFailure() {
+ delegate.testValidateValueFailure();
+ }
+
+ public void testValidateValuePassingNullAsGroup() {
+ delegate.testValidateValuePassingNullAsGroup();
+ }
+
+ public void testValidateValueSuccess() {
+ delegate.testValidateValueSuccess();
+ }
+
+ public void testValidateValueWithEmptyPropertyPath() {
+ delegate.testValidateValueWithEmptyPropertyPath();
+ }
+
+ public void testValidateValueWithInvalidPropertyPath() {
+ delegate.testValidateValueWithInvalidPropertyPath();
+ }
+
+ public void testValidateValueWithNullObject() {
+ delegate.testValidateValueWithNullObject();
+ }
+
+ public void testValidateValueWithNullPropertyName() {
+ delegate.testValidateValueWithNullPropertyName();
+ }
+
+ public void testValidIsNotHonoredValidateValue() {
+ delegate.testValidIsNotHonoredValidateValue();
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validation/ValidationGwtSuite.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.sample.validationtck.validation;
+
+import com.google.gwt.junit.tools.GWTTestSuite;
+
+import junit.framework.Test;
+
+/**
+ * Tck Tests for the {...@code validation} package.
+ */
+public class ValidationGwtSuite {
+ public static Test suite() {
+ GWTTestSuite suite = new GWTTestSuite(
+ "TCK for GWT Validation, validation package");
+ suite.addTestSuite(PropertyPathTest.class);
+ suite.addTestSuite(ValidatePropertyTest.class);
+ suite.addTestSuite(ValidateValueTest.class);
+ return suite;
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory/ConstraintApplicationGwtSuite.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.sample.validationtck.validatorfactory;
+
+import com.google.gwt.junit.tools.GWTTestSuite;
+
+import junit.framework.Test;
+
+/**
+ * Tck Tests for the {...@code validatorfactory} package.
+ */
+public class ConstraintApplicationGwtSuite {
+ public static Test suite() {
+ GWTTestSuite suite = new GWTTestSuite(
+ "TCK for GWT Validation, validatorfactory package");
+ suite.addTestSuite(CustomConstraintValidatorTest.class);
+ return suite;
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory/CustomConstraintValidatorTest.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,44 @@
+/*
+ * 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.sample.validationtck.validatorfactory;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Wraps
+ * {...@link
org.hibernate.jsr303.tck.tests.constraints.customconstraint.CustomConstraintValidatorTest}
+ * .
+ */
+public class CustomConstraintValidatorTest extends GWTTestCase {
+
org.hibernate.jsr303.tck.tests.validatorfactory.CustomConstraintValidatorTest
delegate = new
org.hibernate.jsr303.tck.tests.validatorfactory.CustomConstraintValidatorTest();
+
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.sample.validationtck.validatorfactory.TckTest";
+ }
+
+ public void testDefaultConstructorInValidatorCalled() {
+ delegate.testDefaultConstructorInValidatorCalled();
+ }
+
+ public void testRuntimeExceptionInValidatorCreationIsWrapped() {
+ delegate.testRuntimeExceptionInValidatorCreationIsWrapped();
+ }
+
+ public void testValidationExceptionIsThrownInCaseFactoryReturnsNull() {
+ delegate.testValidationExceptionIsThrownInCaseFactoryReturnsNull();
+ }
+}
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory/TckTest.gwt.xml
Fri Nov 19 17:25:09 2010
@@ -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="com.google.gwt.sample.validationtck.ValidationTck" />
+ <source path="">
+ <include name="*.java" />
+ <exclude name="super" />
+ </source>
+ <replace-with
class="com.google.gwt.sample.validationtck.validatorfactory.TckTestValidator">
+ <when-type-is class="javax.validation.Validator"/>
+ </replace-with>
+</module>
=======================================
--- /dev/null
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/validatorfactory/TckTestValidator.java
Fri Nov 19 17:25:09 2010
@@ -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 com.google.gwt.sample.validationtck.validatorfactory;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.validation.client.AbstractValidator;
+import com.google.gwt.validation.client.GwtValidation;
+
+import
org.hibernate.jsr303.tck.tests.validatorfactory.CustomConstraintValidatorTest.Dummy;
+
+import javax.validation.Validator;
+
+/**
+ * {...@link Validator} implementation that uses
+ * {...@link com.google.gwt.validation.client.GwtValidation GwtValidation}.
+ */
+public final class TckTestValidator extends AbstractValidator {
+ /**
+ * Marker Interface for {...@link GWT#create(Class)}.
+ */
+ @GwtValidation(value = {Dummy.class})
+ public static interface GwtValidator extends Validator {
+ }
+
+ public TckTestValidator() {
+ super((Validator) GWT.create(GwtValidator.class));
+ }
+}
=======================================
--- /dev/null
+++ /trunk/user/src/com/google/gwt/validation/client/AbstractValidator.java
Fri Nov 19 17:25:09 2010
@@ -0,0 +1,84 @@
+/*
+ * 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.client;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.metadata.BeanDescriptor;
+
+/**
+ * Abstract {...@link Validator} that delegates to a GWT generated validator.
+ * <p>
+ * Extend this class create a default no arg constructor like.
+ *
+ * <pre>
+ * public class MyValidator {
+ * @GwtValidation(value = {Pojo.class,Other.class})
+ * public static interface GwtValidator extends Validator {
+ * }
+ *
+ * MyValidator() {
+ * super((Validator) GWT.create(GwtValidator.class));
+ * }
+ * }
+ * </pre>
+ * <p>
+ * Then add a line like this to your Gwt Module config (gwt.xml) file.
+ *
+ * <pre>
+ * <replace-with class="com.example.MyValidator.GwtValidator">
+ * <when-type-is class="javax.validation.Validator"/>
+ * </replace-with>
+ * </pre>
+ */
+public abstract class AbstractValidator implements Validator {
+
+ private final Validator validator;
+
+ /**
+ * Pass a GWT created {...@link Validator} to this constructor.
+ */
+ public AbstractValidator(Validator validator) {
+ super();
+ this.validator = validator;
+ }
+
+ public final BeanDescriptor getConstraintsForClass(Class<?> clazz) {
+ return validator.getConstraintsForClass(clazz);
+ }
+
+ public final <T> T unwrap(Class<T> type) {
+ return validator.unwrap(type);
+ }
+
+ public final <T> Set<ConstraintViolation<T>> validate(T object,
+ Class<?>... groups) {
+ return validator.validate(object, groups);
+ }
+
+ public final <T> Set<ConstraintViolation<T>> validateProperty(T object,
+ String propertyName, Class<?>... groups) {
+ return validator.validateProperty(object, propertyName, groups);
+ }
+
+ public final <T> Set<ConstraintViolation<T>> validateValue(Class<T>
beanType,
+ String propertyName, Object value,
+ Class<?>... groups) {
+ return validator.validateValue(beanType, propertyName, value,
groups);
+ }
+}
=======================================
---
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/TckTestValidator.java
Mon Nov 15 10:52:58 2010
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.sample.validationtck;
-
-import com.google.gwt.core.client.GWT;
-
-import java.util.Set;
-
-import javax.validation.ConstraintViolation;
-import javax.validation.Validator;
-import javax.validation.metadata.BeanDescriptor;
-
-/**
- * TCK implementation that uses
- * {...@link com.google.gwt.validation.client.GwtValidation GwtValidation}
- */
-public class TckTestValidator implements Validator {
-
- TckValidator validator = GWT.create(TckValidator.class);
-
- public BeanDescriptor getConstraintsForClass(Class<?> clazz) {
- return validator.getConstraintsForClass(clazz);
- }
-
- public <T> T unwrap(Class<T> type) {
- return validator.unwrap(type);
- }
-
- public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>...
groups) {
- return validator.validate(object, groups);
- }
-
- public <T> Set<ConstraintViolation<T>> validateProperty(T object,
- String propertyName, Class<?>... groups) {
- return validator.validateProperty(object, propertyName, groups);
- }
-
- public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType,
- String propertyName, Object value, Class<?>... groups) {
- return validator.validateValue(beanType, propertyName, value, groups);
- }
-}
=======================================
---
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/TckValidator.java
Tue Nov 16 11:22:38 2010
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.sample.validationtck;
-
-import com.google.gwt.validation.client.GwtValidation;
-
-import org.hibernate.jsr303.tck.tests.constraints.application.Building;
-import org.hibernate.jsr303.tck.tests.constraints.application.SuperWoman;
-import org.hibernate.jsr303.tck.tests.constraints.application.Woman;
-
-import javax.validation.Validator;
-
-/**
- * Top Level validator for the TCK tests
- */
-...@gwtvalidation(value = {
- Building.class,
- SuperWoman.class,
- Woman.class
- })
-public interface TckValidator extends Validator {
-}
=======================================
---
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/TckGwtSuite.java
Mon Nov 15 10:52:58 2010
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.sample.validationtck;
-
-import com.google.gwt.junit.tools.GWTTestSuite;
-import
com.google.gwt.sample.validationtck.constraints.application.ValidationRequirementTest;
-
-import junit.framework.Test;
-
-/**
- * All Tck Tests
- */
-public class TckGwtSuite {
-
- public static Test suite() {
- GWTTestSuite suite = new GWTTestSuite("TCK for GWT Validation");
- suite.addTestSuite(ValidationRequirementTest.class);
- // suite.addTestSuite(CustomConstraintValidatorTest.class);
- return suite;
- }
-}
=======================================
---
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/ValidationTckTest.gwt.xml
Mon Nov 15 10:52:58 2010
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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="com.google.gwt.sample.validationtck.ValidationTck" />
-
- <source path="">
- <exclude name="super" />
- </source>
- <entry-point class="com.google.gwt.sample.validationtck.Tck" />
-</module>
=======================================
--- /trunk/samples/validationtck/build.xml Mon Nov 15 10:52:58 2010
+++ /trunk/samples/validationtck/build.xml Fri Nov 19 17:25:09 2010
@@ -50,7 +50,7 @@
-->
<path id="test.extraclasspath">
<pathelement location="${gwt.build}/out/dev/bin-test" />
- <pathelement location="${gwt.dev.jar}" />
+ <pathelement location="${gwt.dev.jar}" />
<pathelement location="${gwt.build.lib}/gwt-user.jar" />
<path refid="sample.extraclasspath" />
</path>
@@ -64,24 +64,24 @@
<property name="gwt.junit.testcase.dev.includes"
value="${gwt.junit.testcase.includes}" />
<property name="gwt.junit.testcase.dev.excludes" value="" />
- <!--
+ <!--
Compiles the test code for this project
-->
- <target name="compile.tests"
+ <target name="compile.tests"
depends="compile.emma.if.enabled"
unless="compile.tests.complete">
- <mkdir dir="${javac.junit.out}" />
- <gwt.javac srcdir="test" excludes="com/google/gwt/langtest/**"
+ <mkdir dir="${javac.junit.out}" />
+ <gwt.javac srcdir="test" excludes="com/google/gwt/langtest/**"
destdir="${javac.junit.out}">
- <classpath>
- <pathelement location="${javac.out}" />
- <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
- <pathelement
location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
- <path refid="sample.extraclasspath" />
- <path refid="test.extraclasspath" />
- </classpath>
- </gwt.javac>
- </target>
+ <classpath>
+ <pathelement location="${javac.out}" />
+ <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" />
+ <pathelement
location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" />
+ <path refid="sample.extraclasspath" />
+ <path refid="test.extraclasspath" />
+ </classpath>
+ </gwt.javac>
+ </target>
<target name="tck"
@@ -94,13 +94,13 @@
<property.ensure name="distro.built" location="${gwt.dev.staging.jar}"
message="GWT must be built before performing any tests. This can
be fixed by running ant in the ${gwt.root} directory." />
<limit failonerror="true" hours="${test.timeout}">
- <parallel threadsPerProcessor="${gwt.threadsPerProcessor}"
+ <parallel threadsPerProcessor="${gwt.threadsPerProcessor}"
threadCount="${gwt.threadCount}">
- <!--
+ <!--
The remote targets must be run sequentially or BrowserManager will
queue
requests, which will cause some tests to timeout while waiting.
-->
- <!--sequential>
+ <!--sequential>
<antcall target="test.dev.remote"/>
<antcall target="test.emma.remote"/>
<antcall target="test.web.remote"/>
@@ -112,13 +112,26 @@
<antcall target="test.web.selenium"/>
<antcall target="test.draft.selenium"/>
<antcall target="test.nometa.selenium"/-->
- <antcall target="test.dev.htmlunit"/>
- <!--antcall target="test.emma.htmlunit"/>
+ <antcall target="test.dev.htmlunit"/>
+ <!--antcall target="test.emma.htmlunit"/>
<antcall target="test.web.htmlunit"/>
<antcall target="test.draft.htmlunit"/>
<antcall target="test.nometa.htmlunit"/-->
- </parallel>
+ </parallel>
</limit>
+
+
+ <mkdir dir="${junit.out}/tck-report"/>
+ <junitreport todir="${junit.out}/tck-report">
+ <fileset dir="${junit.out}">
+ <include name="*/reports/TEST-*.xml"/>
+ </fileset>
+ <report format="noframes" todir="${junit.out}/tck-report"/>
+ </junitreport>
+
+ <fail
+ message="One or more junit tests failed for target: @{test.name}
@{test.args}"
+ if="junit.failure" status="2" />
</target>
<target name="test.dev.htmlunit"
@@ -132,11 +145,15 @@
test.args="${test.args} -standardsMode "
test.jvmargs="${test.jvmargs}"
test.out="${junit.out}/dev-htmlunit"
- test.cases="test.dev.htmlunit.tests" >
+ test.cases="test.dev.htmlunit.tests"
+ haltonfailure="false"
+ >
<extraclasspaths>
<path refid="test.extraclasspath" />
</extraclasspaths>
</gwt.junit>
+
+
</target>
</project>
=======================================
---
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/Tck.java
Mon Nov 15 10:52:58 2010
+++
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/Tck.java
Fri Nov 19 17:25:09 2010
@@ -16,23 +16,15 @@
package com.google.gwt.sample.validationtck;
import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
-import org.hibernate.jsr303.tck.tests.constraints.application.Woman;
-
-import javax.validation.Validator;
-
/**
* Just a place holder Entry point.
*/
public class Tck implements EntryPoint {
public void onModuleLoad() {
- Validator validator = GWT.create(Validator.class);
- Woman w = new Woman();
- validator.validate(w);
Label label = new Label("tck");
RootPanel.get("view").add(label);
}
=======================================
---
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/ValidationTck.gwt.xml
Mon Nov 15 10:52:58 2010
+++
/trunk/samples/validationtck/src/com/google/gwt/sample/validationtck/ValidationTck.gwt.xml
Fri Nov 19 17:25:09 2010
@@ -23,7 +23,4 @@
<exclude name="super" />
</source>
<entry-point class="com.google.gwt.sample.validationtck.Tck" />
- <replace-with
class="com.google.gwt.sample.validationtck.TckTestValidator">
- <when-type-is class="javax.validation.Validator"/>
- </replace-with>
</module>
=======================================
---
/trunk/samples/validationtck/src/org/hibernate/jsr303/tck/Jsr303Tck.gwt.xml
Mon Nov 15 10:52:58 2010
+++
/trunk/samples/validationtck/src/org/hibernate/jsr303/tck/Jsr303Tck.gwt.xml
Fri Nov 19 17:25:09 2010
@@ -15,7 +15,6 @@
<exclude name="tests/bootstrap/" />
<exclude name="tests/constraints/builtinconstraints/" />
<exclude name="tests/messageinterpolation/" />
- <exclude name="tests/validation/" />
<exclude name="tests/xmlconfiguration/" />
<exclude name="util/StandaloneContainersImpl.java" />
</source>
=======================================
---
/trunk/samples/validationtck/src/org/hibernate/jsr303/tck/super/org/hibernate/jsr303/tck/util/TestUtil.java
Mon Nov 15 10:52:58 2010
+++
/trunk/samples/validationtck/src/org/hibernate/jsr303/tck/super/org/hibernate/jsr303/tck/util/TestUtil.java
Fri Nov 19 17:25:09 2010
@@ -19,8 +19,6 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.regexp.shared.MatchResult;
import com.google.gwt.regexp.shared.RegExp;
-import com.google.gwt.sample.validationtck.TckTestValidator;
-import com.google.gwt.sample.validationtck.TckValidator;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@@ -48,7 +46,7 @@
* <ul>
* <li>Use RegExp instead of Pattern</li>
* <li>Hard code the validator</li>
- * </ul>
+ * </ul>
* @author Hardy Ferentschik
*/
public final class TestUtil {
=======================================
--- /trunk/samples/validationtck/src/org/testng/TestNg.gwt.xml Mon Nov 15
10:52:58 2010
+++ /trunk/samples/validationtck/src/org/testng/TestNg.gwt.xml Fri Nov 19
17:25:09 2010
@@ -5,6 +5,7 @@
-->
<module>
<inherits name="com.google.gwt.user.User" />
+ <inherits name="com.google.gwt.junit.JUnit" />
<source path="annotations">
<exclude name="ITestAnnotation.java" />
<exclude name="Listeners.java" />
=======================================
---
/trunk/samples/validationtck/src/org/testng/super/org/testng/Assert.java
Mon Nov 15 10:52:58 2010
+++
/trunk/samples/validationtck/src/org/testng/super/org/testng/Assert.java
Fri Nov 19 17:25:09 2010
@@ -14,11 +14,12 @@
/**
* Assertion tool class. Presents assertion methods with a more natural
parameter order.
* The order is always <B>actualValue</B>, <B>expectedValue</B> [,
message].
- *
+ *
* <p>
* Modified by Google
* <ul>
* <li>Removed java.lang.reflect</li>
+ * <li>Delegate fail messages to junit</li>
* </ul>
*
* @author <a href='mailto:[email protected]'>Alexandru Popescu</a>
@@ -81,10 +82,14 @@
* @param realCause the original exception
*/
static public void fail(String message, Throwable realCause) {
- AssertionError ae = new AssertionError(message);
- ae.initCause(realCause);
-
- throw ae;
+ if(message == null){
+ if (realCause != null){
+ message = realCause.getMessage();
+ }
+ } else {
+ message = message + ": " + realCause.getMessage();
+ }
+ junit.framework.Assert.fail(message);
}
/**
@@ -92,7 +97,7 @@
* @param message the assertion error message
*/
static public void fail(String message) {
- throw new AssertionError(message);
+ junit.framework.Assert.fail(message);
}
/**
=======================================
---
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/ValidationRequirementTest.java
Mon Nov 15 10:52:58 2010
+++
/trunk/samples/validationtck/test/com/google/gwt/sample/validationtck/constraints/application/ValidationRequirementTest.java
Fri Nov 19 17:25:09 2010
@@ -20,6 +20,7 @@
/**
* Wraps
* {...@link
org.hibernate.jsr303.tck.tests.constraints.application.ValidationRequirementTest}
+ * .
*/
public class ValidationRequirementTest extends GWTTestCase {
org.hibernate.jsr303.tck.tests.constraints.application.ValidationRequirementTest
delegate =
@@ -27,7 +28,7 @@
@Override
public String getModuleName() {
- return "com.google.gwt.sample.validationtck.ValidationTckTest";
+
return "com.google.gwt.sample.validationtck.constraints.application.TckTest";
}
public void testClassLevelConstraints() {
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors