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 ! 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 6982N/A ! If applicable, add the following below this CDDL HEADER, with the 6982N/A ! fields enclosed by brackets "[]" replaced with your own identifying 2852N/A ! Portions Copyright [yyyy] [name of copyright owner] 5073N/A ! Copyright 2007-2010 Sun Microsystems, Inc. 6102N/A ! Portions Copyright 2011-2013 ForgeRock AS. 2852N/A <
defaultcall function="import-ldif"/>
2852N/A <
function name="import-ldif" 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 Import Tasks 4618N/A #@TestSuitePurpose Validate the Import functionality in mode task 4618N/A <
call function="'common_setup'">
4618N/A <!--- Test Case information 4618N/A #@TestName Import task in synchronous mode 4618N/A #@TestPurpose Schedule a import in task mode to be executed immedialy in synchronous mode 4618N/A #@TestStep Execute a import-ldif in a task 4618N/A #@TestStep Execute manage-tasks output and check the Import task is returned 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 import 4618N/A <
testcase name="getTestCaseName('schedule import-ldif task for immediate execution in synchronous mode')">
4618N/A <
call function="'testCase_Preamble'"/>
4618N/A <
call function="'ImportLdifWithScript'">
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,
5073N/A 'backEnd' : DIRECTORY_INSTANCE_BE}
4618N/A <!-- Check data are imported --> 4618N/A <
call function="'checkImport'">
4618N/A { 'expectedEntries' : ['uid=scarter,dc=example,dc=com',
4618N/A 'uid=tmorris, dc=example,dc=com'],
4618N/A <
call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4618N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4618N/A 'dsBaseDN' : 'uid=scarter,dc=example,dc=com' }
4618N/A <
call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4618N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4618N/A 'dsBaseDN' : 'uid=tmorris,dc=example,dc=com' }
4618N/A <
call function="'testCase_Postamble'"/>
4618N/A <!--- Test Case information 4618N/A #@TestName Import task in asynchronous mode 4618N/A #@TestPurpose Schedule a import in task mode to be executed immedialy in asynchronous mode 4618N/A #@TestStep Execute a import-ldif in a task 4618N/A #@TestStep specify the -t option with the value 0 4618N/A #@TestStep The task is scheduled for immediate execution 4618N/A @TestStep The script returns immedialy after scheduling the task 4618N/A <
testcase name="getTestCaseName('schedule import-ldif task for immediate execution in asynchronous mode')">
4618N/A <
call function="'testCase_Preamble'"/>
4618N/A <
call function="'ImportLdifWithScript'">
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,
5073N/A 'backEnd' : DIRECTORY_INSTANCE_BE}
4680N/A { 'sleepForMilliSeconds' : 40000 }
4618N/A <!-- Check data are imported --> 4618N/A <
call function="'checkImport'">
4618N/A { 'expectedEntries' : ['uid=scarter,dc=example,dc=com',
4618N/A 'uid=tmorris, dc=example,dc=com'],
4618N/A <
call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4618N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4618N/A 'dsBaseDN' : 'uid=scarter,dc=example,dc=com' }
4618N/A <
call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
4618N/A 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
4618N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
4618N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
4618N/A 'dsBaseDN' : 'uid=tmorris,dc=example,dc=com' }
4618N/A <
call function="'testCase_Postamble'"/>
4618N/A <!--- Test Case information 4618N/A #@TestName Schedule a Import task 4618N/A #@TestPurpose Schedule a import in task mode 4618N/A #@TestStep Execute a import-ldif in a task 4618N/A @TestStep specify the -t option with the value non null to schedule an execution 4618N/A <
testcase name="getTestCaseName('schedule import-ldif task for scheduled execution in asynchronous mode')">
4618N/A <
call function="'testCase_Preamble'"/>
4618N/A <
call function="'ImportLdifWithScript'">
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',
5073N/A 'backEnd' : DIRECTORY_INSTANCE_BE}
4618N/A returnString = STAXResult[0][1]
5073N/A <
call function="'checktestString'">
5073N/A {'returnString' : returnString ,
5073N/A 'expectedString' : 'The specified start time \'20061212000000\' has already passed'
4618N/A <
call function="'testCase_Postamble'"/>
4618N/A <!--- Test Case information 4618N/A #@TestName Schedule a recurring Import task 4618N/A #@TestPurpose Schedule a recurring Import in task mode 4618N/A #@TestStep Create a recurring Import 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 import task')">
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="'ImportLdifWithScript'">
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 * * * *"',
5073N/A 'backEnd' : DIRECTORY_INSTANCE_BE}
6665N/A <
script>checkRC=9999</
script>
6665N/A <
loop from="1" to="10" var="loop" while="checkRC != 0">
6665N/A <
message>'MANAGE-TASKS LOOP %s' % loop</
message>
6665N/A <
call function="'manage-tasks'">
6665N/A { 'location' : STAF_REMOTE_HOSTNAME ,
6665N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
6665N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
6665N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
6665N/A returnString = STAXResult[0][1]
6665N/A <
call function="'searchString'">
6665N/A { 'expectedString' : 'ImportTask-',
6665N/A 'returnString' : returnString ,
6665N/A <
call function="'searchString'">
6665N/A { 'expectedString' : 'Waiting on start time',
6665N/A 'returnString' : returnString ,
6665N/A checkRC = checkRC + STAXResult[0]
6665N/A { 'sleepForMilliSeconds' : 2000 }
4680N/A { 'sleepForMilliSeconds' : 120000 }
6665N/A <
script>checkRC=9999</
script>
6665N/A <
loop from="1" to="10" var="loop" while="checkRC != 0">
6665N/A <
message>'MANAGE-TASKS LOOP %s' % loop</
message>
6665N/A <
call function="'manage-tasks'">
6665N/A { 'location' : STAF_REMOTE_HOSTNAME ,
6665N/A 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
6665N/A 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
6665N/A 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
6665N/A returnString = STAXResult[0][1]
6665N/A <
call function="'searchString'">
6665N/A { 'expectedString' : 'ImportTask-*',
6665N/A 'returnString' : returnString ,
6665N/A <
call function="'searchString'">
6665N/A { 'expectedString' : 'Completed successfully',
6665N/A 'returnString' : returnString ,
6665N/A checkRC = checkRC + STAXResult[0]
6665N/A <
call function="'searchString'">
6665N/A { 'expectedString' : 'Waiting on start time',
6665N/A 'returnString' : returnString ,
6665N/A checkRC = checkRC + STAXResult[0]
6665N/A { 'sleepForMilliSeconds' : 2000 }
4618N/A <!-- cancel the recurring task ExportTask-* 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' : 'ImportTask-*',
4618N/A returnString = STAXResult[0][1]
6665N/A <
call function="'searchString'">
6665N/A { 'expectedString' : 'Task ImportTask-\* canceled',
6665N/A 'returnString' : returnString }
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'"/>