JdbcMapper/controls/test/build.xml

262 lines
12 KiB
XML
Raw Normal View History

<?xml version="1.0" ?>
<!--
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.
$Header:$
-->
<project name="Beehive/Controls/Test" default="usage">
<property environment="os"/>
<import file="../../beehive-imports.xml"/>
<import file="../../ant/axis-import.xml"/>
<import file="../../ant/beehive-tools.xml"/>
<taskdef name="assemble"
classname="org.apache.beehive.controls.runtime.assembly.AssembleTask"
classpathref="controls.dependency.path"
onerror="report"/>
<path id="test-junit.dependency.path">
<path refid="junit.dependency.path"/>
<path refid="controls.dependency.path"/>
<path refid="commons-discovery.dependency.path"/>
<path refid="commons-logging.dependency.path"/>
<path refid="log4j.dependency.path"/>
</path>
<property name="build.dir" location="build"/>
<property name="src.dir" location="src"/>
<property name="controls.src.dir" location="${src.dir}/junit-controls"/>
<property name="controls.beansrc.dir" location="${build.dir}/junit-controls-beansrc"/>
<property name="controls.classes.dir" location="${build.dir}/junit-controls-classes"/>
<property name="controls.jar" location="${build.dir}/beehive-controls-junit-tests.jar"/>
<property name="tests.src.dir" location="${src.dir}/junit-tests"/>
<property name="tests.beansrc.dir" location="${build.dir}/junit-tests-beansrc"/>
<property name="tests.classes.dir" location="${build.dir}/junit-tests-classes"/>
<property name="aux.src.dir" location="${src.dir}/auxilaries"/>
<property name="aux.beansrc.dir" location="${build.dir}/junit-aux-beansrc"/>
<property name="aux.classes.dir" location="${build.dir}/junit-aux-classes"/>
<property name="assembly.beansrc.dir" location="${build.dir}/junit-assembly-beansrc"/>
<property name="log.dir" location="${build.dir}/logs"/>
<!-- ==================================================================== -->
<!-- -->
<!-- -->
<!-- Targets to run test suites -->
<!-- -->
<!-- -->
<!-- ==================================================================== -->
<target name="drt" description="Run the Controls checkin tests">
<antcall target="clean"/>
<antcall target="build"/>
<antcall target="test"/>
</target>
<target name="bvt" description="Run the entire Controls test suite">
<antcall target="clean"/>
<antcall target="build"/>
<antcall target="test"/>
</target>
<target name="clean" description="Clean the control tests">
<delete dir="${build.dir}"/>
<delete file="velocity.log"/>
</target>
<target name="update.beaninfo" description="Refresh the .beaninfo files used to test BeanInfo creation during Controls testing.">
<path id="beaninfo.path">
<pathelement path="${controls.jar}"/>
<pathelement location="${tests.classes.dir}"/>
<path refid="test-junit.dependency.path"/>
</path>
<gen-beaninfo beaninfo="${tests.src.dir}/org/apache/beehive/controls/test/junit/beaninfo/InfoTestBean.beaninfo"
beanclass="org.apache.beehive.controls.test.controls.beaninfo.InfoTestBean"/>
<gen-beaninfo beaninfo="${tests.src.dir}/org/apache/beehive/controls/test/junit/inherit/Intf1Bean.beaninfo"
beanclass="org.apache.beehive.controls.test.controls.inherit.Intf1Bean"/>
<gen-beaninfo beaninfo="${tests.src.dir}/org/apache/beehive/controls/test/junit/inherit/Intf2Bean.beaninfo"
beanclass="org.apache.beehive.controls.test.controls.inherit.Intf2Bean"/>
<gen-beaninfo beaninfo="${tests.src.dir}/org/apache/beehive/controls/test/junit/inherit/Ext1Bean.beaninfo"
beanclass="org.apache.beehive.controls.test.controls.inherit.Ext1Bean"/>
<gen-beaninfo beaninfo="${tests.src.dir}/org/apache/beehive/controls/test/junit/inherit/Ext2Bean.beaninfo"
beanclass="org.apache.beehive.controls.test.controls.inherit.Ext2Bean"/>
</target>
<target name="junit.clean">
<delete dir="${controls.classes.dir}"/>
<delete dir="${controls.beansrc.dir}"/>
<delete dir="${tests.classes.dir}"/>
<delete dir="${aux.beansrc.dir}"/>
<delete dir="${aux.classes.dir}"/>
<delete dir="${assembly.beansrc.dir}"/>
<delete file="${controls.jar}"/>
</target>
<!--
Aux files are those needed for tests but which must be built before beans/drivers
like Checkers. Files in 'aux' should only have dependecies on the existing classpath and
have NO DEPENDENCIES on artifacts from this build process!
-->
<target name="aux" description="Build support classes for junit tests">
<mkdir dir="${aux.classes.dir}"/>
<mkdir dir="${aux.beansrc.dir}"/>
<build-controls srcdir="${aux.src.dir}"
destdir="${aux.classes.dir}"
tempdir="${aux.beansrc.dir}"
classpathref="test-junit.dependency.path"/>
</target>
<target name="build" depends="aux" description="Build control sources">
<mkdir dir="${controls.classes.dir}"/>
<mkdir dir="${controls.beansrc.dir}"/>
<mkdir dir="${tests.classes.dir}"/>
<mkdir dir="${assembly.beansrc.dir}"/>
<path id="_test.classpath">
<path refid="test-junit.dependency.path"/>
<pathelement location="${aux.classes.dir}"/>
</path>
<build-controls srcdir="${controls.src.dir}"
destdir="${controls.classes.dir}"
tempdir="${controls.beansrc.dir}"
classpathref="_test.classpath"/>
<copy todir="${controls.classes.dir}">
<fileset dir="${controls.src.dir}">
<include name="**/*.txt"/>
</fileset>
</copy>
<assemble moduleDir="${controls.classes.dir}"
srcOutputDir="${controls.beansrc.dir}"
contextFactoryClassname="org.apache.beehive.controls.runtime.assembly.EJBAssemblyContext$Factory">
<classpath>
<path refid="test-junit.dependency.path"/>
<pathelement location="${controls.classes.dir}"/>
</classpath>
<fileset dir="${controls.classes.dir}">
<include name="**/*.controls.properties"/>
</fileset>
</assemble>
<control-jar destfile="${controls.jar}">
<fileset dir="${controls.classes.dir}"/>
<fileset dir="${aux.classes.dir}"/>
</control-jar>
<path id="_test.classpath">
<path refid="test-junit.dependency.path"/>
<pathelement location="${controls.jar}"/>
</path>
<build-controls srcdir="${tests.src.dir}"
destdir="${tests.classes.dir}"
tempdir="${tests.beansrc.dir}"
classpathref="_test.classpath"/>
<copy todir="${tests.classes.dir}">
<fileset dir="${tests.src.dir}">
<include name="**/*.beaninfo"/>
</fileset>
</copy>
<!-- in the assemble phase, any clients processed above which use controls requiring assembly will be dealt with here -->
<assemble moduleDir="${tests.classes.dir}"
srcOutputDir="${assembly.beansrc.dir}"
contextFactoryClassname="org.apache.beehive.controls.runtime.assembly.EJBAssemblyContext$Factory">
<classpath>
<pathelement location="${controls.classes.dir}"/>
<path refid="_test.classpath"/>
<pathelement location="${tests.classes.dir}"/>
</classpath>
<fileset dir="${tests.classes.dir}">
<include name="**/*.controls.properties"/>
</fileset>
</assemble>
<!-- build the generated files from the assemble phase -->
<javac srcdir="${assembly.beansrc.dir}"
destdir="${tests.classes.dir}"
classpathref="_test.classpath"
debug="on"
verbose="false"
failonerror="true">
<include name="**/*generated/*"/>
</javac>
</target>
<target name="test" description="Run tests for this project">
<mkdir dir="${log.dir}/html"/>
<path id="_test.classpath">
<path refid="junit.dependency.path"/>
<path refid="test-junit.dependency.path"/>
<pathelement location="${tests.classes.dir}"/>
<pathelement location="${controls.jar}"/>
</path>
<junit printsummary="yes" showOutput="true" failureproperty="controls.junit.failure" errorproperty="controls.junit.error">
<classpath refid="_test.classpath"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${log.dir}">
<fileset dir="${tests.classes.dir}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${log.dir}">
<fileset dir="${log.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${log.dir}/html"/>
</junitreport>
<fail if="controls.junit.failure" message="Controls JUnit tests had a failure"/>
<fail if="controls.junit.error" message="Controls JUnit tests had an error"/>
</target>
<!-- ==================================================================== -->
<!-- -->
<!-- -->
<!-- Private Ant macros -->
<!-- -->
<!-- -->
<!-- ==================================================================== -->
<!-- Note, this macro is PRIVATE to this build file and should not be used outside of controls/test/build.xml -->
<macrodef name="gen-beaninfo">
<attribute name="beaninfo"/>
<attribute name="beanclass"/>
<sequential>
<java classname="org.apache.beehive.controls.test.junit.utils.ControlIntrospector" classpathref="beaninfo.path" fork="yes">
<arg line="-outputPath @{beaninfo} @{beanclass}"/>
</java>
</sequential>
</macrodef>
</project>