openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r898974 - in /openjpa/trunk/openjpa-integration/tck: pom.xml tck2.xml
Date Wed, 13 Jan 2010 22:25:56 GMT
Author: dwoods
Date: Wed Jan 13 22:25:55 2010
New Revision: 898974

URL: http://svn.apache.org/viewvc?rev=898974&view=rev
Log:
updates to run TCK twice, since pluggability tests require a different setup

Added:
    openjpa/trunk/openjpa-integration/tck/tck2.xml   (with props)
Modified:
    openjpa/trunk/openjpa-integration/tck/pom.xml

Modified: openjpa/trunk/openjpa-integration/tck/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/tck/pom.xml?rev=898974&r1=898973&r2=898974&view=diff
==============================================================================
--- openjpa/trunk/openjpa-integration/tck/pom.xml (original)
+++ openjpa/trunk/openjpa-integration/tck/pom.xml Wed Jan 13 22:25:55 2010
@@ -103,235 +103,68 @@
               <artifactId>maven-antrun-plugin</artifactId>
               <executions>
                 <execution>
+                  <id>tckinit</id>
+                  <phase>pre-integration-test</phase>
+                  <configuration>
+                    <tasks>
+                        <echo>Running Sun JPA 2.0 TCK Init</echo>
+                        <property name="tck.base" value="${basedir}/target/tck" />
+                        <property name="tck.dir" value="${tck.base}/jpatck" />
+                        <property name="LOCAL_M2_REPO" value="${settings.localRepository}"/>
+                        <ant antfile="${basedir}/tck2.xml">
+                            <target name="init" />
+                        </ant>
+                    </tasks>
+                  </configuration>
+                  <goals>
+                    <goal>run</goal>
+                  </goals>
+                </execution>
+                <execution>
                   <id>run-tck</id>
                   <phase>integration-test</phase>
                   <configuration>
                     <tasks>
                         <echo>Running Sun JPA 2.0 TCK</echo>
 
-                        <property name="tck.level" value="jpatck-2.0_09-Dec-2009" />
-                        <property name="tck.zip" value="${settings.localRepository}/../privaterepos/${tck.level}.zip"
/>
-                        <available property="tck.available" file="${tck.zip}" />
-                        <fail unless="tck.available">The TCK file specified in the
"tck.zip" system property (${tck.zip}) does not exist. This file must be downloaded separately
in order to be able to run the JPA 2.0 TCK</fail>
-
-                        <property name="tck_patches.zip" value="${settings.localRepository}/../privaterepos/${tck.level}_patches.zip"
/>
-                        <available property="tck_patches.available" file="${tck_patches.zip}"
/>
-                        <fail unless="tck_patches.available">The TCK patches file specified
in the "tck_patches.zip" system property (${tck_patches.zip}) does not exist. This file must
be downloaded separately in order to be able to run the JPA 2.0 TCK</fail>
-
                         <property name="tck.base" value="${basedir}/target/tck" />
                         <property name="tck.dir" value="${tck.base}/jpatck" />
+                        <property name="tck.reports" value="${tck.dir}/reports" />
+                        <property name="tck.work" value="${tck.dir}/work" />
 
-                        <delete dir="${tck.dir}" />
-                        <unzip overwrite="false" src="${tck.zip}" dest="${tck.base}" />
-                        <unzip overwrite="true" src="${tck_patches.zip}" dest="${tck.base}"
/>
-
-                        <!-- 
+                        <!--
                             Setup jpa.classes to only use the Maven artifacts
                             that we specified as dependencies
                         -->
-                        <path id="cp">
+                        <path id="cp.openjpa">
                             <path refid="maven.compile.classpath" />
                         </path>
-                        <pathconvert property="cp.property" refid="cp" />
-
-                        <property name="db.name" value="derby" />
-                        <property name="db.driver" value="org.apache.derby.jdbc.EmbeddedDriver"
/>
-                        <property name="db.url" value="jdbc:derby:derby-database;create=true"
/>
-                        <property name="db.username" value="nousername" />
-                        <property name="db.password" value="nopassword" />
-
-                        <property name="openjpa.log.level" value="WARN" />
-
-                        <property name="jpatck.pkg.dir" value="com" />
-                        <property name="jpatck.test" value="" />
-
-                        <property name="jpatck.reports.dir" value="${tck.base}/reports"
/>
-                        <property name="jpatck.work.dir" value="${tck.base}/work" />
-                        <property name="tck.log" value="${tck.base}/openjpa-tck.log" />
-
-                        <property name="openjpa.properties" value="${tck.dir}/openjpa-provier.properties"
/>
-
-                        <!-- create the OpenJPA properties for the TCK run -->
-                        <echo append="false" file="${openjpa.properties}">
-javax.persistence.provider: org.apache.openjpa.persistence.PersistenceProviderImpl
-openjpa.ConnectionDriverName: ${db.driver}
-openjpa.ConnectionURL: ${db.url}
-openjpa.ConnectionUserName: ${db.username}
-openjpa.ConnectionPassword: ${db.password}
-openjpa.FetchBatchSize: -1
-openjpa.Compatibility: StrictIdentityValues=true
-openjpa.Sequence: time
-openjpa.Log: DefaultLevel=${openjpa.log.level}
-openjpa.jdbc.DBDictionary: StoreCharsAsNumbers=true
-openjpa.jdbc.SchemaFactory: native(ForeignKeys=true)
-openjpa.jdbc.SynchronizeMappings: buildSchema(ForeignKeys=true)
-                        </echo>
-
-                        <!-- Append OpenJPA-specific configuration -->
-                        <property name="jpatck.config" value="${tck.dir}/bin/ts.jte" />
-
-                        <echo append="false" file="${jpatck.config}.tmp">
-
-
-#########################################################################
-## OpenJPA specific properties follow
-#########################################################################
-
-jpa.home=${tck.dir}
-work.dir=${jpatck.work.dir}
-report.dir=${jpatck.reports.dir}
-jpa.classes=${cp.property}
-# jpa.classes includes Derby, so only set database.classes for other DBs
-database.classes=
-# Need to specify java.* classes, both in Windows/UNIX locations as well as Mac.
-# This includes a few different possible locations; only one of them needs to 
-# actually work for a given environment.
-sigTestClasspath=${JAVA_HOME}/lib/rt.jar${path.separator}${JAVA_HOME}/jre/lib/rt.jar${path.separator}${JAVA_HOME}/../Classes/classes.jar${path.separator}$${jpa.classes}
-persistence.unit.properties.file.full.path=${openjpa.properties}
-database.user=${db.username}
-database.passwd=${db.password}
-database.url=${db.url}
-database.driver=${db.driver}
-databaseName=${db.name}
-
-                        </echo>
-
-                        <!-- convert backslashes and known paths with spaces
-                            to get around a problem with the TCK testrunner 
-                            on windows -->
-                        <echo>Update directory paths if running on Windows</echo>
-                        <replace summary="yes" file="${jpatck.config}.tmp" replacefilterfile="windows-replacefilter.properties"
/>
-                        <concat append="true" destfile="${jpatck.config}">
-                            <fileset file="${jpatck.config}.tmp" />
-                        </concat>
-
-                        <path id="agent.path">
-                            <fileset dir="../../openjpa/target">
-                                <include name="*.jar" />
-                                <exclude name="*-sources.jar" />
-                                <exclude name="original-*.jar" />
-                                <exclude name="*-tests.jar" />
-                                <exclude name="*-javadoc.jar" />
-                            </fileset>
-                        </path>
-                        <pathconvert dirsep="/" property="agent" refid="agent.path" />
-                        <property name="agent.properties" value="" />
-                        <echo>AGENT: ${agent}${agent.properties}</echo>
+                        <pathconvert property="OPENJPA_CLASSPATH" refid="cp.openjpa" />
 
                         <!--
-                            Add in a javaagent argument (optional in JPA2 TCK.)
-                            Also, we need to specify the default MetaDataFactory
-                            inorder to allow tests that don't have any
-                            persistent classes to work (like the SignatureTest)
+                            Setup jpa.classes to use the Maven artifacts AND
+                            the toplink provider required for pluggability tests
                         -->
-                        <replace file="${jpatck.config}">
-                            <replacefilter token="-Ddeliverable.class=${deliverable.class}"
value="-Ddeliverable.class=${deliverable.class} -javaagent:${agent}${agent.properties} -Dopenjpa.MetaDataFactory=jpa(DefaultAccessType=PROPERTY)"/>
-                        </replace>
-
-                        <!-- Fix path for java.security.policy -->
-                        <replace file="${jpatck.config}">
-                            <replacefilter token="-Djava.security.policy=${bin.dir}/harness.policy"
value="-Djava.security.policy=${ts.home}/bin/harness.policy"/>
-                        </replace>
-
-                        <!-- make a macro for the TCK harness launcher -->
-                        <macrodef name="tsant">
-                            <attribute name="buildfile" />
-                            <attribute name="target" />
-                            <sequential>
-                                <java classname="org.apache.tools.ant.launch.Launcher"
fork="true" failonerror="false" dir="${tck.dir}/src" append="true" output="${tck.log}" timeout="7200000"
resultproperty="tsant.result">
-                                    <arg value="-emacs" />
-                                    <arg value="-buildfile" />
-                                    <arg value="@{buildfile}" />
-                                    <arg value="-listener" />
-                                    <arg value="com.sun.ant.TSBuildListener" />
-                                    <arg value="-logger" />
-                                    <arg value="com.sun.ant.TSLogger" />
-                                    <arg value="@{target}" />
-
-                                    <env key="TS_HOME" value="${tck.dir}" />
-                                    <sysproperty key="ts.home" value="${tck.dir}" />
-
-                                    <env key="ANT_HOME" value="${tck.dir}/tools/ant" />
-                                    <sysproperty key="ant.home" value="${tck.dir}/tools/ant"
/>
-
-                                    <sysproperty key="pkg.dir" value="${jpatck.pkg.dir}"
/>
-                                    <!--
-                                    <sysproperty key="test" value="${jpatck.test}" />
-                                    -->
-
-                                    <classpath>
-                                        <path refid="cp" />
-                                        <fileset dir="${tck.dir}/tools/ant/lib">
-                                            <include name="**/*.jar" />
-                                        </fileset>
-                                        <fileset dir="${tck.dir}/lib">
-                                            <include name="**/*.jar" />
-                                        </fileset>
-                                    </classpath>
-                                </java>
-                            </sequential>
-                        </macrodef>
-
-                        <echo>Logging JPA 2.0 TCK output to ${tck.log}</echo>
-
-                        <!-- first initialize the database -->
-                        <echo>Calling TCK initdb.xml</echo>
-                        <tsant buildfile="${tck.dir}/bin/initdb.xml" target="init.database"
/>
-                        <echo>TCK initdb.xml returned result=${tsant.result}</echo>
-
-                        <!-- now run the TCK -->
-                        <echo>Calling TCK build.xml</echo>
-                        <tsant buildfile="${tck.dir}/bin/build.xml" target="runclient"
/>
-                        <echo>TCK build.xml returned result=${tsant.result}</echo>
-
-                        <!-- archive the results -->
-                        <property name="tck.results.archive" value="${tck.base}/openjpa-tck-results.zip"
/>
-                        <zip destfile="${tck.results.archive}">
-                            <fileset dir="${jpatck.work.dir}" />
-                            <fileset dir="${jpatck.reports.dir}" />
-                        </zip>
-                        <echo>Results archive at: ${tck.results.archive}</echo>
-
-                        <!-- Figure out the Passed/Failed counts -->
-                        <resourcecount property="count.passed">
-                          <tokens>
-                            <concat>
-                              <filterchain>
-                                <tokenfilter>
-                                  <containsstring contains="Passed."/>
-                                </tokenfilter>
-                              </filterchain>
-                              <fileset dir="${jpatck.reports.dir}" includes="summary.txt"
/>
-                            </concat>
-                          </tokens>
-                        </resourcecount>
-                        <resourcecount property="count.failed">
-                          <tokens>
-                            <concat>
-                              <filterchain>
-                                <tokenfilter>
-                                  <containsstring contains="Failed."/>
-                                </tokenfilter>
-                              </filterchain>
-                              <fileset dir="${jpatck.reports.dir}" includes="summary.txt"
/>
-                            </concat>
-                          </tokens>
-                        </resourcecount>
-                        <echo>TCK Results - Passed: ${count.passed}, Failed: ${count.failed}</echo>
+                        <path id="cp.toplink">
+                            <path refid="maven.compile.classpath" />
+                            <!-- need to include the toplink jars for pluggability tests
-->
+                            <fileset dir="${tck.dir}/lib">
+                                <include name="**/*toplink*.jar" />
+                            </fileset>
+                        </path>
+                        <pathconvert property="TOPLINK_CLASSPATH" refid="cp.toplink" />
 
-                        <!--
-                            The TCK's Java process doesn't actually fail when
-                            tests fail, so we need to parse the results file
-                            for a string indicating whether or not it passed.
-                        -->
-                        <loadfile property="jpatck.results" srcfile="${jpatck.work.dir}/jtData/log.txt"
/>
-                        <condition property="jpatck.failed">
-                            <contains string="${jpatck.results}" substring="Completed
test run: not ok" />
-                        </condition>
-                        <fail if="jpatck.failed">${count.failed} tests failed</fail>
-                        <!-- else -->
-                        <echo>Passed JPA 2.0 TCK!</echo>
+                        <path id="cp">
+                            <path refid="maven.compile.classpath" />
+                        </path>
 
+                        <ant antfile="${basedir}/tck2.xml" inheritRefs="true">
+                            <target name="run-pluggability" />
+                        </ant>
+
+                        <ant antfile="${basedir}/tck2.xml" inheritRefs="true">
+                            <target name="run-tck" />
+                        </ant>
                     </tasks>
                   </configuration>
                   <goals>

Added: openjpa/trunk/openjpa-integration/tck/tck2.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-integration/tck/tck2.xml?rev=898974&view=auto
==============================================================================
--- openjpa/trunk/openjpa-integration/tck/tck2.xml (added)
+++ openjpa/trunk/openjpa-integration/tck/tck2.xml Wed Jan 13 22:25:55 2010
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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.   
+-->
+
+<!--
+    This ANT build file is used to run the JPA 2.0 TCK. It assumes that you have
+    the TCK and patches zip files located at:
+
+        ${user.home}/.m2/privaterepos/jpatck-2.0_09-Dec-2009.zip
+        ${user.home}/.m2/privaterepos/jpatck-2.0_09-Dec-2009_patches.zip
+
+    If you have that file in a different location, it can be specified with
+    the "tck.zip" and "tck_patches.zip" system property.
+
+    The TCK running process will do the following:
+        1. Fine the TCK zip file and extract it
+        2. Create an openjpa-provider.properties file with the OpenJPA config
+        3. Modify the TCK's main configuration file (ts.jte) to use OpenJPA
+        4. Run the database initialization script
+        5. Run the TCK script
+        6. Parse the TCK result log to determine to fail the build or not
+
+    Other options are documented in the Maven pom.xml which calls this script.
+-->
+<!-- 
+    Please keep the project tag on one line to avoid confusing 
+    the release plugin.
+-->
+<project name="JPA2TCK" default="run-tck">
+
+
+    <!--
+        Target:  init
+        Description:  This initializes required properties and validates that
+                      required TCK zip files are present on the system and
+                      then extracts them.
+     -->
+    <target name="init">
+        <property name="tck.level" value="jpatck-2.0_09-Dec-2009" />
+        <property name="tck.zip" value="${LOCAL_M2_REPO}/../privaterepos/${tck.level}.zip"
/>
+        <available property="tck.available" file="${tck.zip}" />
+        <fail unless="tck.available">The TCK file specified in the "tck.zip" system
property (${tck.zip}) does not exist. This file must be downloaded separately in order to
be able to run the JPA 2.0 TCK</fail>
+
+        <property name="tck_patches.zip" value="${LOCAL_M2_REPO}/../privaterepos/${tck.level}_patches.zip"
/>
+        <available property="tck_patches.available" file="${tck_patches.zip}" />
+        <fail unless="tck_patches.available">The TCK patches file specified in the
"tck_patches.zip" system property (${tck_patches.zip}) does not exist. This file must be downloaded
separately in order to be able to run the JPA 2.0 TCK</fail>
+
+        <delete dir="${tck.dir}" />
+        <unzip overwrite="false" src="${tck.zip}" dest="${tck.base}" />
+        <unzip overwrite="true" src="${tck_patches.zip}" dest="${tck.base}" />
+        <copy overwrite="true"
+            file="${tck.dir}/bin/ts.jte" tofile="${tck.dir}/bin/ts.jte.orig" />
+        <!-- Pluggability tests using Toplink needs this dir created -->
+        <mkdir dir="${tck.dir}/domains/domain1/logs" />
+    </target>
+
+
+    <!--
+        Target:  setup
+        Description:  This updates the TCK configuration for OpenJPA.
+     -->
+    <target name="setup">
+        <property name="db.name" value="derby" />
+        <property name="db.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
+        <property name="db.url" value="jdbc:derby:derby-database;create=true" />
+        <property name="db.username" value="nousername" />
+        <property name="db.password" value="nopassword" />
+
+        <property name="openjpa.log.level" value="WARN" />
+
+        <property name="jpatck.test" value="" />
+
+        <property name="tck.reports" value="${tck.base}/reports" />
+        <property name="tck.work" value="${tck.base}/work" />
+
+        <property name="openjpa.properties" value="${tck.dir}/openjpa-provider.properties"
/>
+        <property name="toplink.properties" value="${tck.dir}/bin/toplink-provider.properties"
/>
+        <!-- create the OpenJPA properties for the TCK run -->
+        <echo append="false" file="${openjpa.properties}">
+javax.persistence.provider: org.apache.openjpa.persistence.PersistenceProviderImpl
+openjpa.ConnectionDriverName: ${db.driver}
+openjpa.ConnectionURL: ${db.url}
+openjpa.ConnectionUserName: ${db.username}
+openjpa.ConnectionPassword: ${db.password}
+openjpa.FetchBatchSize: -1
+openjpa.Compatibility: StrictIdentityValues=true
+openjpa.Sequence: time
+openjpa.Log: DefaultLevel=${openjpa.log.level}
+openjpa.jdbc.DBDictionary: StoreCharsAsNumbers=true
+openjpa.jdbc.SchemaFactory: native(ForeignKeys=true)
+openjpa.jdbc.SynchronizeMappings: buildSchema(ForeignKeys=true)
+        </echo>
+
+        <!-- Append OpenJPA-specific configuration -->
+        <property name="jpatck.config" value="${tck.dir}/bin/ts.jte" />
+
+        <echo append="false" file="${jpatck.config}.tmp">
+
+
+#########################################################################
+## OpenJPA specific properties follow
+#########################################################################
+
+jpa.home=${tck.dir}
+work.dir=${tck.work}
+report.dir=${tck.reports}
+jpa.classes=${cp.property}
+# jpa.classes includes Derby, so only set database.classes for other DBs
+database.classes=
+# different properties needed for pluggability bucket
+openjpa.properties=${openjpa.properties}
+toplink.properties=${toplink.properties}
+# Need to specify java.* classes, both in Windows/UNIX locations as well as Mac.
+# This includes a few different possible locations; only one of them needs to 
+# actually work for a given environment.
+sigTestClasspath=${JAVA_HOME}/lib/rt.jar${path.separator}${JAVA_HOME}/jre/lib/rt.jar${path.separator}${JAVA_HOME}/../Classes/classes.jar${path.separator}$${jpa.classes}
+persistence.unit.properties.file.full.path=${provider.properties}
+database.user=${db.username}
+database.passwd=${db.password}
+database.url=${db.url}
+database.driver=${db.driver}
+databaseName=${db.name}
+
+        </echo>
+
+        <!-- convert backslashes and known paths with spaces
+            to get around a problem with the TCK testrunner 
+            on windows -->
+        <echo>Update directory paths if running on Windows</echo>
+        <replace summary="yes" file="${jpatck.config}.tmp" replacefilterfile="windows-replacefilter.properties"
/>
+
+        <!-- append our updated config properties to a clean ts.jte -->
+        <copy overwrite="true"
+            file="${tck.dir}/bin/ts.jte.orig" tofile="${tck.dir}/bin/ts.jte" />
+        <concat append="true" destfile="${jpatck.config}">
+            <fileset file="${jpatck.config}.tmp" />
+        </concat>
+
+        <path id="agent.path">
+            <fileset dir="../../openjpa/target">
+                <include name="*.jar" />
+                <exclude name="*-sources.jar" />
+                <exclude name="original-*.jar" />
+                <exclude name="*-tests.jar" />
+                <exclude name="*-javadoc.jar" />
+            </fileset>
+        </path>
+        <pathconvert dirsep="/" property="agent" refid="agent.path" />
+        <property name="agent.properties" value="" />
+        <echo>AGENT: ${agent}${agent.properties}</echo>
+
+        <!--
+            Add in a javaagent argument (optional in JPA2 TCK.)
+            Also, we need to specify the default MetaDataFactory
+            inorder to allow tests that don't have any
+            persistent classes to work (like the SignatureTest)
+        -->
+        <replace file="${jpatck.config}">
+            <replacefilter token="-Ddeliverable.class=${deliverable.class}" value="-Ddeliverable.class=${deliverable.class}
-javaagent:${agent}${agent.properties} -Dopenjpa.MetaDataFactory=jpa(DefaultAccessType=PROPERTY)"/>
+        </replace>
+
+        <!-- Fix path for java.security.policy -->
+        <replace file="${jpatck.config}">
+            <replacefilter token="-Djava.security.policy=${bin.dir}/harness.policy" value="-Djava.security.policy=${ts.home}/bin/harness.policy"/>
+        </replace>
+
+        <!-- cleanup reports/work dirs from any prior runs -->
+        <delete dir="${tck.reports}" />
+        <delete dir="${tck.work}" />
+        <echo>Logging JPA 2.0 TCK output to ${tck.log}</echo>
+    </target>
+
+
+    <!--
+        Macro for the TCK harness launcher
+    -->
+    <macrodef name="tsant">
+        <attribute name="buildfile" />
+        <attribute name="target" />
+        <sequential>
+            <java classname="org.apache.tools.ant.launch.Launcher" fork="true" failonerror="false"
dir="${tck.dir}/src" append="true" output="${tck.log}" timeout="7200000" resultproperty="tsant.result">
+                <arg value="-emacs" />
+                <arg value="-buildfile" />
+                <arg value="@{buildfile}" />
+                <arg value="-listener" />
+                <arg value="com.sun.ant.TSBuildListener" />
+                <arg value="-logger" />
+                <arg value="com.sun.ant.TSLogger" />
+                <arg value="@{target}" />
+
+                <env key="TS_HOME" value="${tck.dir}" />
+                <sysproperty key="ts.home" value="${tck.dir}" />
+
+                <env key="ANT_HOME" value="${tck.dir}/tools/ant" />
+                <sysproperty key="ant.home" value="${tck.dir}/tools/ant" />
+
+                <sysproperty key="pkg.dir" value="${jpatck.pkg.dir}" />
+                <!--
+                <sysproperty key="test" value="${jpatck.test}" />
+                -->
+
+                <classpath>
+                    <path refid="cp" />
+                    <fileset dir="${tck.dir}/tools/ant/lib">
+                        <include name="**/*.jar" />
+                    </fileset>
+                    <fileset dir="${tck.dir}/lib">
+                        <include name="**/*.jar" />
+                    </fileset>
+                </classpath>
+            </java>
+        </sequential>
+    </macrodef>
+
+
+    <!--
+        Macro to determine how many tests passed/failed
+    -->
+    <macrodef name="results">
+        <!-- Figure out the Passed/Failed counts -->
+        <sequential>
+        <resourcecount property="count.passed">
+            <tokens>
+                <concat>
+                    <filterchain>
+                        <tokenfilter>
+                            <containsstring contains="Passed."/>
+                        </tokenfilter>
+                    </filterchain>
+                    <fileset dir="${tck.reports}" includes="summary.txt" />
+                </concat>
+            </tokens>
+        </resourcecount>
+        <resourcecount property="count.failed">
+            <tokens>
+                <concat>
+                    <filterchain>
+                        <tokenfilter>
+                            <containsstring contains="Failed."/>
+                        </tokenfilter>
+                    </filterchain>
+                    <fileset dir="${tck.reports}" includes="summary.txt" />
+                </concat>
+            </tokens>
+        </resourcecount>
+        <echo>TCK Results - Passed: ${count.passed}, Failed: ${count.failed}</echo>
+        </sequential>
+    </macrodef>
+
+
+    <!--
+        Target:  run-tck
+        Description:  This is the main routine that runs the TCK, after
+                      all other setup steps have been performed.
+     -->
+    <target name="run-tck">
+        <echo>Running Sun JPA 2.0 TCK - w/o Pluggability tests</echo>
+        <echo>Init must have been called before running this target!</echo>
+        <property name="jpatck.pkg.dir" value="com" />
+        <property name="tck.log" value="${tck.base}/openjpa-tck.log" />
+        <property name="provider.properties" value="${openjpa.properties}" />
+
+        <!-- call TCK setup with above run specific properties set -->
+        <fail unless="OPENJPA_CLASSPATH">The OPENJPA_CLASSPATH was not provided and
needs to point to the required OpenJPA and Derby runtime jars.</fail>
+        <antcall target="setup">
+            <param name="cp.property" value="${OPENJPA_CLASSPATH}" />
+        </antcall>
+
+        <!-- HACK - Need to exclude Pluggability tests from a normal run,
+            due to the need for Toplink.
+        -->
+        <delete dir="${tck.dir}/src/com/sun/ts/tests/pluggability" />
+
+        <!-- backup our updated ts.jte for later debugging -->
+        <copy overwrite="true"
+            file="${tck.dir}/bin/ts.jte" tofile="${tck.base}/ts.jte.tck" />
+
+        <!-- first initialize the database -->
+        <echo>Calling TCK initdb.xml</echo>
+        <tsant buildfile="${tck.dir}/bin/initdb.xml" target="init.database" />
+        <echo>TCK initdb.xml returned result=${tsant.result}</echo>
+
+        <!-- now run the TCK -->
+        <echo>Calling TCK build.xml</echo>
+        <tsant buildfile="${tck.dir}/bin/build.xml" target="runclient" />
+        <echo>TCK build.xml returned result=${tsant.result}</echo>
+
+        <!-- archive the results and check for test failures -->
+        <antcall target="zip-artifacts">
+            <param name="results.name" value="tck" />
+        </antcall> 
+    </target>
+
+
+    <!--
+        Target:  run-pluggability
+        Description:  This runs just the pluggability bucket, which requires
+                      us to add the toplink provider on the classpath
+     -->
+    <target name="run-pluggability">
+        <echo>Running Sun JPA 2.0 TCK - only Pluggability tests</echo>
+        <echo>Init must have been called before running this target!</echo>
+        <property name="jpatck.pkg.dir" value="com/sun/ts/tests/pluggability" />
+        <property name="tck.log" value="${tck.base}/openjpa-pluggability.log" />
+        <property name="provider.properties" value="${toplink.properties}" />
+
+        <!-- call TCK setup with above run specific properties set -->
+        <fail unless="TOPLINK_CLASSPATH">The TOPLINK_CLASSPATH was not provided and
needs to point to the required Toplink, OpenJPA and Derby runtime jars.</fail>
+        <antcall target="setup">
+            <param name="cp.property" value="${TOPLINK_CLASSPATH}" />
+        </antcall>
+
+        <!-- backup our updated ts.jte for later debugging -->
+        <copy overwrite="true"
+            file="${tck.dir}/bin/ts.jte" tofile="${tck.base}/ts.jte.pluggability" />
+
+        <!-- first initialize the database -->
+        <echo>Calling TCK initdb.xml</echo>
+        <tsant buildfile="${tck.dir}/bin/initdb.xml" target="init.database" />
+        <echo>TCK initdb.xml returned result=${tsant.result}</echo>
+
+        <!-- now run the TCK -->
+        <echo>Calling TCK build.xml</echo>
+        <tsant buildfile="${tck.dir}/bin/build.xml" target="runclient" />
+        <echo>TCK build.xml returned result=${tsant.result}</echo>
+
+        <!-- archive the results and check for test failures -->
+        <antcall target="zip-artifacts">
+            <param name="results.name" value="pluggability" />
+        </antcall> 
+    </target>
+
+
+    <!--
+        Target:  zip-artifacts
+        Description:  Collects generic TCK test artifacts for debugging
+     -->
+    <target name="zip-artifacts">
+        <echo>Gathering test artifacts for Sun JPA 2.0 TCK</echo>
+        <copy overwrite="true"
+            file="${tck.reports}/summary.txt"
+            tofile="${tck.base}/summary-${results.name}.txt" />
+        <property name="tck.results.archive" value="${tck.base}/openjpa-${results.name}-results.zip"
/>
+        <!-- archive the results -->
+        <zip destfile="${tck.results.archive}">
+            <fileset dir="${tck.work}" />
+            <fileset dir="${tck.reports}" />
+            <fileset dir="${tck.base}">
+                <include name="*${results.name}.log" />
+                <include name="*${results.name}.txt" />
+                <include name="ts.jte.${results.name}" />
+            </fileset>
+        </zip>
+        <echo>Results archive at: ${tck.results.archive}</echo>
+
+        <!--
+            The TCK's Java process doesn't actually fail when
+            tests fail, so we need to parse the results file
+            for a string indicating whether or not it passed.
+        -->
+        <loadfile property="jpatck.results" srcfile="${tck.work}/jtData/log.txt" />
+        <condition property="jpatck.failed">
+            <contains string="${jpatck.results}" substring="Completed test run: not ok"
/>
+        </condition>
+        <fail if="jpatck.failed">Test Results:  FAILED ${count.failed} tests!</fail>
+        <!-- else -->
+        <echo>Test Results:  PASSED!</echo>
+    </target>
+
+</project>
+

Propchange: openjpa/trunk/openjpa-integration/tck/tck2.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message