<?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="main_run"/>
|
|
<function name="main_run" scope="local">
|
<function-map-args>
|
<function-arg-def name="configurationFile" type="required">
|
<function-arg-description>
|
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"
|
default="'true'">
|
<function-arg-description>
|
run installation phase
|
</function-arg-description>
|
</function-arg-def>
|
<function-arg-def name="runGenerateLdif" type="optional"
|
default="'true'">
|
<function-arg-description>
|
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
|
</function-arg-description>
|
</function-arg-def>
|
</function-map-args>
|
|
<sequence>
|
<!-- ============ GLOBAL VARIABLES ============================ -->
|
<!-- Warning : some of global variables are also defined in -->
|
<!-- parser.py file, be sure to update both files -->
|
<script>
|
STAXLogMessage = 1
|
TRUE = 0
|
FALSE = 1
|
NO_FILE = 'do_not_write_in_file'
|
NOT_DEFINED = 'ERROR_not_defined'
|
MultimasterSync = 'Multimaster Synchronization'
|
MultimasterType = 'multimaster'
|
DSCONFIG = 'dsconfig'
|
DIRECTORY_INSTANCE_BE = 'userRoot'
|
DOMAIN = STAXGlobal([0])
|
DOMAIN[0] = ''
|
|
ERR_NUM = STAXGlobal([0])
|
ERR_NUM_TOTAL = 0
|
|
SHARED_FUNC_DIR = '%s/phases/shared/functions' % TESTS_DIR
|
</script>
|
|
|
<!-- ============ LOAD LIB ===================================== -->
|
<!-- Load in any standard python libraries -->
|
<script>
|
import re
|
import posixpath
|
import sys
|
from time import localtime,strftime
|
</script>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/main_run_lib.xml' % (TESTS_DIR)"/>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/utils.xml' % (SHARED_FUNC_DIR)"/>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/stafcmd.xml' % (SHARED_FUNC_DIR)"/>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/opendsadm.xml' % (SHARED_FUNC_DIR)"/>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/ldap.xml' % (SHARED_FUNC_DIR)"/>
|
|
<!-- TBD : should not have dependency with functional test suite -->
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/../functional-run/staf/services/stax/libraries/STAXUtil.xml'
|
% (TESTS_DIR)"/>
|
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/parser/object_lib.xml' % (TESTS_DIR)"/>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/log/log.xml' % (TESTS_DIR)"/>
|
|
|
<!-- ============ CONF FILES CHECK ============================= -->
|
<!-- Check that configuration files have no NEED_VALUE string -->
|
<script>ERR_NUM[0] = 0</script>
|
<call function="'checkConfigurationFiles'">
|
{ 'configurationFile' : configurationFile }
|
</call>
|
<if expr="ERR_NUM[0] != 0">
|
<return/>
|
<else>
|
<script>ERR_NUM[0] = 0</script>
|
</else>
|
</if>
|
|
|
<!-- ============ CREATE LOG STUFF ============================= -->
|
<script>
|
logsDate = strftime("%Y%m%d-%H%M%S",localtime())
|
LOG_DIR = '%s/%s' % (TMPDIR,logsDate)
|
LOG_TMP_DIR = '%s/tmp' % LOG_DIR
|
LOG_XML_TMP_DIR = '%s/xmltmp' % LOG_DIR
|
LOCAL_TESTS_DIR = '%s/fwrk' % LOG_DIR
|
</script>
|
<call function="'createLogDir'"/>
|
<!-- Write xml result header -->
|
<script>
|
LOG_FILE = '%s/result.xml' % (LOG_DIR)
|
LOG_MAIN_FD = open(LOG_FILE,'w')
|
str = '<?xml version=\"1.0\" encoding=\"UTF-8\"'
|
str = '%s standalone=\"no\"?>\n' % str
|
str = '%s <?xml-stylesheet type="text/xsl" href="result.xsl"?>\n' \
|
% str
|
str = '%s <systemTestRoot' % str
|
str = '%s xmlns:xlink="http://www.w3.org/1999/xlink">\n' % str
|
LOG_MAIN_FD.write(str)
|
</script>
|
|
<!-- ======= Create object for each phase ====================== -->
|
<script>
|
sys.path.append("%s/phases/parser" % TESTS_DIR )
|
from parser import *
|
PHASE_PARSER = Phase('parser')
|
PHASE_INSTALLATION = Phase('installation')
|
PHASE_GEN_LDIF = Phase('generateldif')
|
PHASE_PRE_CONFIGURATION = Phase('preconfiguration')
|
PHASE_CONFIGURATION = Phase('configuration')
|
PHASE_POST_CONFIGURATION = Phase('postconfiguration')
|
PHASE_SCHEDULER = Phase('scheduler')
|
PHASE_VERDICT = Phase('verdict')
|
</script>
|
|
<!-- ============ PARSER ======================================= -->
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/parser/parser.xml' % (TESTS_DIR)"/>
|
<call function="'parser'">configurationFile</call>
|
<script>
|
result = STAXResult
|
msg = result[0]
|
instances = result[1]
|
suffix = result[2]
|
scheduler = result[3]
|
scenario = result[4]
|
externalTools = result[5]
|
PHASE_PARSER.setRun('true')
|
PHASE_PARSER.setErrNum(ERR_NUM[0])
|
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
|
</script>
|
<if expr="PHASE_PARSER.getErrNum() != 0">
|
<return/>
|
</if>
|
|
|
<!-- ============ PREAMBLE ===================================== -->
|
<call function="'mainPreamble'">
|
{
|
'instances' : instances,
|
'scheduler' : scheduler,
|
'runInstallation' : runInstallation,
|
'runConfiguration' : runConfiguration,
|
'runScheduler' : runScheduler
|
}
|
</call>
|
<if expr="ERR_NUM[0] != 0">
|
<return/>
|
</if>
|
|
|
<!-- ============ INSTALLATION ================================= -->
|
<if expr="runInstallation == 'true'">
|
<sequence>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/installation/installation.xml' % (TESTS_DIR)"/>
|
<call function="'installation'">
|
{
|
'phase' : PHASE_INSTALLATION,
|
'instances' : instances,
|
'suffix' : suffix
|
}
|
</call>
|
<script>
|
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
|
</script>
|
</sequence>
|
</if>
|
|
|
<!-- ============ PRE-CONFIGURATION ============================ -->
|
<if expr="runPreConfiguration == 'true' and ERR_NUM_TOTAL == 0">
|
<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'">
|
{
|
'phase' : PHASE_PRE_CONFIGURATION,
|
'instances' : instances,
|
'suffix' : suffix,
|
'scheduler' : scheduler
|
}
|
</call>
|
<script>
|
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
|
</script>
|
</sequence>
|
<else>
|
<sequence>
|
<message>
|
'ERROR : preConfiguration phase is enabled and file \
|
does not exist on %s : %s' % \
|
(STAXServiceMachine,preConfigurationFile)
|
</message>
|
<script>ERR_NUM_TOTAL += 1 </script>
|
</sequence>
|
</else>
|
</if>
|
</sequence>
|
</if>
|
|
|
<!-- ============ GENERATE LDIF & IMPORT LDIF ================== -->
|
<if expr="runGenerateLdif == 'true' and ERR_NUM_TOTAL == 0">
|
<sequence>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/generateLdif/generateLdif.xml' % (TESTS_DIR)"/>
|
<call function="'generateLdif'">
|
{
|
'phase' : PHASE_GEN_LDIF,
|
'suffix' : suffix
|
}
|
</call>
|
<script>
|
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
|
</script>
|
</sequence>
|
</if>
|
|
|
<!-- ============ CONFIGURATION =============================== -->
|
<if expr="runConfiguration == 'true' and ERR_NUM_TOTAL == 0">
|
<sequence>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/configuration/configuration.xml' % TESTS_DIR"/>
|
<call function="'configuration'">
|
{
|
'phase' : PHASE_CONFIGURATION,
|
'instances' : instances,
|
'suffix' : suffix
|
}
|
</call>
|
<script>
|
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
|
</script>
|
</sequence>
|
</if>
|
|
|
<!-- ============ POST-CONFIGURATION =========================== -->
|
<if expr="runPostConfiguration == 'true' and ERR_NUM_TOTAL == 0">
|
<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'">
|
{
|
'phase' : PHASE_POST_CONFIGURATION,
|
'instances' : instances,
|
'suffix' : suffix,
|
'scheduler' : scheduler
|
}
|
</call>
|
<script>
|
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
|
</script>
|
</sequence>
|
<else>
|
<sequence>
|
<message>
|
'ERROR : postConfiguration phase is enabled and file \
|
does not exist on %s : %s' % \
|
(STAXServiceMachine,postConfigurationFile)
|
</message>
|
<script>ERR_NUM_TOTAL += 1 </script>
|
</sequence>
|
</else>
|
</if>
|
</sequence>
|
</if>
|
|
|
<!-- ============ MONITORING =================================== -->
|
|
|
|
<!-- ============ SCHEDULER ==================================== -->
|
<!--== Get the enabled clients list from all modules ==-->
|
<call function="'getEnabledClients'">{'scheduler':scheduler}</call>
|
<script>clients = STAXResult </script>
|
<if expr="runScheduler == 'true' and ERR_NUM_TOTAL == 0
|
and len(clients) > 0">
|
<sequence>
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/scheduler/scheduler.xml' % (TESTS_DIR)"/>
|
<call function="'scheduler'">
|
{
|
'phase' : PHASE_SCHEDULER,
|
'instances' : instances,
|
'suffix' : suffix,
|
'scheduler' : scheduler,
|
'scenario' : scenario
|
}
|
</call>
|
<script>
|
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
|
</script>
|
</sequence>
|
</if>
|
|
|
<!-- ============ TOPOLOGY ===================================== -->
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/log/topology.xml' % (TESTS_DIR)"/>
|
<call function="'writeTopology'">
|
{
|
'instances' : instances,
|
'suffix' : suffix,
|
'scheduler' : scheduler
|
}
|
</call>
|
|
|
<!-- ============ VERDICT ====================================== -->
|
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
|
file="'%s/phases/verdict/verdict.xml' % (TESTS_DIR)"/>
|
<call function="'verdict'">
|
{
|
'phase' : PHASE_VERDICT,
|
'instances' : instances,
|
'suffix' : suffix,
|
'runConfiguration' : runConfiguration,
|
'runScheduler' : runScheduler
|
}
|
</call>
|
<script>
|
ERR_NUM_TOTAL = ERR_NUM_TOTAL + ERR_NUM[0]
|
</script>
|
|
<!-- ====== Write information phases to xml report ============ -->
|
<!-- == Write phase summary == -->
|
<!-- this function is in log/log.xml file -->
|
<call function="'writeSummary'">
|
{
|
'scenario' : scenario,
|
'fileFd' : LOG_MAIN_FD
|
}
|
</call>
|
|
<!-- ====== Write global result for system test run ============ -->
|
<script>
|
str = '<globalResult percentage="%s"/>\n' % \
|
PHASE_VERDICT.getPercentage()
|
LOG_MAIN_FD.write(str)
|
</script>
|
|
|
<!-- ============ POSTAMBLE ==================================== -->
|
<call function="'mainPostamble'">
|
{
|
'instances' : instances,
|
'scheduler' : scheduler
|
}
|
</call>
|
|
|
</sequence>
|
|
</function>
|
|
|
</stax>
|