From 91f46aa2b61f42e8818c7c27291ddacd9ae3809b Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Thu, 07 Mar 2013 16:46:28 +0000
Subject: [PATCH] CR-1378 Fix tasks/restore_db testcase on Windows and cleanup known issue in tasks testsuite

---
 opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml  |   44 ++++++++++++++
 opends/tests/staf-tests/functional-tests/testcases/tasks/restart_db.xml  |   64 +++++++++++++++++---
 opends/tests/staf-tests/functional-tests/testcases/tasks/backup_db.xml   |   17 +----
 opends/tests/staf-tests/functional-tests/testcases/tasks/import-ldif.xml |   18 -----
 4 files changed, 101 insertions(+), 42 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/tasks/backup_db.xml b/opends/tests/staf-tests/functional-tests/testcases/tasks/backup_db.xml
index ee72112..9dbf4a5 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/tasks/backup_db.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/tasks/backup_db.xml
@@ -24,7 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2007-2009 Sun Microsystems, Inc.
- !      Portions Copyright 2011 ForgeRock AS.
+ !      Portions Copyright 2011-2013 ForgeRock AS.
 ! -->
 <stax>
   <defaultcall function="backup_db"/>
@@ -387,7 +387,8 @@
                 'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
                 'startTask'           : '20061212000000',	                
                 'backupDir'           : '%s/tasks/backup_schedule_asynchronous' % remote.temp,
-                'backEnd'             : DIRECTORY_INSTANCE_BE}
+                'backEnd'             : DIRECTORY_INSTANCE_BE,
+                'expectedRC'          : 1 }
               </call>
               
               <script>
@@ -396,9 +397,7 @@
   
               <call function="'searchString'">
                 { 'expectedString' : 'The specified start time \'20061212000000\' has already passed' ,
-                  'returnString'	 : returnString ,
-                  'knownIssue'     : '3909' ,
-                  'expectedRC'     : '1' }
+                  'returnString'   : returnString }
                 </call>
               
               
@@ -409,7 +408,7 @@
             <!--- Test Case information
             #@TestMarker      Backup tasks
             #@TestName        Schedule a recurring Backup task with the same name as previously
-            #@TestPurpose     Schedule a recurring Backup in task mode with the same name see issue 3373
+            #@TestPurpose     Schedule a recurring Backup in task mode with the same name
             #@TestPreamble
             #@TestStep        Create a recurring Backup in task mode with the same name as previously
             #@TestStep        specify the recurringTask option with the value
@@ -560,12 +559,6 @@
                 }
               </call>
   
-  	    <!---
-              <call function="'setKnownIssue'">
-                { 'issueId' : '3773' }
-              </call>
-  	    -->
-  
               <call function="'testCase_Postamble'"/>
             </sequence>
           </testcase>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/tasks/import-ldif.xml b/opends/tests/staf-tests/functional-tests/testcases/tasks/import-ldif.xml
index a2f7067..4b1619c 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/tasks/import-ldif.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/tasks/import-ldif.xml
@@ -24,7 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2007-2010 Sun Microsystems, Inc.
- !      Portions Copyright 2011 ForgeRock AS.
+ !      Portions Copyright 2011-2013 ForgeRock AS.
 ! -->
 <stax>
   <defaultcall function="import-ldif"/>
@@ -93,14 +93,6 @@
                 }
               </call>
 
-              <if expr="RC != 0">
-                <sequence>
-                  <call function="'setKnownIssue'">
-                    { 'issueId' : 6962694 }
-                  </call>
-                </sequence>
-              </if>
-
               <!-- Delete entries -->
               <call function="'DeleteEntry'">
                 { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
@@ -160,14 +152,6 @@
                 'startDS'     : 'False'              
                 }
               </call>
-
-              <if expr="RC != 0">
-                <sequence>
-                  <call function="'setKnownIssue'">
-                    { 'issueId' : 6962694 }
-                  </call>
-                </sequence>
-              </if>
               
               <!-- Delete entries -->
               <call function="'DeleteEntry'">
diff --git a/opends/tests/staf-tests/functional-tests/testcases/tasks/restart_db.xml b/opends/tests/staf-tests/functional-tests/testcases/tasks/restart_db.xml
index 561e727..03205a3 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/tasks/restart_db.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/tasks/restart_db.xml
@@ -24,6 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2007-2009 Sun Microsystems, Inc.
+ !      Portions Copyright 2013 ForgeRock AS.
 ! -->
 <stax>
   <defaultcall function="restart_db"/>
@@ -54,14 +55,13 @@
               'stopServer'    : False
             }
           </call>  
-  
+
           <!--- Test Case information
             #@TestMarker          Restart tasks
             #@TestName            Restart task in asynchronous mode
             #@TestPurpose         Schedule a restart in task mode to be executed immedialy in asynchronous mode
             #@TestPreamble
             #@TestStep            Execute a restart in task
-            #@TestStep            Specify the -t option with the value non null  to schedule an  execution
             #@TestPostamble
             #@TestResult
             -->
@@ -77,13 +77,17 @@
                 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
                 'dsBindDN'    : DIRECTORY_INSTANCE_DN,
                 'dsBindPwd'   : DIRECTORY_INSTANCE_PSWD,
-                'dsRestart'   : ' ',
-                'dsStopTime'  : '20061212000000',
-                'knownIssue'  : '3909' ,
-                'expectedRC'  : '89'
+                'dsRestart'   : ' '
                 }
               </call>
-                                     
+
+              <!--- Check that DS started -->
+              <call function="'isAlive'">
+               { 'noOfLoops'		: 10 ,
+                 'noOfMilliSeconds' : 2000
+               }
+              </call>
+
               <call function="'testCase_Postamble'"/>
             </sequence>
           </testcase>
@@ -95,7 +99,6 @@
             #@TestPurpose         Schedule a stop in task mode to be executed immedialy in asynchronous mode
             #@TestPreamble
             #@TestStep            Execute a stop in task mode
-            #@TestStep            Specify the -t option with the value non null to schedule an execution
             #@TestPostamble
             #@TestResult
             -->
@@ -111,9 +114,6 @@
                 'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
                 'dsBindDN'    : DIRECTORY_INSTANCE_DN,
                 'dsBindPwd'   : DIRECTORY_INSTANCE_PSWD,
-                'dsStopTime'  : '20061212000000',
-                'knownIssue'  : '3909' ,
-                'expectedRC'  : '89'
                 }
               </call>
            
@@ -143,7 +143,49 @@
               <call function="'testCase_Postamble'"/>
             </sequence>
           </testcase>
+          
+          <!--- Test Case information
+            #@TestMarker          Restart tasks
+            #@TestName            Restart task in asynchronous mode with date in the past
+            #@TestPurpose         Schedule a restart in task mode to be executed in asynchronous mode
+                                  with date in the past
+            #@TestPreamble
+            #@TestStep            Execute a restart in task with date in the past
+            #@TestStep            Specify the -t option with date in the past
+            #@TestPostamble
+            #@TestResult
+            -->
   
+          <testcase name="getTestCaseName('schedule restart task for scheduled execution with date in the past')">
+            <sequence>
+              <call function="'testCase_Preamble'"/>
+              
+              
+              <call function="'StopDsWithScript'">
+                { 'location'  : STAF_REMOTE_HOSTNAME,
+                'dsHost'      : DIRECTORY_INSTANCE_HOST,
+                'dsAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+                'dsBindDN'    : DIRECTORY_INSTANCE_DN,
+                'dsBindPwd'   : DIRECTORY_INSTANCE_PSWD,
+                'dsRestart'   : ' ',
+                'dsStopTime'  : '20061212000000',
+                'expectedRC'  : 89
+                }
+              </call>
+
+              <script>
+                returnString = STAXResult[0][1]
+              </script>
+              <call function="'checktestString'">
+                {'returnString'     : returnString ,
+                  'expectedString'  : 'The specified stop time \'20061212000000\' has already passed'
+                }
+              </call>
+                                             
+              <call function="'testCase_Postamble'"/>
+            </sequence>
+          </testcase>
+          
         </sequence>
         <finally>
           <sequence>
diff --git a/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml b/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml
index a0d7944..2d8e0cb 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/tasks/restore_db.xml
@@ -24,7 +24,7 @@
  ! CDDL HEADER END
  !
  !      Copyright 2007-2009 Sun Microsystems, Inc.
- !      Portions Copyright 2011 ForgeRock AS.
+ !      Portions Copyright 2011-2013 ForgeRock AS.
 ! -->
 <stax>
   <defaultcall function="restore_db"/>
@@ -212,7 +212,7 @@
                 import java.text.SimpleDateFormat
   
                 cal = java.util.Calendar.getInstance()
-                cal.add(java.util.Calendar.SECOND,30)
+                cal.add(java.util.Calendar.SECOND,120)
   
                 dateFormat = java.text.SimpleDateFormat("yyyyMMddHHmmss")
   
@@ -363,7 +363,47 @@
               <call function="'testCase_Postamble'"/>
             </sequence>
           </testcase>
+
+          <!--- Test Case information
+            #@TestMarker          Restore tasks
+            #@TestName            Restore task in asynchronous mode with date in the past
+            #@TestPurpose         Schedule a restore in task mode to be executed in asynchronous mode
+                                  with date in the past
+            #@TestPreamble
+            #@TestStep            Execute a restore in task with date in the past
+            #@TestStep            Specify the -t option with date in the past
+            #@TestPostamble
+            #@TestResult
+            -->
   
+          <testcase name="getTestCaseName('schedule restart task for scheduled execution with date in the past')">
+            <sequence>
+              <call function="'testCase_Preamble'"/>
+              
+              <call function="'restore'">
+                { 'location'          : STAF_REMOTE_HOSTNAME ,
+                'dsInstanceHost'      : DIRECTORY_INSTANCE_HOST,
+                'dsInstanceAdminPort' : DIRECTORY_INSTANCE_ADMIN_PORT,
+                'dsInstanceDn'        : DIRECTORY_INSTANCE_DN,
+                'dsInstancePswd'      : DIRECTORY_INSTANCE_PSWD,
+                'backupDir'           : '%s/tasks/backup_synchronous' % remote.temp,
+                'startTask'           : '20061212000000',
+                'expectedRC'          : 1 }
+              </call>
+
+              <script>
+                returnString = STAXResult[0][1]
+              </script>
+              <call function="'checktestString'">
+                {'returnString'     : returnString ,
+                  'expectedString'  : 'The specified start time \'20061212000000\' has already passed'
+                }
+              </call>
+
+              <call function="'testCase_Postamble'"/>
+            </sequence>
+          </testcase>
+
         </sequence>
         <finally>
           <sequence>

--
Gitblit v1.10.0