3832N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
3832N/A ! The contents of this file are subject to the terms of the 3832N/A ! Common Development and Distribution License, Version 1.0 only 3832N/A ! (the "License"). You may not use this file except in compliance 3832N/A ! You can obtain a copy of the license at 3832N/A ! See the License for the specific language governing permissions 6982N/A ! and limitations under the License. 6982N/A ! When distributing Covered Code, include this CDDL HEADER in each 6982N/A ! file and include the License file at 3832N/A ! add the following below this CDDL HEADER, with the fields enclosed 3832N/A ! by brackets "[]" replaced with your own identifying information: 3832N/A ! Portions Copyright [yyyy] [name of copyright owner] 3832N/A ! Copyright 2007-2010 Sun Microsystems, Inc. 3832N/A ! Portions Copyright 2011 ForgeRock AS. 3832N/A <
function name="importSharedLibraries">
3832N/A This function imports the shared function xml libraries.
3832N/A <!--- Import all the shared xml libraries --> 4714N/A <
iterate var="sharedLib" in="sharedLibs">
4714N/A <
import machine="STAF_LOCAL_HOSTNAME" 4714N/A file="'%s/%s' % (TESTS_FUNCTIONS_DIR,sharedLib)"/>
4714N/A <
function name="importPythonLibraries">
4714N/A This function imports the Python libraries and objects,
4714N/A both standard and local shared ones.
4714N/A <!-- Load in any standard python libraries --> 4714N/A <!-- Load in any additional Java classes --> 4714N/A <!-- Load in any standard python functions --> 3832N/A from time import localtime,strftime
3832N/A <!-- Load in the local shared python objects from libraries --> 4714N/A <
function name="initialiseGlobalVariables">
4714N/A This function initialises a set of global variables.
4714N/A <!-- Default LDAP Server Object --> 4714N/A TestSuiteStartTime = STAXGlobal([])
4714N/A <!-- Set the signal handlers --> 4714N/A <
call function="'signals'"/>
3832N/A <!-- Initialize any global variables --> 3832N/A if is_windows_platform(STAF_REMOTE_HOSTNAME):
4458N/A if DIRECTORY_INSTANCE_BIN != DIRECTORY_INSTANCE_DIR:
3832N/A # threshold set so that functions such as getFile may not cause staf
3832N/A # process to run out of memory (value in bytes)
3832N/A # this function return a well-formatted testcase name
4714N/A return '%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],name)
3832N/A DSREPLICATION = 'dsreplication'
6033N/A # Replication configuration default names
4714N/A MultimasterSync = 'Multimaster Synchronization'
4458N/A MultimasterType = 'multimaster'
3832N/A # Replication execution mode variables: if not defined, set "random"
3832N/A # (day of the month % 4) == 0 --> (split servers, eclmode n/a)
3832N/A # (day of the month % 4) == 1 --> (don't split, opends eclmode)
3832N/A # (day of the month % 4) == 2 --> (don't split, draft eclmode)
4714N/A # (day of the month % 4) == 3 --> (don't split, eclmode n/a)
3832N/A if REPLICATION_SPLIT_SERVERS == '':
3832N/A oldSplitConfig = """REPLICATION_SPLIT_SERVERS = ''"""
4714N/A REPLICATION_SPLIT_SERVERS = 'true'
4714N/A REPLICATION_SPLIT_SERVERS = 'false'
4714N/A newSplitConfig = """REPLICATION_SPLIT_SERVERS = '%s'""" % \
4714N/A newSplitConfig = """REPLICATION_SPLIT_SERVERS = '%s'""" % \
3832N/A oldSplitConfig = newSplitConfig
3832N/A if REPLICATION_ECL_MODE == '':
3832N/A oldEclmodeConfig = """REPLICATION_ECL_MODE = ''"""
3832N/A REPLICATION_ECL_MODE = 'opends'
3832N/A REPLICATION_ECL_MODE = 'draft'
3832N/A REPLICATION_ECL_MODE = 'n/a'
3832N/A newEclmodeConfig = """REPLICATION_ECL_MODE = '%s'""" % \
3832N/A newEclmodeConfig = """REPLICATION_ECL_MODE = '%s'""" % \
3832N/A oldEclmodeConfig = newEclmodeConfig
3832N/A if rewriteConfigFile == True :
3832N/A configFile = STAXJobScriptFiles[0]
3832N/A configInput = open(configFile, 'r')
3832N/A configOutput = open(configFile,'w')
3832N/A <
function name="GetDirectoryServerInformation">
3832N/A This function gets information about the Directory Server
3832N/A InstanceInstallDir= '%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
3832N/A <!-- Copy DS zip archive to remote host--> 3832N/A 'Copy DS zip archive to %s %
s.zip.' % (STAF_REMOTE_HOSTNAME,InstanceInstallDir)
3832N/A <
call function="'copyFile'">
3832N/A { 'srcfile' : '%s/%s' % (ZIPPATH,ZIPNAME),
3832N/A 'remotehost' : STAF_REMOTE_HOSTNAME }
4714N/A <!-- Install DS into temporary folder --> 4714N/A 'Extract temporary DS zip archive to %s %s.' % (STAF_REMOTE_HOSTNAME,DIRECTORY_INSTANCE_DIR)
4714N/A <
call function="'unZipFile'">
4714N/A { 'location' : STAF_REMOTE_HOSTNAME,
4714N/A 'unzipdir' : '%s' % DIRECTORY_INSTANCE_DIR }
4714N/A <!-- Get Directory Server Variables --> 4714N/A <
call function="'GetDirectoryServerVars'">
4714N/A { 'location' : STAF_REMOTE_HOSTNAME,
4714N/A 'dsPath' : '%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME) }
4714N/A <
throw exception="'TestExceptionResultFailed'">
4714N/A <!-- Set Directory Server Variables --> 4714N/A { 'location' : STAF_REMOTE_HOSTNAME,
4714N/A 'variable' : 'Job%s_ServerInfo=%s' % (STAXJobID,DSInfoServersDict) }
3832N/A <
throw exception="'TestExceptionResultFailed'">
4714N/A <!-- Uninstall DS from temporary folder --> 4714N/A 'Remove temporary DS zip archive from %s %s' % (STAF_REMOTE_HOSTNAME,InstanceInstallDir)
4714N/A <
call function="'deleteFolder'">
3832N/A { 'location' : STAF_REMOTE_HOSTNAME ,
3832N/A 'foldername' : '%s' % InstanceInstallDir }
3832N/A <
call function="'deleteFile'">
3832N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4714N/A <
catch exception="'TestExceptionResultFailed'" typevar="eType" var="eInfo">
3832N/A <
message>'caught %s with %s' % (eType,eInfo)</
message>
3832N/A 'Remove temporary DS zip archive from %s %s' % (STAF_REMOTE_HOSTNAME,InstanceInstallDir)
3832N/A <
call function="'deleteFolder'">
3832N/A { 'location' : STAF_REMOTE_HOSTNAME ,
'foldername' : '%s' % InstanceInstallDir }
<
call function="'deleteFile'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'filename' : '%
s.zip' % InstanceInstallDir }
<
function name="SetFolders">
This function sets the folders to which test data are written.
<
function-
arg-
def name="sourceDir" type="required">
<
function-
arg-
description>
A locally accessable directory to the tests source
</
function-
arg-
description>
<
function-
arg-
property name="type" value="structure"/>
<
function-
arg-
def name="localDir" type="required">
<
function-
arg-
description>
A locally accessable directory to write test information
</
function-
arg-
description>
<
function-
arg-
property name="type" value="structure"/>
<
function-
arg-
def name="remoteDir" type="required">
<
function-
arg-
description>
A remotely accessable directory to write test information
</
function-
arg-
description>
<
function-
arg-
property name="type" value="structure"/>
if host_is_localhost(STAF_REMOTE_HOSTNAME):
<
function name="CreateFolders" scope="local">
This function sets the folders to which logs are written
<
call function="'createFolder'">
{ 'location' : STAF_LOCAL_HOSTNAME,
<
message>'Create local folder %s' %
local.temp</
message>
<
call function="'createFolder'">
{ 'location' : STAF_LOCAL_HOSTNAME,
<
message>'Create local folder %s' %
logs.sut</
message>
<
call function="'createFolder'">
{ 'location' : STAF_LOCAL_HOSTNAME,
<
message>'Create local folder %s' %
logs.tests</
message>
<
call function="'createFolder'">
{ 'location' : STAF_LOCAL_HOSTNAME,
<
call function="'createFolder'">
{ 'location' : STAF_LOCAL_HOSTNAME,
<
message>'Create remote folder %s' %
remote.temp</
message>
<
call function="'createFolder'">
{ 'location' : STAF_REMOTE_HOSTNAME,
<
function name="loadGlobalEnvironment">
This function loads the environment (libraries, functions, variables)
needed by the global test job farmer.
'Load environment for test suite execution.'
<
call function="'importSharedLibraries'"/>
<
call function="'importPythonLibraries'"/>
<
call function="'initialiseGlobalVariables'"/>
'Remove files from previous runs under %s.' % DIRECTORY_INSTANCE_DIR
<
call function="'deleteFolder'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'foldername' : '%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) }
<
call function="'createFolder'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'foldername' : '%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME) }
<
call function="'GetDirectoryServerInformation'"/>
<!-- Set variables to build unique path to store data --> logsOS='%s-%s' % (logsOSName,logsArch)
<
call function="'SetFolders'">
{ 'sourceDir' : '%s' % TESTS_ROOT,
'localDir' : '%s' % LOGS_ROOT,
'remoteDir' : DIRECTORY_INSTANCE_DIR }
<
call function="'SetVar'">
{ 'location' : STAF_REMOTE_HOSTNAME,
<!-- Create the local folders to store data --> <
call function="'CreateFolders'"/>
<
message>'Copy OpenDS css and png files under %s' %
logs.reports</
message>
<
call function="'copyFile'">
<
call function="'copyFile'">
<
call function="'copyFile'">
<
function name="loadJobEnvironment">
This function loads the environment (libraries, functions, variables)
<
function-
arg-
def name="parent" type="optional" default="''">
<
function-
arg-
description>
</
function-
arg-
description>
<
function-
arg-
property name="type" value="integer"/>
'Load environment for test suite execution.'
<!-- All exceptions are logged to user log --> <
call function="'importSharedLibraries'"/>
<
call function="'importPythonLibraries'"/>
<
call function="'initialiseGlobalVariables'"/>
<
call function="'GetVar'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'variable' : 'Job%s_LogsDir' % parent }
<!-- TODO: defend against mangled STAFResult --> <
message>'%s' % parentsLogDir</
message>
<
call function="'SetFolders'">
{ 'sourceDir' : '%s' % TESTS_ROOT,
'localDir' : '%s' % parentsLogDir,
'remoteDir' : DIRECTORY_INSTANCE_DIR }