main_run_lib.xml revision d81978a0815d5b8a75633c35e3e1f8708d36f017
<?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>
<!-- ************************************************************ -->
<function name="checkConfigurationFiles" scope="local">
<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>
<message>'ERROR config.py : OPENDSDIR variable not defined'</message>
<script> ERR_NUM[0] += 1 </script>
</sequence>
<elseif expr="TMPDIR == 'NEED_VALUE'">
<sequence>
<message>'ERROR config.py : TMPDIR variable not defined'</message>
<script> ERR_NUM[0] += 1 </script>
</sequence>
</elseif>
<elseif expr="JAVA_HOME == 'NEED_VALUE'">
<sequence>
<message>'ERROR config.py : JAVA_HOME variable not defined'</message>
<script> ERR_NUM[0] += 1 </script>
</sequence>
</elseif>
<else>
<sequence>
<call function="'grep'">
{
'location' : STAXServiceMachine,
'string2grep' : 'NEED_VALUE',
'expect2Find' : FALSE,
'caseSensitive' : FALSE,
'file' : '%s/config.py' % TESTS_DIR,
'fileFd' : NO_FILE
}
</call>
<call function="'grep'">
{
'location' : STAXServiceMachine,
'string2grep' : 'NEED_VALUE',
'expect2Find' : FALSE,
'caseSensitive' : FALSE,
'file' : configurationFile,
'fileFd' : NO_FILE
}
</call>
</sequence>
</else>
</if>
</sequence>
</function>
<!-- ************************************************************ -->
<function name="mainPreamble" scope="local">
<function-prolog>
'preamble before running the system test'
</function-prolog>
<function-map-args>
<function-arg-def name="instances" type="required">
<function-arg-description>
instances list
</function-arg-description>
</function-arg-def>
<function-arg-def name="scheduler" type="required">
<function-arg-description>
clients list
</function-arg-description>
</function-arg-def>
<function-arg-def name="runInstallation" type="required"/>
<function-arg-def name="runConfiguration" type="required"/>
<function-arg-def name="runScheduler" type="required"/>
</function-map-args>
<sequence>
<message log="1">
'=================== PREAMBLE ========================='
</message>
<!--========================================================-->
<!--======= INSTANCE PREAMBLE =====-->
<!--======= Create instance log dir on instance's host =====-->
<paralleliterate in="instances" var="instance">
<sequence>
<call function="'createFolder'">
{ 'location' : instance.getHost(),
'foldername' : instance.getLogDir(),
'fileFd' : NO_FILE
}
</call>
<call function="'createFolder'">
{ 'location' : instance.getHost(),
'foldername' : LOG_TMP_DIR,
'fileFd' : NO_FILE
}
</call>
</sequence>
</paralleliterate>
<!--== Copy framework files needed to instance hosts ==-->
<!-- Copy framework one time per host even if several -->
<!-- instances are on a same host -->
<!--== Get the list of hosts for each instance ==-->
<script>
_list = []
_i = 0
_listName = []
for instance in instances:
if instance.getHost() not in _listName:
_listName.append(instance.getHost())
_list.append([_i,instance])
_i += 1
</script>
<paralleliterate in="_list" var="element">
<sequence>
<script>
id = element[0]
instance = element[1]
</script>
<!-- Parrallel copy, all instances except instance 0 wait 2 sec -->
<!-- This prevent copying the same folder in case of NFS -->
<if expr="id != 0">
<call function="'sleep'">
{
'sleepForMilliSeconds' : '2000',
'silentMode' : 'TRUE',
'fileFd' : NO_FILE
}
</call>
</if>
<call function="'createFolder'">
{ 'location' : instance.getHost(),
'foldername' : LOCAL_TESTS_DIR,
'fileFd' : NO_FILE
}
</call>
<call function="'copyFolder'">
{
'remoteHost' : '%s%s' % (instance.getHost(),DOMAIN[0]),
'fromDirectory' : '%s/phases/shared/java' % TESTS_DIR,
'toDirectory' : '%s/phases/shared/java' % LOCAL_TESTS_DIR,
'fileFd' : NO_FILE
}
</call>
<!-- Copy data that are under the scenario directory -->
<call function="'isFile'">
{
'location' : STAXServiceMachine,
'fileName' : '%s/scenario/%s/data' % \
(TESTS_DIR,DIR_NAME),
}
</call>
<script>
fileExist = STAXResult
</script>
<if expr="fileExist == TRUE">
<call function="'copyFolder'">
{
'remoteHost' : '%s%s' % (instance.getHost(),DOMAIN[0]),
'fromDirectory' : '%s/scenario/%s/data' % \
(TESTS_DIR,DIR_NAME),
'toDirectory' : '%s/scenario/%s/data' % \
(LOCAL_TESTS_DIR,DIR_NAME),
'fileFd' : NO_FILE
}
</call>
</if>
</sequence>
</paralleliterate>
<!--== Get opends buildid if instance is already installed ==-->
<if expr="runInstallation == 'false'">
<paralleliterate in="instances" var="instance">
<sequence>
<if expr="instance.getProduct() == 'opends'">
<sequence>
<import machine="'%s' % (STAF_LOCAL_HOSTNAME)"
file="'%s/phases/installation/installation_opends.xml' %
(TESTS_DIR)"/>
<call function="'getOpendsBuildID'">
{ 'instance' : instance }
</call>
</sequence>
</if>
</sequence>
</paralleliterate>
</if>
<!--========================================================-->
<!--======= CLIENT PREAMBLE =====-->
<!--== Get the enabled clients list from all modules ==-->
<call function="'getEnabledClients'">{'scheduler':scheduler}</call>
<script>clients = STAXResult </script>
<if expr="len(clients) > 0">
<sequence>
<!--======= Create instance log dir on instance's host =====-->
<paralleliterate in="clients" var="client">
<sequence>
<call function="'createFolder'">
{ 'location' : client.getHost(),
'foldername' : client.getLogDir(),
'fileFd' : NO_FILE
}
</call>
<call function="'createFolder'">
{ 'location' : client.getHost(),
'foldername' : LOG_TMP_DIR,
'fileFd' : NO_FILE
}
</call>
</sequence>
</paralleliterate>
<!--====== Copy framework files needed to client hosts ======-->
<!-- Copy framework one time per host even if several -->
<!-- client on same host -->
<!--== Get the list of hosts for each client ===-->
<script>
_list = []
_i = 0
_listName = []
for client in clients:
if client.getHost() not in _listName:
_listName.append(client.getHost())
_list.append([_i,client])
_i += 1
</script>
<paralleliterate in="_list" var="element">
<sequence>
<if expr="runScheduler == 'true' or runConfiguration == 'true'">
<sequence>
<script>
id = element[0]
client = element[1]
</script>
<!-- Parrallel copy, all instances except -->
<!-- client 0 wait 2 sec. This prevent copying -->
<!-- the same folder in case of NFS -->
<if expr="id != 0">
<call function="'sleep'">
{
'sleepForMilliSeconds' : '2000',
'silentMode' : 'TRUE',
'fileFd' : NO_FILE
}
</call>
</if>
<!-- Copy shared clients -->
<call function="'copyFolder'">
{
'remoteHost' : '%s%s' % (client.getHost(),DOMAIN[0]),
'fromDirectory' : '%s/clients' % TESTS_DIR,
'toDirectory' : '%s/clients' % LOCAL_TESTS_DIR,
'fileFd' : NO_FILE
}
</call>
<!-- Copy clients that are under the scenario directory -->
<call function="'isFile'">
{
'location' : STAXServiceMachine,
'fileName' : '%s/scenario/%s/clients' % \
(TESTS_DIR,DIR_NAME),
}
</call>
<script>
fileExist = STAXResult
</script>
<if expr="fileExist == TRUE">
<call function="'copyFolder'">
{
'remoteHost' : '%s%s' % (client.getHost(),DOMAIN[0]),
'fromDirectory' : '%s/scenario/%s/clients' % \
(TESTS_DIR,DIR_NAME),
'toDirectory' : '%s/scenario/%s/clients' % \
(LOCAL_TESTS_DIR,DIR_NAME),
'fileFd' : NO_FILE
}
</call>
</if>
<!-- Copy data that are under the scenario directory -->
<call function="'isFile'">
{
'location' : STAXServiceMachine,
'fileName' : '%s/scenario/%s/data' % \
(TESTS_DIR,DIR_NAME),
}
</call>
<script>
fileExist = STAXResult
</script>
<if expr="fileExist == TRUE">
<call function="'copyFolder'">
{
'remoteHost' : '%s%s' % (client.getHost(),DOMAIN[0]),
'fromDirectory' : '%s/scenario/%s/data' % \
(TESTS_DIR,DIR_NAME),
'toDirectory' : '%s/scenario/%s/data' % \
(LOCAL_TESTS_DIR,DIR_NAME),
'fileFd' : NO_FILE
}
</call>
</if>
</sequence>
</if>
</sequence>
</paralleliterate>
</sequence>
</if>
<!-- Set path to clients -->
<!-- set local client by default if exist in the scenario -->
<!-- else get the shared client if exist -->
<if expr="runScheduler == 'true'">
<sequence>
<call function="'getEnabledClients'">{'scheduler':scheduler}</call>
<script>clients = STAXResult </script>
<if expr="len(clients) > 0">
<paralleliterate in="clients" var="client">
<sequence>
<call function="'clientSetPath'">
{ 'client' : client }
</call>
</sequence>
</paralleliterate>
</if>
</sequence>
</if>
<message log="1">
'== Found %s Error(s) during this phase' % (ERR_NUM[0])
</message>
</sequence>
</function>
<!-- ************************************************************ -->
<function name="mainPostamble" scope="local">
<function-prolog>
'postamble after running the system test'
</function-prolog>
<function-map-args>
<function-arg-def name="instances" type="required">
<function-arg-description>
instances list
</function-arg-description>
</function-arg-def>
<function-arg-def name="scheduler" type="required">
<function-arg-description>
clients list
</function-arg-description>
</function-arg-def>
</function-map-args>
<sequence>
<message log="1">
'=================== POSTAMBLE ========================='
</message>
<!--========================================================-->
<!--======= INSTANCE PREAMBLE =====-->
<iterate in="instances" var="instance">
<sequence>
<!--== Copy instance directory on main host ==-->
<call function="'copyFolder'">
{ 'location' : instance.getHost(),
'remoteHost' : STAXServiceMachine,
'fromDirectory' : instance.getLogDir(),
'toDirectory' : instance.getLogDir(),
'fileFd' : NO_FILE
}
</call>
<!--== Log cn=monitor replication stuff ==-->
<call function="'ldapSearch'">
{ 'location' : instance.getHost(),
'dsPath' : instance.getInstallDir(),
'dsInstanceHost' : instance.getHost(),
'dsInstancePort' : instance.getLDAPPort(),
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'dsScope' : 'sub',
'dsBaseDN' : 'cn=monitor',
'dsFilter' : 'objectclass=*',
'expectedRC' : 0,
'fileFd' : NO_FILE,
'outputFile' : '%s/cnMonitor.txt' % instance.getLogDir()
}
</call>
<call function="'copyFile'">
{
'srcFile' : '%s/cnMonitor.txt' % instance.getLogDir(),
'destFile' : '%s/cnMonitor.txt' % instance.getLogDir(),
'location' : '%s%s' % (instance.getHost(),DOMAIN[0]),
'remoteHost' : STAXServiceMachine,
'fileFd' : NO_FILE
}
</call>
<!--== Save conf.ldif file ==-->
<call function="'copyFile'">
{
'srcFile' : '%s/config/config.ldif' % instance.getInstallDir(),
'destFile' : '%s/config.ldif' % instance.getLogDir(),
'location' : '%s%s' % (instance.getHost(),DOMAIN[0]),
'remoteHost' : STAXServiceMachine,
'fileFd' : NO_FILE
}
</call>
</sequence>
</iterate>
<!--========================================================-->
<!--======= CLIENT PREAMBLE =====-->
<!--== Get the enabled clients list from all modules ==-->
<call function="'getEnabledClients'">{'scheduler':scheduler}</call>
<script>clients = STAXResult </script>
<if expr="len(clients) > 0">
<iterate in="clients" var="client">
<sequence>
<call function="'copyFolder'">
{ 'location' : client.getHost(),
'remoteHost' : STAXServiceMachine,
'fromDirectory' : client.getLogDir(),
'toDirectory' : client.getLogDir(),
'fileFd' : NO_FILE
}
</call>
</sequence>
</iterate>
</if>
<!--== Copy xsl file needed to read the report ==-->
<call function="'copyFile'">
{
'srcFile' : '%s/report/result.xsl' % (TESTS_DIR),
'destFile' : '%s/result.xsl' % LOG_DIR,
'remoteHost' : STAXServiceMachine,
'fileFd' : NO_FILE
}
</call>
<!--== Copy css file needed to read the report ==-->
<call function="'copyFile'">
{
'srcFile' : '%s/report/result.css' % (TESTS_DIR),
'destFile' : '%s/result.css' % LOG_DIR,
'remoteHost' : STAXServiceMachine,
'fileFd' : NO_FILE
}
</call>
<!--== Copy xsl file needed to read the client details ==-->
<call function="'copyFile'">
{
'srcFile' : '%s/report/clientDetails.xsl' % (TESTS_DIR),
'destFile' : '%s/tmp/clientDetails.xsl' % LOG_DIR,
'remoteHost' : STAXServiceMachine,
'fileFd' : NO_FILE
}
</call>
<!--== Close main output file ==-->
<script>
LOG_MAIN_FD.write('&lt;/systemTestRoot&gt;\n')
LOG_MAIN_FD.close()
</script>
<message>'***************************************************'</message>
<message>'****** RUN IS FINISHED ' </message>
<message>'****** Results stored on %s ' % STAXServiceMachine </message>
<message>'****** %s' % LOG_DIR </message>
<message>'****** Found %s ERROR(S)' % ERR_NUM_TOTAL </message>
<message>'***************************************************'</message>
</sequence>
</function>
</stax>