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:
2007-04-06 17:19:53 -04:00
${user.home}/.m2/privaterepos/jpa-1_0b-tck.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.
2007-04-06 17:19:53 -04:00
The TCK will only be run if you have the "tck-profile" enabled.
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
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
-->
<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">
<modelVersion > 4.0.0</modelVersion>
<artifactId > tck</artifactId>
<packaging > pom</packaging>
<name > OpenJPA JPA TCK Integration Tests</name>
<parent >
<groupId > org.apache.openjpa</groupId>
<artifactId > openjpa-integration</artifactId>
2007-05-22 23:36:05 -04:00
<version > 0.9.8-SNAPSHOT</version>
2007-01-30 04:37:59 -05:00
</parent>
2007-04-06 17:19:53 -04:00
<profiles >
<profile >
<id > tck-profile</id>
2007-01-30 04:37:59 -05:00
<build >
<plugins >
<plugin >
<artifactId > maven-antrun-plugin</artifactId>
<executions >
<execution >
<id > run-tck</id>
<phase > integration-test</phase>
<configuration >
<tasks >
<echo > Running Sun JPA TCK</echo>
<property name= "tck.zip" value=
2007-04-06 17:19:53 -04:00
"${settings.localRepository}/../privaterepos/jpa-1_0b-tck.zip"/>
2007-02-09 01:16:07 -05:00
<available property= "tck.available" file= "${tck.zip}" />
<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
<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
<property name= "tck.base"
value="${basedir}/target/tck"/>
<property name= "tck.dir" value= "${tck.base}/jpatck" />
2007-04-08 14:11:21 -04:00
<delete dir= "${tck.dir}" />
2007-04-06 22:10:20 -04:00
<unzip overwrite= "false"
src="${tck.zip}" dest="${tck.base}"/>
2007-01-30 04:37:59 -05:00
<path id= "cp" >
<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" >
<include name= "**/*.jar" />
<exclude name= "**/geronimo-jpa*" />
</fileset>
2007-02-08 22:51:48 -05:00
<pathelement path= "${java.class.path}" />
2007-01-30 04:37:59 -05:00
</path>
<pathconvert property= "cp.property" refid= "cp" />
<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= "jpatck.pkg.dir" value= "com" />
<property name= "jpatck.work.dir"
value="${tck.dir}/../work"/>
2007-04-06 22:10:20 -04:00
<property name= "tck.log"
value="${tck.base}/openjpa-tck.log"/>
2007-01-30 04:37:59 -05:00
<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=WARN
openjpa.jdbc.DBDictionary: StoreCharsAsNumbers=false
openjpa.jdbc.SchemaFactory: native(ForeignKeys=true)
</echo>
<!-- Append OpenJPA - specific configuration -->
<property name= "jpatck.config"
value="${tck.dir}/bin/ts.jte"/>
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}
report.dir=${tck.dir}/../reports
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-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 -->
<replace summary= "yes" file= "${jpatck.config}.tmp"
replacefilterfile="windows-replacefilter.properties"/>
<concat append= "true" destfile= "${jpatck.config}" >
<fileset file= "${jpatck.config}.tmp" />
</concat>
2007-01-30 04:37:59 -05:00
<path id= "agent.path" >
<fileset dir= "../../openjpa-all/target" >
<include name= "**/*.jar" />
</fileset>
</path>
2007-04-08 14:11:21 -04:00
<pathconvert dirsep= "/" property= "agent"
refid="agent.path"/>
2007-01-30 04:37:59 -05:00
<echo > AGENT: ${agent}</echo>
<!--
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}" >
<replacefilter token= "-javaagent:${jpa.home}/lib/toplink-essentials-agent.jar" value= "-javaagent:${agent} -Dopenjpa.MetaDataFactory=jpa(DefaultAccessType=PROPERTY)" />
</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="true"
2007-04-06 18:40:38 -04:00
dir="${tck.dir}/src"
2007-04-06 22:10:20 -04:00
append="true"
output="${tck.log}"
2007-04-06 18:40:38 -04:00
timeout="7200000">
2007-01-30 04:37:59 -05: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}"/>
<classpath >
2007-04-06 22:10:20 -04:00
<path refid= "cp" />
2007-01-30 04:37:59 -05:00
<fileset dir= "${tck.dir}/tools/ant/lib" >
<include name= "**/*.jar" />
</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 -->
<tsant buildfile= "${tck.dir}/bin/initdb.xml"
target="init.database"/>
<!-- now run the TCK -->
<tsant buildfile= "${tck.dir}/bin/build.xml"
target="runclient"/>
<!--
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" > Some tests failed</fail>
2007-04-06 22:10:20 -04:00
<echo > JPA TCK Passed 100%!</echo>
<property name= "tck.results.archive"
value="${tck.base}/openjpa-tck-results.zip"/>
<zip destfile= "${tck.results.archive}"
basedir="${jpatck.work.dir}"/>
<echo > Results archive at: ${tck.results.archive}</echo>
2007-01-30 04:37:59 -05:00
</tasks>
</configuration>
<goals >
<goal > run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
2007-04-06 17:19:53 -04:00
</profile>
</profiles>
2007-04-06 22:10:20 -04:00
<repositories >
<repository >
<id > java.net</id>
<name > Java.net Maven Repository</name>
<url > https://maven-repository.dev.java.net/nonav/repository</url>
<layout > legacy</layout>
</repository>
</repositories>
2007-01-30 04:37:59 -05:00
<dependencies >
2007-04-06 22:10:20 -04:00
<!-- use the authoritative javax.persistence API for testing -->
<dependency >
<groupId > javax.persistence</groupId>
<artifactId > persistence-api</artifactId>
<version > 1.0b</version>
</dependency>
2007-01-30 04:37:59 -05:00
<dependency >
<groupId > org.apache.openjpa</groupId>
2007-04-06 22:10:20 -04:00
<artifactId > openjpa-kernel</artifactId>
2007-01-30 04:37:59 -05:00
<version > ${pom.version}</version>
</dependency>
<dependency >
<groupId > org.apache.derby</groupId>
<artifactId > derby</artifactId>
<version > 10.2.1.6</version>
<scope > compile</scope>
</dependency>
</dependencies>
</project>