871N/A<!--
871N/A ! CDDL HEADER START
871N/A !
871N/A ! The contents of this file are subject to the terms of the
871N/A ! Common Development and Distribution License, Version 1.0 only
871N/A ! (the "License"). You may not use this file except in compliance
871N/A ! with the License.
871N/A !
871N/A ! You can obtain a copy of the license at
871N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
871N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
871N/A ! See the License for the specific language governing permissions
871N/A ! and limitations under the License.
871N/A !
871N/A ! When distributing Covered Code, include this CDDL HEADER in each
871N/A ! file and include the License file at
871N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
871N/A ! add the following below this CDDL HEADER, with the fields enclosed
873N/A ! by brackets "[]" replaced with your own identifying information:
871N/A ! Portions Copyright [yyyy] [name of copyright owner]
871N/A !
871N/A ! CDDL HEADER END
871N/A !
871N/A !
5061N/A ! Copyright 2008-2010 Sun Microsystems, Inc.
6211N/A ! Portions Copyright 2011-2013 ForgeRock AS
871N/A ! -->
3832N/A<project name="opends-staf-tests" basedir="../.." default="usage">
871N/A
871N/A <description>
2175N/A Installer ant file for the staf platform
2175N/A This allows tests that need a running instance of staf to easily
2175N/A get one and hides all the complexity under the hood
871N/A </description>
871N/A
871N/A
3832N/A <!-- ################## -->
3832N/A <!-- # ANT PROPERTIES # -->
3832N/A <!-- ################## -->
871N/A
3832N/A <!-- Display ant properties -->
3832N/A <target name="properties">
3832N/A <echoproperties/>
871N/A </target>
871N/A
871N/A
3832N/A <!-- ######## -->
3832N/A <!-- # INIT # -->
3832N/A <!-- ######## -->
927N/A
3832N/A <!-- Initialise variables -->
3832N/A <target name="global-init">
3832N/A <!-- Define project.home variable -->
3832N/A <dirname file="${basedir}/.." property="project.home"/>
871N/A
3832N/A <!-- Default value for product.name variable -->
3832N/A <property file="${project.home}/PRODUCT"/>
4723N/A <property name="product.short.name"
3832N/A value="${SHORT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}"/>
900N/A
3832N/A <!-- Define antfile.dir variable -->
3832N/A <property name="antfile.dir" value="${basedir}/shared/ant"/>
964N/A
3832N/A <!-- Load ant-contrib -->
1835N/A <taskdef resource="net/sf/antcontrib/antlib.xml">
1835N/A <classpath>
3832N/A <fileset dir="${project.home}/ext/ant/lib">
5353N/A <include name="*/*.jar"/>
1835N/A </fileset>
1835N/A </classpath>
1835N/A </taskdef>
3832N/A
4458N/A <!-- User environment -->
4458N/A <property environment="env"/>
4458N/A
3832N/A <!-- Check if the current platform is supported -->
3832N/A <switch value="${os.name}">
3832N/A <case value="SunOS">
3832N/A <!-- Solaris system -->
3832N/A <switch value="${os.arch}">
3832N/A <case value="sparc">
4458N/A <!-- Solaris sparc 32 bit -->
4458N/A <property name="os.myname" value="solaris-sparc"/>
4458N/A </case>
4458N/A <case value="sparcv9">
4458N/A <!-- Solaris sparc 64 bit -->
4458N/A <property name="os.myname" value="solaris-sparc64"/>
3832N/A </case>
3832N/A <case value="x86">
3832N/A <!-- Solaris x86 -->
3832N/A <property name="os.myname" value="solaris-x86"/>
3832N/A </case>
3832N/A <case value="amd64">
3832N/A <!-- Solaris amd64 -->
3832N/A <property name="os.myname" value="solaris-x64-64"/>
3832N/A </case>
3832N/A </switch>
3832N/A
3832N/A <exec executable="uname" outputproperty="host.name">
3832N/A <arg line="-n"/>
3832N/A </exec>
3832N/A <property name="extension.binary" value=""/>
3832N/A <property name="extension.shell" value=""/>
3832N/A <property name="var.path" value="PATH"/>
3832N/A </case>
3832N/A <case value="Linux">
3832N/A <!-- Linux system -->
3832N/A <switch value="${os.arch}">
3832N/A <case value="i386">
3832N/A <!-- Linux i386 -->
3832N/A <property name="os.myname" value="linux"/>
3832N/A </case>
3832N/A <case value="amd64">
3832N/A <!-- Linux amd64 -->
3832N/A <property name="os.myname" value="linux-amd64"/>
3832N/A </case>
3832N/A </switch>
3832N/A
3832N/A <exec executable="uname" outputproperty="host.name">
3832N/A <arg line="-n"/>
3832N/A </exec>
3832N/A <property name="extension.binary" value=""/>
3832N/A <property name="extension.shell" value=""/>
3832N/A <property name="var.path" value="PATH"/>
3832N/A </case>
5416N/A <case value="Mac OS X">
5416N/A <!-- MacOSX system -->
5416N/A <switch value="${os.arch}">
5416N/A <case value="x86_64">
5416N/A <!-- Linux i386 -->
5417N/A <property name="os.myname" value="macosx-universal"/>
5416N/A </case>
5416N/A </switch>
5416N/A
5416N/A <exec executable="uname" outputproperty="host.name">
5416N/A <arg line="-n"/>
5416N/A </exec>
5416N/A <property name="extension.binary" value=""/>
5416N/A <property name="extension.shell" value=""/>
5416N/A <property name="var.path" value="PATH"/>
5416N/A </case>
3832N/A <default>
4458N/A <osfamily property="os.family"/>
3832N/A <if>
3832N/A <equals arg1="${os.family}" arg2="windows"/>
3832N/A <then>
3832N/A <!-- Windows system -->
3832N/A <property name="os.myname" value="win32"/>
3832N/A
3832N/A <property name="host.name" value="${env.COMPUTERNAME}"/>
3832N/A <property name="extension.binary" value=".exe"/>
3832N/A <property name="extension.shell" value=".bat"/>
3832N/A <property name="var.path" value="Path"/>
3832N/A </then>
3832N/A <else>
5416N/A <fail>"Unsupported platform. ${os.name} - ${os.arch}"</fail>
3832N/A </else>
3832N/A </if>
3832N/A </default>
3832N/A </switch>
6211N/A
6211N/A <!-- Define tmp.dir variable -->
6211N/A <property name="tmp.dir" value="${java.io.tmpdir}/temp_files/${host.name}"/>
6211N/A
3832N/A <!-- Default value for staf.type -->
1835N/A <if>
3832N/A <not>
3832N/A <isset property="staf.type"/>
3832N/A </not>
1835N/A <then>
4458N/A <property name="staf.type" value="controller"/>
1835N/A </then>
1835N/A </if>
1835N/A
3832N/A <!-- Default value for tests.type -->
1835N/A <if>
3832N/A <not>
3832N/A <isset property="tests.type"/>
3832N/A </not>
1835N/A <then>
3832N/A <property name="tests.type" value="functional-tests"/>
1835N/A </then>
1835N/A </if>
3832N/A
3832N/A <!-- Default values for build environment -->
3832N/A <property file="${antfile.dir}/build.properties"/>
1215N/A
4458N/A <!-- User-defined values -->
4458N/A <if>
4458N/A <available file="${basedir}/user.properties"/>
4458N/A <then>
4458N/A <var file="${basedir}/user.properties"/>
4458N/A </then>
4458N/A </if>
4458N/A
4458N/A <!-- Tests-defined values -->
4458N/A <if>
4458N/A <available file="${env.CONFIG_FILE}"/>
4458N/A <then>
4458N/A <var file="${env.CONFIG_FILE}"/>
4458N/A </then>
4458N/A <else>
4458N/A <if>
4495N/A <available file="${basedir}/${tests.type}-${local.hostname}.properties"/>
4458N/A <then>
4495N/A <var file="${basedir}/${tests.type}-${local.hostname}.properties"/>
4458N/A </then>
4458N/A </if>
4458N/A </else>
4458N/A </if>
4458N/A
4714N/A <!-- Set value for tests.config.file variable depending on tests.mode -->
4458N/A <if>
4458N/A <equals arg1="${tests.mode}" arg2="remote"/>
4458N/A <then>
4458N/A <property name="tests.config.file" value="config-${local.hostname}-${remote.hostname}.py"/>
4458N/A </then>
4458N/A <else>
4458N/A <property name="tests.config.file" value="config-${local.hostname}.py"/>
4458N/A </else>
4458N/A </if>
4458N/A
4714N/A <!-- Set value for email.subject variable depending on tests.type -->
4495N/A <if>
4495N/A <equals arg1="${tests.type}" arg2="functional-tests"/>
4495N/A <then>
4495N/A <property name="email.subject"
4495N/A value="Functional tests: ${opends.name} ${remote.hostname} ${tests.os.string} ${tests.jvm.string}"/>
4495N/A </then>
4495N/A <else>
4495N/A <property name="email.subject"
4495N/A value="Stress tests: ${opends.name} ${remote.hostname} ${tests.os.string} ${tests.jvm.string}"/>
4495N/A </else>
4495N/A </if>
4495N/A
4714N/A <!-- Set value for variables which depends on user configuration -->
4714N/A <var name="staf.name" value="STAF-v${staf.version}-${os.myname}"/>
4714N/A <var name="staf.install.dir" value="${repository.dir}/install"/>
4714N/A <var name="staf.config.dir" value="${repository.dir}/configs"/>
4714N/A <var name="staf.config.file" value="${staf.config.dir}/staf-${staf.type}-${host.name}.cfg"/>
4714N/A <var name="staf.bin.dir" value="${staf.install.dir}/${staf.name}/bin"/>
4714N/A <var name="staf.daemon" value="${staf.bin.dir}/STAFProc${extension.binary}"/>
4714N/A <var name="staf.executable" value="${staf.bin.dir}/STAF${extension.binary}"/>
4495N/A
4714N/A <var name="archives.dir" value="${repository.dir}/archives"/>
5061N/A <var name="tests.run.dir" value="${logs.dir}"/>
4714N/A
3832N/A <if>
3832N/A <equals arg1="${os.family}" arg2="windows"/>
3832N/A <then>
3832N/A <!-- Windows system -->
3832N/A <property name="staf.archive"
3832N/A value="STAF${staf.version}-setup-${os.myname}.exe"/>
4714N/A <property name="staf.lib.dir" value="${staf.install.dir}/${staf.name}/bin"/>
3832N/A </then>
3832N/A <else>
3832N/A <!-- Other systems -->
3832N/A <property name="staf.archive"
3832N/A value="STAF${staf.version}-${os.myname}.tar.gz"/>
4714N/A <property name="staf.lib.dir" value="${staf.install.dir}/${staf.name}/lib"/>
3832N/A </else>
3832N/A </if>
4714N/A <var name="stax.name" value="STAX-v${stax.version}"/>
4714N/A <var name="stax.archive" value="STAXV${stax.version}.zip"/>
4714N/A <var name="email.name" value="Email-v${email.version}"/>
4714N/A <var name="email.archive" value="EmailV${email.version}.zip"/>
4714N/A <var name="event.name" value="Event-v${event.version}"/>
4714N/A <var name="event.archive" value="EventV${event.version}.zip"/>
4714N/A <var name="eventmanager.name" value="EventManager-v${eventmanager.version}"/>
4714N/A <var name="eventmanager.archive" value="EventManagerV${eventmanager.version}.zip"/>
4714N/A <var name="http.name" value="HTTP-v${http.version}"/>
4714N/A <var name="http.archive" value="HTTPV${http.version}.zip"/>
4714N/A <var name="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat.version}/bin"/>
4714N/A <var name="tomcat.archive" value="apache-tomcat-${tomcat.version}.zip"/>
4978N/A <var name="glassfish.url" value="http://download.java.net/glassfish/${glassfish.version}/release"/>
4978N/A <var name="glassfish.archive" value="glassfish-${glassfish.version}.zip"/>
4978N/A <var name="sunwebserver.archive" value="sjsws-${sunwebserver.version}-${os.myname}.zip"/>
4978N/A
4978N/A <switch value="${wc.type}">
4978N/A <case value="glassfish">
4978N/A <!-- Glassfish webcontainer -->
4978N/A <var name="wc.url" value="${glassfish.url}"/>
4978N/A <var name="wc.archive" value="${glassfish.archive}"/>
4978N/A <var name="wc.version" value="${glassfish.version}"/>
4978N/A </case>
4978N/A <case value="sunwebserver">
4978N/A <!-- SunWebserver webcontainer -->
4978N/A <var name="wc.url" value="${sunwebserver.url}"/>
4978N/A <var name="wc.archive" value="${sunwebserver.archive}"/>
4978N/A <var name="wc.version" value="${sunwebserver.version}"/>
4978N/A </case>
4978N/A <default>
4978N/A <!-- Tomcat webcontainer -->
4978N/A <var name="wc.url" value="${tomcat.url}"/>
4978N/A <var name="wc.archive" value="${tomcat.archive}"/>
4978N/A <var name="wc.version" value="${tomcat.version}"/>
4978N/A </default>
4978N/A </switch>
4978N/A
4978N/A
1215N/A </target>
1215N/A
3832N/A <!-- ######### -->
3832N/A <!-- # USAGE # -->
3832N/A <!-- ######### -->
1835N/A
3832N/A <!-- Display usage -->
3832N/A <target name="usage"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/usage.xml" target="usage"/>
871N/A </target>
1835N/A
3832N/A
3832N/A <!-- ############# -->
3832N/A <!-- # CONFIGURE # -->
3832N/A <!-- ############# -->
3832N/A
3832N/A <!-- Configure user variables -->
3832N/A <target name="user-configure"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/user.xml" target="configure"/>
871N/A </target>
3832N/A
3832N/A <!-- ######### -->
3832N/A <!-- # PROXY # -->
3832N/A <!-- ######### -->
3832N/A
3832N/A <!-- Check proxy -->
3832N/A <target name="proxy-check"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/proxy.xml" target="check"/>
2175N/A </target>
3832N/A
3832N/A <!-- Set proxy -->
3832N/A <target name="proxy-set"
3832N/A depends="global-init,proxy-check">
3832N/A <ant antfile="${antfile.dir}/proxy.xml" target="set"/>
2175N/A </target>
1445N/A
3832N/A
3832N/A <!-- ############ -->
3832N/A <!-- # DOWNLOAD # -->
3832N/A <!-- ############ -->
3832N/A
3832N/A <!-- Download dependencies -->
3832N/A <target name="dependencies-download"
3832N/A depends="global-init,proxy-set">
3832N/A <ant antfile="${antfile.dir}/dependencies.xml" target="download"/>
2175N/A </target>
3832N/A
3832N/A <!-- Remove current dependencies -->
3832N/A <target name="dependencies-remove"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/dependencies.xml" target="remove"/>
3832N/A </target>
3832N/A
3832N/A <!-- Remove old dependencies -->
3832N/A <target name="dependencies-removeold"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/dependencies.xml" target="removeold"/>
3832N/A </target>
3832N/A
3832N/A <!-- Remove all dependencies -->
3832N/A <target name="dependencies-removeall"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/dependencies.xml" target="removeall"/>
3832N/A </target>
871N/A
871N/A
3832N/A <!-- ######## -->
3832N/A <!-- # STAF # -->
3832N/A <!-- ######## -->
3832N/A
4458N/A <target name="set-controller-type">
4458N/A <property name="staf.type" value="controller"/>
4458N/A </target>
4458N/A
4458N/A <target name="set-slave-type">
4458N/A <property name="staf.type" value="slave"/>
4458N/A </target>
4458N/A
3832N/A <!-- Install STAF and STAF services -->
3832N/A <target name="staf-install"
3832N/A depends="global-init,dependencies-download">
3832N/A <ant antfile="${antfile.dir}/staf.xml" target="install"/>
3832N/A </target>
3832N/A
3832N/A <!-- Uninstall STAF and STAF services -->
3832N/A <target name="staf-uninstall"
3832N/A depends="global-init,staf-stop">
3832N/A <ant antfile="${antfile.dir}/staf.xml" target="uninstall"/>
3832N/A </target>
3832N/A
3832N/A <!-- Start STAF -->
4458N/A <target name="staf-start">
4458N/A <antcall target="staf-controller-start"/>
4458N/A </target>
4458N/A
4458N/A <target name="staf-controller-start"
4458N/A depends="set-controller-type,global-init,staf-install">
4458N/A <var name="staf.type" value="controller"/>
3832N/A <ant antfile="${antfile.dir}/staf.xml" target="start"/>
3832N/A </target>
900N/A
4458N/A <target name="staf-slave-start"
4458N/A depends="set-slave-type,global-init,staf-install">
4458N/A <var name="staf.type" value="slave"/>
4458N/A <ant antfile="${antfile.dir}/staf.xml" target="start"/>
3832N/A </target>
871N/A
3832N/A <!-- Stop STAF -->
3832N/A <target name="staf-stop"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/staf.xml" target="stop"/>
3832N/A </target>
871N/A
3832N/A <!-- Status STAF -->
3832N/A <target name="staf-status"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/staf.xml" target="status"/>
2175N/A </target>
3832N/A
3832N/A <!-- Start STAF GUI -->
3832N/A <target name="staf-gui"
3832N/A depends="global-init,staf-start">
3832N/A <ant antfile="${antfile.dir}/staf.xml" target="gui"/>
2175N/A </target>
1445N/A
3832N/A <!-- Display STAF JVM logs -->
3832N/A <target name="staf-jvmlogs"
3832N/A depends="global-init,staf-start">
3832N/A <ant antfile="${antfile.dir}/staf.xml" target="jvmlogs"/>
1629N/A </target>
3832N/A
3832N/A
3832N/A <!-- ######### -->
3832N/A <!-- # TESTS # -->
3832N/A <!-- ######### -->
4692N/A <!-- generate tests specs -->
4692N/A <target name="tests-specs"
4692N/A depends="set-func-type,global-init">
4692N/A <ant antfile="${antfile.dir}/tests.xml" target="specs"/>
4692N/A </target>
3832N/A
4458N/A <target name="set-func-type">
4458N/A <property name="tests.type" value="functional-tests"/>
4458N/A </target>
4458N/A
4458N/A <target name="set-stress-type">
4458N/A <property name="tests.type" value="stress-tests"/>
4458N/A </target>
4458N/A
3832N/A <!-- Configure tests to run -->
4458N/A <target name="tests-configure">
4458N/A <antcall target="tests-func-configure"/>
3832N/A </target>
3832N/A
3832N/A <!-- Configure functional tests to run -->
4458N/A <target name="tests-func-configure"
4458N/A depends="set-func-type,global-init">
4458N/A <ant antfile="${antfile.dir}/tests.xml" target="configure"/>
3832N/A </target>
3832N/A
3832N/A <!-- Configure stress tests to run -->
4458N/A <target name="tests-stress-configure"
4458N/A depends="set-stress-type,global-init">
4458N/A <ant antfile="${antfile.dir}/tests.xml" target="configure"/>
880N/A </target>
3832N/A
3832N/A <!-- Run tests -->
4458N/A <target name="tests-run">
4458N/A <antcall target="tests-func-run"/>
4458N/A </target>
4458N/A
4458N/A <!-- Run functional tests -->
4458N/A <target name="tests-func-run"
4458N/A depends="set-func-type,global-init,opends-build,staf-start">
3832N/A <ant antfile="${antfile.dir}/tests.xml" target="run"/>
3832N/A </target>
3832N/A
4645N/A <target name="tests-func-coverage"
4645N/A depends="set-func-type,global-init,opends-build,staf-start">
4645N/A <ant antfile="${antfile.dir}/tests.xml" target="testwithcoverage"/>
4645N/A </target>
4645N/A
3832N/A <!-- Run stress tests -->
4458N/A <target name="tests-stress-run"
4458N/A depends="set-stress-type,global-init,opends-build,staf-start">
4458N/A <ant antfile="${antfile.dir}/tests.xml" target="run"/>
1209N/A </target>
3832N/A
3832N/A
3832N/A <!-- ########## -->
3832N/A <!-- # OPENDS # -->
3832N/A <!-- ########## -->
3832N/A
3832N/A <!-- Build OpenDS zip -->
3832N/A <target name="opends-build"
3832N/A depends="global-init">
3832N/A <ant antfile="${antfile.dir}/opends.xml" target="build"/>
2062N/A </target>
871N/A</project>