Revision: 9561
Author: ncha...@google.com
Date: Mon Jan 17 15:51:59 2011
Log: Add a @TestNotCompatible for tests where the test code is not GWT
compatible.
[JSR 303 TCK Result] 62 of 257 (24.12%) Pass with 27 Failures and 5 Errors.
Review at http://gwt-code-reviews.appspot.com/1298801
http://code.google.com/p/google-web-toolkit/source/detail?r=9561
Added:
/trunk/user/test/org/hibernate/jsr303/tck/util/client/TestNotCompatible.java
Modified:
/trunk/user/build.xml
/trunk/user/style/html/junit-noframes.xsl
/trunk/user/style/text/junit-noframes.xsl
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/ValidationGwtTest.java
/trunk/user/test/org/hibernate/jsr303/tck/util/TckTestSuiteWrapper.java
=======================================
--- /dev/null
+++
/trunk/user/test/org/hibernate/jsr303/tck/util/client/TestNotCompatible.java
Mon Jan 17 15:51:59 2011
@@ -0,0 +1,54 @@
+/*
+ * 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.util.client;
+
+import org.hibernate.jsr303.tck.util.TckTestSuiteWrapper;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Marks a testMethod as not compatible to prevent it from running in the
+ * standard tests. Use this when the test code is not supported by GWT,
but the
+ * behavior is tested in some other way. Used by the {@link
TckTestSuiteWrapper}
+ * .
+ */
+@Target({METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface TestNotCompatible {
+ /**
+ * Constants for why a test is not supported.
+ */
+ public enum Reason {
+ REFLECTION
+ }
+
+ /**
+ * The JVM property name checked by {@link TckTestSuiteWrapper}. If the
JVM
+ * property {@value} is set to true the {@link TckTestSuiteWrapper} will
run
+ * tests annotated {@link TestNotCompatible}.
+ */
+ String INCLUDE
= "com.google.gwt.sample.validationtck.util.TestNotCompatible.include";
+
+ Reason reason();
+
+ String whereTested();
+}
=======================================
--- /trunk/user/build.xml Mon Jan 17 09:08:08 2011
+++ /trunk/user/build.xml Mon Jan 17 15:51:59 2011
@@ -692,17 +692,19 @@
<countfilter match="@Failing" property="jsr303.marked.Failing"
init="0"/>
<countfilter match="@NonTckTest"
property="jsr303.marked.NonTckTest" init="0"/>
<countfilter match="@NotSupported"
property="jsr303.marked.NotSupported" init="0"/>
+ <countfilter match="@TestNotCompatible"
property="jsr303.marked.NotSupported" init="0"/>
</filterchain>
</scan>
<!-- force to zero if not set above -->
<property name="jsr303.marked.Failing" value="0"/>
<property name="jsr303.marked.NonTckTest" value="0"/>
- <property name="jsr303.marked.NotSupported" value="0"/>
+ <property name="jsr303.marked.TestNotCompatible" value="0"/>
<echo message="Marked Failing = ${jsr303.marked.Failing}" />
<echo message="Marked NonTckTest = ${jsr303.marked.NonTckTest}" />
<echo message="Marked NotSupported = ${jsr303.marked.NotSupported}"
/>
+ <echo message="Marked TestNotCompatible =
${jsr303.marked.TestNotCompatible}" />
<junitreport todir="${junit.out}/tck-report">
<fileset dir="${junit.out}/tck-dev-htmlunit">
@@ -712,11 +714,13 @@
<param name="markedFailing"
expression="${jsr303.marked.Failing}" />
<param name="markedNonTckTest"
expression="${jsr303.marked.NonTckTest}" />
<param name="markedNotSupported"
expression="${jsr303.marked.NotSupported}" />
+ <param name="markedTestNotCompatible"
expression="${jsr303.marked.TestNotCompatible}" />
</report>
<report format="noframes" todir="${junit.out}/tck-report/text"
styledir="style/text">
<param name="markedFailing"
expression="${jsr303.marked.Failing}" />
<param name="markedNonTckTest"
expression="${jsr303.marked.NonTckTest}" />
<param name="markedNotSupported"
expression="${jsr303.marked.NotSupported}" />
+ <param name="markedTestNotCompatible"
expression="${jsr303.marked.TestNotCompatible}" />
</report>
</junitreport>
=======================================
--- /trunk/user/style/html/junit-noframes.xsl Mon Jan 17 09:08:08 2011
+++ /trunk/user/style/html/junit-noframes.xsl Mon Jan 17 15:51:59 2011
@@ -34,6 +34,7 @@
<xsl:param name="markedFailing" />
<xsl:param name="markedNonTckTest" />
<xsl:param name="markedNotSupported" />
+<xsl:param name="markedTestNotCompatible" />
<xsl:template match="testsuites">
<html>
@@ -259,7 +260,7 @@
jar -xf jsr303-tck-1.0.3.GA-sources.jar
grep -r \@Test org/hibernate/jsr303/tck/tests/| grep -v "enabled
= false" | wc -l
-->
- <xsl:variable name="testCount" select="($rawTestCount -
$markedNotSupported)"/>
+ <xsl:variable name="testCount" select="($rawTestCount -
$markedNotSupported - $markedTestNotCompatible)"/>
<xsl:variable name="testExecutedCount"
select="sum(testsuite/@tests)"/>
<xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
<xsl:variable name="failureCount"
select="sum(testsuite/@failures)"/>
=======================================
--- /trunk/user/style/text/junit-noframes.xsl Mon Jan 17 09:08:08 2011
+++ /trunk/user/style/text/junit-noframes.xsl Mon Jan 17 15:51:59 2011
@@ -33,6 +33,8 @@
<xsl:param name="markedFailing" />
<xsl:param name="markedNonTckTest" />
<xsl:param name="markedNotSupported" />
+<xsl:param name="markedTestNotCompatible" />
+
<xsl:template match="testsuites">
<xsl:variable name="rawTestCount" select="258"/>
@@ -41,7 +43,7 @@
jar -xf jsr303-tck-1.0.3.GA-sources.jar
grep -r \@Test org/hibernate/jsr303/tck/tests/| grep -v "enabled =
false" | wc -l
-->
- <xsl:variable name="testCount" select="($rawTestCount -
$markedNotSupported)"/>
+ <xsl:variable name="testCount" select="($rawTestCount -
$markedNotSupported -$markedTestNotCompatible)"/>
<xsl:variable name="testExecutedCount" select="sum(testsuite/@tests)"/>
<xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
<xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
=======================================
---
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/ValidationGwtTest.java
Tue Jan 11 14:19:47 2011
+++
/trunk/user/test/org/hibernate/jsr303/tck/tests/validation/ValidationGwtTest.java
Mon Jan 17 15:51:59 2011
@@ -15,6 +15,9 @@
*/
package org.hibernate.jsr303.tck.tests.validation;
+import org.hibernate.jsr303.tck.util.client.TestNotCompatible;
+import org.hibernate.jsr303.tck.util.client.TestNotCompatible.Reason;
+
/**
* Test wrapper for {@link ValidationTest}.
*/
@@ -22,11 +25,6 @@
private final ValidationTest delegate = new ValidationTest();
- public void notGwtCompatibleTestVerifyMethodsOfValidationObjects() {
- // This test relies on reflection so it is not run.
- // delegate.testVerifyMethodsOfValidationObjects();
- }
-
public void testBuildDefaultValidatorFactory() {
delegate.testBuildDefaultValidatorFactory();
}
@@ -38,4 +36,11 @@
public void testSpecificValidationProvider() {
delegate.testSpecificValidationProvider();
}
-}
+
+ @TestNotCompatible(reason = Reason.REFLECTION,
+ whereTested = "This test checks the methods of the API itself, it
does not need to be tested here also.")
+ public void testVerifyMethodsOfValidationObjects() {
+ // This method is excluded because it does not compile.
+ // delegate.testVerifyMethodsOfValidationObjects();
+ }
+}
=======================================
--- /trunk/user/test/org/hibernate/jsr303/tck/util/TckTestSuiteWrapper.java
Tue Jan 11 14:19:47 2011
+++ /trunk/user/test/org/hibernate/jsr303/tck/util/TckTestSuiteWrapper.java
Mon Jan 17 15:51:59 2011
@@ -30,6 +30,7 @@
import org.hibernate.jsr303.tck.util.client.Failing;
import org.hibernate.jsr303.tck.util.client.NonTckTest;
import org.hibernate.jsr303.tck.util.client.NotSupported;
+import org.hibernate.jsr303.tck.util.client.TestNotCompatible;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -47,14 +48,17 @@
private static final Predicate<Method> HAS_FAILING =
createHasAnnotationPredicate(Failing.class);
private static final Predicate<Method> HAS_NON_TCK_TEST =
createHasAnnotationPredicate(NonTckTest.class);
private static final Predicate<Method> HAS_NOT_SUPPORTED =
createHasAnnotationPredicate(NotSupported.class);
+ private static final Predicate<Method> HAS_TEST_NOT_COMPATIBLE =
createHasAnnotationPredicate(TestNotCompatible.class);
private static final Predicate<Method> INCLUDE_FAILING =
createHasProperty(Failing.INCLUDE);
private static final Predicate<Method> INCLUDE_NOT_SUPPORTED =
createHasProperty(NotSupported.INCLUDE);
+ private static final Predicate<Method> INCLUDE_TEST_NOT_COMPATIBLE =
createHasProperty(TestNotCompatible.INCLUDE);
private static final Predicate<Method> EXCLUDE_NON_TCK_TEST =
createHasProperty(NonTckTest.EXCLUDE);
@SuppressWarnings("unchecked")
private static final Predicate<Method> METHOD_FILTER = and(
or(INCLUDE_NOT_SUPPORTED, not(HAS_NOT_SUPPORTED)),
+ or(INCLUDE_TEST_NOT_COMPATIBLE, not(HAS_TEST_NOT_COMPATIBLE)),
not(and(EXCLUDE_NON_TCK_TEST, HAS_NON_TCK_TEST)),
or(INCLUDE_FAILING, not(HAS_FAILING))
);
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors