2852N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
2852N/A ! The contents of this file are subject to the terms of the 2852N/A ! Common Development and Distribution License, Version 1.0 only 2852N/A ! (the "License"). You may not use this file except in compliance 2852N/A ! You can obtain a copy of the license at 2852N/A ! See the License for the specific language governing permissions 2852N/A ! and limitations under the License. 2852N/A ! When distributing Covered Code, include this CDDL HEADER in each 2852N/A ! file and include the License file at 2852N/A ! add the following below this CDDL HEADER, with the fields enclosed 2852N/A ! by brackets "[]" replaced with your own identifying information: 2852N/A ! Portions Copyright [yyyy] [name of copyright owner] 4347N/A ! Copyright 2007-2009 Sun Microsystems, Inc. 6102N/A ! Portions Copyright 2011-2013 ForgeRock AS. 2852N/A <
defaultcall function="backup_db"/>
2852N/A <
function name="backup_db" scope="local">
2852N/A <
block name="STAXCurrentFunction">
4618N/A CurrentTestPath['suite']=STAXCurrentFunction
4618N/A <
call function="'testSuite_Preamble'" />
4618N/A <!--- Test Suite information 4618N/A #@TestSuiteName Backup tasks 4618N/A #@TestSuitePurpose Validate the backup functionality in mode task 4618N/A <
call function="'common_setup'">
4618N/A <!--- Test Case information 4618N/A #@TestName Schedule a recurring Backup task 4618N/A #@TestPurpose Schedule a recurring Backup in task mode 4618N/A #@TestStep Create a recurring Backup in task mode 4618N/A #@TestStep specify the recurringTask option with the value 4618N/A #@TestStep non null to schedule a recurring execution 4618N/A <
testcase name="getTestCaseName('schedule recurring backup task for scheduled execution in asynchronous mode')">
4618N/A <
call function="'testCase_Preamble'"/>
4618N/A <!--- ReStart DS to clear the output of manage-tasks--> 4618N/A <
call function="'StopDsWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME,
4618N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
4618N/A <
call function="'StartDsWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME }
4618N/A <!--- Check that DS started --> 4618N/A <
call function="'isAlive'">
4618N/A 'noOfMilliSeconds' : 2000 }
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'schedulePattern' : '"0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * *"',
4618N/A 'backupID' : 'recurring-backup-1',
4618N/A 'backEnd' : DIRECTORY_INSTANCE_BE}
4618N/A <
call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A returnString = STAXResult[0][1]
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'recurring-backup-1',
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Waiting on start time',
4680N/A { 'sleepForMilliSeconds' : 120000 }
4618N/A <
call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A returnString = STAXResult[0][1]
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'recurring-backup-1',
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Completed successfully',
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Waiting on start time',
4618N/A <!-- cancel the recurring task recurring-backup-1 with manage-tasks --> 4618N/A <
call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'dsCancel' : 'recurring-backup-1',
4618N/A returnString = STAXResult[0][1]
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Task recurring-backup-1 canceled',
4618N/A <
call function="'testCase_Postamble'"/>
4618N/A <!--- Test Case information 4618N/A #@TestName Backup task in asynchronous mode 4618N/A #@TestPurpose Schedule a backup in task mode to be executed immedialy in asynchronous mode 4618N/A #@TestStep Execute a backup in mode task 4618N/A #@TestStep Execute manage-tasks tools and check a backup task is managed 4618N/A #@TestStep Specify the -t 0 4618N/A #@TestStep The task is scheduled for immediate execution 4618N/A #@TestSteps The script returns immedialy after scheduling the task 4618N/A <
testcase name="getTestCaseName('schedule backup task for immediate execution in asynchronous mode')">
4618N/A <
call function="'testCase_Preamble'"/>
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'backEnd' : DIRECTORY_INSTANCE_BE}
4618N/A <
script>checkRC=9999</
script>
4618N/A <
loop from="1" to="10" var="loop" while="checkRC != 0">
4618N/A <
message>'LOOP %s' % loop</
message>
4618N/A <
call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A returnString = STAXResult[0][1]
4618N/A currentDate=strftime("%Y%m%d",localtime())
4618N/A <
call function="'searchString'">
4618N/A { 'expectedString' : '%s.* Backup Completed successfully' \
4618N/A 'returnString' : returnString ,
4865N/A { 'sleepForMilliSeconds' : 2000 }
4618N/A <
message>'--- Check log files backup_asynchronous ---'</
message>
4618N/A <
call function="'listFolder'">
4618N/A { 'location' : '%s' % (STAF_REMOTE_HOSTNAME),
4618N/A 'filename' : 'backup_asynchronous'
4618N/A <!-- check the export ldif file has been created--> 4618N/A <
if expr="len(cmdResult) == 0">
4618N/A <
call function="'testFailed'"/>
4618N/A <
call function="'testPassed'"/>
4618N/A <
call function="'testCase_Postamble'"/>
4618N/A <!--- Test Case information 4618N/A #@TestName Backup task in synchronous mode 4618N/A #@TestPurpose Schedule a Backup in task mode to be executed immedialy in synchronous mode 4618N/A #@TestStep Execute a backup in mode task 4618N/A #@TestStep Don't specify the -t option 4618N/A #@TestStep The task is scheduled for immediate execution and the script must wait the end of the task to return 4618N/A <
testcase name="getTestCaseName('schedule backup task for immediate execution in synchronous mode')">
4618N/A <
call function="'testCase_Preamble'"/>
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'backEnd' : DIRECTORY_INSTANCE_BE}
4713N/A <
script>checkRC=9999</
script>
4713N/A <
loop from="1" to="10" var="loop" while="checkRC != 0">
4713N/A <
message>'LOOP %s' % loop</
message>
4713N/A <
call function="'manage-tasks'">
4713N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4713N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4713N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4713N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4713N/A returnString = STAXResult[0][1]
4713N/A currentDate=strftime("%Y%m%d",localtime())
4713N/A <
call function="'searchString'">
4713N/A { 'expectedString' : '%s.* Backup Completed successfully' \
4713N/A 'returnString' : returnString ,
4865N/A { 'sleepForMilliSeconds' : 2000 }
4618N/A <
message>'--- Check log files ---'</
message>
4618N/A <
call function="'listFolder'">
4618N/A { 'location' : '%s' % (STAF_REMOTE_HOSTNAME),
4618N/A 'filename' : 'backup_synchronous'
4618N/A <!-- check the export ldif file has been created--> 4618N/A <
if expr="len(cmdResult) == 0">
4618N/A <
call function="'testFailed'"/>
4618N/A <
call function="'testPassed'"/>
4618N/A <
call function="'testCase_Postamble'"/>
4618N/A <!--- Test Case information 4618N/A #@TestName Schedule a Backup task 4618N/A #@TestPurpose Schedule a Backup in task mode 4618N/A #@TestStep Execute a Backup in task mode 4618N/A #@TestStep specify the -t option with the value non null to schedule an execution 4618N/A <
testcase name="getTestCaseName('schedule backup task for scheduled execution in asynchronous mode')">
4618N/A <
call function="'testCase_Preamble'"/>
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'startTask' : '20061212000000',
6102N/A 'backEnd' : DIRECTORY_INSTANCE_BE,
4618N/A returnString = STAXResult[0][1]
4618N/A <
call function="'searchString'">
4618N/A { 'expectedString' : 'The specified start time \'20061212000000\' has already passed' ,
6102N/A 'returnString' : returnString }
4618N/A <
call function="'testCase_Postamble'"/>
4618N/A <!--- Test Case information 4618N/A #@TestName Schedule a recurring Backup task with the same name as previously 6102N/A #@TestPurpose Schedule a recurring Backup in task mode with the same name 4618N/A #@TestStep Create a recurring Backup in task mode with the same name as previously 4618N/A #@TestStep specify the recurringTask option with the value 4618N/A #@TestStep non null to schedule a recurring execution 4618N/A <
testcase name="getTestCaseName('schedule recurring backup task with the same name as previously')">
4618N/A <
call function="'testCase_Preamble'"/>
4618N/A <!--- ReStart DS to clear the output of manage-tasks--> 4618N/A <
call function="'StopDsWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME,
4618N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
4618N/A <
call function="'StartDsWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME }
4618N/A <!--- Check that DS started --> 4618N/A <
call function="'isAlive'">
4618N/A <
call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A returnString = STAXResult[0][1]
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'recurring-backup-1',
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A 'schedulePattern' : '"0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58 * * * *"',
4618N/A 'backupID' : 'recurring-backup-1',
4618N/A 'backEnd' : DIRECTORY_INSTANCE_BE}
4618N/A <
call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A returnString = STAXResult[0][1]
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'recurring-backup-1',
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Waiting on start time',
4680N/A { 'sleepForMilliSeconds' : 120000 }
4618N/A <
call function="'manage-tasks'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
4618N/A returnString = STAXResult[0][1]
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'recurring-backup-1',
4618N/A <
call function="'searchStringForSubstring'">
4618N/A { 'returnString' : returnString,
4618N/A 'testString' : 'Completed successfully',
4618N/A <
call function="'StopDsWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME,
4618N/A 'dsHost' : DIRECTORY_INSTANCE_HOST,
4618N/A 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
4618N/A 'dsBindDN' : DIRECTORY_INSTANCE_DN,
4618N/A 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
4618N/A <
call function="'StartDsWithScript'">
4618N/A { 'location' : STAF_REMOTE_HOSTNAME }
4618N/A <!--- Check that DS started --> 4618N/A <
call function="'isAlive'">
4618N/A 'location' : STAF_REMOTE_HOSTNAME ,
4618N/A 'testString': 'because another task already exists with the same ID' ,
4618N/A <
call function="'testCase_Postamble'"/>
4618N/A <!-- Test Suite Cleanup --> 4618N/A <
message>'Finally: Tasks Cleanup.'</
message>
4618N/A <
call function="'common_cleanup'" />
4618N/A <
catch exception="'STAFException'">
4618N/A <
message log="1" level="'fatal'">'Cleanup of test suite failed.'</
message>
4618N/A <
call function="'testSuite_Postamble'"/>