<project name="opends-perf-test" basedir="." default="usage">
|
<target name="usage">
|
<echo>Usage:
|
clean : remove OpenDS instance and all temporary files
|
get-opends : retrieve the latest weekly build
|
configure-opends: install and configures opends</echo>
|
</target>
|
<!-- declare the ant-contrib resource -->
|
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
|
|
<!-- load the properties -->
|
<property file="build.properties" />
|
<property file="opends.properties" prefix="opends" />
|
<property file="proxy.properties" prefix="proxy" />
|
<property file="${basedir}/../../../PRODUCT"/>
|
|
<!-- platform specific properties -->
|
<condition property="script.ext" value=".bat" else="">
|
<os family="windows" />
|
</condition>
|
<condition
|
property="opends.bin.path"
|
value="${product.path}${file.separator}bat"
|
else="${product.path}${file.separator}bin" >
|
<os family="windows" />
|
</condition>
|
|
<target name="clean-install">
|
<delete dir="${install.path}" />
|
</target>
|
<target name="clean"
|
description="Removes all temporary files and installed bits"
|
depends="clean-install" >
|
<delete dir="${tmp.path}" />
|
</target>
|
|
|
<target name="init">
|
<!-- create the temporary directory -->
|
<mkdir dir="${tmp.path}" />
|
</target>
|
|
<target name="chk-pkg">
|
<available file="${dest}"
|
property="already.downloaded"/>
|
</target>
|
|
<target name="get-pkg" depends="chk-pkg" unless="already.downloaded">
|
<get src="${src}" dest="${dest}"/>
|
</target>
|
|
<target name="get-opends-id" depends="init" unless="opends.manual.download">
|
<delete file="${tmp.path}${file.separator}${opends.url.file}" />
|
<condition property="opends.url" value="${opends.url.weekly}/${opends.url.file}">
|
<not>
|
<isset property="opends.url" />
|
</not>
|
</condition>
|
<antcall target="get-pkg">
|
<param name="src" value="${opends.url}"/>
|
<param name="dest" value="${tmp.path}${file.separator}${opends.url.file}"/>
|
</antcall>
|
<loadfile srcfile="${tmp.path}${file.separator}${opends.url.file}"
|
property="opends.build.name">
|
<filterchain>
|
<linecontainsregexp>
|
<regexp pattern="OpenDS-.*\.zip" />
|
</linecontainsregexp>
|
<replaceregex
|
pattern="^.*<A HREF=".*(OpenDS-.*)\.zip">.*$"
|
replace="\1" />
|
<striplinebreaks/>
|
</filterchain>
|
</loadfile>
|
<loadfile srcfile="${tmp.path}${file.separator}${opends.url.file}"
|
property="opends.package.url">
|
<filterchain>
|
<linecontainsregexp>
|
<regexp pattern="OpenDS-.*\.zip" />
|
</linecontainsregexp>
|
<replaceregex
|
pattern="^.*<A HREF="(.*)">.*$"
|
replace="\1" />
|
<striplinebreaks/>
|
</filterchain>
|
</loadfile>
|
<property name="opends.package.name" value="${opends.build.name}.zip" />
|
</target>
|
|
<target name="get-opends"
|
depends="init,get-opends-id"
|
unless="opends.package.available">
|
<echo message="The latest weekly build of OpenDS is packaged as [${opends.package.name}]"/>
|
<condition property="opends.url" value="${opends.url.weekly}/${opends.url.file}">
|
<not>
|
<isset property="opends.url" />
|
</not>
|
</condition>
|
<antcall target="get-pkg">
|
<param name="src" value="${opends.url}${opends.package.url}"/>
|
<param name="dest" value="${tmp.path}${file.separator}${opends.package.name}"/>
|
</antcall>
|
</target>
|
|
<target name="unpack-opends">
|
<if>
|
<available file="${product.path}" />
|
<then>
|
<echo message="OpenDS already unpacked." />
|
</then>
|
<else>
|
<mkdir dir="${install.path}" />
|
<unzip dest="${install.path}">
|
<fileset dir="${tmp.path}">
|
<include name="OpenDS-*.zip"/>
|
</fileset>
|
<mapper type="regexp" from="^OpenDS-.*?/(.*)$$" to="${product.dir}/\1"/>
|
</unzip>
|
<if>
|
<not>
|
<os family="windows" />
|
</not>
|
<then>
|
<chmod perm="755" >
|
<fileset dir="${product.path}">
|
<include name="setup" />
|
<include name="lib/*" />
|
<include name="bin/*" />
|
</fileset>
|
</chmod>
|
</then>
|
</if>
|
</else>
|
</if>
|
</target>
|
|
<target name="setup-opends">
|
<if>
|
<available file="${product.path}" />
|
<then>
|
<echo message="Setting custom schema" />
|
<copy file="${data.path}${file.separator}${opends.schema.ldif}"
|
tofile="${product.path}${file.separator}config${file.separator}schema${file.separator}${opends.schema.ldif}" />
|
<echo message="Setting OpenDS up" />
|
<exec
|
executable="${product.path}${file.separator}setup${script.ext}">
|
<arg value="--cli" />
|
<arg value="--rootUserDN" />
|
<arg value="${opends.admin.dn}" />
|
<arg value="--rootUserPassword" />
|
<arg value="${opends.admin.pwd}" />
|
<arg value="--ldapPort" />
|
<arg value="${opends.port.ldap}" />
|
<arg value="--baseDN" />
|
<arg value="${opends.suffix}" />
|
<arg value="--addBaseEntry" />
|
<arg value="--doNotStart" />
|
<arg value="--no-prompt" />
|
</exec>
|
</then>
|
<else>
|
<echo message="OpenDS is not installed." />
|
</else>
|
</if>
|
</target>
|
|
<target name="import-ldif">
|
<if>
|
<available file="${product.path}" />
|
<then>
|
<input message="JVM arguments" addproperty="JAVA_ARGS.input" defaultvalue="-Xms256M -Xmx1G"/>
|
<echo message="Importing data" />
|
<exec
|
executable="${opends.bin.path}${file.separator}import-ldif${script.ext}">
|
<arg value="--ldifFile" />
|
<arg value="${tmp.path}${file.separator}${opends.makeldif.ldif}" />
|
<arg value="--backendID" />
|
<arg value="userRoot" />
|
<arg value="--clearBackend" />
|
<env key="JAVA_ARGS" value="${JAVA_ARGS.input}" />
|
</exec>
|
</then>
|
<else>
|
<echo message="OpenDS is not installed." />
|
</else>
|
</if>
|
</target>
|
|
<target name="regenerate-template">
|
<delete file="${tmp.path}${file.separator}${opends.makeldif.template}" />
|
<antcall target="generate-template" />
|
</target>
|
|
<target name="generate-template">
|
<if>
|
<available file="${tmp.path}${file.separator}${opends.makeldif.template}" />
|
<then>
|
<echo message="Template already generated."/>
|
</then>
|
<else>
|
<if>
|
<isset property="entries"/>
|
<then>
|
<property name="entries.total.input" value="${entries}" />
|
</then>
|
<else>
|
<input message="How many entries should the resulting template generate?"
|
addproperty="entries.total.input"
|
defaultvalue="${opends.makeldif.entries}" />
|
</else>
|
</if>
|
|
<math result="modulo30"
|
operand1="${entries.total.input}"
|
operation="%"
|
operand2="30"
|
datatype="long"/>
|
<if>
|
<equals arg1="${modulo30}" arg2="0" />
|
<then>
|
<echo message="Keeping ${entries.total.input} because it is divisable by 30"/>
|
<property name="entries.total" value="${entries.total.input}"/>
|
</then>
|
<else>
|
<math result="modulo30.adjust"
|
operand1="30"
|
operation="-"
|
operand2="${modulo30}"
|
datatype="long"/>
|
<math result="entries.total"
|
operand1="${entries.total.input}"
|
operation="+"
|
operand2="${modulo30.adjust}"
|
datatype="long"/>
|
<echo message="Increasing total entries to ${entries.total} to make it divisable by 30"/>
|
</else>
|
</if>
|
|
<math result="entries.subscribers"
|
operand1="${entries.total}"
|
operation="/"
|
operand2="3"/>
|
<math result="entries.devices"
|
operand1="${entries.subscribers}"
|
operation="*"
|
operand2="2"
|
datatype="long" />
|
<math result="entries.subscribers.4devices"
|
operand1="${entries.subscribers}"
|
operation="/"
|
operand2="10"
|
datatype="long" />
|
<math result="entries.subscribers.3devices"
|
operand1="${entries.subscribers.4devices}"
|
operation="*"
|
operand2="2"
|
datatype="long" />
|
<math result="entries.subscribers.2devices"
|
operand1="${entries.subscribers.4devices}"
|
operation="*"
|
operand2="3"
|
datatype="long" />
|
<math result="entries.subscribers.1device"
|
operand1="${entries.subscribers.4devices}"
|
operation="*"
|
operand2="4"
|
datatype="long" />
|
<property name="offset" value="1000000001"/>
|
<property name="subscribersStart" value="${offset}" />
|
<property name="devicesStart" value="${offset}" />
|
<property name="subscribers1Start" value="${subscribersStart}" />
|
<math result="subscribers2Start"
|
operand1="${subscribers1Start}"
|
operation="+"
|
operand2="${entries.subscribers.1device}"
|
datatype="long" />
|
<math result="subscribers3Start"
|
operand1="${subscribers2Start}"
|
operation="+"
|
operand2="${entries.subscribers.2devices}"
|
datatype="long" />
|
<math result="subscribers4Start"
|
operand1="${subscribers3Start}"
|
operation="+"
|
operand2="${entries.subscribers.3devices}"
|
datatype="long" />
|
<math result="subscribers2aStart"
|
operand1="${subscribers1Start}"
|
operation="+"
|
operand2="${entries.subscribers.1device}"
|
datatype="long" />
|
<math result="subscribers2bStart"
|
operand1="${subscribers2aStart}"
|
operation="+"
|
operand2="${entries.subscribers.2devices}"
|
datatype="long" />
|
<math result="subscribers3aStart"
|
operand1="${subscribers2bStart}"
|
operation="+"
|
operand2="${entries.subscribers.2devices}"
|
datatype="long" />
|
<math result="subscribers3bStart"
|
operand1="${subscribers3aStart}"
|
operation="+"
|
operand2="${entries.subscribers.3devices}"
|
datatype="long" />
|
<math result="subscribers3cStart"
|
operand1="${subscribers3bStart}"
|
operation="+"
|
operand2="${entries.subscribers.3devices}"
|
datatype="long" />
|
<math result="subscribers4aStart"
|
operand1="${subscribers3cStart}"
|
operation="+"
|
operand2="${entries.subscribers.3devices}"
|
datatype="long" />
|
<math result="subscribers4bStart"
|
operand1="${subscribers4aStart}"
|
operation="+"
|
operand2="${entries.subscribers.4devices}"
|
datatype="long" />
|
<math result="subscribers4cStart"
|
operand1="${subscribers4bStart}"
|
operation="+"
|
operand2="${entries.subscribers.4devices}"
|
datatype="long" />
|
<math result="subscribers4dStart"
|
operand1="${subscribers4cStart}"
|
operation="+"
|
operand2="${entries.subscribers.4devices}"
|
datatype="long" />
|
<copy file="${data.path}${file.separator}${opends.makeldif.stubs}"
|
tofile="${tmp.path}${file.separator}${opends.makeldif.template}">
|
<filterchain>
|
<expandproperties />
|
</filterchain>
|
</copy>
|
</else>
|
</if>
|
</target>
|
|
<target name="regenerate-ldif">
|
<delete file="${tmp.path}${file.separator}${opends.makeldif.ldif}" />
|
<antcall target="generate-ldif" />
|
</target>
|
<target name="generate-ldif">
|
<if>
|
<or>
|
<available file="${tmp.path}${file.separator}${opends.makeldif.ldif}" />
|
<not>
|
<available file="${tmp.path}${file.separator}${opends.makeldif.template}" />
|
</not>
|
<not>
|
<available file="${product.path}"/>
|
</not>
|
</or>
|
<then>
|
<if>
|
<available file="${tmp.path}${file.separator}${opends.makeldif.ldif}" />
|
<then>
|
<echo message="LDIF data already generated."/>
|
</then>
|
<else>
|
<if>
|
<available file="${product.path}"/>
|
<then>
|
<echo message="Template not available. Use 'generate-template' target."/>
|
</then>
|
<else>
|
<echo message="OpenDS not installed. Use 'get-opends unpack-opends' targets."/>
|
</else>
|
</if>
|
</else>
|
</if>
|
</then>
|
<else>
|
<exec executable="${opends.bin.path}${file.separator}make-ldif${script.ext}">
|
<arg line="--randomSeed 0" />
|
<arg value="--templateFile" />
|
<arg value="${tmp.path}${file.separator}${opends.makeldif.template}" />
|
<arg value="--ldifFile" />
|
<arg value="${tmp.path}${file.separator}${opends.makeldif.ldif}" />
|
</exec>
|
</else>
|
</if>
|
</target>
|
|
<target name="generate-opends-config">
|
</target>
|
|
<target name="generate-slamd-config" >
|
</target>
|
|
<target name="opends-build-check" >
|
<available file="${basedir}/../../../build/package/${SHORT_NAME}-${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}.zip" property="opends.built.already" />
|
</target>
|
|
<target name="build-opends" depends="opends-build-check" unless="opends.built.already">
|
<ant dir="${basedir}/../../.." antfile="build.xml" target="package" />
|
</target>
|
<target name="all" depends="build-opends">
|
<delete file="${tmp.path}${file.separator}${opends.package.name}" />
|
<copy todir="${tmp.path}">
|
<fileset dir="${basedir}/../../../build/package">
|
<include name="OpenDS*.zip"/>
|
</fileset>
|
</copy>
|
<antcall target="unpack-opends" />
|
<antcall target="generate-template" />
|
<antcall target="generate-ldif" />
|
<antcall target="setup-opends" />
|
<antcall target="import-ldif" />
|
</target>
|
</project>
|