mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

smaguin
12.02.2007 9e37369f1c761f25eb47ef726d3932cf2196e4eb
add testsuite tasks
7 files added
964 ■■■■■ changed files
opends/tests/functional-tests/testcases/tasks/backup_db.xml 211 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/tasks/cleanup.xml 74 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/tasks/export-ldif.xml 210 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/tasks/import-ldif.xml 170 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/tasks/restore_db.xml 159 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/tasks/setup.xml 89 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/tasks/tasks.xml 51 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/tasks/backup_db.xml
New file
@@ -0,0 +1,211 @@
<?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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="backup_db"/>
  <function name="backup_db" scope="local">
    <block name="STAXCurrentFunction">
    <sequence>
      <script>
        CurrentTestPath['suite']=STAXCurrentFunction
      </script>
      <call function="'testSuite_Preamble'" />
          <!--- Test Suite information
          #@TestSuiteName      Tasks
          #@TestSuitePurpose    Verify that the  backup functionality is working in mode task
          #@TestSuiteID            backup Tests
          #@TestSuiteGroup       backup
          #@TestGroup             tasks
          #@TestScript             backup.xml
          #@TestHTMLLink        http://opends.dev.java.net/
          -->
          <!--- Test Case information
          #@TestMarker          Backend backup Tests
          #@TestName            Backend: backup
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a backup in task mode to be executed immedialy in asynchronous mode
          #@TestPreamble
          #@TestSteps            execute a backup in a task
          #@TestSteps            specify the -t option with the value 0 to schedule for immediate execution
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule backup task for immediate execution in asynchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'backup'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'backupDir'  :  '%s/tasks/backup_asynchronous' % logsRemoteDataDir,
                  'startTask'  : '0',
                  'backEnd'   : 'userRoot'}
              </call>
              <message>'--- Check log files backup_asynchronous ---'</message>
                            <call function="'listFolder'">
                                { 'location'   : '%s' % (STAF_REMOTE_HOSTNAME),
                                  'foldername' : '%s/tasks' % logsRemoteDataDir,
                                  'filename'   : 'backup_asynchronous'
                                 }
              </call>
              <!-- check  the export ldif file has been created-->
                <if expr="len(cmdResult) == 0">
                    <call function="'testFailed'"/>
              <else>
                    <call function="'testPassed'"/>
              </else>
              </if>
              <script>
                mydate=strftime("%Y%m%d%H%M%S",localtime())
              </script>
              <message>'mydate %s' % mydate</message>
                     <call function="'testCase_Postamble'"/>
          </sequence>
      </testcase>
          <!--- Test Case information
          #@TestMarker          Backend Backup
          #@TestName            Backend: Backup
          #@TestPurpose        schedule a Backup in task mode to be executed immedialy in synchronous mode
          #@TestPreamble
          #@TestSteps            execute a Backup in a task
          #@TestSteps            don't specify the -t option  to schedule for immediate execution and wait the end of the task to return
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule backup task for immediate execution in synchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'backup'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'backupDir'  :  '%s/tasks/backup_synchronous' % logsRemoteDataDir,
                  'backEnd'   : 'userRoot'}
              </call>
              <message>'--- Check log files ---'</message>
                            <call function="'listFolder'">
                                { 'location'   : '%s' % (STAF_REMOTE_HOSTNAME),
                                  'foldername' : '%s/tasks' % logsRemoteDataDir,
                                  'filename'   : 'backup_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          Backend Backup
          #@TestName            Backend: Backup
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a Backup in task mode to be executed immedialy in asynchronous mode
          #@TestPreamble
          #@TestSteps            execute a Backup in a task
          #@TestSteps            specify the -t option with the value non null  to schedule an  execution
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule backup task for scheduled execution in asynchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
                            <script>
                mydate=strftime("%Y%m%d%H%M%S",localtime())
              </script>
              <call function="'backup'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                                    'startTask'  : '%s' % mydate,
                  'backupDir'  :  '%s/tasks/backup_schedule_asynchronous' % logsRemoteDataDir,
                  'backEnd'   : 'userRoot'}
              </call>
              <message>'--- Check log files backup_schedule_asynchronous ---'</message>
                            <call function="'listFolder'">
                                { 'location'   : '%s' % (STAF_REMOTE_HOSTNAME),
                                  'foldername' : '%s/tasks' % logsRemoteDataDir,
                                  'filename'   : 'backup_schedule_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>
 <call function="'testSuite_Postamble'" />
 </sequence>
 </block>
</function>
</stax>
opends/tests/functional-tests/testcases/tasks/cleanup.xml
New file
@@ -0,0 +1,74 @@
<?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
 !
 !      Portions Copyright 2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="cleanup"/>
  <function name="cleanup">
    <sequence>
      <block name="'cleanup'">
       <sequence>
          <block name="'Block DS Process Stop'">
          <!--- Stop DS -->
            <sequence>
              <message>
                'Stop DS running on port %s' % (DIRECTORY_INSTANCE_PORT)
              </message>
              <call function="'StopDsWithScript'">
               { 'location'  : STAF_REMOTE_HOSTNAME,
                 'dsHost'    : DIRECTORY_INSTANCE_HOST,
                 'dsPort'    : DIRECTORY_INSTANCE_PORT,
                 'dsBindDN'  : DIRECTORY_INSTANCE_DN,
                 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD }
              </call>
              <call function="'checkRC'">
               { 'returncode' : RC ,
                 'result'     : STAXResult }
              </call>
            </sequence>
            <!--- End Block DS Process Stop -->
          </block>
          <block name="'Block Remove DS Topology'">
          <!-- Remove  the topology created for the test suite -->
            <sequence>
              <message>
               'Remove DS topology created for the Test Suite'
              </message>
              <call function="'removeTopology'"/>
              <call function="'checkRC'">
                { 'returncode' : RC ,
                  'result'     : STAXResult }
              </call>
            </sequence>
            <!-- End Block Remove DS Topology-->
          </block>
        </sequence>
      </block>
     </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/tasks/export-ldif.xml
New file
@@ -0,0 +1,210 @@
<?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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="export-ldif"/>
  <function name="export-ldif" scope="local">
    <block name="STAXCurrentFunction">
    <sequence>
      <script>
        CurrentTestPath['suite']=STAXCurrentFunction
      </script>
      <call function="'testSuite_Preamble'" />
          <!--- Test Suite information
          #@TestSuiteName      Tasks
          #@TestSuitePurpose    Verify that the basic export functionality is working in mode task
          #@TestSuiteID            export Tests
          #@TestSuiteGroup       export
          #@TestGroup             tasks
          #@TestScript             export.xml
          #@TestHTMLLink        http://opends.dev.java.net/
          -->
          <!--- Test Case information
          #@TestMarker          Backend export Tests
          #@TestName            Backend: export: LDIF Default
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a Basic export in task mode to be executed immedialy in asynchronous mode
          #@TestPreamble
          #@TestSteps            execute a export-ldif in a task
          #@TestSteps            specify the -t option with the value 0 to schedule for immediate execution
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule export-ldif task for immediate execution in asynchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'exportLdif'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'ldifFile'  :  '%s/tasks/export_asynchronous' % logsRemoteDataDir,
                  'startTask'  : '0',
                  'backEnd'   : 'userRoot'}
              </call>
              <message>'--- Check log files export_asynchronous ---'</message>
                            <call function="'listFolder'">
                                { 'location'   : '%s' % (STAF_REMOTE_HOSTNAME),
                                  'foldername' : '%s/tasks' % logsRemoteDataDir,
                                  '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>
              <script>
                mydate=strftime("%Y%m%d%H%M%S",localtime())
              </script>
              <message>'mydate %s' % mydate</message>
                     <call function="'testCase_Postamble'"/>
          </sequence>
      </testcase>
          <!--- Test Case information
          #@TestMarker          Backend export Tests
          #@TestName            Backend: export: LDIF Default
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a Basic export in task mode to be executed immedialy in synchronous mode
          #@TestPreamble
          #@TestSteps            execute a export-ldif in a task
          #@TestSteps            don't specify the -t option  to schedule for immediate execution and wait the end of the task to return
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule export-ldif task for immediate execution in synchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'exportLdif'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'ldifFile'  :  '%s/tasks/export_synchronous' % logsRemoteDataDir,
                  'backEnd'   : 'userRoot'}
              </call>
              <message>'--- Check log files ---'</message>
                            <call function="'listFolder'">
                                { 'location'   : '%s' % (STAF_REMOTE_HOSTNAME),
                                  'foldername' : '%s/tasks' % logsRemoteDataDir,
                                  '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          Backend export Tests
          #@TestName            Backend: export: LDIF Default
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a Basic export in task mode to be executed immedialy in asynchronous mode
          #@TestPreamble
          #@TestSteps            execute a export-ldif in a task
          #@TestSteps            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'"/>
                            <script>
                mydate=strftime("%Y%m%d%H%M%S",localtime())
              </script>
              <call function="'exportLdif'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'ldifFile'  :  '%s/tasks/export_schedule_asynchronous' % logsRemoteDataDir,
                  'startTask'  : '%s' % mydate,
                  'backEnd'   : 'userRoot'}
              </call>
              <message>'--- Check log files export_asynchronous ---'</message>
                            <call function="'listFolder'">
                                { 'location'   : '%s' % (STAF_REMOTE_HOSTNAME),
                                  'foldername' : '%s/tasks' % logsRemoteDataDir,
                                  'filename'   : 'export_schedule_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>
 <call function="'testSuite_Postamble'" />
 </sequence>
 </block>
</function>
</stax>
opends/tests/functional-tests/testcases/tasks/import-ldif.xml
New file
@@ -0,0 +1,170 @@
<?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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="import-ldif"/>
  <function name="import-ldif" scope="local">
    <block name="STAXCurrentFunction">
    <sequence>
      <script>
        CurrentTestPath['suite']=STAXCurrentFunction
      </script>
      <call function="'testSuite_Preamble'" />
          <!--- Test Suite information
          #@TestSuiteName      Tasks
          #@TestSuitePurpose    Verify that the basic import functionality is working in mode task
          #@TestSuiteID            Import Tests
          #@TestSuiteGroup       Import
          #@TestGroup             tasks
          #@TestScript             import.xml
          #@TestHTMLLink        http://opends.dev.java.net/
          -->
          <!--- Test Case information
          #@TestMarker          Backend Import Tests
          #@TestName            Backend: Import: LDIF Default
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a Basic import in task mode to be executed immedialy in synchronous mode
          #@TestPreamble
          #@TestSteps            execute a import-ldif in a task
          #@TestSteps            don't specify the -t option  to schedule for immediate execution and wait the end of the task to return
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule import-ldif task for immediate execution in synchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'ImportLdifWithScript'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'dsLdifFile'  : '%s/tasks/import.ldif' % logsRemoteDataDir,
                  'dsAppend' : ' ',
                  'dsBackEnd'   : 'userRoot'}
              </call>
              <!-- Check data are imported -->
              <call function="'checkImport'">
                { 'expectedEntries' : ['uid=scarter,dc=example,dc=com',
                                       'uid=tmorris, dc=example,dc=com'],
                   'startDS'     : 'False'
                 }
              </call>
              <!-- Delete entries -->
                            <call function="'DeleteEntry'">
                              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'  : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                    'dsBaseDN'      : 'uid=scarter,dc=example,dc=com' }
                    </call>
                        <call function="'DeleteEntry'">
                              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'  : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                    'dsBaseDN'      : 'uid=tmorris,dc=example,dc=com' }
                    </call>
                     <call function="'testCase_Postamble'"/>
          </sequence>
      </testcase>
          <!--- Test Case information
          #@TestMarker          Backend Import Tests
          #@TestName            Backend: Import: LDIF Default
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a Basic import in task mode to be executed immedialy in asynchronous mode
          #@TestPreamble
          #@TestSteps            execute a import-ldif in a task
          #@TestSteps            specify the -t option with the value 0 to schedule for immediate execution
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule import-ldif task for immediate execution in asynchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'ImportLdifWithScript'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'dsLdifFile'  : '%s/tasks/import.ldif' % logsRemoteDataDir,
                  'dsAppend' : ' ',
                  'startTask'  : '0',
                  'dsBackEnd'   : 'userRoot'}
              </call>
              <call function="'Sleep'">
                 { 'location'  :     STAF_REMOTE_HOSTNAME,
                    'sleepForMilliSeconds'  :  90000 }
              </call>
                <!--  Check data are imported -->
              <call function="'checkImport'">
                { 'expectedEntries' : ['uid=scarter,dc=example,dc=com',
                                       'uid=tmorris, dc=example,dc=com'],
                   'startDS'     : 'False'
                 }
              </call>
              <!-- Delete entries -->
                            <call function="'DeleteEntry'">
                              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'  : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                    'dsBaseDN'      : 'uid=scarter,dc=example,dc=com' }
                    </call>
                        <call function="'DeleteEntry'">
                              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'  : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                    'dsBaseDN'      : 'uid=tmorris,dc=example,dc=com' }
                    </call>
                     <call function="'testCase_Postamble'"/>
          </sequence>
      </testcase>
 <call function="'testSuite_Postamble'" />
 </sequence>
 </block>
</function>
</stax>
opends/tests/functional-tests/testcases/tasks/restore_db.xml
New file
@@ -0,0 +1,159 @@
<?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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="restore_db"/>
  <function name="restore_db" scope="local">
    <block name="STAXCurrentFunction">
    <sequence>
      <script>
        CurrentTestPath['suite']=STAXCurrentFunction
      </script>
      <call function="'testSuite_Preamble'" />
          <!--- Test Suite information
          #@TestSuiteName      Tasks
          #@TestSuitePurpose    Verify that the  restore functionality is working in mode task
          #@TestSuiteID            restore Tests
          #@TestSuiteGroup       restore
          #@TestGroup             tasks
          #@TestScript             restore.xml
          #@TestHTMLLink        http://opends.dev.java.net/
          -->
          <!--- Test Case information
          #@TestMarker          Backend restore Tests
          #@TestName            Backend: restore
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a restore in task mode to be executed immedialy in asynchronous mode
          #@TestPreamble
          #@TestSteps            execute a restore in a task
          #@TestSteps            specify the -t option with the value 0 to schedule for immediate execution
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule restore task for immediate execution in asynchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'restore'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'backupDir'  :  '%s/tasks/backup_asynchronous' % logsRemoteDataDir,
                  'startTask'  : '0'}
              </call>
                     <call function="'testCase_Postamble'"/>
          </sequence>
      </testcase>
          <!--- Test Case information
          #@TestMarker          Backend restore
          #@TestName            Backend: restore
          #@TestPurpose        schedule a restore in task mode to be executed immedialy in synchronous mode
          #@TestPreamble
          #@TestSteps            execute a restore in a task
          #@TestSteps            don't specify the -t option  to schedule for immediate execution and wait the end of the task to return
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule restore task for immediate execution in synchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
              <call function="'restore'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                  'backupDir'  :  '%s/tasks/backup_synchronous' % logsRemoteDataDir}
              </call>
                     <call function="'testCase_Postamble'"/>
          </sequence>
      </testcase>
          <!--- Test Case information
          #@TestMarker          Backend restore
          #@TestName            Backend: restore
          #@TestID                 LDIF Default
          #@TestPurpose        schedule a restore in task mode to be executed immedialy in asynchronous mode
          #@TestPreamble
          #@TestSteps            execute a restore in a task
          #@TestSteps            specify the -t option with the value non null  to schedule an  execution
          #@TestPostamble
          #@TestResult
          -->
          <testcase name="getTestCaseName('schedule restore task for scheduled execution in asynchronous mode')">
            <sequence>
              <call function="'testCase_Preamble'"/>
                            <script>
                mydate=strftime("%Y%m%d%H%M%S",localtime())
              </script>
              <call function="'restore'">
                { 'location'    : STAF_REMOTE_HOSTNAME ,
                  'dsInstanceHost' :  DIRECTORY_INSTANCE_HOST,
                  'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
                  'dsInstanceDn'  : DIRECTORY_INSTANCE_DN,
                  'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
                                    'startTask'  : '%s' % mydate,
                  'backupDir'  :  '%s/tasks/backup_schedule_asynchronous' % logsRemoteDataDir
                }
              </call>
                     <call function="'testCase_Postamble'"/>
          </sequence>
      </testcase>
 <call function="'testSuite_Postamble'" />
 </sequence>
 </block>
</function>
</stax>
opends/tests/functional-tests/testcases/tasks/setup.xml
New file
@@ -0,0 +1,89 @@
<?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
 !
 !      Portions Copyright 2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="setup"/>
  <function name="setup">
    <sequence>
      <block name="'setup'">
      <sequence>
        <block name="'Block Create DS Topology'">
          <!-- Create the topology necessary to the test group/suite -->
          <sequence>
              <message>
                 'Create DS topology as described in config.py'
              </message>
                <call function="'createTopology'">
                  { 'initialiseInstance' : True }
                </call>
                <call function="'checkRC'">
                  { 'returncode' : RC ,
                    'result'     : STAXResult }
                </call>
          </sequence>
          <!--- End Block Create DS Topology -->
        </block>
        <block name="'Block DS Process Active'">
        <!--- Start DS -->
          <sequence>
           <message>
            'Start DS to run on port %s' % (DIRECTORY_INSTANCE_PORT)
           </message>
           <!--- Start DS -->
           <call function="'StartDsWithScript'">
             { 'location'  : STAF_REMOTE_HOSTNAME }
           </call>
           <call function="'checkRC'">
            { 'returncode' : RC ,
              'result'     : STAXResult }
           </call>
           <!--- Check that DS started -->
           <call function="'isAlive'">
            { 'noOfLoops'        : 5 ,
              'noOfMilliSeconds' : 2000 }
           </call>
               <call function="'ldapSearchWithScript'">
            { 'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
            'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
            'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
            'dsBaseDN'     : 'dc=com' ,
            'dsFilter'     : 'objectclass=*' }
                    </call>
          </sequence>
          <!--- End Block DS Process Active -->
        </block>
      </sequence>
      </block>
    </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/tasks/tasks.xml
New file
@@ -0,0 +1,51 @@
<?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, exclude this CDDL HEADER in each
 ! file and exclude 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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="main_tasks"/>
  <function name="main_tasks">
    <sequence>
      <block name="'tasks'">
         <sequence>
           <script>
             CurrentTestPath['group']='tasks'
           </script>
          <call function="'testGroup_Preamble'" />
          <iterate var="_test" in="['setup','export-ldif','import-ldif','backup_db','restore_db','cleanup']" >
            <sequence>
              <import machine="STAF_LOCAL_HOSTNAME"
                      file="'%s/testcases/tasks/%s.xml' % (TESTS_DIR,_test)"/>
              <call function="'%s' % _test" />
            </sequence>
          </iterate>
          <call function="'testGroup_Postamble'" />
        </sequence>
      </block>
    </sequence>
  </function>
</stax>