2007-01-30 04:37:59 -05:00
<?xml version="1.0" encoding="UTF-8"?>
<!--
2007-04-14 17:50:17 -04:00
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
2007-01-30 04:37:59 -05:00
http://www.apache.org/licenses/LICENSE-2.0
2007-04-14 17:50:17 -04:00
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.
2007-01-30 04:37:59 -05:00
-->
<!--
This build file is used to run the JPA TCK. It assumes that you have
the TCK zip file located at:
2010-01-04 12:47:19 -05:00
For JPA 1.0 -
${user.home}/.m2/privaterepos/jpa-1_0b-tck.zip
For JPA 2.0 -
2010-09-17 09:46:00 -04:00
${user.home}/.m2/privaterepos/jpatck-2.0_15-Jun-2010.zip
2007-01-30 04:37:59 -05:00
If you have that file in a different location, it can be specified with
the "tck.zip" system property.
2010-01-04 12:47:19 -05:00
The TCK will only be run if you have one of the following profiles enabled:
For JPA 1.0 -
-Ptck-profile
For JPA 2.0 -
-Ptck2-profile
2007-04-06 17:19:53 -04:00
2010-12-14 09:32:29 -05:00
For the JPA 2.0 TCK, the default level used will be the latest available,
but you can also test against prior levels by setting:
-Dtck2.level=20091209
2007-01-30 04:37:59 -05:00
To run a specific package of tests, use the "jpatck.pkg.dir" system
property to specify the parent directory of the tests you want to run.
E.g.:
2007-04-06 17:19:53 -04:00
mvn integration-test -Ptck-profile -Djpatck.pkg.dir=com/sun/ts/tests/ejb30/persistence/inheritance/mappedsc/descriptors
2007-01-30 04:37:59 -05:00
2007-10-13 15:19:11 -04:00
You can also run using another database (e.g., oracle) using command
line properties. For example:
mvn integration-test -Ddb.name=oracle -Ddb.driver=oracle.jdbc.driver.OracleDriver -Ddb.url=jdbc:oracle:thin:@dbhost:1526:dbname -Ddb.username=scott -Ddb.password=tiger -Ddb.jar=/tmp/oracle-jdbc.jar -Dtest=false -Ptck-profile -Djpatck.pkg.dir=com/sun/ts/tests/ejb30/persistence/query/apitests -Djpatck.test=queryAPITest15
2007-01-30 04:37:59 -05:00
The TCK running process will do the following:
1. Fine the TCK zip file and extract it
2. Create an openjpa-provier.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 whether to fail the build or not
-->
2008-06-11 12:48:56 -04:00
<!--
Please keep the project tag on one line to avoid confusing
the release plugin.
-->
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
2010-08-06 14:49:38 -04:00
2007-01-30 04:37:59 -05:00
<modelVersion > 4.0.0</modelVersion>
2010-08-06 14:49:38 -04:00
2007-01-30 04:37:59 -05:00
<parent >
<groupId > org.apache.openjpa</groupId>
<artifactId > openjpa-integration</artifactId>
2010-08-25 21:42:33 -04:00
<version > 2.0.2-SNAPSHOT</version>
2007-01-30 04:37:59 -05:00
</parent>
2010-08-06 14:49:38 -04:00
<groupId > org.apache.openjpa</groupId>
<artifactId > openjpa-integration-tck</artifactId>
<packaging > pom</packaging>
<name > OpenJPA Integration Tests - JPA TCK</name>
<description > OpenJPA Integration Tests - JPA TCK</description>
2010-04-16 09:55:17 -04:00
<properties >
<openjpa.Log > DefaultLevel=WARN</openjpa.Log>
2010-12-14 09:32:29 -05:00
<tck2.level > 20101205</tck2.level>
2010-04-16 09:55:17 -04:00
</properties>
2010-08-07 10:00:37 -04:00
<build >
<plugins >
<plugin >
<groupId > org.apache.maven.plugins</groupId>
<artifactId > maven-deploy-plugin</artifactId>
<configuration >
<!-- Don't publish these artifacts to central -->
<skip > true</skip>
</configuration>
</plugin>
</plugins>
</build>
2007-04-06 17:19:53 -04:00
<profiles >
2010-01-04 12:47:19 -05:00
<profile >
<!-- JPA 2.0 TCK Profile -->
<id > tck2-profile</id>
<build >
<plugins >
<plugin >
<groupId > org.apache.maven.plugins</groupId>
2010-01-04 16:10:09 -05:00
<artifactId > maven-enforcer-plugin</artifactId>
2010-01-04 12:47:19 -05:00
<executions >
<execution >
2010-01-04 16:10:09 -05:00
<phase > validate</phase>
<goals >
<goal > enforce</goal>
</goals>
2010-01-04 12:47:19 -05:00
<configuration >
2010-01-04 16:10:09 -05:00
<rules >
<requireJavaVersion >
<version > [1.6,)</version>
</requireJavaVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin >
<groupId > org.apache.maven.plugins</groupId>
<artifactId > maven-antrun-plugin</artifactId>
<executions >
2010-01-13 17:25:55 -05:00
<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" />
2010-02-24 16:04:42 -05:00
<property name= "LOCAL_M2_REPO" value= "${settings.localRepository}" />
2010-12-14 09:32:29 -05:00
<ant antfile= "${basedir}/tck2-${tck2.level}.xml" >
2010-01-13 17:25:55 -05:00
<target name= "init" />
</ant>
</tasks>
</configuration>
<goals >
<goal > run</goal>
</goals>
</execution>
2010-01-04 16:10:09 -05:00
<execution >
<id > run-tck</id>
<phase > integration-test</phase>
<configuration >
<tasks >
2010-01-04 12:47:19 -05:00
<echo > Running Sun JPA 2.0 TCK</echo>
<property name= "tck.base" value= "${basedir}/target/tck" />
<property name= "tck.dir" value= "${tck.base}/jpatck" />
2010-01-13 17:25:55 -05:00
<property name= "tck.reports" value= "${tck.dir}/reports" />
<property name= "tck.work" value= "${tck.dir}/work" />
2010-01-04 12:47:19 -05:00
2010-01-13 17:25:55 -05:00
<!--
2010-01-06 07:02:29 -05:00
Setup jpa.classes to only use the Maven artifacts
that we specified as dependencies
-->
2010-01-13 17:25:55 -05:00
<path id= "cp.openjpa" >
2010-01-04 12:47:19 -05:00
<path refid= "maven.compile.classpath" />
</path>
2010-01-13 17:25:55 -05:00
<pathconvert property= "OPENJPA_CLASSPATH" refid= "cp.openjpa" />
2010-01-04 12:47:19 -05:00
<!--
2010-01-13 17:25:55 -05:00
Setup jpa.classes to use the Maven artifacts AND
the toplink provider required for pluggability tests
2010-01-04 12:47:19 -05:00
-->
2010-01-13 17:25:55 -05:00
<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" />
2010-01-04 16:10:09 -05:00
2010-01-13 17:25:55 -05:00
<path id= "cp" >
<path refid= "maven.compile.classpath" />
</path>
2010-01-04 16:10:09 -05:00
2010-12-14 09:32:29 -05:00
<ant antfile= "${basedir}/tck2-${tck2.level}.xml" inheritRefs= "true" >
2010-01-13 17:25:55 -05:00
<target name= "run-tck" />
</ant>
2010-01-04 16:10:09 -05:00
</tasks>
</configuration>
<goals >
<goal > run</goal>
</goals>
</execution>
</executions>
2010-01-04 12:47:19 -05:00
</plugin>
</plugins>
</build>
<!-- Just pull in openjpa - all, which will include all required deps -->
<dependencies >
<dependency >
<groupId > org.apache.openjpa</groupId>
<artifactId > openjpa-all</artifactId>
2010-08-17 08:30:40 -04:00
<version > ${project.version}</version>
2010-01-04 12:47:19 -05:00
</dependency>
</dependencies>
</profile>
<profile >
<!-- JPA 1.0b TCK Profile -->
<id > tck-profile</id>
<build >
<plugins >
2010-01-04 16:10:09 -05:00
<plugin >
<groupId > org.apache.maven.plugins</groupId>
<artifactId > maven-antrun-plugin</artifactId>
<executions >
<execution >
<id > run-tck</id>
<phase > integration-test</phase>
<configuration >
<tasks >
2010-01-04 17:55:49 -05:00
<echo > Running Sun JPA 1.0b TCK</echo>
2007-01-30 04:37:59 -05:00
2008-06-11 12:48:56 -04:00
<property name= "tck.zip" value= "${settings.localRepository}/../privaterepos/jpa-1_0b-tck.zip" />
<available property= "tck.available" file= "${tck.zip}" />
2007-02-09 01:16:07 -05:00
<fail unless= "tck.available" > The TCK file ${tck.zip} does not exist. This file must be downloaded separately in order to be able to run the JPA TCK</fail>
2007-01-30 04:37:59 -05:00
2008-06-11 12:48:56 -04:00
<available property= "tck.available" file= "${tck.zip}" />
2007-02-08 22:51:48 -05:00
<fail unless= "tck.available" > The TCK file specific 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 TCK</fail>
2007-01-30 04:37:59 -05:00
2008-06-11 12:48:56 -04:00
<property name= "tck.base" value= "${basedir}/target/tck" />
<property name= "tck.dir" value= "${tck.base}/jpatck" />
2007-01-30 04:37:59 -05:00
2008-06-11 12:48:56 -04:00
<delete dir= "${tck.dir}" />
2007-04-08 14:11:21 -04:00
2008-06-11 12:48:56 -04:00
<unzip overwrite= "false" src= "${tck.zip}" dest= "${tck.base}" />
2007-04-06 22:10:20 -04:00
2007-01-30 04:37:59 -05:00
<path id= "cp" >
2008-06-11 12:48:56 -04:00
<path refid= "maven.compile.classpath" />
2007-04-06 22:10:20 -04:00
<!-- use official JPA API instead of GM's -->
<fileset dir= "${tck.dir}/lib" >
2008-06-11 12:48:56 -04:00
<include name= "**/*.jar" />
2007-04-06 22:10:20 -04:00
</fileset>
2008-06-11 12:48:56 -04:00
<pathelement path= "${java.class.path}" />
<pathelement path= "${db.jar}" />
2007-01-30 04:37:59 -05:00
</path>
2008-06-11 12:48:56 -04:00
<pathconvert property= "cp.property" refid= "cp" />
2007-01-30 04:37:59 -05:00
2008-06-11 12:48:56 -04:00
<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" />
2007-01-30 04:37:59 -05:00
2010-04-14 14:43:11 -04:00
<property name= "openjpa.Log" value= "${openjpa.Log}" />
2007-10-13 15:21:58 -04:00
2008-06-11 12:48:56 -04:00
<property name= "jpatck.pkg.dir" value= "com" />
<property name= "jpatck.test" value= "" />
2007-01-30 04:37:59 -05:00
2010-01-04 17:55:49 -05:00
<property name= "jpatck.reports.dir" value= "${tck.dir}/../reports" />
2008-06-11 12:48:56 -04:00
<property name= "jpatck.work.dir" value= "${tck.dir}/../work" />
<property name= "tck.log" value= "${tck.base}/openjpa-tck.log" />
2007-01-30 04:37:59 -05:00
2008-06-11 12:48:56 -04:00
<property name= "openjpa.properties" value= "${tck.dir}/openjpa-provier.properties" />
2007-01-30 04:37:59 -05:00
<!-- 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
2010-04-14 14:43:11 -04:00
openjpa.Log: ${openjpa.Log}
2007-01-30 04:37:59 -05:00
openjpa.jdbc.DBDictionary: StoreCharsAsNumbers=false
openjpa.jdbc.SchemaFactory: native(ForeignKeys=true)
</echo>
<!-- Append OpenJPA - specific configuration -->
2008-06-11 12:48:56 -04:00
<property name= "jpatck.config" value= "${tck.dir}/bin/ts.jte" />
2007-01-30 04:37:59 -05:00
2007-04-08 14:11:21 -04:00
<echo append= "false" file= "${jpatck.config}.tmp" >
2007-02-08 22:51:48 -05:00
2007-01-30 04:37:59 -05:00
#########################################################################
## OpenJPA specific properties follow
#########################################################################
jpa.home=${tck.dir}
work.dir=${jpatck.work.dir}
2010-01-04 17:55:49 -05:00
report.dir=${jpatck.reports.dir}
2007-01-30 04:37:59 -05:00
jpa.classes=${cp.property}
2007-04-08 14:11:21 -04:00
database.classes=${jpa.classes}
2007-04-08 15:15:05 -04:00
# 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.
2007-04-08 18:27:35 -04:00
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}
2007-01-30 04:37:59 -05:00
persistence.unit.properties.file.full.path=${openjpa.properties}
database.user=${db.username}
database.passwd=${db.password}
database.url=${db.url}
database.driver=${db.driver}
2007-10-13 15:19:11 -04:00
databaseName=${db.name}
2007-02-08 22:51:48 -05:00
2007-01-30 04:37:59 -05:00
</echo>
2007-04-08 14:11:21 -04:00
<!-- convert backslashes and known paths with spaces
to get around a problem with the TCK testrunner
on windows -->
2010-01-04 21:21:40 -05:00
<echo > Update directory paths if running on Windows</echo>
2008-06-11 12:48:56 -04:00
<replace summary= "yes" file= "${jpatck.config}.tmp" replacefilterfile= "windows-replacefilter.properties" />
2007-04-08 14:11:21 -04:00
<concat append= "true" destfile= "${jpatck.config}" >
2008-06-11 12:48:56 -04:00
<fileset file= "${jpatck.config}.tmp" />
2007-04-08 14:11:21 -04:00
</concat>
2007-01-30 04:37:59 -05:00
<path id= "agent.path" >
2009-05-11 11:21:52 -04:00
<fileset dir= "../../openjpa/target" >
2008-06-11 12:48:56 -04:00
<include name= "*.jar" />
2009-10-29 09:15:23 -04:00
<exclude name= "*-sources.jar" />
<exclude name= "original-*.jar" />
<exclude name= "*-tests.jar" />
<exclude name= "*-javadoc.jar" />
2007-01-30 04:37:59 -05:00
</fileset>
</path>
2008-06-11 12:48:56 -04:00
<pathconvert dirsep= "/" property= "agent" refid= "agent.path" />
<property name= "agent.properties" value= "" />
2007-07-30 11:48:14 -04:00
<echo > AGENT: ${agent}${agent.properties}</echo>
2007-01-30 04:37:59 -05:00
<!--
Replace the existing javaagent argument (which
uses Toplink's enhancer) with our own. Also, we
need to specify the default MetaDataFactory in
order to allow tests that don't have any
persistent classes to work (like the SignatureTest)
-->
<replace file= "${jpatck.config}" >
2008-06-11 12:48:56 -04:00
<replacefilter token= "-javaagent:${jpa.home}/lib/toplink-essentials-agent.jar" value= "-javaagent:${agent}${agent.properties} -Dopenjpa.MetaDataFactory=jpa(DefaultAccessType=PROPERTY)" />
2007-01-30 04:37:59 -05:00
</replace>
<!-- make a macro for the TCK harness launcher -->
<macrodef name= "tsant" >
2008-06-11 12:48:56 -04:00
<attribute name= "buildfile" />
<attribute name= "target" />
2007-01-30 04:37:59 -05:00
<sequential >
2011-03-04 09:44:34 -05:00
<java classname= "org.apache.tools.ant.launch.Launcher" fork= "true" failonerror= "true" dir= "${tck.dir}/src" append= "true" output= "${tck.log}" timeout= "14400000" resultproperty= "tsant.result" >
2008-06-11 12:48:56 -04:00
<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= ".." />
<sysproperty key= "ts.home" value= ".." />
<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}" />
2007-10-15 20:39:09 -04:00
<!--
2008-06-11 12:48:56 -04:00
<sysproperty key= "test" value= "${jpatck.test}" />
2007-10-15 20:39:09 -04:00
-->
2007-01-30 04:37:59 -05:00
<classpath >
2008-06-11 12:48:56 -04:00
<path refid= "cp" />
2007-01-30 04:37:59 -05:00
<fileset dir= "${tck.dir}/tools/ant/lib" >
2008-06-11 12:48:56 -04:00
<include name= "**/*.jar" />
2007-01-30 04:37:59 -05:00
</fileset>
</classpath>
</java>
</sequential>
</macrodef>
2007-04-06 22:10:20 -04:00
<echo > Logging JPA TCK output to ${tck.log}</echo>
2007-01-30 04:37:59 -05:00
<!-- first initialize the database -->
2010-01-04 21:21:40 -05:00
<echo > Calling TCK initdb.xml</echo>
2008-06-11 12:48:56 -04:00
<tsant buildfile= "${tck.dir}/bin/initdb.xml" target= "init.database" />
2010-01-05 08:26:00 -05:00
<echo > TCK initdb.xml returned result=${tsant.result}</echo>
2007-01-30 04:37:59 -05:00
<!-- now run the TCK -->
2010-01-04 21:21:40 -05:00
<echo > Calling TCK build.xml</echo>
2008-06-11 12:48:56 -04:00
<tsant buildfile= "${tck.dir}/bin/build.xml" target= "runclient" />
2010-01-05 08:26:00 -05:00
<echo > TCK build.xml returned result=${tsant.result}</echo>
2007-01-30 04:37:59 -05:00
2010-01-04 16:10:09 -05:00
<!-- archive the results -->
<property name= "tck.results.archive" value= "${tck.base}/openjpa-tck-results.zip" />
2010-01-04 17:55:49 -05:00
<zip destfile= "${tck.results.archive}" >
<fileset dir= "${jpatck.work.dir}" />
</zip>
2010-01-04 16:10:09 -05:00
<echo > Results archive at: ${tck.results.archive}</echo>
2007-01-30 04:37:59 -05:00
<!--
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.
-->
2008-06-11 12:48:56 -04:00
<loadfile property= "jpatck.results" srcfile= "${jpatck.work.dir}/jtData/log.txt" />
2007-01-30 04:37:59 -05:00
<condition property= "jpatck.failed" >
2008-06-11 12:48:56 -04:00
<contains string= "${jpatck.results}" substring= "Completed test run: not ok" />
2007-01-30 04:37:59 -05:00
</condition>
2010-01-05 08:26:00 -05:00
<fail if= "jpatck.failed" > Some tests failed</fail>
2010-01-04 16:10:09 -05:00
<!-- else -->
2010-01-05 08:26:00 -05:00
<echo > JPA TCK Passed 100%!</echo>
2007-04-06 22:10:20 -04:00
2010-01-04 16:10:09 -05:00
</tasks>
</configuration>
<goals >
<goal > run</goal>
</goals>
</execution>
</executions>
2007-01-30 04:37:59 -05:00
</plugin>
2010-01-04 12:47:19 -05:00
</plugins>
</build>
2010-01-25 16:50:14 -05:00
2010-01-04 12:47:19 -05:00
<dependencies >
<dependency >
2008-12-05 16:23:36 -05:00
<groupId > org.apache.geronimo.specs</groupId>
<artifactId > geronimo-jpa_2.0_spec</artifactId>
<scope > compile</scope>
2010-01-04 12:47:19 -05:00
</dependency>
<dependency >
2007-01-30 04:37:59 -05:00
<groupId > org.apache.openjpa</groupId>
2007-04-06 22:10:20 -04:00
<artifactId > openjpa-kernel</artifactId>
2010-08-17 08:30:40 -04:00
<version > ${project.version}</version>
2010-01-04 12:47:19 -05:00
</dependency>
</dependencies>
</profile>
</profiles>
<dependencies >
2007-01-30 04:37:59 -05:00
<dependency >
<groupId > org.apache.derby</groupId>
<artifactId > derby</artifactId>
2009-08-19 11:36:02 -04:00
<version > ${derby.version}</version>
2007-01-30 04:37:59 -05:00
<scope > compile</scope>
</dependency>
</dependencies>
</project>