From d48c5abb7ae1d73009bebe16f9c3d4d59446d4d9 Mon Sep 17 00:00:00 2001
From: maudj <maudj@localhost>
Date: Tue, 22 Sep 2009 15:17:09 +0000
Subject: [PATCH] updates and new tests in the backup-tasks and restore-tasks tests in the backends test suite 

---
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks/backup-tasks.xml         |  134 +++++++++
 /dev/null                                                                                                    |  119 --------
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks/backup-tasks_tests.xml   |  218 +++++++++++++++
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks/restore-tasks_tests.xml |  185 +++++++++++++
 opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks/restore-tasks.xml       |  133 +++++++++
 5 files changed, 670 insertions(+), 119 deletions(-)

diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks.xml
deleted file mode 100755
index 1def1dd..0000000
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?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
- !
- !      Copyright 2009 Sun Microsystems, Inc.
- ! -->
-<stax>
-  <defaultcall function="main_backup-tasks"/>
-  <function name="main_backup-tasks">
-    <sequence>
-      <block name="'backup-tasks'">
-        <try>
-          <sequence>
-            <script>
-              if not CurrentTestPath.has_key('group'):
-                CurrentTestPath['group']='backends'
-              CurrentTestPath['suite']=STAXCurrentBlock
-            </script>
-            <call function="'testSuite_Preamble'" />
-            
-            <call function="'common_setup'">
-              {
-                'quickStart'  : False ,
-                'loadData'    : False ,
-                'startServer' : True ,
-                'stopServer'  : False
-              }
-            </call>
-  
-            <testcase name="getTestCaseName('Test 1')">
-              <sequence>
-                <call function="'testCase_Preamble'"/>
-                <message>
-                  'Backend ExportTasks1: Backup the data in OpenDS by scheduling a task'
-                </message>
-                <call function="'backupTask'">
-                  { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
-                    'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
-                    'dsInstanceDn'   : DIRECTORY_INSTANCE_DN,
-                    'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
-                    'taskID'         : '3',
-                    'backupDir'       : '%s/backends/' % remote.data
-                  }
-                </call>
-                <call function="'checktestRC'">
-                  { 'returncode' : RC ,
-                    'result'     : STAXResult
-                  }
-                </call>
-                <call function="'testCase_Postamble'" />
-              </sequence>
-            </testcase>
-            
-          </sequence>
-
-          <finally>
-            <sequence>
-              <!-- Test Suite Cleanup -->
-              <message>'Finally: Global Backup Cleanup.'</message>
-              <try>
-                <try>
-                  <call function="'common_cleanup'" />
-                <catch exception="'STAFException'">
-                  <sequence>
-                    <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
-                  </sequence>
-                </catch>
-                </try>
-              <finally>
-                <call function="'testSuite_Postamble'"/>
-              </finally>
-              </try>
-            </sequence>
-          </finally>
-        </try>
-      </block>
-    </sequence>
-  </function>
-</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks/backup-tasks.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks/backup-tasks.xml
new file mode 100644
index 0000000..e022a49
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks/backup-tasks.xml
@@ -0,0 +1,134 @@
+<?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 2009 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  <defaultcall function="main_backup-tasks"/>
+  <function name="main_backup-tasks" scope="local">
+    <sequence>
+      <block name="'main_backup-tasks'">
+        <try>
+          <sequence>
+            <script>
+              CurrentTestPath['group']='backends'        
+              CurrentTestPath['suite']='backup-tasks'
+              
+              __group=CurrentTestPath['group']
+              __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+            </script>
+
+            <!--- Test Suite information
+            #@TestSuiteName       Backend Backup Tasks Tests
+            #@TestSuitePurpose    Verify that the basic backup task functionality is working in the Directory Server.
+            #@TestSuiteID         Backup Tasks Tests
+            #@TestSuiteGroup      Backup Tasks
+            #@TestGroup           Backend
+            #@TestScript          backup-tasks.xml
+            #@TestHTMLLink        http://opends.dev.java.net/
+            -->
+
+            <call function="'testSuite_Preamble'"/>
+
+            <try>
+              <sequence> 
+
+                <call function="'common_setup'">
+                  {
+                    'quickStart'  : False ,
+                    'startServer' : True ,
+                    'loadData'    : False ,
+                    'stopServer'  : False
+                  }
+                </call>
+ 
+                <!-- List of Backup Tasks of Test Functions -->
+                <script>
+                  backupList=[]
+                  backupList.append('backup-tasks/backup-tasks_tests')
+                </script>
+
+                <!-- Import the files for this test suite -->
+                <iterate var="__backup" in="backupList">
+                  <import machine="STAF_LOCAL_HOSTNAME"
+                    file="'%s/%s.xml' % (__groupdir,__backup)"/>
+                </iterate>                                                                       
+                                                    
+                <!-- List of Test Cases -->
+                <script>
+                  testsList=[]
+                  testsList.append('backends_backup_tasks_001')
+                  testsList.append('backends_backup_tasks_002')
+                  testsList.append('backends_backup_tasks_003')
+                </script>
+
+                <!-- Execute the Tests -->
+                <iterate var="__test" in="testsList">
+                  <sequence>
+                    <call function="'%s' % (__test)" />
+                  </sequence>
+                </iterate>                
+                                
+              </sequence>
+            <catch exception="'STAFException.TestSuite.SetupException'">
+              <sequence>
+                <message log="1" level="'fatal'">
+                  'Setup of test suite failed.'
+                </message>
+                <rethrow/>
+              </sequence>
+            </catch>
+
+            <finally>
+              <message>'Test Cases Completed.'</message>
+            </finally>
+
+            </try>
+
+          </sequence>
+          
+          <finally>
+            <sequence>
+              <!-- Test Suite Cleanup -->
+              <message>'Finally: Global Schema 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>
+    </sequence>
+  </function>
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks/backup-tasks_tests.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks/backup-tasks_tests.xml
new file mode 100755
index 0000000..2ce4fe8
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup-tasks/backup-tasks_tests.xml
@@ -0,0 +1,218 @@
+<?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
+ !
+ !      Copyright 2009 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  <!--- Test Case information
+  #@TestMarker          Backend Backup Tasks Tests
+  #@TestName            Backup: Backup Tasks 001
+  #@TestID              Backup Tasks 001
+  #@TestPurpose         Schedule a Backup of the data in OpenDS and test the
+                        option completionNotify.
+  #@TestPreamble
+  #@TestSteps           Client calls an online backup with completionNotify with
+                        an incorrect email address and with a correct email
+  #@TestPostamble
+  #@TestResult Success if backup returns 0
+  -->
+  
+  <function name="backends_backup_tasks_001" scope="local">
+    <testcase name="getTestCaseName('Create a backup task with --completionNotify')">
+      <try>
+        <sequence>      
+          <call function="'testCase_Preamble'"/>
+            
+          <message>
+            'Backend Backup Tasks 001: Schedule a Backup task with --completionNotify incorrect email'
+          </message>
+
+          <call function="'backup'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupID'            : 'scheduled-backup',
+              'schedulePattern'     : '"0 15 * * 1-5"' ,
+              'backupDir'           : '%s/backends/' % remote.data ,
+              'extraParams'         : '--completionNotify foo' ,
+              'expectedRC'          : 1
+            }
+          </call>
+
+
+          <message>
+            'Backend Backup Tasks 001: Schedule a Backup task with --completionNotify correct email'
+          </message>
+
+          <call function="'backup'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupID'            : 'scheduled-backup',
+              'schedulePattern'     : '"0 15 * * 1-5"' ,
+              'backupDir'           : '%s/backends/' % remote.data ,
+              'extraParams'         : '--completionNotify foo@example.com'
+            }
+          </call>
+
+        </sequence>
+
+        <catch exception="'STAXException.*'" typevar="eType" var="eInfo">
+          <message log="1" level="'fatal'">
+            '%s: Test failed. eInfo(%s)' % (eType,eInfo)
+          </message>
+        </catch>
+
+        <finally>
+          <call function="'testCase_Postamble'"/>
+        </finally>
+      </try>
+    </testcase>
+  </function>
+
+  <!--- Test Case information
+  #@TestMarker          Backend Backup Tasks Tests
+  #@TestName            Backup: Backup Tasks 002
+  #@TestID              Backup Tasks 002
+  #@TestPurpose         Schedule a Backup of the data in OpenDS and test the
+                        option errorNotify
+  #@TestPreamble
+  #@TestSteps           Client calls an online backup with errorNotify
+                        with an incorrect email address and with a correct email
+  #@TestPostamble
+  #@TestResult Success if backup returns 0
+  -->
+
+  <function name="backends_backup_tasks_002" scope="local">
+    <testcase name="getTestCaseName('Create a backup task with --errorNotify')">
+      <try>
+        <sequence>
+
+          <call function="'testCase_Preamble'"/>
+
+          <message>
+            'Backend Backup Tasks 002: Schedule a Backup task with --errorNotify incorrect email'
+          </message>
+
+          <call function="'backup'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupID'            : 'scheduled-backup-2',
+              'schedulePattern'     : '"0 15 * * 1-5"' ,
+              'backupDir'           : '%s/backends/' % remote.data ,
+              'extraParams'         : '--errorNotify foo' ,
+              'expectedRC'          : 1
+            }
+          </call>
+
+
+          <message>
+            'Backend Backup Tasks 002: Schedule a Backup task with --errorNotify correct email'
+          </message>
+
+          <call function="'backup'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupID'            : 'scheduled-backup-2',
+              'schedulePattern'     : '"0 15 * * 1-5"' ,
+              'backupDir'           : '%s/backends/' % remote.data ,
+              'extraParams'         : '--errorNotify foo@example.com'
+            }
+          </call>
+
+        </sequence>
+
+        <catch exception="'STAXException.*'" typevar="eType" var="eInfo">
+          <message log="1" level="'fatal'">
+            '%s: Test failed. eInfo(%s)' % (eType,eInfo)
+          </message>
+        </catch>
+
+        <finally>
+          <call function="'testCase_Postamble'"/>
+        </finally>
+      </try>
+    </testcase>
+  </function>
+
+  <!--- Test Case information
+  #@TestMarker          Backend Backup Tasks Tests
+  #@TestName            Backup: Backup Tasks 003
+  #@TestID              Backup Tasks 003
+  #@TestPurpose         Schedule a Backup of the data in OpenDS and test the
+                        option dependency
+  #@TestPreamble
+  #@TestSteps           Client calls an online backup
+  #@TestPostamble
+  #@TestResult Success if backup returns 0
+  -->
+
+  <function name="backends_backup_tasks_003" scope="local">
+    <testcase name="getTestCaseName('Create a backup task with --dependency')">
+      <try>
+        <sequence>
+
+          <call function="'testCase_Preamble'"/>
+
+          <message>
+            'Backend Backup Tasks 003: Schedule a Backup task with --dependency incorrect'
+          </message>
+
+          <call function="'backup'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupID'            : 'scheduled-backup-3',
+              'backupDir'           : '%s/backends/' % remote.data ,
+              'extraParams'         : '--dependency foo' ,
+              'expectedRC'          : 1
+            }
+          </call>
+     
+
+        </sequence>
+
+        <catch exception="'STAXException.*'" typevar="eType" var="eInfo">
+          <message log="1" level="'fatal'">
+            '%s: Test failed. eInfo(%s)' % (eType,eInfo)
+          </message>
+        </catch>
+
+        <finally>
+          <call function="'testCase_Postamble'"/>
+        </finally>
+      </try>
+    </testcase>
+  </function>
+
+
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks.xml
deleted file mode 100755
index b258c0b..0000000
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?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
- !
- !      Copyright 2008-2009 Sun Microsystems, Inc.
- ! -->
-<stax>
-  <defaultcall function="main_restore-tasks"/>
-  <function name="main_restore-tasks">
-    <sequence>
-      <block name="'restore-tasks'">
-        <try>
-          <sequence>
-            <script>
-              if not CurrentTestPath.has_key('group'):
-                CurrentTestPath['group']='backends'
-              CurrentTestPath['suite']=STAXCurrentBlock
-            </script>
-            <call function="'testSuite_Preamble'"/>
-            <!--- Test Suite information
-              #@TestSuiteName       Backend Restore Tasks Tests
-              #@TestSuitePurpose    Verify that the basic restore task functionality is working in the Directory Server.
-              #@TestSuiteID         Restore Tasks Tests
-              #@TestSuiteGroup      Restore Tasks
-              #@TestGroup           Backend
-              #@TestScript          restore-tasks.xml
-              #@TestHTMLLink        http://opends.dev.java.net/
-            -->
-            <call function="'common_setup'">
-              {
-                'quickStart'  : False ,
-                'loadData'    : False ,
-                'startServer' : True ,
-                'stopServer'  : False
-              }
-            </call> 
-            
-            <!--- Test Case information
-              #@TestMarker          Backend Restore Tasks Tests
-              #@TestName            Restore Tasks: Restore Tasks 1
-              #@TestID              RestoreTasks1
-              #@TestPurpose         Verify an restore task of a LDIF file on the default backend.
-              #@TestPreamble
-              #@TestSteps           An ldif file is created that describes the restore task to be
-                                    scheduled. The task is scheduled by adding the ldif file
-                                    with the static ldapmodify.
-              #@TestPostamble
-              #@TestResult          Success if OpenDS returns 0
-            -->
-            <testcase name="getTestCaseName('Test 1')">
-              <sequence>
-                <call function="'testCase_Preamble'"/>
-                <message>
-                  'Backend RestoreTasks1: Restore the data in OpenDS by scheduling a task'
-                </message>
-                <call function="'restoreTask'">
-                  { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
-                    'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
-                    'dsInstanceDn'   : DIRECTORY_INSTANCE_DN,
-                    'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
-                    'taskID'         : '4',
-                    'backupDir'      : '%s/backends/' % remote.data
-                  }
-                </call>
-                <call function="'checktestRC'">
-                  { 'returncode' : RC ,
-                    'result'     : STAXResult
-                  }
-                </call>
-                <call function="'testCase_Postamble'"/>
-              </sequence>
-            </testcase>
-  
-          </sequence>
-          <finally>
-            <sequence>
-              <!-- Test Suite Cleanup -->
-              <message>'Finally: Global Backup Cleanup.'</message>
-              <try>
-                <try>
-                  <call function="'common_cleanup'" />
-                <catch exception="'STAFException'">
-                  <sequence>
-                    <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
-                  </sequence>
-                </catch>
-                </try>
-              <finally>
-                <call function="'testSuite_Postamble'"/>
-              </finally>
-              </try>
-            </sequence>
-          </finally>
-        </try>
-      </block>
-    </sequence>
-  </function>
-</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks/restore-tasks.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks/restore-tasks.xml
new file mode 100644
index 0000000..036154a
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks/restore-tasks.xml
@@ -0,0 +1,133 @@
+<?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 2009 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  <defaultcall function="main_restore-tasks"/>
+  <function name="main_restore-tasks" scope="local">
+    <sequence>
+      <block name="'main_restore-tasks'">
+        <try>
+          <sequence>
+            <script>
+              CurrentTestPath['group']='backends'        
+              CurrentTestPath['suite']='restore-tasks'
+              
+              __group=CurrentTestPath['group']
+              __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+            </script>
+
+            <!--- Test Suite information
+            #@TestSuiteName       Backend Restore Tasks Tests
+            #@TestSuitePurpose    Verify that the basic restore task functionality is working in the Directory Server.
+            #@TestSuiteID         Restore Tasks Tests
+            #@TestSuiteGroup      Restore Tasks
+            #@TestGroup           Backend
+            #@TestScript          restore-tasks.xml
+            #@TestHTMLLink        http://opends.dev.java.net/
+            -->
+
+            <call function="'testSuite_Preamble'"/>
+
+            <try>
+              <sequence> 
+
+                <call function="'common_setup'">
+                  {
+                    'quickStart'  : False ,
+                    'startServer' : True ,
+                    'loadData'    : False ,
+                    'stopServer'  : False
+                  }
+                </call>
+ 
+                <!-- List of Restore Tasks of Test Functions -->
+                <script>
+                  restoreList=[]
+                  restoreList.append('restore-tasks/restore-tasks_tests')
+                </script>
+
+                <!-- Import the files for this test suite -->
+                <iterate var="__restore" in="restoreList">
+                  <import machine="STAF_LOCAL_HOSTNAME"
+                    file="'%s/%s.xml' % (__groupdir,__restore)"/>
+                </iterate>                                                                       
+                                                    
+                <!-- List of Test Cases -->
+                <script>
+                  testsList=[]
+                  testsList.append('backends_restore_tasks_001')
+                  testsList.append('backends_restore_tasks_002')
+                </script>
+
+                <!-- Execute the Tests -->
+                <iterate var="__test" in="testsList">
+                  <sequence>
+                    <call function="'%s' % (__test)" />
+                  </sequence>
+                </iterate>                
+                                
+              </sequence>
+            <catch exception="'STAFException.TestSuite.SetupException'">
+              <sequence>
+                <message log="1" level="'fatal'">
+                  'Setup of test suite failed.'
+                </message>
+                <rethrow/>
+              </sequence>
+            </catch>
+
+            <finally>
+              <message>'Test Cases Completed.'</message>
+            </finally>
+
+            </try>
+
+          </sequence>
+          
+          <finally>
+            <sequence>
+              <!-- Test Suite Cleanup -->
+              <message>'Finally: Global Schema 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>
+    </sequence>
+  </function>
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks/restore-tasks_tests.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks/restore-tasks_tests.xml
new file mode 100755
index 0000000..7857960
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore-tasks/restore-tasks_tests.xml
@@ -0,0 +1,185 @@
+<?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
+ !
+ !      Copyright 2008-2009 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  <!--- Test Case information
+  #@TestMarker          Backend Restore Tasks Tests
+  #@TestName            Restore Tasks: Restore Tasks 001
+  #@TestID              Restore Tasks 001
+  #@TestPurpose         Create a restore task of the data in OpenDS and test the
+                        option completionNotify.
+  #@TestPreamble
+  #@TestSteps           Client calls an online restore with completionNotify 
+                        with an incorrect email address and with a correct email
+  #@TestPostamble
+  #@TestResult          Success if OpenDS returns 0
+  -->
+
+  <function name="backends_restore_tasks_001" scope="local">
+    <testcase name="getTestCaseName('Create a restore task with --completionNotify')">
+      <try>
+        <sequence>
+      
+          <call function="'testCase_Preamble'"/>
+
+          <message>
+            'Backend Restore Tasks 001: Create a backup of the data'
+          </message>
+
+          <call function="'backup'">
+            { 'backupDir'           : '%s/backends/backup1' % remote.data ,
+              'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST ,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN ,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
+              'extraParams'         : '-y -c'
+            }
+          </call>
+
+          <message>
+            'Backend Restore Tasks 001: Restore with --completionNotify incorrect email'
+          </message>
+
+          <call function="'restore'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupDir'           : '%s/backends/backup1' % remote.data,
+              'extraParams'         : '--completionNotify foo',
+              'expectedRC'          : 1
+            }
+          </call>
+
+          <message>
+            'Backend Restore Tasks 001: Restore with --completionNotify correct email'
+          </message>
+
+          <call function="'restore'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupDir'           : '%s/backends/backup1' % remote.data,
+              'extraParams'         : '--completionNotify foo@example.com'
+            }
+          </call>
+          
+        </sequence>
+
+        <catch exception="'STAXException.*'" typevar="eType" var="eInfo">
+          <message log="1" level="'fatal'">
+            '%s: Test failed. eInfo(%s)' % (eType,eInfo)
+          </message>
+        </catch>
+
+        <finally>
+          <call function="'testCase_Postamble'"/>
+        </finally>
+      </try>
+    </testcase>
+  </function>
+
+  <!--- Test Case information
+  #@TestMarker          Backend Restore Tasks Tests
+  #@TestName            Restore Tasks: Restore Tasks 002
+  #@TestID              Restore Tasks 002
+  #@TestPurpose         Create a restore task of the data in OpenDS and test the
+                        option errorNotify.
+  #@TestPreamble
+  #@TestSteps           Client calls an online restore with errorNotify
+                        with an incorrect email address and with a correct email
+  #@TestPostamble
+  #@TestResult          Success if OpenDS returns 0
+  -->
+
+  <function name="backends_restore_tasks_002" scope="local">
+    <testcase name="getTestCaseName('Create a restore task with --errorNotify')">
+      <try>
+        <sequence>
+
+          <call function="'testCase_Preamble'"/>
+
+          <message>
+            'Backend Restore Tasks 002: Create a backup of the data'
+          </message>
+
+          <call function="'backup'">
+            { 'backupDir'           : '%s/backends/backup2' % remote.data ,
+              'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST ,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN ,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD ,
+              'extraParams'         : '-c -A'
+            }
+          </call>
+
+          <message>
+            'Backend Restore Tasks 002: Restore with --errorNotify incorrect email'
+          </message>
+
+          <call function="'restore'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupDir'           : '%s/backends/backup2' % remote.data,
+              'extraParams'         : '--errorNotify foo',
+              'expectedRC'          : 1
+            }
+          </call>
+
+          <message>
+            'Backend Restore Tasks 002: Restore with --errorNotify correct email'
+          </message>
+
+          <call function="'restore'">
+            { 'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+              'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+              'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+              'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+              'backupDir'           : '%s/backends/backup2' % remote.data,
+              'extraParams'         : '--errorNotify foo@example.com'
+            }
+          </call>
+
+        </sequence>
+
+        <catch exception="'STAXException.*'" typevar="eType" var="eInfo">
+          <message log="1" level="'fatal'">
+            '%s: Test failed. eInfo(%s)' % (eType,eInfo)
+          </message>
+        </catch>
+
+        <finally>
+          <call function="'testCase_Postamble'"/>
+        </finally>
+      </try>
+    </testcase>
+  </function>
+
+</stax>

--
Gitblit v1.10.0