Move the TCK report task to user/build.xml and
delete samples/validationtck

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

Review by: rchandia@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9559 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/common.ant.xml b/common.ant.xml
index a62cce3..ea0d870 100755
--- a/common.ant.xml
+++ b/common.ant.xml
@@ -128,6 +128,15 @@
       <pathelement location="${gwt.tools.antlib}/ant-contrib-1.0b3.jar" />
     </classpath>
   </taskdef>
+  
+  
+  <!-- Pulls in tasks defined in antcount, i.e. countfilter -->
+  <taskdef resource="net/sf/antcount/antlib.xml">
+    <classpath>
+      <pathelement location="${gwt.tools.antlib}/antcount-1.2.jar" />
+    </classpath>
+  </taskdef>
+  
 
   <!-- Global Custom Tasks -->
   <presetdef name="gwt.ant">
diff --git a/samples/validationtck/README.txt b/samples/validationtck/README.txt
deleted file mode 100644
index f6fe5e8..0000000
--- a/samples/validationtck/README.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-This is not actually a sample.  
-It is a GWT HACK to run the JSR 303 Technology Compatibility Kit.
-
-See
-http://docs.jboss.org/hibernate/stable/beanvalidation/tck/reference/html_single/
-
-from this dir run
-ant tck
-
-A html report will be generated.
-
diff --git a/samples/validationtck/build.xml b/samples/validationtck/build.xml
deleted file mode 100755
index 67094c5..0000000
--- a/samples/validationtck/build.xml
+++ /dev/null
@@ -1,212 +0,0 @@
-<project name="validationtck" default="build" basedir=".">
-  <property name="sample.root" value="validationtck" />
-  <property name="sample.module" value="ValidationTck" />
-  <property name="sample.path" value="src" />
-  <property name="test.args" value="-ea" />
-  <property name="test.jvmargs" value="-ea -Dcom.google.gwt.sample.validationtck.util.Failing.include=true  -Dcom.google.gwt.sample.validationtck.util.NonTckTest.exclude=true" />
-  <import file="../common.ant.xml" />
-
-  <!-- these are after the common.ant.xml so they have gwt.tools etc. -->
-  <path id="sample.extraclasspath">
-    <pathelement location="${gwt.tools.lib}/apache/log4j/log4j-1.2.16.jar" />
-    <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" />
-    <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar" />
-    <pathelement location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final.jar" />
-    <pathelement location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final-sources.jar" />
-    <pathelement location="${gwt.tools.lib}/slf4j/slf4j-api/slf4j-api-1.6.1.jar" />
-    <pathelement location="${gwt.tools.lib}/slf4j/slf4j-log4j12/slf4j-log4j12-1.6.1.jar" />
-    <!-- TCK jars -->
-    <pathelement location="${gwt.tools.lib}/hibernate/validator/tck/jsr303-tck-1.0.3.GA-sources.jar" />
-    <pathelement location="${gwt.tools.lib}/hibernate/validator/tck/jsr303-tck-1.0.3.GA.jar" />
-    <pathelement location="${gwt.tools.lib}/jboss/test-audit/jboss-test-audit-api-1.0.0-sources.jar" />
-    <pathelement location="${gwt.tools.lib}/jboss/test-audit/jboss-test-audit-api-1.0.0.jar" />
-    <pathelement location="${gwt.tools.lib}/jboss/test-harness/jboss-test-harness-1.0.0-sources.jar" />
-    <pathelement location="${gwt.tools.lib}/jboss/test-harness/jboss-test-harness-1.0.0.jar" />
-    <pathelement location="${gwt.tools.lib}/jboss/test-harness/jboss-test-harness-api-1.0.0-sources.jar" />
-    <pathelement location="${gwt.tools.lib}/jboss/test-harness/jboss-test-harness-api-1.0.0.jar" />
-    <pathelement location="${gwt.tools.lib}/testng/testng-5.14.1-sources.jar" />
-    <pathelement location="${gwt.tools.lib}/testng/testng-5.14.1.jar" />
-    <!-- Needed for JDK 1.5-->
-    <pathelement location="${gwt.tools.lib}/javax/activation/activation-1.1.jar" />
-    <pathelement location="${gwt.tools.lib}/javax/xml/bind/jaxb-api-2.1.jar" />
-    <pathelement location="${gwt.tools.lib}/sun/jaxb/jaxb-impl-2.1.3.jar" />
-    <pathelement location="${gwt.tools.lib}/javax/xml/stream/stax-api-1.0-2.jar" />
-  </path>
-  <fileset id="sample.server.libs" dir="${gwt.tools.lib}">
-    <include name="hibernate/validator/hibernate-validator-4.1.0.Final.jar" />
-    <include name="apache/log4j/log4j-1.2.16.jar" />
-    <include name="slf4j/slf4j-api/slf4j-api-1.6.1.jar" />
-    <include name="slf4j/slf4j-log4j12/slf4j-log4j12-1.6.1.jar" />
-    <!-- Needed for JDK 1.5-->
-    <include name="javax/activation/activation-1.1.jar" />
-    <include name="javax/xml/bind/jaxb-api-2.1.jar" />
-    <include name="sun/jaxb/jaxb-impl-2.1.3.jar" />
-    <include name="javax/xml/stream/stax-api-1.0-2.jar" />
-  </fileset>
-
-
-  <!--
-    Classpaths added for test cases
-  -->
-  <path id="test.extraclasspath">
-    <pathelement location="${gwt.build}/out/dev/bin-test" />
-    <pathelement location="${gwt.dev.jar}" />
-    <pathelement location="${gwt.build.lib}/gwt-user.jar" />
-    <path refid="sample.extraclasspath" />
-  </path>
-
-
-  <property name="test.timeout" value="4" />
-  <property name="emma.merged.out" value="${junit.out}/emma-coverage" />
-  <property name="gwt.junit.testcase.web.includes" value="${gwt.junit.testcase.includes}" />
-  <property name="gwt.junit.testcase.web.excludes" value="" />
-  <property name="gwt.junit.testcase.dev.includes" value="org/hibernate/jsr303/tck/tests/**/*GwtSuite.class" />
-  <property name="gwt.junit.testcase.dev.excludes" value="org/hibernate/jsr303/tck/util/*.class" />
-
-  <!--
-        Compiles the test code for this project
-    -->
-  <target name="compile.tests"
-        depends="compile.emma.if.enabled"
-        unless="compile.tests.complete">
-    <mkdir dir="${javac.junit.out}" />
-    <gwt.javac srcdir="test" excludes="**/super/**"
-          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>
-
-
-  <!-- TODO(nchalko) move the tck target to user/build.xml and then delete
-       all of samples/validaitontck -->
-  <target name="tck"
-      depends="tck.run,tck.report"
-      description="Run all tests for this project.">
-    <fail
-        message="One or more junit tests failed for target: @{test.name} @{test.args}"
-        if="junit.failure" status="2" />
-  </target>
-
-  <target name="tck.run"
-      depends="compile, compile.tests"
-      description="Run all tests for this project.">
-    <!-- Prevent compilation for every target. -->
-    <property name="compile.complete" value="true"/>
-    <property name="compile.tests.complete" value="true"/>
-
-    <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}"
-        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>
-        <antcall target="test.dev.remote"/>
-        <antcall target="test.emma.remote"/>
-        <antcall target="test.web.remote"/>
-        <antcall target="test.draft.remote"/>
-        <antcall target="test.nometa.remote"/>
-      </sequential>
-      <antcall target="test.dev.selenium"/>
-      <antcall target="test.emma.selenium"/>
-      <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.web.htmlunit"/>
-      <antcall target="test.draft.htmlunit"/>
-      <antcall target="test.nometa.htmlunit"/-->
-      </parallel>
-    </limit>
-
-    <fail
-        message="One or more junit tests failed for target: @{test.name} @{test.args}"
-        if="junit.failure" status="2" />
-  </target>
-
-  <macrodef name="countMarkedTests">
-    <attribute name="annotation" default="NOT SET" />
-    <attribute name="outputproperty" default="jsr303.marked.@{annotation}" />
-    <sequential>
-      <!--TODO(nchalko) find a way to count annotations in windows -->
-      <exec dir="${basedir}"
-          executable="${basedir}/countMarkedTests.sh"
-          outputproperty="@{outputproperty}"
-          os="Mac OS X,Linux"
-          >
-        <arg line="@{annotation}" />
-      </exec>
-    </sequential>
-  </macrodef>
-
-  <target name="tck.report">
-    <mkdir dir="${junit.out}/tck-report" />
-    <mkdir dir="${junit.out}/tck-report/text" />
-    
-    <!-- Greping for annotation currently only works on OS X and Linux -->
-    <!-- The reports will still run but the total count will not be reduced -->
-    <countMarkedTests annotation="Failing" />
-    <countMarkedTests annotation="NonTckTest" />
-    <countMarkedTests annotation="NotSupported" />
-    
-    <echo message="Marked Failing = ${jsr303.marked.Failing}" />
-    <echo message="Marked NonTckTest = ${jsr303.marked.NonTckTest}" />
-    <echo message="Marked NotSupported = ${jsr303.marked.NotSupported}" />
-    
-    <junitreport todir="${junit.out}/tck-report">
-      <fileset dir="${junit.out}">
-        <include name="*/reports/TEST-*.xml" />
-      </fileset>
-      <report format="noframes" todir="${junit.out}/tck-report" styledir="style/html">
-        <param name="markedFailing" expression="${jsr303.marked.Failing}" />
-        <param name="markedNonTckTest" expression="${jsr303.marked.NonTckTest}" />
-        <param name="markedNotSupported" expression="${jsr303.marked.NotSupported}" />
-      </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}" />
-      </report>
-    </junitreport>
-
-    <concat taskname="JSR 303 TCK Result">
-      <filelist>
-        <file name="${junit.out}/tck-report/text/junit-noframes.html" />
-      </filelist>
-    </concat>
-
-  </target>
-
-  <target name="test.dev.htmlunit"
-      depends="compile, compile.tests"
-      description="Run dev-mode tests with HtmlUnit."
-      unless="test.dev.htmlunit.disable">
-    <fileset id="test.dev.htmlunit.tests" dir="${javac.junit.out}"
-        includes="${gwt.junit.testcase.dev.includes}"
-        excludes="${gwt.junit.testcase.dev.excludes}" />
-    <gwt.junit test.name="test.dev.htmlunit"
-        test.args="${test.args} -standardsMode "
-        test.jvmargs="${test.jvmargs}"
-        test.out="${junit.out}/dev-htmlunit"
-        test.cases="test.dev.htmlunit.tests"
-        haltonfailure="false"
-       >
-      <extraclasspaths>
-        <path refid="test.extraclasspath" />
-      </extraclasspaths>
-    </gwt.junit>
-
-
-  </target>
-
-</project>
diff --git a/samples/validationtck/countMarkedTests.sh b/samples/validationtck/countMarkedTests.sh
deleted file mode 100755
index 061b6d0..0000000
--- a/samples/validationtck/countMarkedTests.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-name=$1
-count=$(grep -r  @${name} test |wc -l)
-echo "$((${count} -1))"
-
-
diff --git a/samples/validationtck/src/com/google/gwt/sample/validationtck/SampleValidationTck.gwt.xml b/samples/validationtck/src/com/google/gwt/sample/validationtck/SampleValidationTck.gwt.xml
deleted file mode 100644
index 24885ee..0000000
--- a/samples/validationtck/src/com/google/gwt/sample/validationtck/SampleValidationTck.gwt.xml
+++ /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 rename-to="validationtck">
-  <inherits name="com.google.gwt.user.User" />
-  <inherits name="org.hibernate.validator.HibernateValidator" />
-  <source path="">
-    <exclude name="super" />
-  </source>
-  <entry-point class="com.google.gwt.sample.validationtck.Tck" />
-</module>
\ No newline at end of file
diff --git a/samples/validationtck/src/com/google/gwt/sample/validationtck/Tck.java b/samples/validationtck/src/com/google/gwt/sample/validationtck/Tck.java
deleted file mode 100644
index f5fd5d3..0000000
--- a/samples/validationtck/src/com/google/gwt/sample/validationtck/Tck.java
+++ /dev/null
@@ -1,31 +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.EntryPoint;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.RootPanel;
-
-/**
- * Just a place holder Entry point.
- */
-public class Tck implements EntryPoint {
-
-  public void onModuleLoad() {
-    Label label = new Label("tck");
-    RootPanel.get("view").add(label);
-  }
-}
diff --git a/user/build.xml b/user/build.xml
index 1fc402f..4e54bee 100755
--- a/user/build.xml
+++ b/user/build.xml
@@ -31,6 +31,9 @@
   <property name="benchmark.timeout" value="30" />
   <property name="gwt.benchmark.testcase.web.includes" value="${gwt.benchmark.testcase.includes}" />
   <property name="gwt.benchmark.testcase.web.excludes" value="${gwt.benchmark.testcase.excludes}" />
+  
+  <property name="gwt.tck.testcase.dev.includes" value="com/google/gwt/validation/tck/**/*GwtSuite.class" />
+  <property name="gwt.tct.testcase.dev.excludes" value="" />
 
   <!--
     Test args can be specified per test target type.
@@ -638,7 +641,113 @@
     </parallel>
     </limit>
   </target>
+  
+  
+  <!-- Validation TCK test and reports -->
+  
+  <!-- TODO(nchalko) move the tck target to user/build.xml and then delete
+         all of samples/validaitontck -->
+    <target name="tck"
+        depends="tck.run,tck.report"
+        description="Run all tests for this project.">
+      <fail
+          message="One or more junit tests failed for target: @{test.name} @{test.args}"
+          if="junit.failure" status="2" />
+    </target>
 
+    <target name="tck.run"
+        depends="compile, compile.tests"
+        description="Run all tests for this project.">
+      <!-- Prevent compilation for every target. -->
+      <property name="compile.complete" value="true"/>
+      <property name="compile.tests.complete" value="true"/>
+
+      <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}">
+
+          <antcall target="tck.dev.htmlunit"/>
+      </limit>
+
+      <fail
+          message="One or more tck tests failed for target: @{test.name} @{test.args}"
+          if="junit.failure" status="2" />
+    </target>
+
+    <macrodef name="countMarkedTests">
+      <attribute name="annotation" default="NOT SET" />
+      <attribute name="outputproperty" default="jsr303.marked.@{annotation}" />
+      <sequential>
+   
+      </sequential>
+    </macrodef>
+
+    <target name="tck.report">
+      <mkdir dir="${junit.out}/tck-report" />
+      <mkdir dir="${junit.out}/tck-report/text" />
+      
+      <scan> 
+        <fileset dir="test/org/hibernate/jsr303/tck/tests" id="id"/>
+        <filterchain>
+          <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"/>
+        </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"/>
+      
+      <echo message="Marked Failing = ${jsr303.marked.Failing}" />
+      <echo message="Marked NonTckTest = ${jsr303.marked.NonTckTest}" />
+      <echo message="Marked NotSupported = ${jsr303.marked.NotSupported}" />
+      
+      <junitreport todir="${junit.out}/tck-report">
+        <fileset dir="${junit.out}/tck-dev-htmlunit">
+          <include name="reports/TEST-*.xml" />
+        </fileset>
+        <report format="noframes" todir="${junit.out}/tck-report" styledir="style/html">
+          <param name="markedFailing" expression="${jsr303.marked.Failing}" />
+          <param name="markedNonTckTest" expression="${jsr303.marked.NonTckTest}" />
+          <param name="markedNotSupported" expression="${jsr303.marked.NotSupported}" />
+        </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}" />
+        </report>
+      </junitreport>
+
+      <concat taskname="JSR 303 TCK Result">
+        <filelist>
+          <file name="${junit.out}/tck-report/text/junit-noframes.html" />
+        </filelist>
+      </concat>
+
+    </target>
+
+    <target name="tck.dev.htmlunit"
+        depends="compile, compile.tests"
+        description="Run dev-mode tests with HtmlUnit."
+        unless="test.dev.htmlunit.disable">
+      <fileset id="tck.dev.htmlunit.tests" dir="${javac.junit.out}"
+          includes="${gwt.tck.testcase.dev.includes}"
+          excludes="${gwt.tck.testcase.dev.excludes}" />
+      <gwt.junit test.name="test.dev.htmlunit"
+          test.args="${test.args} -standardsMode "
+          test.jvmargs="-ea -Dcom.google.gwt.sample.validationtck.util.Failing.include=true  -Dcom.google.gwt.sample.validationtck.util.NonTckTest.exclude=true"
+          test.out="${junit.out}/tck-dev-htmlunit"
+          test.cases="tck.dev.htmlunit.tests"
+          haltonfailure="false"
+         >
+        <extraclasspaths>
+          <path refid="test.extraclasspath" />
+        </extraclasspaths>
+      </gwt.junit>
+    </target>
+  
   <target name="benchmark"
       description="Run all benchmarks for this project.">
 
diff --git a/samples/validationtck/style/html/junit-noframes.xsl b/user/style/html/junit-noframes.xsl
similarity index 100%
rename from samples/validationtck/style/html/junit-noframes.xsl
rename to user/style/html/junit-noframes.xsl
diff --git a/samples/validationtck/style/text/junit-noframes.xsl b/user/style/text/junit-noframes.xsl
similarity index 100%
rename from samples/validationtck/style/text/junit-noframes.xsl
rename to user/style/text/junit-noframes.xsl