<!--
! CDDL HEADER START
!
! The contents of this file are subject to the terms of the
! Common Development and Distribution License, Version 1.0 only
! (the "License"). You may not use this file except in compliance
! with the License.
!
! You can obtain a copy of the license at
! See the License for the specific language governing permissions
! and limitations under the License.
!
! When distributing Covered Code, include this CDDL HEADER in each
! file and include the License file at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
! add the following below this CDDL HEADER, with the fields enclosed
! by brackets "[]" replaced with your own identifying information:
! Portions Copyright [yyyy] [name of copyright owner]
!
! CDDL HEADER END
!
!
! Copyright 2008-2010 Sun Microsystems, Inc.
! Portions Copyright 2011-2013 ForgeRock AS
! -->
<project name="opends-staf-tests" basedir="../.." default="usage">
<description>
Installer ant file for the staf platform
This allows tests that need a running instance of staf to easily
get one and hides all the complexity under the hood
</description>
<!-- ################## -->
<!-- # ANT PROPERTIES # -->
<!-- ################## -->
<!-- Display ant properties -->
<target name="properties">
<echoproperties/>
</target>
<!-- ######## -->
<!-- # INIT # -->
<!-- ######## -->
<!-- Initialise variables -->
<target name="global-init">
<!-- Define project.home variable -->
<!-- Default value for product.name variable -->
<property file="${project.home}/PRODUCT"/>
<property name="product.short.name"
value="${SHORT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}"/>
<!-- Define antfile.dir variable -->
<!-- Load ant-contrib -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${project.home}/ext/ant/lib">
<include name="*/*.jar"/>
</fileset>
</classpath>
</taskdef>
<!-- User environment -->
<property environment="env"/>
<!-- Check if the current platform is supported -->
<switch value="${os.name}">
<case value="SunOS">
<!-- Solaris system -->
<switch value="${os.arch}">
<case value="sparc">
<!-- Solaris sparc 32 bit -->
</case>
<case value="sparcv9">
<!-- Solaris sparc 64 bit -->
</case>
<case value="x86">
<!-- Solaris x86 -->
</case>
<case value="amd64">
<!-- Solaris amd64 -->
</case>
</switch>
<arg line="-n"/>
</exec>
</case>
<case value="Linux">
<!-- Linux system -->
<switch value="${os.arch}">
<case value="i386">
<!-- Linux i386 -->
</case>
<case value="amd64">
<!-- Linux amd64 -->
</case>
</switch>
<arg line="-n"/>
</exec>
</case>
<case value="Mac OS X">
<!-- MacOSX system -->
<switch value="${os.arch}">
<case value="x86_64">
<!-- Linux i386 -->
</case>
</switch>
<arg line="-n"/>
</exec>
</case>
<default>
<osfamily property="os.family"/>
<if>
<then>
<!-- Windows system -->
</then>
<else>
</else>
</if>
</default>
</switch>
<!-- Define tmp.dir variable -->
<!-- Default value for staf.type -->
<if>
<not>
<isset property="staf.type"/>
</not>
<then>
</then>
</if>
<!-- Default value for tests.type -->
<if>
<not>
<isset property="tests.type"/>
</not>
<then>
</then>
</if>
<!-- Default values for build environment -->
<property file="${antfile.dir}/build.properties"/>
<!-- User-defined values -->
<if>
<available file="${basedir}/user.properties"/>
<then>
<var file="${basedir}/user.properties"/>
</then>
</if>
<!-- Tests-defined values -->
<if>
<available file="${env.CONFIG_FILE}"/>
<then>
<var file="${env.CONFIG_FILE}"/>
</then>
<else>
<if>
<available file="${basedir}/${tests.type}-${local.hostname}.properties"/>
<then>
<var file="${basedir}/${tests.type}-${local.hostname}.properties"/>
</then>
</if>
</else>
</if>
<!-- Set value for tests.config.file variable depending on tests.mode -->
<if>
<then>
</then>
<else>
</else>
</if>
<!-- Set value for email.subject variable depending on tests.type -->
<if>
<then>
<property name="email.subject"
value="Functional tests: ${opends.name} ${remote.hostname} ${tests.os.string} ${tests.jvm.string}"/>
</then>
<else>
<property name="email.subject"
value="Stress tests: ${opends.name} ${remote.hostname} ${tests.os.string} ${tests.jvm.string}"/>
</else>
</if>
<!-- Set value for variables which depends on user configuration -->
<if>
<then>
<!-- Windows system -->
<property name="staf.archive"
value="STAF${staf.version}-setup-${os.myname}.exe"/>
</then>
<else>
<!-- Other systems -->
<property name="staf.archive"
value="STAF${staf.version}-${os.myname}.tar.gz"/>
</else>
</if>
<var name="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat.version}/bin"/>
<switch value="${wc.type}">
<case value="glassfish">
<!-- Glassfish webcontainer -->
</case>
<case value="sunwebserver">
<!-- SunWebserver webcontainer -->
</case>
<default>
<!-- Tomcat webcontainer -->
</default>
</switch>
</target>
<!-- ######### -->
<!-- # USAGE # -->
<!-- ######### -->
<!-- Display usage -->
<target name="usage"
depends="global-init">
</target>
<!-- ############# -->
<!-- # CONFIGURE # -->
<!-- ############# -->
<!-- Configure user variables -->
<target name="user-configure"
depends="global-init">
</target>
<!-- ######### -->
<!-- # PROXY # -->
<!-- ######### -->
<!-- Check proxy -->
<target name="proxy-check"
depends="global-init">
</target>
<!-- Set proxy -->
<target name="proxy-set"
depends="global-init,proxy-check">
</target>
<!-- ############ -->
<!-- # DOWNLOAD # -->
<!-- ############ -->
<!-- Download dependencies -->
<target name="dependencies-download"
depends="global-init,proxy-set">
</target>
<!-- Remove current dependencies -->
<target name="dependencies-remove"
depends="global-init">
</target>
<!-- Remove old dependencies -->
<target name="dependencies-removeold"
depends="global-init">
</target>
<!-- Remove all dependencies -->
<target name="dependencies-removeall"
depends="global-init">
</target>
<!-- ######## -->
<!-- # STAF # -->
<!-- ######## -->
<target name="set-controller-type">
</target>
<target name="set-slave-type">
</target>
<!-- Install STAF and STAF services -->
<target name="staf-install"
depends="global-init,dependencies-download">
</target>
<!-- Uninstall STAF and STAF services -->
<target name="staf-uninstall"
depends="global-init,staf-stop">
</target>
<!-- Start STAF -->
<target name="staf-start">
<antcall target="staf-controller-start"/>
</target>
<target name="staf-controller-start"
depends="set-controller-type,global-init,staf-install">
</target>
<target name="staf-slave-start"
depends="set-slave-type,global-init,staf-install">
</target>
<!-- Stop STAF -->
<target name="staf-stop"
depends="global-init">
</target>
<!-- Status STAF -->
<target name="staf-status"
depends="global-init">
</target>
<!-- Start STAF GUI -->
<target name="staf-gui"
depends="global-init,staf-start">
</target>
<!-- Display STAF JVM logs -->
<target name="staf-jvmlogs"
depends="global-init,staf-start">
</target>
<!-- ######### -->
<!-- # TESTS # -->
<!-- ######### -->
<!-- generate tests specs -->
<target name="tests-specs"
depends="set-func-type,global-init">
</target>
<target name="set-func-type">
</target>
<target name="set-stress-type">
</target>
<!-- Configure tests to run -->
<target name="tests-configure">
<antcall target="tests-func-configure"/>
</target>
<!-- Configure functional tests to run -->
<target name="tests-func-configure"
depends="set-func-type,global-init">
</target>
<!-- Configure stress tests to run -->
<target name="tests-stress-configure"
depends="set-stress-type,global-init">
</target>
<!-- Run tests -->
<target name="tests-run">
<antcall target="tests-func-run"/>
</target>
<!-- Run functional tests -->
<target name="tests-func-run"
depends="set-func-type,global-init,opends-build,staf-start">
</target>
<target name="tests-func-coverage"
depends="set-func-type,global-init,opends-build,staf-start">
</target>
<!-- Run stress tests -->
<target name="tests-stress-run"
depends="set-stress-type,global-init,opends-build,staf-start">
</target>
<!-- ########## -->
<!-- # OPENDS # -->
<!-- ########## -->
<!-- Build OpenDS zip -->
<target name="opends-build"
depends="global-init">
</target>
</project>