From ccb383c5308f88916e6946ef9479cedef8d98481 Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Tue, 04 Aug 2009 10:14:21 +0000
Subject: [PATCH] refactoring to use different backend types

---
 opends/tests/staf-tests/functional-tests/testcases/backends/backup.xml |  392 +++++++++++++++++++++++++++++--------------------------
 1 files changed, 209 insertions(+), 183 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/backends/backup.xml b/opends/tests/staf-tests/functional-tests/testcases/backends/backup.xml
index 310f3b8..1a7a94e 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/backends/backup.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/backends/backup.xml
@@ -23,197 +23,223 @@
  !
  ! CDDL HEADER END
  !
- !      Copyright 2008 Sun Microsystems, Inc.
+ !      Copyright 2008-2009 Sun Microsystems, Inc.
  ! -->
 <stax>
   <defaultcall function="main_backup"/>
   <function name="main_backup">
     <sequence>
       <block name="'backup'">
-        <sequence>
-          <script>
-            if not CurrentTestPath.has_key('group'):
-              CurrentTestPath['group']='backends'
-            CurrentTestPath['suite']=STAXCurrentBlock
-          </script>
-          <call function="'testSuite_Preamble'" />
-          <!--- Test Suite information
-            #@TestSuiteName       Backend Backup Tests
-            #@TestSuitePurpose    Verify that the basic backup functionality is working in the Directory Server.
-            #@TestSuiteID         Backup Tests
-            #@TestSuiteGroup      Backup
-            #@TestGroup           Backend
-            #@TestScript          backup.xml
-            #@TestHTMLLink        http://opends.dev.java.net/
-          -->
-          <import machine="STAF_LOCAL_HOSTNAME"
-            file="'%s/testcases/backends/backend_setup.xml' % (TESTS_DIR)"/>
-          <call function="'backend_setup'"> 
-            { 'startDS' : False,
-              'loadBackend' : True
-            } 
-          </call>
-          <!--- Test Case information
-            #@TestMarker          Backend Backup Tests
-            #@TestName            Export: Backup 1
-            #@TestID              Backup1
-            #@TestPurpose         Backup the data in OpenDS.
-            #@TestPreamble
-            #@TestSteps           Client calls backup with the parameters
-                                  default backendID, and backupDirectory
-            #@TestPostamble
-            #@TestResult Success if backup returns 0
-          -->
-          <testcase name="getTestCaseName('Test 1')">
+
+        <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 Backup Tests
+              #@TestSuitePurpose    Verify that the basic backup functionality is working in the Directory Server.
+              #@TestSuiteID         Backup Tests
+              #@TestSuiteGroup      Backup
+              #@TestGroup           Backend
+              #@TestScript          backup.xml
+              #@TestHTMLLink        http://opends.dev.java.net/
+            -->
+
+            <call function="'common_setup'">
+              {
+                'quickStart'  : False ,
+                'startServer' : False ,
+                'loadData'    : False ,
+                'stopServer'  : False
+              }
+            </call>
+
+            <!--- Test Case information
+              #@TestMarker          Backend Backup Tests
+              #@TestName            Export: Backup 1
+              #@TestID              Backup1
+              #@TestPurpose         Backup the data in OpenDS.
+              #@TestPreamble
+              #@TestSteps           Client calls backup with the parameters
+                                    default backendID, and backupDirectory
+              #@TestPostamble
+              #@TestResult Success if backup returns 0
+            -->
+            <testcase name="getTestCaseName('Test 1')">
+              <sequence>
+                <call function="'testCase_Preamble'"/>
+                <message>
+                  'Backend Backup1: Create a backup of the data in OpenDS'
+                </message>
+                <call function="'backup'">
+                  { 'backupDir'       : '%s/backends/backup1' % remote.data
+                  }
+                </call>
+                
+                <call function="'checktestRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult
+                  }
+                </call>
+                
+                <call function="'testCase_Postamble'"/>
+              </sequence>
+            </testcase>
+            
+            <!--- Test Case information
+              #@TestMarker          Backend Backup Tests
+              #@TestName            Export: Backup 2
+              #@TestID              Backup2
+              #@TestPurpose         Create an incremental backup of the data in OpenDS.
+              #@TestPreamble
+              #@TestSteps           Client calls backup with the parameters
+                                    default backendID, backupDir, and incremental
+              #@TestPostamble
+              #@TestResult Success if backup returns 0
+            -->
+            <testcase name="getTestCaseName('Test 2')">
+              <sequence>
+                <call function="'testCase_Preamble'"/>
+                <message>
+                  'Backend Backup2: Create an incremental backup of the data in OpenDS'
+                </message>
+                <call function="'backup'">
+                  { 'backupDir'   : '%s/backends/backup1' % remote.data,
+                    'extraParams' : '-i'
+                  }
+                </call>
+                
+                <call function="'checktestRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult
+                  }
+                </call>
+                <call function="'testCase_Postamble'" />
+              </sequence>
+            </testcase>
+            
+            <!--- Test Case information
+              #@TestMarker          Backend Backup Tests
+              #@TestName            Export: Backup 3
+              #@TestID              Backup3
+              #@TestPurpose         Create a backup of the data in OpenDS with a backup id.
+              #@TestPreamble
+              #@TestSteps           Client calls backup with the parameters
+                                    default backendID, backupDir, and backupID
+              #@TestPostamble
+              #@TestResult Success if backup returns 0
+            -->
+            <testcase name="getTestCaseName('Test 3')">
+              <sequence>
+                <call function="'testCase_Preamble'"/>
+                <message>
+                  'Backend Backup3: Create a backup of the data in OpenDS with a backup id'
+                </message>
+                <call function="'backup'">
+                  { 'backupDir'   : '%s/backends/backup2' % remote.data,
+                    'extraParams' : '-I 20070714142807Z'
+                  }
+                </call>
+                <call function="'checktestRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult
+                  }
+                </call>
+                <call function="'testCase_Postamble'" />
+              </sequence>
+            </testcase>
+            
+            <!--- Test Case information
+              #@TestMarker          Backend Backup Tests
+              #@TestName            Export: Backup 4
+              #@TestID              Backup4
+              #@TestPurpose         Create an incremental backup of the data in OpenDS with a backup id.
+              #@TestPreamble
+              #@TestSteps           Client calls backup with the parameters
+                                    default backendID, backupDir, incremental, and backupID
+              #@TestPostamble
+              #@TestResult Success if backup returns 0
+            -->
+            <testcase name="getTestCaseName('Test 4')">
+              <sequence>
+                <call function="'testCase_Preamble'" />
+                <message>
+                  'Backend Backup4: Create an incremental backup of the data in OpenDS with a backup id'
+                </message>
+                <call function="'backup'">
+                  { 'backupDir'   : '%s/backends/backup2' % remote.data,
+                    'extraParams' : '-B 20070714142807Z -i'
+                  }
+                </call>
+                <call function="'checktestRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult
+                  }
+                </call>
+                <call function="'testCase_Postamble'" />
+              </sequence>
+            </testcase>
+            
+            <!--- Test Case information
+              #@TestMarker          Backend Backup Tests
+              #@TestName            Export: Backup 5
+              #@TestID              Backup5
+              #@TestPurpose         Create a compressed backup of the data in OpenDS.
+              #@TestPreamble
+              #@TestSteps           Client calls backup with the parameters
+                                    default backendID, backupDir, and compress
+              #@TestPostamble
+              #@TestResult Success if backup returns 0
+            -->
+            <testcase name="getTestCaseName('Test 5')">
+              <sequence>
+                <call function="'testCase_Preamble'"/>
+                <message>
+                  'Backend Backup5: Create a compressed backup of the data in OpenDS'
+                </message>
+                <call function="'backup'">
+                  { 'backupDir'   : '%s/backends/backup1' % remote.data,
+                    'extraParams' : '-c'
+                  }
+                </call>
+                <call function="'checktestRC'">
+                  { 'returncode' : RC ,
+                    'result'     : STAXResult
+                  }
+                </call>
+                <call function="'testCase_Postamble'" />
+              </sequence>
+            </testcase>
+  
+          </sequence>
+
+          <finally>
             <sequence>
-              <call function="'testCase_Preamble'"/>
-              <message>
-                'Backend Backup1: Create a backup of the data in OpenDS'
-              </message>
-              <call function="'backup'">
-                { 'backupDir'       : '%s/backends/backup1' % remote.data
-                }
-              </call>
-              
-              <call function="'checktestRC'">
-                { 'returncode' : RC ,
-                  'result'     : STAXResult
-                }
-              </call>
-              
-              <call function="'testCase_Postamble'"/>
+              <!-- 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>
-          </testcase>
-          
-          <!--- Test Case information
-            #@TestMarker          Backend Backup Tests
-            #@TestName            Export: Backup 2
-            #@TestID              Backup2
-            #@TestPurpose         Create an incremental backup of the data in OpenDS.
-            #@TestPreamble
-            #@TestSteps           Client calls backup with the parameters
-                                  default backendID, backupDir, and incremental
-            #@TestPostamble
-            #@TestResult Success if backup returns 0
-          -->
-          <testcase name="getTestCaseName('Test 2')">
-            <sequence>
-              <call function="'testCase_Preamble'"/>
-              <message>
-                'Backend Backup2: Create an incremental backup of the data in OpenDS'
-              </message>
-              <call function="'backup'">
-                { 'backupDir'   : '%s/backends/backup1' % remote.data,
-                  'extraParams' : '-i'
-                }
-              </call>
-              
-              <call function="'checktestRC'">
-                { 'returncode' : RC ,
-                  'result'     : STAXResult
-                }
-              </call>
-              <call function="'testCase_Postamble'" />
-            </sequence>
-          </testcase>
-          
-          <!--- Test Case information
-            #@TestMarker          Backend Backup Tests
-            #@TestName            Export: Backup 3
-            #@TestID              Backup3
-            #@TestPurpose         Create a backup of the data in OpenDS with a backup id.
-            #@TestPreamble
-            #@TestSteps           Client calls backup with the parameters
-                                  default backendID, backupDir, and backupID
-            #@TestPostamble
-            #@TestResult Success if backup returns 0
-          -->
-          <testcase name="getTestCaseName('Test 3')">
-            <sequence>
-              <call function="'testCase_Preamble'"/>
-              <message>
-                'Backend Backup3: Create a backup of the data in OpenDS with a backup id'
-              </message>
-              <call function="'backup'">
-                { 'backupDir'   : '%s/backends/backup2' % remote.data,
-                  'extraParams' : '-I 20070714142807Z'
-                }
-              </call>
-              <call function="'checktestRC'">
-                { 'returncode' : RC ,
-                  'result'     : STAXResult
-                }
-              </call>
-              <call function="'testCase_Postamble'" />
-            </sequence>
-          </testcase>
-          
-          <!--- Test Case information
-            #@TestMarker          Backend Backup Tests
-            #@TestName            Export: Backup 4
-            #@TestID              Backup4
-            #@TestPurpose         Create an incremental backup of the data in OpenDS with a backup id.
-            #@TestPreamble
-            #@TestSteps           Client calls backup with the parameters
-                                  default backendID, backupDir, incremental, and backupID
-            #@TestPostamble
-            #@TestResult Success if backup returns 0
-          -->
-          <testcase name="getTestCaseName('Test 4')">
-            <sequence>
-              <call function="'testCase_Preamble'" />
-              <message>
-                'Backend Backup4: Create an incremental backup of the data in OpenDS with a backup id'
-              </message>
-              <call function="'backup'">
-                { 'backupDir'   : '%s/backends/backup2' % remote.data,
-                  'extraParams' : '-B 20070714142807Z -i'
-                }
-              </call>
-              <call function="'checktestRC'">
-                { 'returncode' : RC ,
-                  'result'     : STAXResult
-                }
-              </call>
-              <call function="'testCase_Postamble'" />
-            </sequence>
-          </testcase>
-          
-          <!--- Test Case information
-            #@TestMarker          Backend Backup Tests
-            #@TestName            Export: Backup 5
-            #@TestID              Backup5
-            #@TestPurpose         Create a compressed backup of the data in OpenDS.
-            #@TestPreamble
-            #@TestSteps           Client calls backup with the parameters
-                                  default backendID, backupDir, and compress
-            #@TestPostamble
-            #@TestResult Success if backup returns 0
-          -->
-          <testcase name="getTestCaseName('Test 5')">
-            <sequence>
-              <call function="'testCase_Preamble'"/>
-              <message>
-                'Backend Backup5: Create a compressed backup of the data in OpenDS'
-              </message>
-              <call function="'backup'">
-                { 'backupDir'   : '%s/backends/backup1' % remote.data,
-                  'extraParams' : '-c'
-                }
-              </call>
-              <call function="'checktestRC'">
-                { 'returncode' : RC ,
-                  'result'     : STAXResult
-                }
-              </call>
-              <call function="'testCase_Postamble'" />
-            </sequence>
-          </testcase>
-          <import machine="STAF_LOCAL_HOSTNAME"
-            file="'%s/testcases/backends/backend_cleanup.xml' % (TESTS_DIR)"/>
-          <call function="'backend_cleanup'"> { 'stopDS' : False } </call>
-          <call function="'testSuite_Postamble'" />
-        </sequence>
+          </finally>
+
+        </try>
+        
       </block>
     </sequence>
   </function>

--
Gitblit v1.10.0