mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

al_xipe
19.54.2006 f502162737ab6b22d7625cac7c07dcdfdb050aa9
commit for issues 847 & 848
847: test suite independent installer.xml
848: ease oulu automation
6 files added
1 files modified
629 ■■■■ changed files
opends/tests/default.installer.properties 7 ●●●●● patch | view | raw | blame | history
opends/tests/installer.xml 252 ●●●●● patch | view | raw | blame | history
opends/tests/integration-tests-testng/build.xml 165 ●●●● patch | view | raw | blame | history
opends/tests/oulu-tests/build.bat 51 ●●●●● patch | view | raw | blame | history
opends/tests/oulu-tests/build.xml 146 ●●●●● patch | view | raw | blame | history
opends/tests/oulu-tests/oulu.properties 6 ●●●●● patch | view | raw | blame | history
opends/tests/product.properties 2 ●●●●● patch | view | raw | blame | history
opends/tests/default.installer.properties
New file
@@ -0,0 +1,7 @@
project.home=${basedir}/..
port.ldap=1389
bind.dn=cn=Directory Manager
bind.pwd=password
host.name=localhost
install.dir=${project.home}/build/install
full.install.dir=${install.dir}/${product.name}-${product.version}
opends/tests/installer.xml
New file
@@ -0,0 +1,252 @@
<!--
 ! 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-installer" basedir="." default="usage">
  <description>
        Installer ant file for the server
        This allows tests that need a running instance of the product to easily
        get one.
  </description>
  <!-- this one has to be loaded first since it's used in
    default.installer.properties
  -->
    <property file="product.properties"                       />
    <!-- this is an optional file if you want to pass custom values  -->
    <property file="installer.properties"                     />
    <!-- this is the file where the default values are defined       -->
    <property file="default.installer.properties"             />
    <!-- Define default values for mandatory properties in case the
        property files would not be found
    -->
    <target name="usage">
        <echo>Installer usage:
  status     : reports if product is installed and/or running
main target=
  bootstrap  : installs and configure the product
  wipeout    : stops and uninstalls the product
subtargets=
  install    : installs the product
  configure  : set the server up to listen on a given port
  start      : start the product unless it is already running
  stop       : stop the product if it is already running
  stop.force : stop no matter what
  uninstall  : uninstall the product if it is installed
        </echo>
    </target>
    <!-- Installation -->
    <target name="install.do"
          description="deploy the product bits"
                    unless="product.installed"          >
        <echo message="Installing ${product.name} ${product.version}..." />
    <property name="config.file"
              location="${full.install.dir}/config/config.ldif"/>
    <mkdir dir="${install.dir}"/>
    <unzip dest="${install.dir}">
      <fileset dir="${project.home}/build/package">
        <include name="*.zip"/>
      </fileset>
    </unzip>
    <chmod perm="755">
      <fileset dir="${full.install.dir}/bin">
        <include name="*.sh"/>
      </fileset>
    </chmod>
  </target>
    <target name="install" >
    <available file="${full.install.dir}"
              type="dir"
              property="product.installed" />
        <antcall target="install.do"           />
    </target>
    <!-- end of install related targets -->
    <!-- Uninstallation -->
  <target name="uninstall.do"
          description="Uninstall the product"
                    if="product.installed"            >
        <echo message="Uninstalling ${product.name} ${product.version}..." />
    <delete dir="${install.dir}" />
  </target>
    <target name="uninstall">
    <available file="${full.install.dir}"
              type="dir"
              property="product.installed" />
        <antcall target="uninstall.do"         />
    </target>
    <!-- end of uninstall related targets -->
    <!-- configuration -->
  <target name="configure.do"
          description="configures product to listen on the right port number"
                    if="product.installed" >
    <echo message="basedir=[${basedir}]" />
        <echo message="configuring ${product.name} ${product.version}..." />
    <java classname="org.opends.server.tools.ConfigureDS">
      <!-- building the classpath to run the configurator -->
      <classpath>
        <fileset dir="${full.install.dir}/lib">
          <include name="*.jar"/>
        </fileset>
      </classpath>
      <!-- provide the arguments here -->
      <arg value="--configClass" />
      <arg value="org.opends.server.extensions.ConfigFileHandler"  />
      <arg value="--configFile" />
      <arg value="${full.install.dir}/config/config.ldif"       />
      <arg line="-p ${port.ldap}" />
      <arg value="-D"/>
      <arg value="${bind.dn}"/>
      <arg value="-w"/>
      <arg value="${bind.pwd}"/>
    </java>
  </target>
    <target name="configure">
    <available file="${full.install.dir}"
              type="dir"
              property="product.installed" />
        <antcall target="configure.do" />
    </target>
    <!-- end of config related targets -->
    <!-- start -->
  <target name="start.do"
          description="start the product"
          if="product.installed"
          unless="product.running" >
        <echo message="Starting ${product.name} ${product.version}... on ${os.name}" />
    <exec
          os="Windows XP,windows,dos"
      executable="${full.install.dir}\bin\start-ds.bat"
     spawn="true"                                                           />
    <exec
      os="unix"
      executable="${full.install.dir}/bin/start-ds.sh"
      spawn="true"                                                           />
  </target>
    <target name="start">
    <available file="${full.install.dir}"
              type="dir"
              property="product.installed" />
    <condition property="product.running">
      <socket port="${port.ldap}" server="${host.name}"/>
    </condition>
        <antcall target="start.do" />
    </target>
    <!--  end of start related targets -->
  <!-- stop  -->
  <target name="stop.force"
          description="stop the server">
        <echo message="Stopping ${product.name} ${product.version}..." />
    <exec
      os="Windows XP,windows,dos"
      executable="${full.install.dir}\bin\stop-ds.bat"
      spawn="true">
      <arg line="-h ${host.name}"/>
      <arg line="-p ${port.ldap}"/>
      <arg line="-w ${bind.pwd}" />
      <arg value="-D"            />
      <arg value="${bind.dn}"    />
    </exec>
    <exec
      os="unix"
      executable="${full.install.dir}/bin/stop-ds.sh"
      spawn="true"                                   >
      <arg line="-h ${host.name}"/>
      <arg line="-p ${port.ldap}"/>
      <arg line="-w ${bind.pwd}" />
      <arg value="-D"            />
      <arg value="${bind.dn}"    />
    </exec>
  </target>
    <target name="stop.do" if="product.running">
        <antcall target="stop.force" />
    </target>
  <target name="stop" >
    <condition property="product.running">
      <socket port="${port.ldap}" server="${host.name}"/>
    </condition>
        <antcall target="stop.do" />
    </target>
    <!-- end of stop related targets -->
    <!-- status -->
      <!-- Installation status -->
    <target name="is-product-installed?" if="product.installed">
        <echo message="Found ${product.name} installed in [${full.install.dir}]" />
    </target>
    <target name="is-product-not-installed?" unless="product.installed">
        <echo message="Could not find ${product.name} installation." />
    </target>
        <!-- end of installation status -->
        <!-- Running status -->
  <target name="is-product-running?" if="product.running">
    <echo message="${product.name} is listening on port [${port.ldap}]"/>
  </target>
  <target name="is-product-not-running?" unless="product.running">
    <echo message="${product.name} is NOT running"/>
  </target>
        <!-- end of running status -->
    <target name="status">
    <available file="${full.install.dir}"
              type="dir"
              property="product.installed" />
    <condition property="product.running">
      <socket port="${port.ldap}" server="${host.name}"/>
    </condition>
        <antcall target="is-product-installed?"     />
        <antcall target="is-product-not-installed?" />
        <antcall target="is-product-running?"       />
        <antcall target="is-product-not-running?"   />
    </target>
    <!--  end of status related tasks -->
    <!-- macros - chained operations -->
    <target name="bootstrap">
        <echo message="Bootstrap: wipe the plate clean in case there is a previous install"/>
        <antcall target="wipeout" />
        <echo message="Bootstrap: install the product" />
        <antcall target="install"   />
        <antcall target="configure" />
        <antcall target="start"     />
    </target>
    <target name="wipeout">
      <echo message="Wipeout: removing product" />
        <antcall target="stop"      />
    <echo message="Give the server some time to shut down and release locks..." />
    <sleep seconds="10"         />
        <antcall target="uninstall" />
    </target>
    <!--  end of macros related targets-->
</project>
opends/tests/integration-tests-testng/build.xml
@@ -37,6 +37,12 @@
    <format property="run.time" pattern="yyyy.MM.dd-HH.mm.ss"                />
  </tstamp>
  
  <property file="../product.properties"                      />
  <!-- in case there's a custom installer properties file    -->
  <property file="../installer.properties"         />
  <!-- in case there isn't - load default values             -->
  <property file="../default.installer.properties"            />
  <!-- General build-wide properties                                        -->
  <property name="opends.dir"       location="../.."                         />
  <property name="tests.src.dir"    location="${basedir}/src/server"                    />
@@ -57,10 +63,6 @@
  <property name="opends.classes"     location="${opends.build.dir}/classes" />
  <property name="opends.src"         location="${opends.dir}/src/server"    />
  <!-- product values for opends -->
  <property name="product.version"     value="0.1"                           />
  <property name="product.name"        value="OpenDS"                        />
  <!-- Properties for code coverage -->
  <property name="emma.lib.dir" value="${ext.dir}/emma/lib"                  />
  <property name="opends.coverage.dir" 
@@ -93,8 +95,8 @@
       port.ssl
       install.dir
       host.name
       bindDN
       password
       bind.dn
       bind.pwd
       
       see set-default-props target for default values
  -->
@@ -103,29 +105,25 @@
  <target name="set-default-props"
          description="defines the default values if no custom values were provided">
    <property name="install.dir" value="${tests.build.dir}/install"          />
    <property name="port.ldap"   value="1389"                                />
    <property name="port.ssl"    value="1636"                                />
    <property name="host.name"   value="localhost"                           />
    <property name="bindDN"      value="cn=Directory Manager"                />
    <property name="password"    value="password"                            />
    <property name="full.install.dir"
            value="${install.dir}/${product.name}-${product.version}"        />
    <property name="MEM" value="128M"                                        />
  </target>
  
  <!-- this is a private target that checks for emma instrumented opends 
       classes 
  -->
  <target name="check-opends-instrumentation">
  <target name="check-opends-instrumented">
    <available file="${coverage.instr.dir}/org/opends/server" 
              type="dir" 
              property="is-opends-instrumented"
              property="opends.instrumented"
              value="true"                                     />
  </target>
  
  <target name="coverage" 
          if="is-opends-instrumented"
          depends="check-opends-instrumentation"
          if="opends.instrumented"
          depends="check-opends-instrumented"
          description="initialize emma">
    <echo message="Found opends emma instrumentation, configuring emma to gather code coverage during integration tests run"/>
    <mkdir dir="${coverage.data.dir}"               />
@@ -217,7 +215,8 @@
    <testng outputdir="${tests.run.dir}/reports/testng" 
            haltonfailure="true"
            enableAssert="false"
            listener="org.opends.server.OpenDSTestListener">
            listener="org.opends.server.OpenDSTestListener"
            verbose="2">
      <classpath>
        <!-- where to get the instrumented server classes (if built) -->
        <pathelement location="${coverage.instr.dir}"/>
@@ -233,7 +232,7 @@
        <!-- last but not least, where to get the emma library -->
        <path refid="emma.lib"/>
      </classpath>
      <!--<classfileset dir="${tests.classes}" includes="**/*.class" />-->
      <!-- coverage specific jvm options -->
        <!-- where to store the run-time coverage data --> 
      <jvmarg  value="-Demma.coverage.out.file=${coverage.data.dir}/integration.emma" />
@@ -264,7 +263,7 @@
    </copy>
    
    
    <emma enabled="${is-opends-instrumented}" >
    <emma enabled="${opends.instrumented}" >
      <!-- generate the integration test coverage report -->
      <report sourcepath="${opends.src}" >
        <fileset dir="${coverage.data.dir}" >
@@ -276,7 +275,7 @@
      </report>
    </emma>
    
    <emma enabled="${is-opends-instrumented}">
    <emma enabled="${opends.instrumented}">
      <!-- generate the global test coverage report -->
      <report sourcepath="${opends.src}" >
        <fileset dir="${coverage.data.dir}" >
@@ -288,122 +287,20 @@
    </emma>
  </target>
  
  <target name="install"
          description="deploy the opends bits"
          depends="set-default-props"  >
    <property name="config.file"
              location="${full.install.dir}/config/config.ldif"/>
    <mkdir dir="${install.dir}"/>
    <unzip dest="${install.dir}">
      <fileset dir="${opends.package.dir}">
        <include name="*.zip"/>
      </fileset>
    </unzip>
    <chmod perm="755">
      <fileset dir="${full.install.dir}/bin">
        <include name="*.sh"/>
      </fileset>
    </chmod>
  <target name="bootstrap" >
    <ant
      antfile="installer.xml"
      dir=".."
      target="bootstrap"
      inheritAll="false" />
  </target>
  <target name="uninstall"
          description="Uninstall opends"
          depends="set-default-props" >
    <delete dir="${install.dir}" />
  <target name="wipeout">
    <ant
      antfile="installer.xml"
      dir=".."
      target="wipeout"
      inheritAll="false" />
  </target>
  
  <target name="configure"
          description="configures opends to listen on the right port number"
          depends="set-default-props"
          >
    <java classname="org.opends.server.tools.ConfigureDS">
      <!-- building the classpath to run the configurator -->
      <classpath>
        <fileset dir="${full.install.dir}/lib">
          <include name="*.jar"/>
        </fileset>
      </classpath>
      <!-- provide the arguments here -->
      <arg value="--configClass" />
      <arg value="org.opends.server.extensions.ConfigFileHandler"  />
      <arg value="--configFile" />
      <arg value="${full.install.dir}/config/config.ldif"       />
      <arg line="-p ${port.ldap}" />
      <arg value="-D"/>
      <arg value="${bindDN}"/>
      <arg value="-w"/>
      <arg value="${password}"/>
    </java>
  </target>
  <!-- Windows specific start / stop commands -->
  <target name="start-windows" if="isWindows">
    <echo message="Starting in the background ..."/>
    <exec
      executable="${full.install.dir}\bin\start-ds.bat"
      spawn="true"                                                           />
  </target>
  <target name="stop-windows"  if="isWindows" >
    <echo message="Stopping ..." />
    <exec
      executable="${full.install.dir}\bin\stop-ds.bat">
      <arg line="-h ${host.name}"/>
      <arg line="-p ${port.ldap}"/>
      <arg line="-w ${password}"/>
      <arg value="-D"/>
      <arg value="${bindDN}"/>
    </exec>
  </target>
  <!-- Unix specific start / stop commands -->
  <target name="start-unix" if="isUnix" >
    <echo message="Starting in the background ..."/>
    <exec
      executable="${full.install.dir}/bin/start-ds.sh"
      spawn="true"                                                           />
  </target>
  <target name="stop-unix" if="isUnix" >
    <echo message="Stopping ..." />
    <exec
      executable="${full.install.dir}/bin/stop-ds.sh" >
      <arg line="-h ${host.name}"/>
      <arg line="-p ${port.ldap}"/>
      <arg line="-w ${password}"/>
      <arg value="-D"/>
      <arg value="${bindDN}"/>
    </exec>
  </target>
  <!-- platform independent start / stop targets -->
  <target name="start"
          description="start the server"
          depends="set-default-props,start-windows,start-unix" />
  <target name="stop"
          description="stop the server"
          depends="set-default-props,stop-windows,stop-unix" />
  <target name="sleep">
    <!--
      this is somewhat based on experience
      before we can delete the installation directory
      we have to wait for opends to exit gracefully and free all the locks on
      the various resources it uses.
      this may need to be computed based on the tests execution time to try
      to approximate the machine speed
      right now it's hardcoded to 15 seconds
    -->
    <sleep seconds="15"/>
  </target>
  <target name="bootstrap"
          description="bootstrap opends"
          depends="install,configure,start" />
  <target name="wipeout"
          description="stop and uninstall opends"
          depends="stop,sleep,uninstall"          />
</project>
opends/tests/oulu-tests/build.bat
New file
@@ -0,0 +1,51 @@
@echo off
rem CDDL HEADER START
rem
rem The contents of this file are subject to the terms of the
rem Common Development and Distribution License, Version 1.0 only
rem (the "License").  You may not use this file except in compliance
rem with the License.
rem
rem You can obtain a copy of the license at
rem trunk/opends/resource/legal-notices/OpenDS.LICENSE
rem or https://OpenDS.dev.java.net/OpenDS.LICENSE.
rem See the License for the specific language governing permissions
rem and limitations under the License.
rem
rem When distributing Covered Code, include this CDDL HEADER in each
rem file and include the License file at
rem trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
rem add the following below this CDDL HEADER, with the fields enclosed
rem information:
rem      Portions Copyright [yyyy] [name of copyright owner]
rem
rem CDDL HEADER END
rem
rem
rem      Portions Copyright 2006 Sun Microsystems, Inc.
setlocal
rem These are the variables we need to run the integration tests
set FT_HOME=%~dP0
set ANT_HOME=%FT_HOME%\..\..\ext\ant
if "%JAVA_HOME%" == "" goto noJavaHome
goto runAnt
:noJavaHome
echo Error: JAVA_HOME environment variable is not set.
echo        Please set it to a valid Java 5 Development Kit installation.
goto end
:runAnt
rem echo a quick summary of what this script did
echo using the following variables:
echo   ANT_HOME=%ANT_HOME%
echo   JAVA_HOME=%JAVA_HOME%
if not "%*" == "" echo   your parameters=%*
echo Now running ant ...
"%ANT_HOME%\bin\ant" %*
:end
opends/tests/oulu-tests/build.xml
New file
@@ -0,0 +1,146 @@
<!--
 ! 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-oulu" basedir="." default="usage">
  <description>
    the purpose of this ant file is to facilitate and automate the protocol
    testing of the project.
    Due to legal issues, we cannot provide the package
  </description>
  <property name="project.home.dir"  value="${basedir}/../.." />
  <property file="../product.properties"                      />
  <!-- in case there's a custom installer properties file    -->
  <property file="../installer.properties"                    />
  <!-- in case there isn't - load default values             -->
  <property file="../default.installer.properties"            />
  <!-- oulu tests specific properties                        -->
  <property file="oulu.properties"                            />
  <tstamp>
    <format property="run.time" pattern="yyyy.MM.dd-HH.mm.ss"                />
  </tstamp>
  <target name="usage">
    <echo>Usage for oulu test suite:
    </echo>
  </target>
  <!-- download the bits from oulu university -->
  <target name="get-bits.do" unless="oulu.uptodate">
    <delete dir="${oulu.build.dir}" />
    <mkdir dir="${oulu.build.dir}" />
    <echo message="Downloading oulu bits ..." />
    <get
      src="${oulu.home.url}/${oulu.ber.jar}"
      dest="${oulu.build.dir}/${oulu.ber.jar}"
      verbose="true"                               />
    <get
      src="${oulu.home.url}/${oulu.ber.pgp}"
      dest="${oulu.build.dir}/${oulu.ber.pgp}"     />
    <get
      src="${oulu.home.url}/${oulu.pdu.jar}"
      dest="${oulu.build.dir}/${oulu.pdu.jar}"
      verbose="true"                               />
    <get
      src="${oulu.home.url}/${oulu.pdu.pgp}"
      dest="${oulu.build.dir}/${oulu.pdu.pgp}"     />
  </target>
  <target name="get-bits.no-need" if="oulu.uptodate">
    <echo message="Oulu bits are already there." />
  </target>
  <target name="get-bits">
    <condition property="oulu.uptodate">
      <and>
        <available file="${oulu.build.dir}/${oulu.ber.jar}"/>
        <available file="${oulu.build.dir}/${oulu.ber.pgp}"/>
        <available file="${oulu.build.dir}/${oulu.pdu.jar}"/>
        <available file="${oulu.build.dir}/${oulu.pdu.pgp}"/>
      </and>
    </condition>
    <antcall target="get-bits.do"      />
    <antcall target="get-bits.no-need" />
  </target>
  <!-- end of of download related targets -->
  <!-- installer related targets -->
  <target name="bootstrap">
    <echo message="basedir=[${basedir}]" />
    <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 -->
  <!-- test related targets -->
  <target name="pdu-tests">
    <java
      jar="${oulu.build.dir}/${oulu.pdu.jar}"
      fork="true"
      output="${oulu.build.dir}/pdu-${run.time}.txt">
      <arg value="-port"        />
      <arg value="${port.ldap}" />
      <arg value="-host"        />
      <arg value="${host.name}" />
      <arg value="-delay"       />
      <arg value="15"           />
      <!-- <arg value="-showreply"    /> -->
    </java>
  </target>
  <target name="ber-tests">
    <java
      jar="${oulu.build.dir}/${oulu.pdu.jar}"
      fork="true"
      output="${oulu.build.dir}/ber-${run.time}.txt">
      <arg value="-port"        />
      <arg value="${port.ldap}" />
      <arg value="-host"        />
      <arg value="${host.name}" />
      <arg value="-delay"       />
      <arg value="15"           />
    </java>
  </target>
  <!-- end of test related targets -->
  <!-- macros - chained targets -->
  <target name="all" >
    <antcall target="boostrap"  />
    <antcall target="get-bits"  />
    <antcall target="pdu-tests" />
    <antcall target="ber-tests" />
    <antcall target="wipeout"   />
  </target>
</project>
opends/tests/oulu-tests/oulu.properties
New file
@@ -0,0 +1,6 @@
oulu.build.dir=../../build/oulu-tests
oulu.home.url=http://www.ee.oulu.fi/research/ouspg/protos/testing/c06/ldapv3
oulu.ber.jar=c06-ldapv3-enc-r1.jar
oulu.ber.pgp=c06-ldapv3-enc-r1.jar.asc
oulu.pdu.jar=c06-ldapv3-app-r1.jar
oulu.pdu.pgp=c06-ldapv3-app-r1.jar.asc
opends/tests/product.properties
New file
@@ -0,0 +1,2 @@
product.name=OpenDS
product.version=0.1