From 2670f6bb8c7ea850638ce4e4d3efad4e98ab10c2 Mon Sep 17 00:00:00 2001
From: al_xipe <al_xipe@localhost>
Date: Tue, 13 Feb 2007 04:42:21 +0000
Subject: [PATCH] commit for issue 843 this aims at easing the automation of the functional tests. it allows to download, install, start staf, run the tests and then stop and uninstall staf.
---
opends/tests/functional-tests/staf-installer/windows.properties | 2
opends/tests/functional-tests/staf-installer/SunOS-x86.properties | 1
opends/tests/functional-tests/staf-installer/poeut.xml | 5
opends/tests/functional-tests/staf-installer/windows-x86-32.properties | 2
opends/tests/functional-tests/staf-installer/Linux.properties | 1
opends/tests/functional-tests/staf-installer/SunOS-sparc.properties | 1
/dev/null | 1
opends/tests/functional-tests/staf-installer.xml | 520 +++++++++++++++++++++++++++++++++++++++++++++++
opends/tests/functional-tests/staf-installer/functional-tests.cfg | 16 +
opends/tests/functional-tests/staf-installer/replay.sh | 10
opends/tests/functional-tests/staf-installer/staf-installer.properties | 51 ++++
opends/tests/functional-tests/staf-installer/replay.bat | 11 +
opends/tests/functional-tests/staf-installer/windows-x86-64.properties | 1
opends/tests/functional-tests/staf-installer/config.py.stubs | 30 ++
14 files changed, 651 insertions(+), 1 deletions(-)
diff --git a/opends/tests/functional-tests/STAF.cfg.stubs b/opends/tests/functional-tests/STAF.cfg.stubs
deleted file mode 100644
index ad2360f..0000000
--- a/opends/tests/functional-tests/STAF.cfg.stubs
+++ /dev/null
@@ -1,19 +0,0 @@
-# Turn on tracing of internal errors and deprecated options
-trace enable tracepoints "error deprecated"
-
-# Enable TCP/IP connections
-interface tcp library STAFTCP
-
-# Set default local trust
-trust machine local://local level 5
-
-# Default Service Loader Service
-serviceloader library STAFDSLS
-
-service stax library JSTAF execute ${staf.services.dir}${file.separator}stax${file.separator}STAX.jar option J2=-Xmx384m
-service event library JSTAF execute ${staf.services.dir}${file.separator}event${file.separator}STAFEvent.jar
-service eventmanager library JSTAF execute ${staf.services.dir}${file.separator}eventmanager${file.separator}STAFEventManager.jar
-service cron library JSTAF execute ${staf.services.dir}${file.separator}cron${file.separator}STAFCron.jar
-set MAXQUEUESIZE 10000
-
-trust level 5 machine tcp://localhost
diff --git a/opends/tests/functional-tests/build.xml b/opends/tests/functional-tests/build.xml
deleted file mode 100644
index 262dffa..0000000
--- a/opends/tests/functional-tests/build.xml
+++ /dev/null
@@ -1,174 +0,0 @@
-<!--
- ! 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
- ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
- ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
- ! 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
- !
- !
- ! Portions Copyright 2006 Sun Microsystems, Inc.
- ! -->
-
-<project name="opends-tests-functional" basedir="." default="usage">
- <description>
- the purpose of this ant file is to facilitate and automate the
- functional testing of opends
- </description>
-
- <property name="project.home.dir"
- value="${basedir}${file.separator}..${file.separator}.." />
- <property name="project.build.dir" value="${project.home.dir}${file.separator}build" />
- <property name="functional.home.dir"
- value="${project.build.dir}${file.separator}functional-tests" />
- <property file="..${file.separator}..${file.separator}PRODUCT" />
- <property name="product.name" value="${SHORT_NAME}" />
- <property name="product.version"
- value="${MAJOR_VERSION}.${MINOR_VERSION}${VERSION_QUALIFIER}" />
- <!-- in case there's a custom installer properties file -->
- <property file="..${file.separator}installer.properties" />
- <!-- in case there isn't - load default values -->
- <property file="..${file.separator}default.installer.properties" />
- <!-- functional tests specific properties -->
- <property file="functional.properties" />
- <tstamp>
- <format property="run.time" pattern="yyyy.MM.dd-HH.mm.ss" />
- </tstamp>
- <condition property="isWindows" >
- <os family="windows" />
- </condition>
- <condition property="staf.jar" value="STAF315-setup-win32.jar">
- <os family="windows" />
- </condition>
- <property name="staf.lib.dir"
- value="${project.home.dir}${file.separator}ext${file.separator}staf" />
- <property name="staf.install.dir"
- value="${functional.home.dir}${file.separator}staf" />
- <property name="staf.services.dir"
- value="${staf.install.dir}${file.separator}services" />
-
- <target name="usage">
- <echo>Usage for oulu test suite:
- [all]
- bootstrap a fresh instance of ${product.name}
- run the functional tests
- wipeout the {{product.name} instance
-
- [install]
-
- [run-tests]
- run the functional tests
-
- [bootstrap]
- install, configure and start an ${product.name} instance
-
- [wipeout]
- stop and uninstall a previously bootstraped ${product.name} instance
- </echo>
- </target>
-
- <!-- install the staf bits on the box -->
- <target name="install.do" >
- <java
- fork="true"
- dir="${staf.lib.dir}"
- jar="${staf.lib.dir}${file.separator}${staf.jar}" >
- <arg value="-silent" />
- <!-- argument switch for the staf installer -->
- <arg value="-W" />
- <!-- installation directory -->
- <arg line='stafinstalldirectory.defaultInstallLocation="${staf.install.dir}"'/>
- <!-- silent acceptance of the staf license -->
- <arg line='license.selection="Accept"' />
- <arg line='stafOptions.updateEnvironmentVariables="None"' />
- </java>
- </target>
-
- <target name="install" >
- <mkdir dir="${func.build.dir}" />
- <antcall target="install.do" />
- <mkdir dir="${staf.services.dir}" />
- <unzip dest="${staf.services.dir}">
- <fileset dir="${staf.lib.dir}">
- <include name="*.zip"/>
- </fileset>
- </unzip>
- <delete
- file="${staf.install.dir}${file.separator}bin${file.separator}STAF.cfg"/>
- <copy file="${basedir}/STAF.cfg.stubs"
- tofile="${staf.install.dir}${file.separator}bin${file.separator}STAF.cfg"
- overwrite="true" >
- <filterchain>
- <expandproperties/>
- </filterchain>
- </copy>
- </target>
- <!-- end of staf installation -->
-
- <!-- staf uninstallation -->
- <target name="uninstall.do" >
- <exec executable="${staf.install.dir}${file.separator}_uninst/uninstaller">
- <arg value="-silent" />
- </exec>
- </target>
-
- <target name="uninstall">
- <antcall target="uninstall.do" />
- <delete dir="${staf.install.dir}" />
- </target>
- <!-- end of staf uninstallation -->
-
- <!-- run the functional tests -->
-<!-- <taskdef name="staf" classpath="${staf.install.dir}\bin\STAFAnt.jar" classname="com.ibm.staf.ant.taskdef.STAF" /> -->
- <!-- end of run functional tests related targets -->
-
- <target name="pouet" >
- <echo message="os.name=${os.name}" />
- <echo message="os.arch=${os.arch}" />
- <echo message="file.separator=${file.separator}" />
-
- </target>
-
-
- <!-- installer related targets -->
- <target name="bootstrap">
- <ant
- antfile="installer.xml"
- dir=".."
- target="bootstrap"
- inheritAll="false" />
- </target>
- <target name="wipeout">
- <ant
- antfile="installer.xml"
- dir=".."
- target="wipeout"
- inheritAll="false" />
- </target>
- <!-- end of installer related targets -->
-
-
- <!-- macros - chained targets -->
- <target name="all" >
- <antcall target="bootstrap" />
- <antcall target="install" />
- <antcall target="run-tests" />
- <antcall target="uninstall" />
- <antcall target="wipeout" />
- </target>
-</project>
diff --git a/opends/tests/functional-tests/functional.properties b/opends/tests/functional-tests/functional.properties
deleted file mode 100644
index b5e2dd1..0000000
--- a/opends/tests/functional-tests/functional.properties
+++ /dev/null
@@ -1 +0,0 @@
-func.build.dir=${project.home.dir}/build/functional-tests
diff --git a/opends/tests/functional-tests/staf-installer.xml b/opends/tests/functional-tests/staf-installer.xml
new file mode 100644
index 0000000..5dbba23
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer.xml
@@ -0,0 +1,520 @@
+<!--
+ ! 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
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! 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
+ !
+ !
+ ! Portions Copyright 2007 Sun Microsystems, Inc.
+ ! -->
+
+<project name="opends-staf-installer" 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>
+
+ <!-- installer wide settings - top -->
+ <!-- this is the file where the default values are defined -->
+ <property file="staf-installer/staf-installer.properties" />
+
+ <!-- Define the os name in case we're on windows
+ why do this ?
+ the jvm returns different strings for os.name on different flavors
+ of windows ('Windows 2000', 'Windows 2003', 'Windows XP', ...)
+ -->
+ <condition property="os.myname" value="windows" else="${os.name}">
+ <os family="windows"/>
+ </condition>
+
+ <!-- Check if the current platform is supported -->
+ <condition property="platform.supported">
+ <available file="staf-installer/${os.myname}.properties"/>
+ </condition>
+
+ <!-- Load architecture specific properties
+ loading this one first allows to override common properties with platform
+ specific properties
+ -->
+ <property file="staf-installer/${os.myname}-${os.arch}-${sun.arch.data.model}.properties" />
+ <property file="staf-installer/${os.myname}-${os.arch}.properties" />
+
+ <!-- Load properties common to the OS regardless of architecture -->
+ <property file="staf-installer/${os.myname}.properties" />
+
+ <!-- installer wide settings - bottom -->
+
+<!-- Usage section - top -->
+ <!-- Default target => how to use this file -->
+ <target name="usage"
+ description="Gives a message that helps using this file">
+ <echo>Installer usage:
+ main targets=
+ usage : print this message
+ status : report if the staf is installed and running
+ bootstrap : install and start the staf
+ wipeout : stop and uninstall the staf
+ subtargets=
+ download : download the archives necessary to install the staf
+ install : install the staf
+ start : start the staf unless it is already running
+ stop : stop the staf if it is already running
+ uninstall : uninstall the staf if it is installed</echo>
+ </target>
+<!-- Usage section - bottom -->
+
+<!-- Downloader section - top -->
+ <target name="download-do-prepare-check-proxy">
+ <echo>Checking for proxy [${proxy.host}:${proxy.port}] as user [${proxy.user}].</echo>
+ <echo>Note: If these values do not match your environment, </echo>
+ <echo> please edit the following config file:</echo>
+ <echo> [${basedir}/staf-installer/staf-installer.properties]</echo>
+ <condition property="proxy.enabled">
+ <and>
+ <not>
+ <http url="${bits.download.url}"/>
+ </not>
+ <isreachable host="${proxy.host}" timeout="5"/>
+ </and>
+ </condition>
+ </target>
+ <target name="download-do-prepare-set-proxy" if="proxy.enabled" >
+ <echo>Proxy detected. Configuring.</echo>
+ <setproxy
+ proxyhost="${proxy.host}"
+ proxyport="${proxy.port}"
+ proxyuser="${proxy.user}"
+ proxypassword="${proxy.pass}"/>
+ </target>
+ <target
+ name="download-do-prepare"
+ depends="download-do-prepare-check-proxy,download-do-prepare-set-proxy">
+ <mkdir dir="${bits.download.dir}" />
+ </target>
+ <target name="download-do-failed" unless="bits.all.downloaded" >
+ <echo>Couldn't get the bits, sorry.</echo>
+ </target>
+ <target name="download-do-succeeded" if="bits.all.downloaded" >
+ <echo>Successfully downloaded all the archives needed for installation.</echo>
+ </target>
+
+ <target name="download-do-get-staf" unless="bits.staf.downloaded.before">
+ <get src="${bits.download.url}/${bits.staf.archive}"
+ dest="${bits.download.dir}/${bits.staf.archive}" />
+ <property name="bits.staf.downloaded" value="true"/>
+ </target>
+
+ <target name="download-do-get-stax" unless="bits.stax.downloaded.before">
+ <get src="${bits.download.url}/${bits.stax.archive}"
+ dest="${bits.download.dir}/${bits.stax.archive}" />
+ <property name="bits.stax.downloaded" value="true" />
+ </target>
+
+ <target name="download-do"
+ if="platform.supported"
+ depends="status-do,download-do-prepare,download-do-get-staf,download-do-get-stax">
+ <condition property="bits.all.downloaded" >
+ <and>
+ <or>
+ <isset property="bits.staf.downloaded"/>
+ <isset property="bits.staf.downloaded.before" />
+ </or>
+ <or>
+ <isset property="bits.stax.downloaded"/>
+ <isset property="bits.stax.downloaded.before" />
+ </or>
+ </and>
+ </condition>
+ <antcall target="download-do-succeeded" />
+ <antcall target="download-do-failed" />
+ </target>
+
+ <target name="download-dont" unless="platform.supported">
+ <echo>${os.myname}-${os.arch} is not a supported platform</echo>
+ </target>
+
+ <target name="download"
+ depends="status-do"
+ description="Download the bits necessary to install staf">
+ <antcall target="download-do" />
+ <antcall target="download-dont" />
+ </target>
+<!-- Downloader section - bottom -->
+
+<!-- Installation section - top -->
+ <target name="install-config" if="staf.install.successful">
+ <copy file="${staf.config.stubs}" tofile="${staf.config}"/>
+ </target>
+
+ <target name="install-stax" if="staf.install.successful">
+ <unzip
+ src="${bits.download.dir}/${bits.stax.archive}"
+ dest="${staf.install.dir}/services"/>
+ </target>
+
+ <target name="install-staf-jar"
+ description="deploy the staf bits"
+ if="staf.archive.is.jar">
+ <echo message="Installing staf, please wait, it'll take some time..." />
+ <java jar="${bits.download.dir}/${bits.staf.archive}" fork="true">
+ <arg value="-silent" />
+ <arg line="-W license.selection="Accept"" />
+ <arg line="-W stafinstalldirectory.defaultInstallLocation="${staf.install.dir}""/>
+ </java>
+ <condition property="staf.install.successful">
+ <available file="${staf.install.dir}/bin/STAF.cfg"/>
+ </condition>
+ </target>
+
+ <target name="install-staf-tar" if="staf.archive.is.tar">
+ <gunzip
+ src="${bits.download.dir}/${bits.staf.archive}"
+ dest="${bits.download.dir}"/>
+ <untar dest="${bits.download.dir}">
+ <fileset dir="${bits.download.dir}">
+ <include name="*.tar"/>
+ </fileset>
+ </untar>
+ <exec executable="${bits.download.dir}/staf/STAFInst">
+ <arg value="-source"/>
+ <arg value="${bits.download.dir}/staf"/>
+ <arg value="-target"/>
+ <arg value="${staf.install.dir}"/>
+ <arg value="-acceptlicense"/>
+ </exec>
+ <condition property="staf.install.successful">
+ <available file="${staf.install.dir}/bin/STAF.cfg"/>
+ </condition>
+ </target>
+
+ <target name="install-staf"
+ depends="install-staf-jar,install-staf-tar">
+ <fail unless="staf.install.successful" />
+ </target>
+
+ <target name="install-prepare" >
+ <mkdir dir="${staf.install.dir}"/>
+ <mkdir dir="${staf.install.dir}/services"/>
+ <mkdir dir="${staf.config.dir}"/>
+ </target>
+
+ <target name="install"
+ description="Perform framework installation"
+ depends="status-do,install-prepare,install-staf,install-stax,install-config"
+ if="bits.all.downloaded"/>
+<!-- Installation section - bottom -->
+
+<!-- Run tests section - top -->
+ <target name="run-tests-prepare" >
+ <condition property="staf.lib.dir"
+ value="${staf.install.dir}${file.separator}bin"
+ else="${staf.install.dir}${file.separator}lib">
+ <os family="windows"/>
+ </condition>
+ <taskdef name="staf" classname="com.ibm.staf.ant.taskdef.STAF" classpath="${staf.lib.dir}${file.separator}STAFAnt.jar"/>
+ <!-- python config - top -->
+ <!-- 1. get a timestamp for step 3 -->
+ <tstamp>
+ <format property="tests.run.time" pattern="yyyy.MM.dd-HH.mm.ss"/>
+ </tstamp>
+
+ <!-- make all the necessary directories for this test run -->
+ <mkdir dir="${staf.tmp.dir}"/>
+ <mkdir dir="${tests.run.dir}/${tests.run.time}"/>
+ <mkdir dir="${tests.run.dir}/${tests.run.time}/config"/>
+ <!-- these will serve for after-the-fact archiving the logs -->
+ <mkdir dir="${tests.run.dir}/${tests.run.time}/staf-logs"/>
+ <mkdir dir="${tests.run.dir}/${tests.run.time}/server-logs"/>
+ <property file="${project.home}/PRODUCT"/>
+ <property name="product.name"
+ value="${SHORT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}" />
+
+ <!-- 3. perform the config back up if necessary -->
+ <copy file="${tests.config}"
+ tofile="${tests.config.backup}"
+ overwrite="false"/>
+ <!-- 4. generate the timestamped config file that will be used for this run -->
+ <copy file="${tests.config.stubs}"
+ tofile="${tests.run.dir}/${tests.run.time}/config/${tests.config.file}">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </copy>
+ <!-- 5. this is a windows-specific measure to replace the windows file
+ separator by a forward slash. Staf otherwise fails to find the
+ files.
+ -->
+ <replace file="${tests.run.dir}/${tests.run.time}/config/${tests.config.file}" token="\" value="/"/>
+ <!-- 6. copy the generated config in place of the previous one -->
+ <copy file="${tests.run.dir}/${tests.run.time}/config/${tests.config.file}"
+ tofile="${tests.config}"
+ overwrite="true"/>
+ <!-- python config - bottom -->
+ </target>
+
+ <target name="run-tests"
+ depends="status-do,run-tests-prepare"
+ if="staf.running">
+ <condition property="binary.extension" value=".exe" else="">
+ <or>
+ <os family="windows"/>
+ <os family="DOS"/>
+ </or>
+ </condition>
+ <property name="tests.request" value="EXECUTE FILE ${tests.xml} JOBNAME OpenDS_Functional_Tests SCRIPTFILE ${tests.config} SCRIPTFILE ${tests.python} WAIT CLEARLOGS"/>
+ <condition property="tests.replay.script" value="replay.bat" else="replay.sh">
+ <os family="windows"/>
+ </condition>
+ <echo>Generating replay script to allow you to re-execute the tests in the same conditions</echo>
+ <copy file="${staf.installer.dir}${file.separator}${tests.replay.script}"
+ tofile="${tests.run.dir}${file.separator}${tests.run.time}${file.separator}${tests.replay.script}">
+ <filterchain>
+ <expandproperties/>
+ </filterchain>
+ </copy>
+ <echo>Running tests. This will more than a while.</echo>
+ <!-- <staf location="LOCAL"
+ service="service"
+ request="list services"
+ />
+ <staf location="LOCAL"
+ service="MISC"
+ request="VERSION"
+ resultPrefix="version"
+ throwBuildException="1"/>-->
+
+ <staf location="local"
+ service="STAX"
+ request="${tests.request}"
+ resultPrefix="staxjob"
+ throwBuildException="1"/>
+ <!-- restore the original config file to avoid it to be mistakenly commited
+ with the generated values -->
+ <copy file="${tests.config.backup}"
+ tofile="${tests.config}"
+ overwrite="true"/>
+ <delete file="${tests.config.backup}"/>
+ <echo file="${tests.run.dir}/last.run">${tests.run.time}</echo>
+ <echo>Saving server logs</echo>
+ <copy todir="${tests.run.dir}/${tests.run.time}/server-logs">
+ <fileset dir="${staf.tmp.dir}/${product.name}/logs"/>
+ </copy>
+ <echo>Saving Staf/Stax logs</echo>
+ <copy todir="${tests.run.dir}/${tests.run.time}/staf-logs">
+ <fileset dir="${staf.home}/logs"/>
+ </copy>
+ <delete dir="${staf.home}/logs" />
+ </target>
+<!-- Run tests section - bottom -->
+
+<!-- Uninstallation section - top -->
+ <target name="uninstall-do"
+ description="Uninstall the staf"
+ if="staf.installed" >
+ <echo message="Uninstalling staf, please wait..." />
+ <java jar="${staf.install.dir}/_uninst/uninstall.jar" fork="true">
+ <arg value="-silent" />
+ </java>
+ <sleep seconds="5" />
+ <delete dir="${staf.install.dir}" />
+ </target>
+
+
+ <target name="uninstall-dont-not-installed" unless="staf.installed">
+ <echo>Staf is not installed.</echo>
+ </target>
+ <target name="uninstall-dont-running" if="staf.running">
+ <echo>Staf is running. Stop staf before uninstalling.</echo>
+ <echo>Use either the 'stop' or the 'wipeout' target.</echo>
+ </target>
+ <target
+ name="uninstall-dont"
+ depends="uninstall-dont-running,uninstall-dont-not-installed" />
+
+ <target name="uninstall" depends="status-do,uninstall-do,uninstall-dont">
+ </target>
+<!-- Uninstallation section - bottom -->
+
+<!-- Start section - top -->
+ <target name="start-do"
+ description="start the staf"
+ if="staf.installed"
+ unless="staf.running" >
+ <echo message="Starting staf ... on ${os.myname}" />
+ <condition
+ property="staf.executable"
+ value="${staf.install.dir}\bin\STAFProc.exe"
+ else="${staf.install.dir}/bin/STAFProc" >
+ <os family="windows"/>
+ </condition>
+ <echo>Running [${staf.executable}]</echo>
+ <property environment="env" />
+ <exec
+ dir="${staf.install.dir}/bin"
+ executable="${staf.executable}"
+ spawn="true">
+ <arg value="${staf.config}"/>
+ <env key="PATH" path="${staf.install.dir}/bin${path.separator}${env.PATH}"/>
+ <env key="LD_LIBRARY_PATH" path="${staf.install.dir}/lib"/>
+ <env key="CLASSPATH" path="${staf.install.dir}/bin/JSTAF.jar${path.separator}${env.CLASSPATH}"/>
+ <env key="STAFCONVDIR" value="${staf.install.dir}/codepage"/>
+ <env key="STAFCODEPAGE" value="LATIN_1"/>
+ <env key="STAF_INSTANCE_NAME" value="STAF"/>
+ </exec>
+ </target>
+ <target name="start-dont" if="staf.running">
+ <echo>Staf is already running.</echo>
+ </target>
+ <target name="start" depends="status-do">
+ <antcall target="start-do"/>
+ <antcall target="start-dont"/>
+ </target>
+<!-- Start section - bottom -->
+
+<!-- Stop section - top -->
+ <target name="stop-do" if="staf.running">
+ <echo>Stopping staf...</echo>
+ <condition
+ property="staf.executable"
+ value="${staf.install.dir}\bin\STAF.exe"
+ else="${staf.install.dir}/bin/STAF" >
+ <os family="windows"/>
+ </condition>
+ <exec
+ executable="${staf.executable}"
+ spawn="true" >
+ <arg line="local shutdown shutdown"/>
+ </exec>
+ <echo>staf has been instructed to close the shop.</echo>
+ <echo>Please allow some time as staf wipes the plate clean</echo>
+ </target>
+ <target name="stop-dont" unless="staf.running">
+ <echo>Staf is not running.</echo>
+ </target>
+ <target name="stop" depends="status-do">
+ <antcall target="stop-do"/>
+ <antcall target="stop-dont"/>
+ </target>
+<!-- Stop section - bottom -->
+
+<!-- Status section - top -->
+ <!-- Bits status section - top -->
+ <target name="status-archive-downloaded?" if="bits.all.downloaded.before">
+ <echo>Staf bits are ready to be installed. Use 'install' target.</echo>
+ </target>
+ <target name="status-archive-not-downloaded?" unless="bits.all.downloaded.before">
+ <echo>No staf bits found. Use the get-bits or bootstrap target.</echo>
+ </target>
+ <!-- Bits status section - bottom -->
+
+ <!-- Installation status section - top -->
+ <target name="status-staf-installed?" if="staf.installed">
+ <echo>Found staf installed in [${staf.install.dir}]</echo>
+ <antcall target="status-staf-running?" />
+ <antcall target="status-staf-not-running?" />
+ </target>
+ <target name="status-staf-not-installed?" unless="staf.installed">
+ <echo>Could not find staf installation.</echo>
+ <echo>Checking if the bits here and ready for installation...</echo>
+ <antcall target="status-archive-downloaded?" />
+ <antcall target="status-archive-not-downloaded?" />
+ </target>
+ <!-- Installation status section - bottom -->
+
+ <!-- Running status section - top -->
+ <target name="status-staf-running?" if="staf.running">
+ <echo>staf is listening on port [${staf.port.default}]</echo>
+ <echo>You're all set to run the functional tests.</echo>
+ </target>
+ <target name="status-staf-not-running?" unless="staf.running">
+ <echo>staf is NOT running. Use the 'start' target.</echo>
+ </target>
+ <!-- Running status section - bottom -->
+
+
+ <!-- Get status section - top -->
+ <target name="status-do" unless="status-do.already.run" >
+ <!-- check if the various archives needed have already been downloaded -->
+ <condition property="bits.staf.downloaded.before">
+ <available file="${bits.download.dir}/${bits.staf.archive}"/>
+ </condition>
+ <condition property="bits.stax.downloaded.before" >
+ <available file="${bits.download.dir}/${bits.stax.archive}" />
+ </condition>
+ <condition property="bits.all.downloaded.before">
+ <and>
+ <isset property="bits.staf.downloaded.before"/>
+ <isset property="bits.stax.downloaded.before"/>
+ </and>
+ </condition>
+
+ <available file="${staf.install.dir}"
+ type="dir"
+ property="staf.installed" />
+
+ <condition property="staf.running">
+ <socket port="${staf.port.default}" server="${host.name}"/>
+ </condition>
+
+ <condition property="staf.archive.is.jar">
+ <contains string="${bits.staf.archive}" substring=".jar"/>
+ </condition>
+ <condition property="staf.archive.is.tar">
+ <not>
+ <contains string="${bits.staf.archive}" substring=".jar"/>
+ </not>
+ </condition>
+ <property name="status-do.already.run" value="true"/>
+ </target>
+ <!-- Get status section - bottom -->
+
+ <!-- Status cli section - top -->
+ <target name="status" depends="status-do">
+ <condition property="is.platform.supported" value="yes" else="no" >
+ <isset property="platform.supported"/>
+ </condition>
+ <echo>Operating System Family - ${os.myname}</echo>
+ <echo>Operating System Name - ${os.name}</echo>
+ <echo>Operating System Version - ${os.version}</echo>
+ <echo>Machine Architecture - ${os.arch}</echo>
+ <echo>Platform Supported - ${is.platform.supported}</echo>
+ <echo>Java Version - ${java.version}</echo>
+ <antcall target="status-staf-installed?" />
+ <antcall target="status-staf-not-installed?" />
+ </target>
+ <!-- Status cli section - bottom -->
+
+<!-- Status section - bottom -->
+
+<!-- Macros section - top -->
+ <target name="bootstrap">
+ <antcall target="download" />
+ <antcall target="install" />
+ <antcall target="start" />
+ </target>
+
+ <target name="wipeout">
+ <antcall target="stop"/>
+ <sleep seconds="10"/>
+ <antcall target="uninstall"/>
+ </target>
+<!-- Macros section - bottom -->
+</project>
diff --git a/opends/tests/functional-tests/staf-installer/Linux.properties b/opends/tests/functional-tests/staf-installer/Linux.properties
new file mode 100644
index 0000000..6791046
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/Linux.properties
@@ -0,0 +1 @@
+bits.staf.archive=STAF320-setup-linux.jar
diff --git a/opends/tests/functional-tests/staf-installer/SunOS-sparc.properties b/opends/tests/functional-tests/staf-installer/SunOS-sparc.properties
new file mode 100644
index 0000000..690bf5c
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/SunOS-sparc.properties
@@ -0,0 +1 @@
+bits.staf.archive=STAF320-setup-solaris-sparc.jar
diff --git a/opends/tests/functional-tests/staf-installer/SunOS-x86.properties b/opends/tests/functional-tests/staf-installer/SunOS-x86.properties
new file mode 100644
index 0000000..a21f6a5
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/SunOS-x86.properties
@@ -0,0 +1 @@
+bits.staf.archive=STAF3201-setup-solaris-x86.jar
diff --git a/opends/tests/functional-tests/staf-installer/config.py.stubs b/opends/tests/functional-tests/staf-installer/config.py.stubs
new file mode 100644
index 0000000..01f1b56
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/config.py.stubs
@@ -0,0 +1,30 @@
+TEST_OS_STRING = '${os.name}'
+TEST_HW_STRING = '${os.arch}(${sun.arch.data.model} bits)'
+TEST_JVM_STRING = '${java.version}'
+STAF_LOCAL_HOSTNAME = 'localhost'
+STAF_REMOTE_HOSTNAME = 'localhost'
+STAF_JAVA_HOME = '${java.home}'
+STAF_HOME_DIR = '${staf.install.dir}'
+TMPDIR = '${staf.tmp.dir}'
+PSWDFILE = '${staf.tmp.dir}/password'
+OPENDSDIR = '${project.home}'
+OPENDSNAME = '${product.name}'
+ZIPNAME = '${product.name}.zip'
+ZIPPATH = '${project.home}/build/package'
+TESTS_DIR = '${basedir}'
+TESTS_ROOT = '${basedir}/tests'
+TESTS_SHARED_DIR = '${basedir}/shared'
+TESTS_FUNCTIONS_DIR = '${basedir}/shared/functions'
+TESTS_DATA_DIR = '${basedir}/shared/data'
+TMP_DATA_DIR = '${tests.run.dir}/${tests.run.time}/data'
+DIRECTORY_INSTANCE_DN = 'cn=Directory Manager'
+DIRECTORY_INSTANCE_PSWD = 'password'
+DIRECTORY_INSTANCE_DIR = '${staf.tmp.dir}'
+DIRECTORY_INSTANCE_HOST = 'localhost'
+DIRECTORY_INSTANCE_PORT = '1389'
+DIRECTORY_INSTANCE_SSL_PORT = '1636'
+DIRECTORY_INSTANCE_SFX = 'dc=com'
+STAGED_DATA_DIR = '${tests.run.dir}/${tests.run.time}/shared/data'
+JAVA_HOME = '${java.home}'
+SEND_MAIL_AFTER_TEST_RUN = '${staf.email.send}'
+SEND_MAIL_TO = '${staf.email.to}'
diff --git a/opends/tests/functional-tests/staf-installer/functional-tests.cfg b/opends/tests/functional-tests/staf-installer/functional-tests.cfg
new file mode 100644
index 0000000..9fbaaee
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/functional-tests.cfg
@@ -0,0 +1,16 @@
+# Turn on tracing of internal errors and deprecated options
+trace enable tracepoints "error deprecated"
+
+# Enable TCP/IP connections
+interface tcp library STAFTCP
+
+# Set default local trust
+trust machine local://local level 5
+
+# Default Service Loader Service
+serviceloader library STAFDSLS
+SERVICE STAX LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/services/stax/STAX.jar OPTION J2=-Xmx384m
+SERVICE EVENT LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/services/stax/STAFEvent.jar
+SET MAXQUEUESIZE 10000
+trust level 5 machine tcp://localhost
+service log library STAFLog parms "Directory {STAF/Config/STAFRoot}/../logs ResolveMessage"
diff --git a/opends/tests/functional-tests/staf-installer/poeut.xml b/opends/tests/functional-tests/staf-installer/poeut.xml
new file mode 100644
index 0000000..c5b1653
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/poeut.xml
@@ -0,0 +1,5 @@
+<project name="the pouet file" basedir="." default="usage">
+ <target name="usage">
+ <echoproperties/>
+ </target>
+</project>
diff --git a/opends/tests/functional-tests/staf-installer/replay.bat b/opends/tests/functional-tests/staf-installer/replay.bat
new file mode 100644
index 0000000..26ed984
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/replay.bat
@@ -0,0 +1,11 @@
+@echo off
+echo Backing configuration up
+move "${tests.config}" "${tests.config.backup}"
+echo Loading configuration as of ${tests.run.time}
+copy "${tests.run.dir}${file.separator}${tests.run.time}${file.separator}config${file.separator}${tests.config.file}" "${tests.config}"
+echo Starting test run
+"${staf.install.dir}${file.separator}bin${file.separator}STAF.exe" local STAX "${tests.request}"
+echo Removing configuration of ${tests.run.time}
+del /f "${tests.config}"
+echo Restoring original configuration
+move "${tests.config.backup}" "${tests.config}"
diff --git a/opends/tests/functional-tests/staf-installer/replay.sh b/opends/tests/functional-tests/staf-installer/replay.sh
new file mode 100644
index 0000000..0793634
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/replay.sh
@@ -0,0 +1,10 @@
+echo "Backing configuration up"
+me "${tests.config}" "${tests.config.backup}"
+echo "Loading configuration as of ${tests.run.time}"
+cp "${tests.run.dir}${file.separator}${tests.run.time}${file.separator}config${file.separator}${tests.config.file}" "${tests.config}"
+echo "Starting test run"
+"${staf.install.dir}${file.separator}bin${file.separator}STAF" local STAX "${tests.request}"
+echo "Removing configuration of ${tests.run.time}"
+rm -f "${tests.config}"
+echo "Restoring original configuration"
+mv "${tests.config.backup}" "${tests.config}"
diff --git a/opends/tests/functional-tests/staf-installer/staf-installer.properties b/opends/tests/functional-tests/staf-installer/staf-installer.properties
new file mode 100644
index 0000000..adbe63f
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/staf-installer.properties
@@ -0,0 +1,51 @@
+# Global section - top
+project.home=${basedir}${file.separator}..${file.separator}..
+host.name=localhost
+# Global section - bottom
+
+# Staf section - top
+staf.home=${project.home}${file.separator}tests${file.separator}functional-run
+staf.installer.dir=${basedir}${file.separator}staf-installer
+staf.install.dir=${staf.home}${file.separator}staf
+staf.config.dir=${staf.home}${file.separator}config
+staf.config.file=functional-tests.cfg
+staf.config=${staf.config.dir}${file.separator}${staf.config.file}
+staf.config.stubs=${staf.installer.dir}${file.separator}${staf.config.file}
+staf.tmp.dir=${staf.home}${file.separator}tmp
+staf.logs.dir=${staf.home}${file.separator}logs
+#
+staf.email.send=false
+staf.email.to=
+
+## TCP port on which to configure staf to listen
+## leave as is unless this port is already in use on your test machine
+staf.port.default=6500
+# Staf section - bottom
+
+# Downloader section - top
+## where to download the staf bits before install
+bits.download.dir=${staf.home}${file.separator}staf-bits
+bits.download.url=http://superb-west.dl.sourceforge.net/sourceforge/staf
+bits.stax.archive=STAXV315.zip
+# Downloader section - bottom
+
+
+# Proxy section - top
+## set to match your own proxy if any
+proxy.host=webcache.central.sun.com
+proxy.port=8080
+proxy.user=
+proxy.pass=
+# Proxy section - bottom
+
+# Tests section - top
+tests.dir=${basedir}
+tests.run.dir=${staf.home}${file.separator}run
+tests.config.dir=${tests.dir}${file.separator}config
+tests.config.file=config.py
+tests.config.stubs=${staf.installer.dir}${file.separator}${tests.config.file}.stubs
+tests.config=${tests.config.dir}${file.separator}${tests.config.file}
+tests.config.backup=${tests.config}.orig
+tests.python=${tests.dir}${file.separator}shared${file.separator}python${file.separator}security.py
+tests.xml=${tests.dir}${file.separator}testcases${file.separator}runTestJob.xml
+# Tests section - bottom
diff --git a/opends/tests/functional-tests/staf-installer/windows-x86-32.properties b/opends/tests/functional-tests/staf-installer/windows-x86-32.properties
new file mode 100644
index 0000000..9da7d03
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/windows-x86-32.properties
@@ -0,0 +1,2 @@
+bits.staf.archive=STAF3201-setup-win32.jar
+
diff --git a/opends/tests/functional-tests/staf-installer/windows-x86-64.properties b/opends/tests/functional-tests/staf-installer/windows-x86-64.properties
new file mode 100644
index 0000000..8371f00
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/windows-x86-64.properties
@@ -0,0 +1 @@
+staf.archive.name=STAF320-setup-win64.jar
diff --git a/opends/tests/functional-tests/staf-installer/windows.properties b/opends/tests/functional-tests/staf-installer/windows.properties
new file mode 100644
index 0000000..9da7d03
--- /dev/null
+++ b/opends/tests/functional-tests/staf-installer/windows.properties
@@ -0,0 +1,2 @@
+bits.staf.archive=STAF3201-setup-win32.jar
+
--
Gitblit v1.10.0