10139N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
10139N/A ! The contents of this file are subject to the terms of the 10139N/A ! Common Development and Distribution License, Version 1.0 only 10139N/A ! (the "License"). You may not use this file except in compliance 10139N/A ! You can obtain a copy of the license at 10592N/A ! See the License for the specific language governing permissions 10139N/A ! and limitations under the License. 10139N/A ! When distributing Covered Code, include this CDDL HEADER in each 10139N/A ! file and include the License file at 10287N/A ! add the following below this CDDL HEADER, with the fields enclosed 10139N/A ! by brackets "[]" replaced with your own identifying information: 10139N/A ! Portions Copyright [yyyy] [name of copyright owner] 10139N/A ! Copyright 2007-2010 Sun Microsystems, Inc. 10139N/A <
function name="importSharedLibraries">
10139N/A This function imports the shared function xml libraries.
10139N/A <!--- Import all the shared xml libraries --> 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
import machine="STAF_LOCAL_HOSTNAME" 10139N/A <
function name="importPythonLibraries">
10139N/A This function imports the Python libraries and objects,
10139N/A both starndard and local shared ones.
10592N/A <!-- Load in any standard python libraries --> 10287N/A <!-- Load in any additional Java classes --> 10285N/A <!-- Load in any standard python functions --> 10179N/A from time import localtime,strftime
10139N/A <!-- Load in the local shared python objects from libraries --> 10139N/A <
function name="initialiseGlobalVariables">
10139N/A This function initialises a set of global variables.
10139N/A <!-- Default LDAP Server Object --> 10139N/A <!-- Set the signal handlers --> 10139N/A <!-- Initialize any global variables --> 10139N/A if is_windows_platform(STAF_REMOTE_HOSTNAME):
10139N/A if DIRECTORY_INSTANCE_BIN != DIRECTORY_INSTANCE_DIR:
10139N/A # threshold set so that functions such as getFile may not cause staf
10139N/A # process to run out of memory (value in bytes)
10139N/A # this function return a well-formatted testcase name
10139N/A return '%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],name)
10139N/A DSREPLICATION = 'dsreplication'
10139N/A # Replication configuration default names
10139N/A MultimasterSync = 'Multimaster Synchronization'
10139N/A MultimasterType = 'multimaster'
10139N/A # Replication execution mode variables: if not defined, set "random"
10139N/A # (day of the month % 4) == 0 --> (split servers, eclmode n/a)
10139N/A # (day of the month % 4) == 1 --> (don't split, opends eclmode)
10139N/A # (day of the month % 4) == 2 --> (don't split, draft eclmode)
10139N/A # (day of the month % 4) == 3 --> (don't split, eclmode n/a)
10139N/A if REPLICATION_SPLIT_SERVERS == '':
10139N/A oldSplitConfig = """REPLICATION_SPLIT_SERVERS = ''"""
10139N/A REPLICATION_SPLIT_SERVERS = 'true'
10139N/A REPLICATION_SPLIT_SERVERS = 'false'
10139N/A newSplitConfig = """REPLICATION_SPLIT_SERVERS = '%s'""" % \
10139N/A newSplitConfig = """'REPLICATION_SPLIT_SERVERS = '%s'""" % \
10139N/A oldSplitConfig = newSplitConfig
10139N/A oldEclmodeConfig = """REPLICATION_ECL_MODE = ''"""
10139N/A REPLICATION_ECL_MODE = 'opends'
10139N/A newEclmodeConfig = """REPLICATION_ECL_MODE = '%s'""" % \
10139N/A newEclmodeConfig = """REPLICATION_ECL_MODE = '%s'""" % \
10139N/A oldEclmodeConfig = newEclmodeConfig
10139N/A configFile = STAXJobScriptFiles[0]
10139N/A configInput = open(configFile, 'r')
10139N/A configOutput = open(configFile,'w')
10139N/A <
function name="GetDirectoryServerInformation">
10139N/A This function gets information about the Directory Server
10139N/A InstanceInstallDir= '%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
10139N/A <!-- Copy DS zip archive to remote host--> 10139N/A 'Copy DS zip archive to %s %
s.zip.' % (STAF_REMOTE_HOSTNAME,InstanceInstallDir)
{ 'srcfile' : '%s/%s' % (ZIPPATH,ZIPNAME),
'destfile' : '%
s.zip' % InstanceInstallDir,
'remotehost' : STAF_REMOTE_HOSTNAME }
<!-- Install DS into temporary folder --> 'Extract temporary DS zip archive to %s %s.' % (STAF_REMOTE_HOSTNAME,DIRECTORY_INSTANCE_DIR)
<
call function="'unZipFile'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'zipfile' : '%
s.zip' % InstanceInstallDir,
'unzipdir' : '%s' % DIRECTORY_INSTANCE_DIR }
<!-- Get Directory Server Variables --> <
call function="'GetDirectoryServerVars'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'dsPath' : '%s/%s' % (DIRECTORY_INSTANCE_BIN,OPENDSNAME) }
<
throw exception="'TestExceptionResultFailed'">
<!-- Set Directory Server Variables --> <
call function="'SetVar'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'variable' : 'Job%s_ServerInfo=%s' % (STAXJobID,DSInfoServersDict) }
<
throw exception="'TestExceptionResultFailed'">
<!-- Uninstall DS from temporary folder --> 'Remove temporary DS zip archive from %s %s' % (STAF_REMOTE_HOSTNAME,InstanceInstallDir)
<
call function="'deleteFolder'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'foldername' : '%s' % InstanceInstallDir }
<
call function="'deleteFile'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'filename' : '%
s.zip' % InstanceInstallDir }
<
catch exception="'TestExceptionResultFailed'" typevar="eType" var="eInfo">
<
message>'caught %s with %s' % (eType,eInfo)</
message>
'Remove temporary DS zip archive from %s %s' % (STAF_REMOTE_HOSTNAME,InstanceInstallDir)
<
call function="'deleteFolder'">
{ '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"/>
<
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 }