OPEN - issue LDAP-34: Move itest-targets.xml to common-build

http://opensource.atlassian.com/projects/spring/browse/LDAP-34
This commit is contained in:
Ulrik Sandberg
2007-01-19 09:58:25 +00:00
parent 6c7f64d6f3
commit 697a9914a9
4 changed files with 7 additions and 243 deletions

View File

@@ -34,13 +34,7 @@
-->
<project name="itest-targets">
<property file="build.properties" />
<property file="project.properties" />
<property file="${common.build.dir}/build.properties" />
<property file="${common.build.dir}/project.properties" />
<property file="${user.home}/build.properties" />
<import file="${common.build.dir}/common-targets.xml" />
<import file="common-targets.xml" />
<!--
Custom properties for itest.
@@ -65,10 +59,10 @@
<!-- default wildcard for finding JUnit tests
the convention is that our JUnit test classes have XXXTests-style names -->
<property name="itest.includes" value="**/*ITest.class,**/*ITests.class,**/*IntegrationTest.class,**/*IntegrationTests.class" />
<!-- wildcards to exclude among JUnit tests -->
<property name="itest.excludes" value="**/Abstract*" />
<property name="itest.includes" value="**/*ITest.class,**/*ITests.class,**/*IntegrationTest.class,**/*IntegrationTests.class" />
<!-- wildcards to exclude among JUnit tests -->
<property name="itest.excludes" value="**/Abstract*" />
<!-- jvm arguments we want tacked on to all integration tests -->
<!-- set fake default value, will not override existing setting -->

View File

@@ -40,7 +40,7 @@
<property file="${common.build.dir}/project.properties" />
<property file="${user.home}/build.properties" />
<import file="${basedir}/itest-targets.xml" />
<import file="${common.build.dir}/itest-targets.xml" />
<import file="${common.build.dir}/common-targets.xml" />
<!--

View File

@@ -1,230 +0,0 @@
<?xml version="1.0"?>
<!--
Copyright 2005-2006 the original author or authors.
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.
- - -
Author: Ulrik Sandberg
- - -
-->
<!--
Note that in your build file, you can no longer import common-targets,
since this file already imports that file. If you do, the hook targets
here will not execute.
Your build file should look something like this:
<import file="${basedir}/itest-targets.xml" />
<import file="${common.build.dir}/doc-targets.xml" />
<import file="${common.build.dir}/clover-targets.xml" />
-->
<project name="itest-targets">
<property file="build.properties" />
<property file="project.properties" />
<property file="${common.build.dir}/build.properties" />
<property file="${common.build.dir}/project.properties" />
<property file="${user.home}/build.properties" />
<import file="${common.build.dir}/common-targets.xml" />
<!--
Custom properties for itest.
Cannot use project.properties, because common-build properties
must be loaded before these ones are set.
-->
<!-- itest sources -->
<property name="src.java.itest.dir" location="${src.dir}/itest/java" />
<!-- any generated java sources go here -->
<property name="target.gen.java.itest.dir" location="${target.dir}/gen-java-itest-src" />
<!-- where built itest class files and resources go -->
<property name="target.itestclasses.dir" location="${target.dir}/itest-classes" />
<!-- where itest results end up -->
<property name="target.itestresults.dir" location="${target.dir}/itest-reports" />
<!-- itest resources get copied into target itest classes dir with filtering -->
<property name="src.itest.resources.dir" location="${src.dir}/itest/resources" />
<!-- default wildcard for finding JUnit tests
the convention is that our JUnit test classes have XXXTests-style names -->
<property name="itest.includes" value="**/*ITest.class,**/*ITests.class,**/*IntegrationTest.class,**/*IntegrationTests.class" />
<!-- wildcards to exclude among JUnit tests -->
<property name="itest.excludes" value="**/Abstract*" />
<!-- jvm arguments we want tacked on to all integration tests -->
<!-- set fake default value, will not override existing setting -->
<property name="itest.arguments" value="-Dzzz456zzz" />
<!-- Hooking in an itest version of statics.test -->
<target name="statics.post">
<!-- copy everything from the source dir, except java files. Do not filter. Files
that need filtering should source from ${src.itest.resources.dir} -->
<copy todir="${target.itestclasses.dir}">
<fileset dir="${src.java.itest.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
<!-- copy test resource files if neccessary, filtering for non-binary types -->
<available file="${src.itest.resources.dir}" property="itest.resources.exists" />
<antcall target="copy.itest.resources" />
<!-- write out a test.properties file with common properties -->
<propertyfile file="${target.testclasses.dir}/test.properties" comment="Common unit/integration test properties">
<entry key="lastupdate" type="date" value="now" />
</propertyfile>
</target>
<!-- The itest version of copy.test.resources -->
<target name="copy.itest.resources" if="itest.resources.exists">
<copy todir="${target.itestclasses.dir}" filtering="on">
<fileset dir="${src.itest.resources.dir}">
<patternset refid="std.files.to.filter" />
</fileset>
<filterset>
<filtersfile file="${target.filter.file}" />
</filterset>
</copy>
<copy todir="${target.itestclasses.dir}">
<fileset dir="${src.itest.resources.dir}">
<patternset refid="std.files.not.to.filter" />
</fileset>
</copy>
</target>
<!-- Hooking in an itest version of compile.tests -->
<target name="compile.post" depends="build.itest.prepare">
<echo>compiling itest sources</echo>
<javac destdir="${target.itestclasses.dir}" debug="${debug}" deprecation="${deprecation}" optimize="${optimize}" source="${javac.source}" target="${javac.target}">
<src path="${src.java.itest.dir}" />
<src path="${target.gen.java.itest.dir}" />
<classpath>
<pathelement location="${target.classes.dir}" />
<path refid="test.classpath" />
</classpath>
</javac>
</target>
<!-- build.itest.prepare: Prepares the build directory for itests -->
<target name="build.itest.prepare" unless="build.itest.prepare.done">
<mkdir dir="${target.gen.java.itest.dir}" />
<mkdir dir="${target.itestclasses.dir}" />
<property name="build.itest.prepare.done" value="true" />
</target>
<!-- The itest version of tests.prepare -->
<target name="itests.prepare" depends="compile" unless="itests.prepare.done">
<mkdir dir="${target.itestresults.dir}" />
<delete>
<fileset dir="${target.itestresults.dir}" includes="**/*.txt,**/*.log" />
</delete>
<property name="itests.prepare.done" value="true" />
</target>
<!-- Runs the integration tests. -->
<target name="itests" depends="itests.prepare" description="Run all integration tests">
<!-- for the time being we just halt on failure, since these are
local tests and there is no external server to shut down, etc.
But if we want to optionally run all tests and report on the
whole batch, then we need to set a failure property. -->
<junit forkmode="perBatch" printsummary="yes" haltonfailure="no" haltonerror="no" dir="${basedir}" errorproperty="itests.failed" failureproperty="itests.failed">
<jvmarg value="${unitvm}" />
<jvmarg value="-Djava.security.auth.login.config=${target.itestclasses.dir}/auth.conf" />
<jvmarg value="${itest.arguments}" />
<classpath>
<pathelement location="${target.classes.dir}" />
<pathelement location="${target.itestclasses.dir}" />
<pathelement location="${target.genclasses.dir}" />
<path refid="test.classpath" />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<batchtest fork="yes" todir="${target.itestresults.dir}">
<fileset dir="${target.itestclasses.dir}" includes="${itest.includes}" excludes="${itest.excludes}" />
</batchtest>
</junit>
</target>
<!-- runs one integration test -->
<target name="itest" depends="guard.itestclass,itests.prepare" description="Runs one integration test using the value of the itest.class property">
<junit forkmode="perBatch" printsummary="yes" haltonfailure="no" haltonerror="no">
<jvmarg value="${unitvm}" />
<jvmarg value="-Djava.security.auth.login.config=${target.itestclasses.dir}/auth.conf" />
<jvmarg value="${test.arguments}" />
<classpath>
<pathelement location="${target.classes.dir}" />
<pathelement location="${target.itestclasses.dir}" />
<pathelement location="${target.genclasses.dir}" />
<path refid="test.classpath" />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<!-- the test case -->
<test name="${itest.class}" todir="${target.itestresults.dir}" />
</junit>
</target>
<target name="guard.itestclass" unless="itest.class">
<fail message="The target you are attempting to run requires the ${itest.class} property to be set, which doesn't appear to be" />
</target>
<!--
itest-example - a sample integration test
shows how to make a target to run just one specific integration test instead
of having to specify the class
It can get a lot more elaborate than this, with various properties being
set up, etc. Property files can be written out, etc.
<target name="itest.example" depends="init">
<antcall target="itest">
<param name="itest.class" value="com.mycompany.myproject.MyIntegrationTest"/>
</antcall>
</target>
-->
<property name="target.itestresults.html.dir" location="${target.itestresults.dir}/html" />
<!-- Generate the unit test report -->
<target name="itest-report" depends="build.prepare" description="Generate HTML report of integration test results">
<delete dir="${target.itestresults.html.dir}" />
<mkdir dir="${target.itestresults.html.dir}" />
<junitreport todir="${target.itestresults.html.dir}">
<fileset dir="${target.itestresults.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${target.itestresults.html.dir}" />
</junitreport>
<echo>
Integration test report has been generated.
The HTML report is ${target.itestresults.html.dir}/index.html
</echo>
<fail if="itests.failed" message="Integration tests failed" />
</target>
</project>

View File

@@ -40,7 +40,7 @@
<property file="${common.build.dir}/project.properties" />
<property file="${user.home}/build.properties" />
<import file="${basedir}/itest-targets.xml" />
<import file="${common.build.dir}/itest-targets.xml" />
<import file="${common.build.dir}/common-targets.xml" />
<!--