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