| | |
| | | ! Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | ! --> |
| | | <stax> |
| | | |
| | | <function name="createTopology"> |
| | | <function-prolog> |
| | | This function creates the topology required by the Test Group/Suite. |
| | |
| | | </function-map-args> |
| | | |
| | | <sequence> |
| | | |
| | | <script> |
| | | if not sharedDataFolder and CurrentTestPath.has_key('group'): |
| | | sharedDataFolder=CurrentTestPath['group'] |
| | |
| | | <message> |
| | | 'SINGLE instance deployment: read parameters from config.py' |
| | | </message> |
| | | |
| | | <call function="'createInstance'"></call> |
| | | |
| | | <call function="'createInstance'" /> |
| | | <if expr="RC == 0 and initialiseInstance == True"> |
| | | <sequence> |
| | | |
| | | <!-- Load the server with default data --> |
| | | <import machine="'%s' % (STAF_LOCAL_HOSTNAME)" |
| | | file="'%s/testcases/quickstart/quickstart.xml' % (TESTS_DIR)" /> |
| | | <call function="'main_quickstart'"/> |
| | | |
| | | </sequence> |
| | | </if> |
| | | |
| | | </sequence> |
| | | |
| | | <else> |
| | | <!-- MULTIPLE instance deployment: read parameters from topologyDescFile --> |
| | | <sequence> |
| | | |
| | | <message> |
| | | 'MULTIPLE instance deployment: read parameters from %s' % topologyDescFile |
| | | </message> |
| | |
| | | 'dsJmxPort' : server.getJmxPort(), |
| | | 'dsBindDN' : server.getRootDn(), |
| | | 'dsBindPwd' : server.getRootPwd(), |
| | | 'dsBaseDN' : server.getBaseDn() } |
| | | 'dsBaseDN' : server.getBaseDn() |
| | | } |
| | | </call> |
| | | |
| | | <!-- Configure replication if required so by the server |
| | | ! (i.e. server is a changelog server and/or has synchronized suffixes) --> |
| | | ! (i.e. server is a changelog server and/or has synchronized suffixes) |
| | | --> |
| | | <if expr="server.requiresSynchronization()"> |
| | | <sequence> |
| | | <message> 'Instance requires REPLICATION configuration.' </message> |
| | | |
| | | <message> |
| | | 'Instance requires REPLICATION configuration.' |
| | | </message> |
| | | <call function="'configureReplication'"> |
| | | [server] |
| | | </call> |
| | | </sequence> |
| | | </if> |
| | | |
| | | </sequence> |
| | | |
| | | </iterate> |
| | | |
| | | </sequence> |
| | | |
| | | </else> |
| | | </if> |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | |
| | | <function name="prepareInstanceCreation"> |
| | | <function-prolog> |
| | | This function prepares locally the necessary |
| | |
| | | </function-arg-def> |
| | | </function-map-args> |
| | | <sequence> |
| | | |
| | | <!-- ON LOCAL HOST: get data ready to copy to remote host --> |
| | | <script> |
| | | testsGroupDir='%s/%s/%s' % (TESTS_DIR,relativeDataDir,groupDataDir) |
| | |
| | | |
| | | <!-- If the test data is already created then don't redo it --> |
| | | <if expr="RC == 48"> |
| | | |
| | | <sequence> |
| | | |
| | | <!-- Locally copy static data files to temporary staging area --> |
| | | <!-- LDIF (.ldif) test data files --> |
| | | <message> |
| | |
| | | { 'location' : STAXServiceMachine, |
| | | 'srcfolder' : testsGroupDir, |
| | | 'destfolder' : localTestsGroupDir, |
| | | 'extension' : 'ldif' } |
| | | 'extension' : 'ldif' |
| | | } |
| | | </call> |
| | | |
| | | <!-- LDIF (.ldif) files for quickinstall --> |
| | | <script> |
| | | quickStartGroupDir='%s/%s/quickstart' % (TESTS_DIR,relativeDataDir) |
| | |
| | | { 'location' : STAXServiceMachine, |
| | | 'srcfolder' : quickStartGroupDir, |
| | | 'destfolder' : quickStartLocalTestsGroupDir, |
| | | 'extension' : 'ldif' } |
| | | 'extension' : 'ldif' |
| | | } |
| | | </call> |
| | | |
| | | <!-- PWD (.pwd) files --> |
| | |
| | | { 'location' : STAXServiceMachine, |
| | | 'srcfolder' : testsGroupDir, |
| | | 'destfolder' : localTestsGroupDir, |
| | | 'extension' : 'pwd' } |
| | | 'extension' : 'pwd' |
| | | } |
| | | </call> |
| | | |
| | | <!-- Archive (.gz) files --> |
| | |
| | | { 'location' : STAXServiceMachine, |
| | | 'srcfolder' : testsGroupDir, |
| | | 'destfolder' : localTestsGroupDir, |
| | | 'extension' : 'gz' } |
| | | 'extension' : 'gz' |
| | | } |
| | | </call> |
| | | |
| | | <!-- Delete the any existing testdata archive --> |
| | |
| | | </message> |
| | | <call function="'deleteFile'"> |
| | | { 'location' : STAXServiceMachine, |
| | | 'filename' : '%s/testdata.zip' % logsTempDir } |
| | | 'filename' : '%s/testdata.zip' % logsTempDir |
| | | } |
| | | </call> |
| | | |
| | | <!-- Zip up contents of tests directory --> |
| | |
| | | { 'location' : STAXServiceMachine, |
| | | 'zipfile' : '%s/testdata.zip' % logsTempDir , |
| | | 'folder' : '%s' % localTestsGroupDir , |
| | | 'relativeto' : logsTestDataDir } |
| | | 'relativeto' : logsTestDataDir |
| | | } |
| | | </call> |
| | | |
| | | <message> |
| | |
| | | { 'location' : STAXServiceMachine, |
| | | 'zipfile' : '%s/testdata.zip' % logsTempDir , |
| | | 'folder' : '%s' % quickStartLocalTestsGroupDir , |
| | | 'relativeto' : logsTestDataDir } |
| | | 'relativeto' : logsTestDataDir |
| | | } |
| | | </call> |
| | | </sequence> |
| | | |
| | | <else> |
| | | <message>'Test data is already created.'</message> |
| | | <message> |
| | | 'Test data is already created.' |
| | | </message> |
| | | </else> |
| | | |
| | | </if> |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <function name="createInstance"> |
| | | <function-prolog> |
| | | This function creates an instance on a given host. |
| | |
| | | </function-arg-def> |
| | | </function-map-args> |
| | | |
| | | |
| | | <sequence> |
| | | |
| | | <message> |
| | | 'Create instance in host %s at directory %s' % (dsHost,dsDir) |
| | | </message> |
| | | |
| | | |
| | | <!-- ON REMOTE HOST: copy files, unzip, configure instance --> |
| | | <!--- Delete folder if it exists on remote host--> |
| | | <message> |
| | |
| | | </message> |
| | | <call function="'deleteFolder'"> |
| | | { 'location' : dsHost, |
| | | 'foldername' : '%s/%s' % (dsDir,OPENDSNAME) } |
| | | 'foldername' : '%s/%s' % (dsDir,OPENDSNAME) |
| | | } |
| | | </call> |
| | | |
| | | <!--- Create folder on remote host--> |
| | |
| | | </message> |
| | | <call function="'createFolder'"> |
| | | { 'location' : dsHost, |
| | | 'foldername' : '%s' % dsDir } |
| | | 'foldername' : '%s' % dsDir |
| | | } |
| | | </call> |
| | | |
| | | <!--- Copy staging data to remote host --> |
| | |
| | | <call function="'copyFile'"> |
| | | { 'srcfile' : '%s/testdata.zip' % logsTempDir, |
| | | 'destfile' : '%s/testdata.zip' % dsDir, |
| | | 'remotehost' : dsHost } |
| | | 'remotehost' : dsHost |
| | | } |
| | | </call> |
| | | |
| | | <!--- Unzip contents of staging data on remote host --> |
| | |
| | | <call function="'unZipFile'"> |
| | | { 'location' : dsHost, |
| | | 'zipfile' : '%s/testdata.zip' % dsDir, |
| | | 'unzipdir' : dsDir } |
| | | 'unzipdir' : dsDir |
| | | } |
| | | </call> |
| | | |
| | | <!--- Install DS Copy zip file --> |
| | |
| | | <call function="'copyFile'"> |
| | | { 'srcfile' : '%s/%s' % (ZIPPATH,ZIPNAME), |
| | | 'destfile' : '%s/%s' % (dsDir,ZIPNAME), |
| | | 'remotehost' : dsHost } |
| | | 'remotehost' : dsHost |
| | | } |
| | | </call> |
| | | |
| | | <!--- Install DS Extract zip file --> |
| | |
| | | <call function="'unZipFile'"> |
| | | { 'location' : dsHost, |
| | | 'zipfile' : '%s/%s' % (dsDir,ZIPNAME), |
| | | 'unzipdir' : dsDir } |
| | | 'unzipdir' : dsDir |
| | | } |
| | | </call> |
| | | |
| | | <!-- fixMe: Windows Services are not enabled --> |
| | | <if expr="isWindows"> |
| | | |
| | | <script> |
| | | enableWindowsService='' |
| | | </script> |
| | | |
| | | <else> |
| | | |
| | | <script> |
| | | enableWindowsService='' |
| | | </script> |
| | | |
| | | </else> |
| | | </if> |
| | | |
| | | <!-- configure the coverage dump file --> |
| | | <script> |
| | | mylog='::coverage: begin\n' |
| | | emmaprops = '%s/%s/classes/emma.properties' % (dsDir,OPENDSNAME) |
| | | group='emma' |
| | | if CurrentTestPath['group']: |
| | | group=CurrentTestPath['group'].strip() |
| | | |
| | | if os.path.exists('%s' % emmaprops): |
| | | mylog+='::coverage: setting %s/%s.coverage to file %s\n' % (TMPDIR,group,emmaprops) |
| | | coveragefh = open(emmaprops,'w') |
| | | coveragefh.write('coverage.out.file=%s/%s.coverage\n' % (TMPDIR,group) ) |
| | | coveragefh.close() |
| | | |
| | | </script> |
| | | <message> |
| | | '%s' % mylog |
| | | </message> |
| | | |
| | | <!--- Set up DS --> |
| | | <message> |
| | | 'Set up DS on %s : %s/%s' % (dsHost,dsDir,OPENDSNAME) |
| | |
| | | 'dsBindDN' : dsBindDN, |
| | | 'dsBindPwd' : dsBindPwd, |
| | | 'dsBaseDN' : dsBaseDN, |
| | | 'dsEnableWindowsService' : enableWindowsService} |
| | | 'dsEnableWindowsService' : enableWindowsService |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checkRC'"> |
| | | { 'returncode' : RC , |
| | | 'result' : STAXResult } |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <if expr="returncode == 0"> |
| | |
| | | </message> |
| | | </else> |
| | | </if> |
| | | |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <function name="DEPRECATEDconfigureReplication"> |
| | | <function-prolog> |
| | | This function configures replication in a given server. |
| | |
| | | <call function="'copyFile'"> |
| | | { 'srcfile' : filePath, |
| | | 'destfile' : '%s/%s' % (dataDir,filename), |
| | | 'remotehost' : syncserver.getHostname() } |
| | | 'remotehost' : syncserver.getHostname() |
| | | } |
| | | </call> |
| | | |
| | | |
| | | <!--- Add replication configuration entries to config.ldif in server --> |
| | | |
| | | <script> |
| | | remoteFilePath = '%s/%s' % (dataDir, filename) |
| | | syncserverPath = '%s/%s' % (syncserver.getDir(),OPENDSNAME) |
| | | </script> |
| | | |
| | | |
| | | <!--- Start DS --> |
| | | <call function="'StartDsWithScript'"> |
| | | { 'location' : syncserver.getHostname(), |
| | | 'dsPath' : syncserverPath } |
| | | 'dsPath' : syncserverPath |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checkRC'"> |
| | | { 'returncode' : RC , |
| | | 'result' : STAXResult } |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <message> |
| | |
| | | 'dsInstancePort' : syncserver.getPort(), |
| | | 'dsInstanceDn' : syncserver.getRootDn(), |
| | | 'dsInstancePswd' : syncserver.getRootPwd(), |
| | | 'entryToBeAdded' : remoteFilePath } |
| | | 'entryToBeAdded' : remoteFilePath |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checkRC'"> |
| | | { 'returncode' : RC, |
| | | 'result' : STAXResult } |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | |
| | | <!--- Stop DS --> |
| | | <call function="'StopDsWithScript'"> |
| | | { 'location' : syncserver.getHostname(), |
| | |
| | | 'dsPath' : syncserverPath, |
| | | 'dsPort' : syncserver.getPort(), |
| | | 'dsBindDN' : syncserver.getRootDn(), |
| | | 'dsBindPwd' : syncserver.getRootPwd() } |
| | | 'dsBindPwd' : syncserver.getRootPwd() |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checkRC'"> |
| | | { 'returncode' : RC , |
| | | 'result' : STAXResult } |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | <function name="configureReplication"> |
| | | <function-prolog> |
| | | This function configures replication in a given server. |
| | |
| | | syncserverPath = '%s/%s' % (syncserver.getDir(),OPENDSNAME) |
| | | </script> |
| | | |
| | | |
| | | <!--- Start DS --> |
| | | <call function="'StartDsWithScript'"> |
| | | { 'location' : syncserver.getHostname(), |
| | | 'dsPath' : syncserverPath } |
| | | 'dsPath' : syncserverPath |
| | | } |
| | | </call> |
| | | |
| | | <message> |
| | |
| | | 'dsInstanceHost' : syncserver.getHostname(), |
| | | 'dsInstancePort' : syncserver.getPort(), |
| | | 'dsInstanceDn' : syncserver.getRootDn(), |
| | | 'dsInstancePswd' : syncserver.getRootPwd() } |
| | | 'dsInstancePswd' : syncserver.getRootPwd() |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | |
| | | <message> |
| | | 'Create replication server listening on port: %s' % replicationServer.getPort() |
| | | </message> |
| | | |
| | | <call function="'createReplicationServer'"> |
| | | { 'location' : syncserver.getHostname(), |
| | | 'dsPath' : syncserverPath, |
| | |
| | | 'dsInstancePswd' : syncserver.getRootPwd(), |
| | | 'replicationPort' : replicationServer.getPort(), |
| | | 'replicationServerId' : replicationServer.getId(), |
| | | 'replicationServerList' : replicationServer.getChangelogServerList() } |
| | | 'replicationServerList' : replicationServer.getChangelogServerList() |
| | | } |
| | | </call> |
| | | </sequence> |
| | | </if> |
| | | |
| | | |
| | | <iterate var="suffix" in="replicatedSuffixList" indexvar="i"> |
| | | <sequence> |
| | | <message> |
| | | 'Create domain name for suffix: %s' % suffix.getSuffixDn() |
| | | </message> |
| | | |
| | | <call function="'createMultimasterDomain'"> |
| | | { 'location' : syncserver.getHostname(), |
| | | 'dsPath' : syncserverPath, |
| | |
| | | 'domainName' : 'SUFFIX-%s' % i, |
| | | 'replicationDn' : suffix.getSuffixDn(), |
| | | 'serverId' : suffix.getId(), |
| | | 'replicationServerList' : suffix.getChangelogServerList() } |
| | | 'replicationServerList' : suffix.getChangelogServerList() |
| | | } |
| | | </call> |
| | | </sequence> |
| | | </iterate> |
| | | |
| | | |
| | | <!--- Stop DS --> |
| | | <call function="'StopDsWithScript'"> |
| | | { 'location' : syncserver.getHostname(), |
| | |
| | | 'dsPath' : syncserverPath, |
| | | 'dsPort' : syncserver.getPort(), |
| | | 'dsBindDN' : syncserver.getRootDn(), |
| | | 'dsBindPwd' : syncserver.getRootPwd() } |
| | | 'dsBindPwd' : syncserver.getRootPwd() |
| | | } |
| | | </call> |
| | | |
| | | </sequence> |
| | | </function> |
| | | |
| | |
| | | </function-map-args> |
| | | |
| | | <sequence> |
| | | |
| | | <message> |
| | | 'Parse file %s for topology parameters' % file |
| | | </message> |
| | |
| | | |
| | | f.close() |
| | | </script> |
| | | |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | |
| | | </function-arg-def> |
| | | </function-map-args> |
| | | |
| | | |
| | | <sequence> |
| | | |
| | | <message> |
| | | 'Removing instance %s/%s on host %s' % (dsDir,OPENDSNAME,dsHost) |
| | | </message> |
| | | |
| | | |
| | | <!-- ON REMOTE HOST: remove files and folders --> |
| | | <!--- Delete staging data file on remote host--> |
| | | <message> |
| | |
| | | </message> |
| | | <call function="'deleteFile'"> |
| | | { 'location' : dsHost, |
| | | 'filename' : '%s/testdata.zip' % dsDir } |
| | | 'filename' : '%s/testdata.zip' % dsDir |
| | | } |
| | | </call> |
| | | |
| | | <!--- Delete staging data folder on remote host --> |
| | |
| | | </message> |
| | | <call function="'deleteFolder'"> |
| | | { 'location' : dsHost, |
| | | 'foldername' : '%s/shared' % dsDir } |
| | | 'foldername' : '%s/shared' % dsDir |
| | | } |
| | | </call> |
| | | |
| | | |
| | | |
| | | <!--- Delete OPENDS zip file on remote host--> |
| | | <message> |
| | | 'Delete OPENDS zip file %s/%s' % (dsDir,ZIPNAME) |
| | |
| | | 'filename' : '%s/%s' % (dsDir,ZIPNAME) } |
| | | </call> |
| | | |
| | | |
| | | <call function="'checkRC'"> |
| | | { 'returncode' : RC , |
| | | 'result' : STAXResult } |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <if expr="returncode == 0"> |
| | | <message> |
| | | 'Instance removed.' |
| | |
| | | </message> |
| | | </else> |
| | | </if> |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | |
| | | |
| | | <function name="removeTopology"> |
| | | <function-prolog> |
| | | This function removes the topology created for the Test Group/Suite. |
| | |
| | | <function-arg-property name="type" value="boolean"/> |
| | | </function-arg-def> |
| | | </function-map-args> |
| | | |
| | | <sequence> |
| | | |
| | | <if expr="multipleInstanceTopology == False"> |
| | | <!-- SINGLE instance deployment: parameters read from config.py (done by default) --> |
| | | |
| | | <call function="'removeInstance'"></call> |
| | | |
| | | <call function="'removeInstance'" /> |
| | | <else> |
| | | <!-- MULTIPLE instance deployment: parameters read from topologyDescFile --> |
| | | <iterate var="server" in="_topologyServerList"> |
| | | |
| | | <call function="'removeInstance'"> |
| | | { 'dsHost' : server.getHostname(), |
| | | 'dsDir' : server.getDir() } |
| | | 'dsDir' : server.getDir() |
| | | } |
| | | </call> |
| | | |
| | | </iterate> |
| | | </else> |
| | | </if> |
| | | |
| | | </sequence> |
| | | |
| | | </function> |
| | | |
| | | |
| | | </stax> |