<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
! 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 ! You can obtain a copy of the license at ! 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 ! 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] ! Copyright 2007-2009 Sun Microsystems, Inc. <
function name="importSharedLibraries">
This function imports the shared function xml libraries.
<!--- Import all the shared xml libraries --> <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" file="'%s/ldap.xml' % (TESTS_FUNCTIONS_DIR)" />
<
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" <
import machine="STAF_LOCAL_HOSTNAME" file="'%s/snmp.xml' % (TESTS_FUNCTIONS_DIR)" />
<
function name="importPythonLibraries">
This function imports the Python libraries and objects,
both starndard and local shared ones.
<!-- Load in any standard python libraries --> <!-- Load in any additional Java classes --> <!-- Load in any standard python functions --> from time import localtime,strftime
<!-- Load in the local shared python objects from libraries --> from replication import *
<
function name="initialiseGlobalVariables">
This function initialises a set of global variables.
<!-- fixMe: this needs some cleanup --> OPENDS_BINPATH ='%s/%
s/
bin' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
if is_windows_platform(STAF_REMOTE_HOSTNAME):
<!-- Default LDAP Server Object --> server=directory_server()
<!-- Set the signal handlers --> <
call function="'signals'"/>
<!-- Initialize any global variables --> # threshold set so that functions such as getFile may not cause staf
# process to run out of memory (value in bytes)
MAX_READABLE_SIZE = 104800
# this function return a well-formatted testcase name
def getTestCaseName(name):
return '%s: %s: %s' % (CurrentTestPath['group'],CurrentTestPath['suite'],name)
DSREPLICATION = 'dsreplication'
# Replication configuration default names
MultimasterSync = 'Multimaster Synchronization'
MultimasterType = 'multimaster'
<
function name="GetDirectoryServerInformation">
This function gets information about the Directory Server
InstanceInstallDir= '%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)
<!-- Copy DS zip archive to remote host--> 'Copy DS zip archive to %s %
s.zip.' % (STAF_REMOTE_HOSTNAME,InstanceInstallDir)
<
call function="'copyFile'">
{ '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/%s-jvm%s' % (LOGS_ROOT,logsOS,logsJvm),
'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'">
<
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 }