build.xml revision 4495
0N/A<!--
3261N/A ! CDDL HEADER START
0N/A !
0N/A ! The contents of this file are subject to the terms of the
0N/A ! Common Development and Distribution License, Version 1.0 only
0N/A ! (the "License"). You may not use this file except in compliance
2362N/A ! with the License.
0N/A !
2362N/A ! You can obtain a copy of the license at
0N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
0N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
0N/A ! See the License for the specific language governing permissions
0N/A ! and limitations under the License.
0N/A !
0N/A ! When distributing Covered Code, include this CDDL HEADER in each
0N/A ! file and include the License file at
0N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
0N/A ! add the following below this CDDL HEADER, with the fields enclosed
0N/A ! by brackets "[]" replaced with your own identifying information:
0N/A ! Portions Copyright [yyyy] [name of copyright owner]
2362N/A !
2362N/A ! CDDL HEADER END
2362N/A !
0N/A !
0N/A ! Copyright 2008-2009 Sun Microsystems, Inc.
0N/A ! -->
0N/A<project name="opends-staf-tests" basedir="../.." default="usage">
0N/A
0N/A <description>
0N/A Installer ant file for the staf platform
0N/A This allows tests that need a running instance of staf to easily
0N/A get one and hides all the complexity under the hood
0N/A </description>
0N/A
0N/A
0N/A <!-- ################## -->
2450N/A <!-- # ANT PROPERTIES # -->
0N/A <!-- ################## -->
0N/A
0N/A <!-- Display ant properties -->
0N/A <target name="properties">
0N/A <echoproperties/>
0N/A </target>
0N/A
0N/A
0N/A <!-- ######## -->
0N/A <!-- # INIT # -->
0N/A <!-- ######## -->
0N/A
0N/A <!-- Initialise variables -->
0N/A <target name="global-init">
0N/A <!-- Define project.home variable -->
0N/A <dirname file="${basedir}/.." property="project.home"/>
0N/A
0N/A <!-- Default value for product.name variable -->
0N/A <property file="${project.home}/PRODUCT"/>
0N/A <property name="product.name"
0N/A value="${SHORT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}"/>
0N/A
0N/A <!-- Define antfile.dir variable -->
0N/A <property name="antfile.dir" value="${basedir}/shared/ant"/>
0N/A
0N/A <!-- Define antfile.dir variable -->
0N/A <property name="tmp.dir" value="${java.io.tmpdir}/temp_files"/>
0N/A
0N/A <!-- Load ant-contrib -->
0N/A <taskdef resource="net/sf/antcontrib/antlib.xml">
0N/A <classpath>
0N/A <fileset dir="${project.home}/ext/ant/lib">
0N/A <include name="**/*.jar"/>
0N/A </fileset>
0N/A </classpath>
0N/A </taskdef>
0N/A
0N/A <!-- User environment -->
0N/A <property environment="env"/>
0N/A
0N/A <!-- Check if the current platform is supported -->
0N/A <switch value="${os.name}">
0N/A <case value="SunOS">
0N/A <!-- Solaris system -->
0N/A <switch value="${os.arch}">
0N/A <case value="sparc">
0N/A <!-- Solaris sparc 32 bit -->
0N/A <property name="os.myname" value="solaris-sparc"/>
0N/A </case>
0N/A <case value="sparcv9">
0N/A <!-- Solaris sparc 64 bit -->
0N/A <property name="os.myname" value="solaris-sparc64"/>
0N/A </case>
0N/A <case value="x86">
0N/A <!-- Solaris x86 -->
0N/A <property name="os.myname" value="solaris-x86"/>
0N/A </case>
0N/A <case value="amd64">
0N/A <!-- Solaris amd64 -->
0N/A <property name="os.myname" value="solaris-x64-64"/>
0N/A </case>
0N/A </switch>
0N/A
0N/A <exec executable="uname" outputproperty="host.name">
0N/A <arg line="-n"/>
0N/A </exec>
0N/A <property name="extension.binary" value=""/>
0N/A <property name="extension.shell" value=""/>
0N/A <property name="var.path" value="PATH"/>
0N/A </case>
0N/A <case value="Linux">
0N/A <!-- Linux system -->
0N/A <switch value="${os.arch}">
0N/A <case value="i386">
0N/A <!-- Linux i386 -->
0N/A <property name="os.myname" value="linux"/>
0N/A </case>
0N/A <case value="amd64">
0N/A <!-- Linux amd64 -->
0N/A <property name="os.myname" value="linux-amd64"/>
0N/A </case>
0N/A </switch>
0N/A
0N/A <exec executable="uname" outputproperty="host.name">
0N/A <arg line="-n"/>
0N/A </exec>
0N/A <property name="extension.binary" value=""/>
0N/A <property name="extension.shell" value=""/>
0N/A <property name="var.path" value="PATH"/>
0N/A </case>
0N/A <default>
0N/A <osfamily property="os.family"/>
0N/A <if>
0N/A <equals arg1="${os.family}" arg2="windows"/>
0N/A <then>
0N/A <!-- Windows system -->
0N/A <property name="os.myname" value="win32"/>
0N/A
0N/A <property name="host.name" value="${env.COMPUTERNAME}"/>
0N/A <property name="extension.binary" value=".exe"/>
0N/A <property name="extension.shell" value=".bat"/>
0N/A <property name="var.path" value="Path"/>
0N/A </then>
0N/A <else>
0N/A <fail>"Unsupported platform."</fail>
0N/A </else>
0N/A </if>
0N/A </default>
0N/A </switch>
0N/A
0N/A <!-- Default value for staf.type -->
0N/A <if>
0N/A <not>
0N/A <isset property="staf.type"/>
0N/A </not>
0N/A <then>
0N/A <property name="staf.type" value="controller"/>
0N/A </then>
0N/A </if>
0N/A
0N/A <!-- Default value for tests.type -->
0N/A <if>
0N/A <not>
0N/A <isset property="tests.type"/>
0N/A </not>
0N/A <then>
0N/A <property name="tests.type" value="functional-tests"/>
0N/A </then>
0N/A </if>
0N/A
0N/A <!-- Default values for build environment -->
0N/A <property file="${antfile.dir}/build.properties"/>
0N/A
0N/A <!-- User-defined values -->
0N/A <if>
0N/A <available file="${basedir}/user.properties"/>
0N/A <then>
0N/A <var file="${basedir}/user.properties"/>
0N/A </then>
0N/A </if>
0N/A
0N/A <!-- Tests-defined values -->
0N/A <if>
0N/A <available file="${env.CONFIG_FILE}"/>
0N/A <then>
0N/A <var file="${env.CONFIG_FILE}"/>
0N/A </then>
0N/A <else>
0N/A <if>
0N/A <available file="${basedir}/${tests.type}-${local.hostname}.properties"/>
0N/A <then>
0N/A <var file="${basedir}/${tests.type}-${local.hostname}.properties"/>
0N/A </then>
0N/A </if>
0N/A </else>
0N/A </if>
0N/A
0N/A <!-- Set value for tests.config.file variable -->
0N/A <if>
0N/A <equals arg1="${tests.mode}" arg2="remote"/>
0N/A <then>
0N/A <property name="tests.config.file" value="config-${local.hostname}-${remote.hostname}.py"/>
0N/A </then>
0N/A <else>
0N/A <property name="tests.config.file" value="config-${local.hostname}.py"/>
0N/A </else>
0N/A </if>
0N/A
0N/A <!-- Set value for tests.run.dir variable -->
0N/A <if>
0N/A <not>
0N/A <equals arg1="${logs.dir}" arg2="${basedir}/temp/logs"/>
0N/A </not>
0N/A <then>
0N/A <var name="tests.run.dir" value="${logs.dir}/${tests.type}/run"/>
0N/A </then>
0N/A </if>
0N/A
0N/A <!-- Set value for email.subject variable -->
0N/A <if>
0N/A <equals arg1="${tests.type}" arg2="functional-tests"/>
0N/A <then>
0N/A <property name="email.subject"
0N/A value="Functional tests: ${opends.name} ${remote.hostname} ${tests.os.string} ${tests.jvm.string}"/>
0N/A </then>
0N/A <else>
0N/A <property name="email.subject"
0N/A value="Stress tests: ${opends.name} ${remote.hostname} ${tests.os.string} ${tests.jvm.string}"/>
0N/A </else>
0N/A </if>
0N/A
0N/A
0N/A <!-- Set value for staf.archive and staf.lib.dir variables -->
0N/A <if>
0N/A <equals arg1="${os.family}" arg2="windows"/>
0N/A <then>
0N/A <!-- Windows system -->
0N/A <property name="staf.archive"
0N/A value="STAF${staf.version}-setup-${os.myname}.exe"/>
0N/A <property name="staf.lib.dir" value="${staf.install.dir}${file.separator}bin"/>
0N/A </then>
0N/A <else>
0N/A <!-- Other systems -->
0N/A <property name="staf.archive"
0N/A value="STAF${staf.version}-${os.myname}.tar.gz"/>
0N/A <property name="staf.lib.dir" value="${staf.install.dir}${file.separator}lib"/>
0N/A </else>
0N/A </if>
0N/A </target>
0N/A
0N/A <!-- ######### -->
0N/A <!-- # USAGE # -->
0N/A <!-- ######### -->
0N/A
0N/A <!-- Display usage -->
0N/A <target name="usage"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/usage.xml" target="usage"/>
0N/A </target>
0N/A
0N/A
0N/A <!-- ############# -->
0N/A <!-- # CONFIGURE # -->
0N/A <!-- ############# -->
0N/A
0N/A <!-- Configure user variables -->
0N/A <target name="user-configure"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/user.xml" target="configure"/>
0N/A </target>
0N/A
0N/A <!-- ######### -->
0N/A <!-- # PROXY # -->
0N/A <!-- ######### -->
0N/A
0N/A <!-- Check proxy -->
0N/A <target name="proxy-check"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/proxy.xml" target="check"/>
0N/A </target>
0N/A
0N/A <!-- Set proxy -->
0N/A <target name="proxy-set"
0N/A depends="global-init,proxy-check">
0N/A <ant antfile="${antfile.dir}/proxy.xml" target="set"/>
0N/A </target>
0N/A
0N/A
0N/A <!-- ############ -->
0N/A <!-- # DOWNLOAD # -->
0N/A <!-- ############ -->
0N/A
0N/A <!-- Download dependencies -->
0N/A <target name="dependencies-download"
0N/A depends="global-init,proxy-set">
0N/A <ant antfile="${antfile.dir}/dependencies.xml" target="download"/>
0N/A </target>
0N/A
0N/A <!-- Remove current dependencies -->
0N/A <target name="dependencies-remove"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/dependencies.xml" target="remove"/>
0N/A </target>
0N/A
0N/A <!-- Remove old dependencies -->
0N/A <target name="dependencies-removeold"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/dependencies.xml" target="removeold"/>
0N/A </target>
0N/A
0N/A <!-- Remove all dependencies -->
0N/A <target name="dependencies-removeall"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/dependencies.xml" target="removeall"/>
0N/A </target>
0N/A
0N/A
0N/A <!-- ######## -->
0N/A <!-- # STAF # -->
0N/A <!-- ######## -->
0N/A
0N/A <target name="set-controller-type">
0N/A <property name="staf.type" value="controller"/>
0N/A </target>
0N/A
0N/A <target name="set-slave-type">
0N/A <property name="staf.type" value="slave"/>
0N/A </target>
0N/A
0N/A <!-- Install STAF and STAF services -->
0N/A <target name="staf-install"
0N/A depends="global-init,dependencies-download">
0N/A <ant antfile="${antfile.dir}/staf.xml" target="install"/>
0N/A </target>
0N/A
0N/A <!-- Uninstall STAF and STAF services -->
0N/A <target name="staf-uninstall"
0N/A depends="global-init,staf-stop">
0N/A <ant antfile="${antfile.dir}/staf.xml" target="uninstall"/>
0N/A </target>
0N/A
0N/A <!-- Start STAF -->
0N/A <target name="staf-start">
0N/A <antcall target="staf-controller-start"/>
0N/A </target>
0N/A
0N/A <target name="staf-controller-start"
0N/A depends="set-controller-type,global-init,staf-install">
0N/A <var name="staf.type" value="controller"/>
0N/A <ant antfile="${antfile.dir}/staf.xml" target="start"/>
0N/A </target>
0N/A
0N/A <target name="staf-slave-start"
0N/A depends="set-slave-type,global-init,staf-install">
0N/A <var name="staf.type" value="slave"/>
0N/A <ant antfile="${antfile.dir}/staf.xml" target="start"/>
0N/A </target>
0N/A
0N/A <!-- Stop STAF -->
0N/A <target name="staf-stop"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/staf.xml" target="stop"/>
0N/A </target>
0N/A
0N/A <!-- Status STAF -->
0N/A <target name="staf-status"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/staf.xml" target="status"/>
0N/A </target>
0N/A
0N/A <!-- Start STAF GUI -->
0N/A <target name="staf-gui"
0N/A depends="global-init,staf-start">
0N/A <ant antfile="${antfile.dir}/staf.xml" target="gui"/>
0N/A </target>
0N/A
0N/A <!-- Display STAF JVM logs -->
0N/A <target name="staf-jvmlogs"
0N/A depends="global-init,staf-start">
0N/A <ant antfile="${antfile.dir}/staf.xml" target="jvmlogs"/>
0N/A </target>
0N/A
0N/A
0N/A <!-- ######### -->
0N/A <!-- # TESTS # -->
0N/A <!-- ######### -->
0N/A
0N/A <target name="set-func-type">
0N/A <property name="tests.type" value="functional-tests"/>
0N/A </target>
0N/A
0N/A <target name="set-stress-type">
0N/A <property name="tests.type" value="stress-tests"/>
0N/A </target>
0N/A
0N/A <!-- Configure tests to run -->
0N/A <target name="tests-configure">
0N/A <antcall target="tests-func-configure"/>
0N/A </target>
0N/A
0N/A <!-- Configure functional tests to run -->
0N/A <target name="tests-func-configure"
0N/A depends="set-func-type,global-init">
0N/A <ant antfile="${antfile.dir}/tests.xml" target="configure"/>
0N/A </target>
0N/A
0N/A <!-- Configure stress tests to run -->
0N/A <target name="tests-stress-configure"
0N/A depends="set-stress-type,global-init">
0N/A <ant antfile="${antfile.dir}/tests.xml" target="configure"/>
0N/A </target>
0N/A
0N/A <!-- Run tests -->
0N/A <target name="tests-run">
0N/A <antcall target="tests-func-run"/>
0N/A </target>
0N/A
0N/A <!-- Run functional tests -->
0N/A <target name="tests-func-run"
0N/A depends="set-func-type,global-init,opends-build,staf-start">
0N/A <ant antfile="${antfile.dir}/tests.xml" target="run"/>
0N/A </target>
0N/A
0N/A <!-- Run stress tests -->
0N/A <target name="tests-stress-run"
0N/A depends="set-stress-type,global-init,opends-build,staf-start">
0N/A <ant antfile="${antfile.dir}/tests.xml" target="run"/>
0N/A </target>
0N/A
0N/A
0N/A <!-- ########## -->
0N/A <!-- # OPENDS # -->
0N/A <!-- ########## -->
0N/A
0N/A <!-- Build OpenDS zip -->
0N/A <target name="opends-build"
0N/A depends="global-init">
0N/A <ant antfile="${antfile.dir}/opends.xml" target="build"/>
0N/A </target>
0N/A</project>
0N/A