From 6b4fccc4dd4cd32b0957c91b4d4cdb79b173025c Mon Sep 17 00:00:00 2001
From: maudj <maudj@localhost>
Date: Tue, 22 Sep 2009 14:07:29 +0000
Subject: [PATCH] Move (rename) backends functional tests backup and restore to preserve history
---
/dev/null | 234 -----------
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup/backup_tests.xml | 522 ++++++++++++++++++++++++++
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore/restore_tests.xml | 391 +++++++++++++++++++
3 files changed, 913 insertions(+), 234 deletions(-)
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup.xml
deleted file mode 100644
index 51ab852..0000000
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup.xml
+++ /dev/null
@@ -1,247 +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_backup"/>
- <function name="main_backup">
- <sequence>
- <block name="'backup'">
-
- <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' : True ,
- 'loadData' : True ,
- 'ldifFile' : '%s/backends/backend_start.ldif' % remote.data ,
- '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>
- <!-- 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/backup_tests.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup/backup_tests.xml
new file mode 100644
index 0000000..a06033b
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/backup/backup_tests.xml
@@ -0,0 +1,522 @@
+<?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 Tests
+ #@TestName Backup: Backup 001
+ #@TestID Backup 001
+ #@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
+ -->
+
+ <function name="backends_backup_001" scope="local">
+ <testcase name="getTestCaseName('Create a backup')">
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'Backend Backup 001: Create a backup of the data in OpenDS'
+ </message>
+
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup1' % remote.data }
+ </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 Tests
+ #@TestName Backup: Backup 002
+ #@TestID Backup 002
+ #@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
+ -->
+ <function name="backends_backup_002" scope="local">
+ <testcase name="getTestCaseName('Create an incremental backup')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Backend Backup 002 Create an incremental backup of the data in OpenDS'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup1' % remote.data,
+ 'extraParams' : '-i'
+ }
+ </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 Tests
+ #@TestName Backup: Backup 003
+ #@TestID Backup 003
+ #@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
+ -->
+ <function name="backends_backup_003" scope="local">
+ <testcase name="getTestCaseName('Create a backup with a backupID')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Backend Backup 003: 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>
+
+ </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 Tests
+ #@TestName Backup: Backup 004
+ #@TestID Backup 004
+ #@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
+ -->
+ <function name="backends_backup_004" scope="local">
+ <testcase name="getTestCaseName('Create an incremental backup with a backupID')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'" />
+ <message>
+ 'Backend Backup 004: 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>
+
+ </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 Tests
+ #@TestName Backup: Backup 005
+ #@TestID Backup 005
+ #@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
+ -->
+ <function name="backends_backup_005" scope="local">
+ <testcase name="getTestCaseName('Create a compressed backup')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Backend Backup 005: Create a compressed backup of the data in OpenDS'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup1' % remote.data,
+ 'extraParams' : '-c'
+ }
+ </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 Tests
+ #@TestName Backup: Backup 006
+ #@TestID Backup 006
+ #@TestPurpose Run backupAll with backendID, should fail.
+ #@TestPreamble
+ #@TestSteps Client calls backup with the parameters
+ #@TestSteps backUpAll with backendID
+ #@TestPostamble
+ #@TestResult Success if backup returns 1
+ -->
+ <function name="backends_backup_006" scope="local">
+ <testcase name="getTestCaseName('Create a backup with -n and -a')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Backend Backup 006: Create a backup with -n and -a'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup1' % remote.data,
+ 'extraParams' : '-n dc=com' ,
+ 'extraParams' : '-a' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'The backUpAll and backendID arguments may not be used together'
+ }
+ </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 Tests
+ #@TestName Backup: Backup 007
+ #@TestID Backup 007
+ #@TestPurpose Run backupAll with -A generate a hash of the
+ #@TestPurpose contents of the backup archive.
+ #@TestPreamble
+ #@TestSteps Client calls backup with the parameter -A
+ #@TestSteps Verify with restore -n the archive is valid
+ #@TestPostamble
+ #@TestResult Success if backup returns 0
+ -->
+ <function name="backends_backup_007" scope="local">
+ <testcase name="getTestCaseName('Create a backup with -A')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Backend Backup 007: Create a backup with -A '
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup1' % remote.data,
+ 'extraParams' : '-A'
+ }
+ </call>
+
+ <!-- Stop DS -->
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'dsHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsBindDN' : DIRECTORY_INSTANCE_DN,
+ 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
+ }
+ </call>
+
+ <!-- restore with -n to validate the archive -->
+ <call function="'restore'">
+ { 'backupDir' : '%s/backends/backup1' % remote.data,
+ 'extraParams' : '-n'
+ }
+ </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 Tests
+ #@TestName Backup: Backup 008
+ #@TestID Backup 008
+ #@TestPurpose Create a backup with a backup id that exists
+ #@TestPreamble
+ #@TestSteps backup should fail as backup id already exists
+ #@TestPostamble
+ #@TestResult Success if backup returns 0
+ -->
+ <function name="backends_backup_008" scope="local">
+ <testcase name="getTestCaseName('Create a backup with an existing backupid')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Backend Backup 008: Create a backup with a backup id'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup2' % remote.data,
+ 'extraParams' : '-I unique-backupid'
+ }
+ </call>
+
+ <message>
+ 'Backend Backup 008: Create a backup with an existing backup id'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup2' % remote.data,
+ 'extraParams' : '-I unique-backupid' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'because another backup already exists with that ID'
+ }
+ </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 Tests
+ #@TestName Backup: Backup 009
+ #@TestID Backup 009
+ #@TestPurpose Run backup with -B but without -i
+ #@TestPreamble
+ #@TestSteps Client calls backup with the parameter
+ #@TestSteps incrementalBaseID but without incremental
+ #@TestPostamble
+ #@TestResult Success if backup returns 1
+ -->
+ <function name="backends_backup_009" scope="local">
+ <testcase name="getTestCaseName('Create a backup with -B but without -i')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Backend Backup 009: Create a backup with -B but without -i '
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup2' % remote.data,
+ 'extraParams' : '-B 20070714142807Z' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'The use of the incrementalBaseID argument requires that the incremental'
+ }
+ </call>
+
+ <call function="'testCase_Postamble'" />
+
+ </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 Tests
+ #@TestName Backup: Backup 010
+ #@TestID Backup 010
+ #@TestPurpose Create an incremental backup when the backup dir doesn't exist yet.
+ #@TestPreamble
+ #@TestSteps Client calls backup with the parameters
+ #@TestSteps incremental and a non existing backup dir
+ #@TestSteps A full backup should be executed
+ #@TestPostamble
+ #@TestResult Success if backup returns 0
+ -->
+ <function name="backends_backup_010" scope="local">
+ <testcase name="getTestCaseName('Create an incremental backup with a non existing backup dir')">
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Backend Backup 010: Create an incremental backup with a non existing backup dir'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup3' % remote.data,
+ 'extraParams' : '-i'
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'A full backup will be executed'
+ }
+ </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.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore.xml
deleted file mode 100755
index d8c79e5..0000000
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore.xml
+++ /dev/null
@@ -1,234 +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"/>
- <function name="main_restore">
- <sequence>
- <block name="'restore'">
- <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 Tests
- #@TestSuitePurpose Test the restore functionality for OpenDS.
- #@TestSuiteID Restore Tests
- #@TestSuiteGroup Restore
- #@TestGroup Backend
- #@TestScript restore.xml
- #@TestHTMLLink http://opends.dev.java.net/
- -->
-
- <call function="'common_setup'">
- {
- 'quickStart' : False ,
- 'startServer' : True ,
- 'loadData' : True ,
- 'ldifFile' : '%s/backends/backend_start.ldif' % remote.data ,
- 'stopServer' : False
- }
- </call>
-
- <message>
- 'Create a backup of the data in OpenDS to be used in the restore testcase'
- </message>
- <call function="'backup'">
- { 'backupDir' : '%s/backends/backup1' % remote.data
- }
- </call>
- <call function="'checktestRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult
- }
- </call>
-
- <!--- Test Case information
- #@TestMarker Backend Restore Tests
- #@TestName Export: Restore 1
- #@TestID Restore1
- #@TestPurpose Restore data to OpenDS.
- #@TestPreamble
- #@TestSteps Client calls restore with the parameters
- default backendID, and backupDirectory
- #@TestPostamble
- #@TestResult Success if restore returns 0
- -->
- <testcase name="getTestCaseName('Test 1')">
- <sequence>
- <call function="'testCase_Preamble'"/>
- <message>
- 'Backend Restore1: Restore data to OpenDS'
- </message>
-
- <!-- Stop DS -->
- <call function="'StopDsWithScript'">
- { 'location' : STAF_REMOTE_HOSTNAME,
- 'dsHost' : DIRECTORY_INSTANCE_HOST,
- 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
- 'dsBindDN' : DIRECTORY_INSTANCE_DN,
- 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
- }
- </call>
-
- <call function="'checkRC'">
- { 'returncode' : RC,
- 'result' : STAXResult
- }
- </call>
-
- <call function="'restore'">
- { 'backupDir' : '%s/backends/backup1' % remote.data
- }
- </call>
-
- <call function="'checktestRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult
- }
- </call>
-
- <!-- Start DS -->
- <message>
- 'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
- </message>
-
- <call function="'StartDsWithScript'">
- { 'location' : STAF_REMOTE_HOSTNAME }
- </call>
-
- <call function="'checkRC'">
- { 'returncode' : RC,
- 'result' : STAXResult
- }
- </call>
-
- <!--- Check that DS started -->
- <call function="'isAlive'">
- { 'noOfLoops' : 10 ,
- 'noOfMilliSeconds' : 2000
- }
- </call>
- <call function="'testCase_Postamble'"/>
- </sequence>
- </testcase>
- <!--- Test Case information
- #@TestMarker Backend Restore Tests
- #@TestName Export: Restore 2
- #@TestID Restore2
- #@TestPurpose Restore compressed data to OpenDS.
- #@TestPreamble
- #@TestSteps Client calls restore with the parameters
- default backendID, backupDirectory, and uncompress
- is automatically done
- #@TestPostamble
- #@TestResult Success if restore returns 0
- -->
- <testcase name="getTestCaseName('Test 2')">
- <sequence>
- <call function="'testCase_Preamble'"/>
- <message>
- 'Backend Restore2: Restore compressed data to OpenDS'
- </message>
-
- <!-- Stop DS -->
- <call function="'StopDsWithScript'">
- { 'location' : STAF_REMOTE_HOSTNAME,
- 'dsHost' : DIRECTORY_INSTANCE_HOST,
- 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
- 'dsBindDN' : DIRECTORY_INSTANCE_DN,
- 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
- }
- </call>
-
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult
- }
- </call>
-
- <call function="'backup'">
- { 'backupDir' : '%s/restore.compressed' % remote.data
- }
- </call>
- <call function="'checktestRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult
- }
- </call>
- <!-- Start DS -->
- <message>
- 'Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
- </message>
- <call function="'StartDsWithScript'">
- { 'location' : STAF_REMOTE_HOSTNAME }
- </call>
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : STAXResult
- }
- </call>
-
- <!--- Check that DS started -->
- <call function="'isAlive'">
- { 'noOfLoops' : 10 ,
- 'noOfMilliSeconds' : 2000
- }
- </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/restore_tests.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore/restore_tests.xml
new file mode 100755
index 0000000..acc3308
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/backends/restore/restore_tests.xml
@@ -0,0 +1,391 @@
+<?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 Restore Tests
+ #@TestName Export: Restore 001
+ #@TestID Restore 001
+ #@TestPurpose Restore data to OpenDS.
+ #@TestPreamble
+ #@TestSteps Client calls restore with the parameters
+ default backendID, and backupDirectory
+ #@TestPostamble
+ #@TestResult Success if restore returns 0
+ -->
+ <function name="backends_restore_001" scope="local">
+ <testcase name="getTestCaseName('Restore data')">
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'Backend Restore 001: Create a backup of the data in OpenDS'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup1' % remote.data
+ }
+ </call>
+
+ <message>
+ 'Backend Restore 001: Restore data to OpenDS'
+ </message>
+
+ <!-- Stop DS -->
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'dsHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsBindDN' : DIRECTORY_INSTANCE_DN,
+ 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
+ }
+ </call>
+
+ <call function="'restore'">
+ { 'backupDir' : '%s/backends/backup1' % remote.data
+ }
+ </call>
+
+ <!-- Start DS -->
+ <message>
+ 'Backend Restore 001: Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
+ </message>
+
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ { 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </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 Tests
+ #@TestName Export: Restore 002
+ #@TestID Restore 002
+ #@TestPurpose Restore compressed data to OpenDS.
+ #@TestPreamble
+ #@TestSteps Client calls restore with the parameters
+ default backendID, backupDirectory, and uncompress
+ is automatically done
+ #@TestPostamble
+ #@TestResult Success if restore returns 0
+ -->
+ <function name="backends_restore_002" scope="local">
+ <testcase name="getTestCaseName('Restore compressed data')">
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'Backend Restore 002: Create a compressed backup of the data in OpenDS'
+ </message>
+
+ <call function="'backup'">
+ { 'backupDir' : '%s/restore.compressed' % remote.data ,
+ 'extraParams' : '-c'
+ }
+ </call>
+
+ <message>
+ 'Backend Restore 002: ldapdelete: delete an entry uid=dcope'
+ </message>
+
+ <call function="'ldapSearchWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsCountEntries' : 'True' ,
+ 'dsBaseDN' : 'dc=com' ,
+ 'dsFilter' : 'uid=dcope' ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : '# Total number of matching entries: 1'
+ }
+ </call>
+
+ <call function="'ldapDeleteWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsDn' : ['uid=dcope,ou=People,o=backend tests,dc=com'] ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <call function="'ldapSearchWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsCountEntries' : 'True' ,
+ 'dsBaseDN' : 'dc=com' ,
+ 'dsFilter' : 'uid=dcope' ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : '# Total number of matching entries: 0'
+ }
+ </call>
+
+ <!-- Stop DS -->
+ <call function="'StopDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME,
+ 'dsHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+ 'dsBindDN' : DIRECTORY_INSTANCE_DN,
+ 'dsBindPwd' : DIRECTORY_INSTANCE_PSWD
+ }
+ </call>
+
+ <call function="'restore'">
+ { 'backupDir' : '%s/restore.compressed' % remote.data
+ }
+ </call>
+
+ <!-- Start DS -->
+ <message>
+ 'Backend Restore 002: Start DS to run on port %s' % DIRECTORY_INSTANCE_PORT
+ </message>
+ <call function="'StartDsWithScript'">
+ { 'location' : STAF_REMOTE_HOSTNAME }
+ </call>
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ { 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </call>
+
+ <message>
+ 'Backend Restore 002: ldapsearch: check uid=dcope that was deleted is now present'
+ </message>
+
+ <call function="'ldapSearchWithScript'">
+ {
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'dsCountEntries' : 'True' ,
+ 'dsBaseDN' : 'dc=com' ,
+ 'dsFilter' : 'uid=dcope' ,
+ 'expectedRC' : 0
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : '# Total number of matching entries: 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>
+
+ <!--- Test Case information
+ #@TestMarker Backend Restore Tests
+ #@TestName Export: Restore 003
+ #@TestID Restore 003
+ #@TestPurpose Backup and Restore encrypted and hashed data to OpenDS.
+ #@TestPreamble
+ #@TestSteps Client calls backup with the parameters -y, -A and -s,
+ restore with -X. Server must be online.
+ #@TestPostamble
+ #@TestResult Success if backup and restore return 0
+ -->
+ <function name="backends_restore_003" scope="local">
+ <testcase name="getTestCaseName('Backup and Restore encrypted, hashed and signhashed data')">
+ <try>
+ <sequence>
+
+ <call function="'testCase_Preamble'"/>
+
+ <message>
+ 'Backend Restore 003: Create an encrypted and signhashed backup of the data in OpenDS'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup3' % remote.data ,
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'extraParams' : '-y -s' ,
+ 'expectedRC' : 1
+ }
+ </call>
+
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'The use of the signHash argument requires that the hash argument is also'
+ }
+ </call>
+
+ <message>
+ 'Backend Restore 003: Create an encrypted, hashed and signhashed backup of the data in OpenDS'
+ </message>
+ <call function="'backup'">
+ { 'backupDir' : '%s/backends/backup3' % remote.data ,
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'extraParams' : '-y -A -s'
+ }
+ </call>
+
+ <message>
+ 'Backend Restore 003: Check Restore with -l'
+ </message>
+
+ <call function="'restore'">
+ { 'backupDir' : '%s/backends/backup3' % remote.data ,
+ 'extraParams' : '-l' ,
+ 'knownIssue' : '4203'
+ }
+ </call>
+ <script>
+ returnString = STAXResult[0][1]
+ </script>
+
+ <call function="'checktestString'">
+ {
+ 'returnString' : returnString ,
+ 'expectedString' : 'Has Signed Hash: true'
+ }
+ </call>
+
+ <message>
+ 'Backend Restore 003: Restore data to OpenDS'
+ </message>
+
+
+ <call function="'restore'">
+ { 'backupDir' : '%s/backends/backup3' % remote.data ,
+ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
+ 'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT ,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
+ 'extraParams' : '-X'
+ }
+ </call>
+
+
+
+ <!--- Check that DS started -->
+ <call function="'isAlive'">
+ { 'noOfLoops' : 10 ,
+ 'noOfMilliSeconds' : 2000
+ }
+ </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