beehive/test/dist-test/build.xml

175 lines
8.1 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/BuildTestDist" default="build" basedir=".">
<import file="../../beehive-imports.xml"/>
<property name="build.dir" location="${beehive.home}/build"/>
<property name="test.dist.base.dir" location="${build.dir}/test-dist"/>
<property name="test.dist.exec.dir" location="${test.dist.base.dir}/run"/>
<property name="test.dist.name" value="beehive-test-dist"/>
<target name="prep" description="Prepare the test-distribution assembling area">
<mkdir dir="${test.dist.base.dir}/${test.dist.name}"/>
<mkdir dir="${test.dist.base.dir}/${test.dist.name}/netui"/>
<mkdir dir="${test.dist.base.dir}/${test.dist.name}/controls"/>
<mkdir dir="${test.dist.base.dir}/${test.dist.name}/wsm"/>
</target>
<target name="clean" description="Cleans the test distribution directories">
<delete dir="${test.dist.base.dir}"/>
<delete dir="${test.dist.exec.dir}"/>
<delete dir="${beehive.home}/build/testDistArchives"/>
</target>
<target name="build" depends="prep" description="Build the test package for Beehive distribution test">
<echo>beehive.dist.home.dir: ${test.dist.base.dir}/${test.dist.name}</echo>
<echo>dist.name: ${dist.name}</echo>
<fail unless="dist.name" message="Unable to build distribution test archives; no dist.name specified"/>
<!-- Build / Assemble NetUI tests here -->
<antcall target="build.netui.tests"/>
<antcall target="assemble.netui.tests"/>
<!-- Build / Assemble Controls tests here -->
<antcall target="build.controls.tests"/>
<antcall target="assemble.controls.tests"/>
<!-- Assemble resources for all tests -->
<copy todir="${test.dist.base.dir}/${test.dist.name}">
<fileset dir="${beehive.home}/test/dist-test" includes="README.txt"/>
</copy>
<copy todir="${test.dist.base.dir}/${test.dist.name}">
<fileset dir="${beehive.home}/test/dist-test/files">
<include name="build.xml"/>
</fileset>
</copy>
<copy todir="${test.dist.base.dir}/${test.dist.name}">
<fileset dir="${beehive.home}/test/dist-test/files" includes="test-imports.xml"/>
</copy>
<copy todir="${test.dist.base.dir}/${test.dist.name}/ant">
<fileset file="${beehive.home}/ant/tomcat-imports.xml"/>
<fileset file="${beehive.home}/test/dist-test/files/testdist-buildWebapp.xml"/>
</copy>
<!-- temporary hacks for adding XMLBeans support to the distribution tests -->
<copy todir="${test.dist.base.dir}/${test.dist.name}/external">
<fileset refid="xbean.fileset"/>
<fileset refid="jsr173.fileset"/>
</copy>
<!-- Package the test distribution -->
<antcall target="package.test.dist"/>
</target>
<target name="build.netui.tests" description="Build netui tests">
<ant dir="${beehive.home}/netui/test/dist-test" antfile="build.xml" target="build.tests" inheritAll="false"/>
</target>
<target name="assemble.netui.tests" description="Assemble the netui tests for the distribution">
<ant dir="${beehive.home}/netui/test/dist-test" antfile="build.xml" target="assemble.tests" inheritAll="false">
<property name="test.dist.base.dir" location="${test.dist.base.dir}"/>
</ant>
</target>
<target name="assemble.controls.tests" description="Assemble the controls tests for the distribution">
<ant dir="${beehive.home}/controls/test/dist-test" antfile="build.xml" target="assemble.tests" inheritAll="false">
<property name="test.dist.base.dir" location="${test.dist.base.dir}"/>
</ant>
</target>
<target name="build.controls.tests" description="Build controls tests">
<ant dir="${beehive.home}/controls/test/dist-test" antfile="build.xml" target="build.tests" inheritAll="false">
<property name="test.dist.base.dir" location="${test.dist.base.dir}"/>
<property name="beehive.home" location="${beehive.home}"/>
</ant>
</target>
<!--
prereq: must run build.dist and build.test.dist before calling this,
and define the props beehive.dist.dir & beehive.dist.name
-->
<target name="run">
<echo>Distribution directory: ${beehive.dist.dir}</echo>
<echo>Distribution name: ${beehive.dist.name}</echo>
<fail unless="beehive.dist.dir" message="Could not run tests on distribution archive; beehive.dist.dir was not specified"/>
<fail unless="beehive.dist.name" message="Could not run tests on distribution archive; beehive.dist.name was not specified"/>
<available property="dist.dir.available" file="${beehive.dist.dir}" type="dir"/>
<fail unless="dist.dir.available" message="Can't find the required dist directory ${beehive.dist.dir}"/>
<delete dir="${test.dist.exec.dir}"/>
<!-- copy the beehive dist and the test dist into a new directory for testing -->
<copy todir="${test.dist.exec.dir}/${beehive.dist.name}">
<fileset dir="${beehive.dist.dir}" includes="**/*"/>
</copy>
<unzip src="${beehive.home}/build/testDistArchives/${beehive.dist.name}-test.zip" dest="${test.dist.exec.dir}"/>
<!-- Tomcat has trouble deploying a webapp with an existing context path whose content root is different
from the currently deployed webapp. Thus, the distribution test infrastructure needs to scrub
the webapps that could exist under $CATALINA_HOME before starting to run tests
Note, this is a *huge* hack and makes it more difficult to run the distribution tests against other app containers.
We should try to tackle this work after Beehive 1.0.
-->
<undeploy-webapps/>
<ant dir="${test.dist.exec.dir}/${test.dist.name}" target="run.tests" inheritAll="false">
<property name="dist.home" location="${beehive.dist.dir}"/>
</ant>
</target>
<target name="package.test.dist" description="Package beehive test distribution into archive files">
<mkdir dir="${beehive.home}/build/testDistArchives"/>
<zip destfile="${beehive.home}/build/testDistArchives/${dist.name}-test.zip" >
<fileset dir="${test.dist.base.dir}" excludes="**/*.gz,**/*.sh"/>
</zip>
<tar destfile="${beehive.home}/build/testDistArchives/${dist.name}-test.tar.gz" compression="gzip">
<tarfileset dir="${test.dist.base.dir}" excludes="**/*.zip,**/*.cmd"/>
</tar>
</target>
<macrodef name="undeploy-webapps">
<sequential>
<delete dir="${os.CATALINA_HOME}/work/Catalina/localhost/coreWeb"/>
<delete file="${os.CATALINA_HOME}/conf/Catalina/localhost/coreWeb.xml"/>
<delete dir="${os.CATALINA_HOME}/work/Catalina/localhost/jsfWeb"/>
<delete file="${os.CATALINA_HOME}/conf/Catalina/localhost/jsfWeb.xml"/>
<delete dir="${os.CATALINA_HOME}/work/Catalina/localhost/urlTemplates"/>
<delete file="${os.CATALINA_HOME}/conf/Catalina/localhost/urlTemplates.xml"/>
<delete dir="${os.CATALINA_HOME}/work/Catalina/localhost/controlsWeb"/>
<delete file="${os.CATALINA_HOME}/conf/Catalina/localhost/controlsWeb.xml"/>
</sequential>
</macrodef>
</project>