export-ldif.xml revision da97433d5cd26e422a370d186f98659383c06721
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
<!--
! CDDL HEADER START
!
! 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
! with the License.
!
! You can obtain a copy of the license at
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
! 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
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
! 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]
!
! CDDL HEADER END
!
! Copyright 2007-2009 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="export-ldif"/>
<function name="export-ldif" scope="local">
<block name="STAXCurrentFunction">
<try>
<sequence>
<script>
CurrentTestPath['suite']=STAXCurrentFunction
</script>
<call function="'testSuite_Preamble'" />
<!--- Test Suite information
#@TestSuiteName Export tasks
#@TestSuitePurpose Validate the export functionality in mode task
#@TestSuiteID export Tests
#@TestSuiteGroup export
#@TestGroup tasks
#@TestScript export_ldif.xml
#@TestHTMLLink http://opends.dev.java.net/
-->
<call function="'common_setup'">
{
'quickStart' : True ,
'startServer' : True ,
'stopServer' : False
}
</call>
<!--- Test Case information
#@TestMarker Export tasks
#@TestName Export task in asynchronous mode
#@TestPurpose Schedule a Export in task mode to be executed immedialy in asynchronous mode
#@TestPreamble
#@TestStep Execute a export-ldif in a task
#@TestStep Specify the -t option with the value 0
#@TestStep The task is scheduled for immediate execution
#@TestStep The script returns immedialy after scheduling the task
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('schedule export-ldif task for immediate execution in asynchronous mode')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'exportLdifWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'ldifFile' : '%s/tasks/export_asynchronous' % remote.data,
'startTask' : '0',
'backEnd' : DIRECTORY_INSTANCE_BE}
</call>
<script>checkRC=9999</script>
<loop from="1" to="10" var="loop" while="checkRC != 0">
<sequence>
<message>'LOOP %s' % loop</message>
<!-- manage-tasks -->
<call function="'manage-tasks'">
{'location' : STAF_REMOTE_HOSTNAME,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'dsQuiet' : ' '
}
</call>
<script>
returnString = STAXResult[0][1]
currentDate=strftime("%Y%m%d",localtime())
</script>
<call function="'searchString'">
{ 'expectedString' : '%s.* Export Completed successfully' \
% currentDate,
'returnString' : returnString ,
'expectedRC' : 'noCheck' }
</call>
<script>
checkRC = STAXResult[0]
</script>
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : 2000 }
</call>
</sequence>
</loop>
<message>'--- Check log files export_asynchronous ---'</message>
<call function="'listFolder'">
{ 'location' : '%s' % (STAF_REMOTE_HOSTNAME),
'foldername' : '%s/tasks' % remote.data,
'filename' : 'export_asynchronous'
}
</call>
<!-- check the export ldif file has been created-->
<if expr="len(cmdResult) == 0">
<call function="'testFailed'"/>
<else>
<call function="'testPassed'"/>
</else>
</if>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Export tasks
#@TestName Export task in synchronous mode
#@TestPurpose Schedule a Export in task mode to be executed immedialy in synchronous mode
#@TestPreamble
#@TestStep Execute a export-ldif in a task
#@TestStep Execute manage-tasks output and check the Export task is returned
#@TestStep Don't specify the -t option
#@TestStep The task is scheduled for immediate execution and the script must wait the end of the export
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('schedule export-ldif task for immediate execution in synchronous mode')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'exportLdifWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'ldifFile' : '%s/tasks/export_synchronous' % remote.data,
'backEnd' : DIRECTORY_INSTANCE_BE}
</call>
<script>checkRC=9999</script>
<loop from="1" to="10" var="loop" while="checkRC != 0">
<sequence>
<message>'LOOP %s' % loop</message>
<!-- manage-tasks -->
<call function="'manage-tasks'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'dsQuiet' : ' '
}
</call>
<script>
returnString = STAXResult[0][1]
currentDate=strftime("%Y%m%d",localtime())
</script>
<call function="'searchString'">
{ 'expectedString' : '%s.* Export Completed successfully' \
% currentDate,
'returnString' : returnString ,
'expectedRC' : 'noCheck' }
</call>
<script>
checkRC = STAXResult[0]
</script>
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : 2000 }
</call>
</sequence>
</loop>
<message>'--- Check log files ---'</message>
<call function="'listFolder'">
{ 'location' : '%s' % (STAF_REMOTE_HOSTNAME),
'foldername' : '%s/tasks' % remote.data,
'filename' : 'export_synchronous'
}
</call>
<!-- check the export ldif file has been created-->
<if expr="len(cmdResult) == 0">
<call function="'testFailed'"/>
<else>
<call function="'testPassed'"/>
</else>
</if>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Export tasks
#@TestName Schedule a Export task
#@TestPurpose Schedule a Export in task mode
#@TestPreamble
#@TestStep Execute a export-ldif in a task
#@TestStep Specify the -t option with the value non null to schedule an execution
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('schedule export-ldif task for scheduled execution in asynchronous mode')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'exportLdifWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'ldifFile' : '%s/tasks/export_schedule_asynchronous' % remote.data,
'startTask' : '20061212000000',
'expectedRC' : 1,
'backEnd' : DIRECTORY_INSTANCE_BE}
</call>
<call function="'searchString'">
{ 'expectedString' : 'The specified start time \'%s\' has already passed'%startTask,
'returnString' : resultString ,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Export tasks
#@TestName Schedule a recurring Export task
#@TestPurpose Schedule a recurring Export in task mode
#@TestPreamble
#@TestStep Create a recurring Export in task mode
#@TestStep specify the recurringTask option with the value
#@TestStep non null to schedule a recurring execution
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('schedule recurring export task')">
<sequence>
<call function="'testCase_Preamble'"/>
<!--- ReStart DS to clear the output of manage-tasks-->
<call function="'StopDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME,
'dsHost' : DIRECTORY_INSTANCE_HOST,
'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsBindDN' : DIRECTORY_INSTANCE_DN,
'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
</call>
<call function="'StartDsWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME }
</call>
<!--- Check that DS started -->
<call function="'isAlive'">
{ 'noOfLoops' : 10 ,
'noOfMilliSeconds' : 2000
}
</call>
<call function="'exportLdifWithScript'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'ldifFile' : '%s/tasks/export_schedule_recurring' % remote.data,
'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 * * * *"',
'backEnd' : DIRECTORY_INSTANCE_BE}
</call>
<!-- manage-tasks -->
<call function="'manage-tasks'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'dsQuiet' : ' '
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchStringForSubstring'">
{ 'returnString' : returnString,
'testString' : 'ExportTask-',
'expectedResult' : '1' }
</call>
<call function="'searchStringForSubstring'">
{ 'returnString' : returnString,
'testString' : 'Waiting on start time',
'expectedResult' : '1' }
</call>
<call function="'Sleep'">
{ 'sleepForMilliSeconds' : 120000 }
</call>
<!-- manage-tasks -->
<call function="'manage-tasks'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'dsQuiet' : ' '
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchStringForSubstring'">
{ 'returnString' : returnString,
'testString' : 'ExportTask-*',
'expectedResult' : '1' }
</call>
<call function="'searchStringForSubstring'">
{ 'returnString' : returnString,
'testString' : 'Completed successfully',
'expectedResult' : '1' }
</call>
<call function="'searchStringForSubstring'">
{ 'returnString' : returnString,
'testString' : 'Waiting on start time',
'expectedResult' : '1' }
</call>
<!-- cancel the recurring task ExportTask-* with manage-tasks -->
<call function="'manage-tasks'">
{ 'location' : STAF_REMOTE_HOSTNAME ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'dsCancel' : 'ExportTask-*',
'dsQuiet' : ' '
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'searchStringForSubstring'">
{ 'returnString' : returnString,
'testString' : 'Task ExportTask-',
'expectedResult' : '1' }
</call>
<call function="'searchStringForSubstring'">
{ 'returnString' : returnString,
'testString' : 'canceled',
'expectedResult' : '1' }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Tasks Cleanup.'</message>
<try>
<call function="'common_cleanup'" />
<catch exception="'STAFException'">
<sequence>
<message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
</sequence>
</catch>
<finally>
<call function="'testSuite_Postamble'"/>
</finally>
</try>
</sequence>
</finally>
</try>
</block>
</function>
</stax>