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

andrug
18.22.2008 48e12ec78a178f795b258c2e90c77e7fa89b5eb8
add pre/post configuration phases
4 files added
5 files modified
486 ■■■■■ changed files
opends/tests/system-tests/phases/log/log.xml 8 ●●●●● patch | view | raw | blame | history
opends/tests/system-tests/phases/main_run.xml 84 ●●●●● patch | view | raw | blame | history
opends/tests/system-tests/phases/main_run_lib.xml 10 ●●●● patch | view | raw | blame | history
opends/tests/system-tests/report/result.xsl 12 ●●●●● patch | view | raw | blame | history
opends/tests/system-tests/scenario/sample/sample.xml 9 ●●●● patch | view | raw | blame | history
opends/tests/system-tests/scenario/sample2/conf.xml 158 ●●●●● patch | view | raw | blame | history
opends/tests/system-tests/scenario/sample2/post_configuration.xml 69 ●●●●● patch | view | raw | blame | history
opends/tests/system-tests/scenario/sample2/pre_configuration.xml 69 ●●●●● patch | view | raw | blame | history
opends/tests/system-tests/scenario/sample2/sample2.xml 67 ●●●●● patch | view | raw | blame | history
opends/tests/system-tests/phases/log/log.xml
@@ -143,10 +143,18 @@
          str = '<phaseSummmary name=\"generateLdif\" result=\"%s\"/>\n'%\
                ERR_NUM_GEN_LDIF
          fileFd.write(str)
        if ERR_NUM_PRE_CONFIGURATION != '':
          str = '<phaseSummmary name=\"preconfiguration\" result=\"%s\"/>\n'%\
                ERR_NUM_PRE_CONFIGURATION
          fileFd.write(str)
        if ERR_NUM_CONFIGURATION != '':
          str = '<phaseSummmary name=\"configuration\" result=\"%s\"/>\n'%\
                ERR_NUM_CONFIGURATION
          fileFd.write(str)
        if ERR_NUM_POST_CONFIGURATION != '':
          str = '<phaseSummmary name=\"postconfiguration\" result=\"%s\"/>\n'%\
                ERR_NUM_POST_CONFIGURATION
          fileFd.write(str)
        if ERR_NUM_SCHEDULER != '':
          str = '<phaseSummmary name=\"scheduler\" result=\"%s\"/>\n' % \
                ERR_NUM_SCHEDULER
opends/tests/system-tests/phases/main_run.xml
@@ -33,7 +33,17 @@
    <function-map-args>
      <function-arg-def name="configurationFile" type="required">
        <function-arg-description>
          configuration file path
          xml configuration file
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="preConfigurationFile" type="optional">
        <function-arg-description>
          pre configuration file for custom pre configuration
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="postConfigurationFile" type="optional">
        <function-arg-description>
          post configuration file for custom pre configuration
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="runInstallation" type="optional" 
@@ -48,12 +58,24 @@
          run generateLdif phase
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="runPreConfiguration" type="optional"
                                                default="'false'">
        <function-arg-description>
          run configuration phase
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="runConfiguration" type="optional"
                                                default="'true'">
        <function-arg-description>
          run configuration phase
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="runPostConfiguration" type="optional"
                                                default="'false'">
        <function-arg-description>
          run configuration phase
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="runScheduler" type="optional" default="'true'">
        <function-arg-description>
          run scheduler phase
@@ -82,7 +104,9 @@
        ERR_NUM_PARSER        = ''
        ERR_NUM_INSTALL       = ''
        ERR_NUM_GEN_LDIF      = ''
        ERR_NUM_PRE_CONFIGURATION  = ''
        ERR_NUM_CONFIGURATION = ''
        ERR_NUM_POST_CONFIGURATION = ''
        ERR_NUM_SCHEDULER     = ''
        ERR_NUM_VERDICT       = ''
        ERR_NUM_TOTAL         = 0
@@ -120,7 +144,9 @@
      <!-- ============ CONF FILES CHECK ============================= -->
      <!-- Check that configuration files have no NEED_VALUE string    -->
      <script>ERR_NUM[0] = 0</script>
      <call function="'checkConfigurationFiles'"/>
      <call function="'checkConfigurationFiles'">
        { 'configurationFile' : configurationFile }
      </call>
      <if expr="ERR_NUM[0] != 0">
        <return/>
      <else>
@@ -212,8 +238,32 @@
      </if>
      
      <!-- ============ PRE-CONFIGURATION ============================ -->
      <if expr="runPreConfiguration == 'true'">
        <sequence>
          <call function="'isFile'">
          {
            'location' : STAXServiceMachine,
            'fileName' : preConfigurationFile
          }
          </call>
          <if expr="STAXResult == TRUE">
            <sequence>
              <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
                      file="'%s' % preConfigurationFile"/>
              <call function="'preConfiguration'">
              {
                'instances' : instances,
                'suffix'    : suffix
              }
              </call>
              <script>
                ERR_NUM_PRE_CONFIGURATION = ERR_NUM[0]
                ERR_NUM_TOTAL             = ERR_NUM_TOTAL + ERR_NUM[0]
              </script>
            </sequence>
          </if>
        </sequence>
      </if>
      
      <!-- ============ CONFIGURATION  =============================== -->
      <if expr="runConfiguration == 'true'">
@@ -235,6 +285,32 @@
      
      
      <!-- ============ POST-CONFIGURATION =========================== -->
      <if expr="runPostConfiguration == 'true'">
        <sequence>
          <call function="'isFile'">
          {
            'location' : STAXServiceMachine,
            'fileName' : postConfigurationFile
          }
          </call>
          <if expr="STAXResult == TRUE">
            <sequence>
              <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
                      file="'%s' % postConfigurationFile"/>
              <call function="'postConfiguration'">
              {
                'instances' : instances,
                'suffix'    : suffix
              }
              </call>
              <script>
                ERR_NUM_POST_CONFIGURATION = ERR_NUM[0]
                ERR_NUM_TOTAL              = ERR_NUM_TOTAL + ERR_NUM[0]
              </script>
            </sequence>
          </if>
        </sequence>
      </if>
      
      
      <!-- ============ MONITORING =================================== -->
opends/tests/system-tests/phases/main_run_lib.xml
@@ -29,7 +29,13 @@
  <!-- ************************************************************ -->
  <function name="checkConfigurationFiles" scope="local">
  <function-no-args/>
    <function-map-args>
      <function-arg-def name="configurationFile" type="required">
        <function-arg-description>
          Location of target host
        </function-arg-description>
      </function-arg-def>
    </function-map-args>
  <sequence>
    <if expr="OPENDSDIR == 'NEED_VALUE'">
      <sequence>
@@ -66,7 +72,7 @@
          'string2grep'   : 'NEED_VALUE',
          'expect2Find'   : FALSE,
          'caseSensitive' : FALSE,
          'file'          : CONF_FILE,
          'file'          : configurationFile,
          'fileFd'        : NO_FILE
        }
        </call>
opends/tests/system-tests/report/result.xsl
@@ -92,12 +92,24 @@
          <xsl:with-param name="phaseName" select="'GenerateLdif'" />
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$phaseName = 'preconfiguration'">
        <a name="preconfiguration"/>
        <xsl:call-template name="parsePhase">
          <xsl:with-param name="phaseName" select="'PreConfiguration'" />
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$phaseName = 'configuration'">
        <a name="configuration"/>
        <xsl:call-template name="parsePhase">
          <xsl:with-param name="phaseName" select="'Configuration'" />
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$phaseName = 'postconfiguration'">
        <a name="postconfiguration"/>
        <xsl:call-template name="parsePhase">
          <xsl:with-param name="phaseName" select="'PostConfiguration'" />
        </xsl:call-template>
      </xsl:when>
      <xsl:when test="$phaseName = 'scheduler'">
        <a name="scheduler"/>
        <xsl:call-template name="parsePhase">
opends/tests/system-tests/scenario/sample/sample.xml
@@ -34,14 +34,19 @@
        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
          file="'%s/phases/main_run.xml' % (TESTS_DIR)"/>
        
        <!-- ********************************************************* -->
        <!-- ****************     README               *************** -->
        <!-- directoryName must have the name of the current directory -->
        <!-- pre and post configuration files are stax code based, these
             files allow you to configure the products as you want !-->
        <!-- ********************************************************* -->
        <script>
          dirName   = 'sample'
          CONF_FILE = '%s/scenario/%s/conf.xml' % (TESTS_DIR,dirName)
          fConf     = '%s/scenario/%s/conf.xml' % (TESTS_DIR,dirName)
        </script>
        <call function="'main_run'">
        {
         'configurationFile': CONF_FILE,
         'configurationFile': fConf,
         'runInstallation'  : 'true',
         'runGenerateLdif'  : 'true',
         'runConfiguration' : 'true',
opends/tests/system-tests/scenario/sample2/conf.xml
New file
@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE systemTestConfiguration SYSTEM "../conf.dtd">
<!--
 ! 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
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<!--==================================================================-->
<!-- This conf.xml file is an example                                 -->
<!-- BEFORE running system-tests, you need to set up your environment -->
<!--==================================================================-->
<systemTestConfiguration>
  <!-- ================= Global Parameters ===================== -->
  <!-- =============  Should be the first node   =============== -->
  <globalParameters>
    <scenario>
      <name>Sample2</name>
      <description>
        This is an example using pre/post configuration files
      </description>
    </scenario>
    <opendsName>OpenDS-1.0.0</opendsName>
    <opendsZip>NEED_VALUE</opendsZip>
    <domain>NEED_VALUE</domain>
  </globalParameters>
  <!-- ================= Instance ============================== -->
  <instance name="I1" product="opends">
    <host>localhost</host>
    <installDir>NEED_VALUE</installDir>
  </instance>
  <!-- ================= Instance ============================== -->
  <instance name="I2" product="opends">
    <host>localhost</host>
    <installDir>NEED_VALUE</installDir>
    <ports>
      <ldap>1234</ldap>
      <ldaps>1235</ldaps>
      <jmx>1236</jmx>
      <replicationServer>1237</replicationServer>
    </ports>
  </instance>
  <!-- ================= Suffix  ============================== -->
  <suffix dn="dc=com">
    <topology>
        <element instanceName="I1" initRule="importLdif"/>
      <element instanceName="I2" initRule="totalUpdate"
               instanceSourceName="I1"/>
    </topology>
    <tree nbOfEntries="50">
      <branch name="ou=france,dc=com">
        <branch name="ou=QA Engineers,ou=france,dc=com">
          <subordinateTemplate type="inetOrgPerson" percentage="30"/>
        </branch>
        <branch name="ou=Accounting,ou=france,dc=com">
          <subordinateTemplate type="organizationalPerson" percentage="30"/>
        </branch>
        <branch name="ou=Managers,ou=france,dc=com">
          <subordinateTemplate type="person" nb="1"/>
        </branch>
        <branch name="ou=Engineers,ou=france,dc=com">
          <subordinateTemplate type="person" percentage="40"/>
        </branch>
      </branch>
    </tree>
  </suffix>
  <!-- ================= Scheduler  =========================== -->
  <!-- [1] duration must be more than 1 minute                  -->
  <!-- [2] dependencyId is a list of client id ie : 1,2         -->
  <!--     if using it, specify id attribute for each clients   -->
  <scheduler>
    <duration unit="m">4</duration>
    <!--== Module 1 ==-->
    <module name="search" enabled="true">
      <client id="1" name="searchLoad" host="localhost" start="t30"
                                                         stop="t60">
        <serverInstance>I1</serverInstance>
        <baseDn>dc=com</baseDn>
        <nbCnx>5</nbCnx>
        <nbMaxSearch>5</nbMaxSearch>
        <attribute>sn</attribute>
      </client>
      <client id="2" name="searchLoad" host="localhost" start="t0"
                                                         stop="t50">
        <serverInstance>I2</serverInstance>
        <baseDn>dc=com</baseDn>
        <nbCnx>5</nbCnx>
        <nbMaxSearch>5</nbMaxSearch>
        <attribute>sn</attribute>
      </client>
    </module>
    <!--== Module 2 ==-->
    <module name="restart_and_modify" enabled="true">
      <client id="3" name="restartDs" host="localhost" start="t50"
                                                        dependencyId="1">
        <serverInstance>I2</serverInstance>
        <baseDn>dc=com</baseDn>
        <nbCnx>5</nbCnx>
        <nbMaxSearch>5</nbMaxSearch>
        <attribute>sn</attribute>
      </client>
      <client id="4" name="modifyLoad" host="localhost" start="t60"
                                                         stop="t100">
        <serverInstance>I1</serverInstance>
        <baseDn>dc=com</baseDn>
        <nbCnx>5</nbCnx>
        <nbMaxSearch>5</nbMaxSearch>
        <attribute>sn</attribute>
      </client>
    </module>
  </scheduler>
</systemTestConfiguration>
opends/tests/system-tests/scenario/sample2/post_configuration.xml
New file
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! 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
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="postConfiguration"/>
  <function name="postConfiguration" scope="local">
    <function-map-args>
      <function-arg-def name="instances" type="required">
        <function-arg-description>
          list of instances classes
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="suffix" type="required">
        <function-arg-description>
          suffix class
        </function-arg-description>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- == Call preambule == -->
      <call function="'phasePreamble'">
      { 'phaseName' : 'postconfiguration' ,
        'fileFd'    : LOG_MAIN_FD }
      </call>
      <!-- ==  Call postphase == -->
      <call function="'phasePostamble'">
      {
        'phaseName' : 'postconfiguration',
        'fileFd'    : LOG_MAIN_FD
      }
      </call>
    </sequence>
  </function>
</stax>
opends/tests/system-tests/scenario/sample2/pre_configuration.xml
New file
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! 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
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="preConfiguration"/>
  <function name="preConfiguration" scope="local">
    <function-map-args>
      <function-arg-def name="instances" type="required">
        <function-arg-description>
          list of instances classes
        </function-arg-description>
      </function-arg-def>
      <function-arg-def name="suffix" type="required">
        <function-arg-description>
          suffix class
        </function-arg-description>
      </function-arg-def>
    </function-map-args>
    <sequence>
      <!-- == Call preambule == -->
      <call function="'phasePreamble'">
      { 'phaseName' : 'preconfiguration' ,
        'fileFd'    : LOG_MAIN_FD }
      </call>
      <!-- ==  Call postphase == -->
      <call function="'phasePostamble'">
      {
        'phaseName' : 'preconfiguration',
        'fileFd'    : LOG_MAIN_FD
      }
      </call>
    </sequence>
  </function>
</stax>
opends/tests/system-tests/scenario/sample2/sample2.xml
New file
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! 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
 !
 !      Copyright 2008 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="mainSample"/>
  <function name="mainSample" scope="local">
      <sequence>
        <import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
          file="'%s/phases/main_run.xml' % (TESTS_DIR)"/>
        <!-- ********************************************************* -->
        <!-- ****************     README               *************** -->
        <!-- directoryName must have the name of the current directory -->
        <!-- pre and post configuration files are stax code based, these
             files allow you to configure the products as you want !-->
        <!-- ********************************************************* -->
        <script>
          dirName   = 'sample2'
          fConf     = '%s/scenario/%s/conf.xml' % (TESTS_DIR,dirName)
          fPreConf  = '%s/scenario/%s/pre_configuration.xml' % \
                      (TESTS_DIR,dirName)
          fPostConf = '%s/scenario/%s/post_configuration.xml' % \
                      (TESTS_DIR,dirName)
        </script>
        <call function="'main_run'">
        {
         'configurationFile'     : fConf,
         'preConfigurationFile'  : fPreConf,
         'postConfigurationFile' : fPostConf,
         'runInstallation'       : 'true',
         'runGenerateLdif'       : 'true',
         'runPreConfiguration'   : 'true',
         'runConfiguration'      : 'true',
         'runPostConfiguration'  : 'true',
         'runScheduler'          : 'false'
        }
        </call>
    </sequence>
  </function>
</stax>