From 404fb6b841fda73b21d3c145a4232a6f10865d09 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Mon, 17 Mar 2008 11:37:59 +0000
Subject: [PATCH] Add testsuite for manage-tasks and dbtest tools

---
 opendj-sdk/opends/tests/functional-tests/testcases/clu/clu.xml                            |   10 
 opendj-sdk/opends/tests/functional-tests/shared/data/clu/disconnect.ldif                  |   14 
 opendj-sdk/opends/tests/functional-tests/testcases/clu/clu_manage-tasks_checkbehavior.xml |  437 +++++++++++++++++++++++++++
 opendj-sdk/opends/tests/shared/functions/dsadm.xml                                        |    2 
 opendj-sdk/opends/tests/functional-tests/testcases/clu/clu_dbtest_checkbehavior.xml       |  443 +++++++++++++++++++++++++++
 5 files changed, 905 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/tests/functional-tests/shared/data/clu/disconnect.ldif b/opendj-sdk/opends/tests/functional-tests/shared/data/clu/disconnect.ldif
new file mode 100644
index 0000000..37afa3e
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/shared/data/clu/disconnect.ldif
@@ -0,0 +1,14 @@
+dn: ds-task-id=125,cn=Scheduled Tasks,cn=Tasks
+objectclass: ds-task-disconnect
+ds-task-class-name: org.opends.server.tasks.DisconnectClientTask
+ds-task-disconnect-connection-id: 99
+ds-task-disconnect-message: This task is explicitly disconnected.
+ds-task-disconnect-notify-client: true
+
+dn: ds-task-id=126,cn=Scheduled Tasks,cn=Tasks
+objectclass: ds-task-disconnect
+ds-task-class-name: org.opends.server.tasks.DisconnectClientTask
+ds-task-disconnect-connection-id: 99
+ds-task-disconnect-message: This task is explicitly disconnected.
+ds-task-disconnect-notify-client: true
+ds-task-scheduled-start-time: 20481212000000
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu.xml b/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu.xml
index 184890d..549fba2 100644
--- a/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu.xml
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu.xml
@@ -47,6 +47,14 @@
           
           <call function="'testGroup_Preamble'"/>
           
+          <!--- 
+            Links between tests:
+            - clu_ldapdelete_checkbehavior remove one entry under dc=com
+            - clu_rebuild-index_checkbehavior add a new index
+            - clu_make-ldif_checkbehavior import new data
+            => this has an impact on clu_rebuild-index_checkbehavior,
+               clu_verify-index_checkbehavior and clu_dbtest_checkbehavior            
+          -->         
           <script>
             testList = []
             testList.append(['.','clu_setup'])
@@ -65,6 +73,8 @@
             testList.append(['.','clu_encode-password_checkbehavior'])
             testList.append(['.','clu_make-ldif_checkbehavior'])
             testList.append(['.','clu_list-backends_checkbehavior'])
+            testList.append(['.','clu_manage-tasks_checkbehavior'])
+            testList.append(['.','clu_dbtest_checkbehavior'])
             testList.append(['.','clu_cleanup'])
           </script>
           
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu_dbtest_checkbehavior.xml b/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu_dbtest_checkbehavior.xml
new file mode 100644
index 0000000..a10f2ff
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu_dbtest_checkbehavior.xml
@@ -0,0 +1,443 @@
+<?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 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  
+  <defaultcall function="clu_dbtest_checkbehavior"/>
+  
+  <function name="clu_dbtest_checkbehavior">
+    
+    <sequence>
+      
+      <block name="'clu_dbtest_checkbehavior'">
+        
+        <sequence>
+          
+          <!--- Test Suite information
+            #@TestSuiteName     dbtest check behavior tests
+            #@TestSuitePurpose  Test the results of the dbtest command.
+            #@TestSuiteGroup    dbtest check behavior tests
+            #@TestScript        clu_dbtest_checkbehavior.xml
+          -->
+          
+          <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group'] = 'clu'              
+            CurrentTestPath['suite'] = STAXCurrentBlock
+          </script>
+          
+          <call function="'testSuite_Preamble'"/>
+          
+          <!--- Test Case information
+            #@TestMarker          dbtest check behavior tests
+            #@TestName            dbtest: list root containers
+            #@TestIssue           none
+            #@TestPurpose         Test dbtest with list-root-containers option
+            #@TestPreamble        none
+            #@TestStep            Do an dbtest with list-root-containers option.
+            #@TestStep            Check the output of the command.            
+            #@TestPostamble       none
+            #@TestResult          Success if dbtest returns 0 and if the
+                                  output is correct.
+          -->
+          <testcase name="getTestCaseName('dbtest: list root containers')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'dbtest: list root containers'
+              </message>
+              
+              <call function="'dbtestWithScript'">
+                {
+                'subcommand'    : 'list-root-containers'
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]              
+              </script>
+                             
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'userRoot    db'
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'Total: 1'
+                }
+              </call>
+              
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>
+          
+          <!--- Test Case information
+            #@TestMarker          dbtest check behavior tests
+            #@TestName            dbtest: list entry containers
+            #@TestIssue           none
+            #@TestPurpose         Test dbtest with list-entry-containers option
+                                  for backend userRoot
+            #@TestPreamble        none
+            #@TestStep            Do an dbtest with list-entry-containers option
+                                  for backend userRoot.
+            #@TestStep            Check the output of the command.            
+            #@TestPostamble       none
+            #@TestResult          Success if dbtest returns 0 and if the
+                                  output is correct.
+          -->
+          <testcase name="getTestCaseName('dbtest: list entry containers')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'dbtest: list entry containers for backend userRoot'
+              </message>
+          
+              <call function="'dbtestWithScript'">
+                {
+                'subcommand'    : 'list-entry-containers' ,
+                'dsBackendID'   : 'userRoot'
+                }
+              </call>
+
+              <script>
+                returnString = STAXResult[0][1]
+              </script>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'dc=com    dc_com              1208'
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'dc=mycom  dc_mycom            11'
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'Total: 2'
+                }
+              </call>
+              
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>
+          
+          <!--- Test Case information
+            #@TestMarker          dbtest check behavior tests
+            #@TestName            dbtest: list index status
+            #@TestIssue           none
+            #@TestPurpose         Test dbtest with list-index-status option
+                                  for backend userRoot and baseDN dc=com
+            #@TestPreamble        none
+            #@TestStep            Do an dbtest with list-index-status option
+                                  for backend userRoot and baseDN dc=com.
+            #@TestStep            Check the output of the command.            
+            #@TestPostamble       none
+            #@TestResult          Success if dbtest returns 0 and if the
+                                  output is correct.
+          -->
+          <testcase name="getTestCaseName('dbtest: list index status')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'dbtest: list index status for backend userRoot and \
+                baseDN dc=com'
+              </message>
+              
+              <call function="'dbtestWithScript'">
+                {
+                'subcommand'    : 'list-index-status' ,
+                'dsBaseDN'      : 'dc=com' ,
+                'dsBackendID'   : 'userRoot'
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+              </script>
+
+              <script>
+                msg1 = 'uid.equality               Index'
+                msg2 = 'dc_com_uid.equality               true'
+              </script>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : '%s       %s' % (msg1, msg2)
+                }
+              </call>
+              
+              <script>
+                msg1 = 'st.equality                Index'
+                msg2 = 'dc_com_st.equality                true'
+              </script>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : '%s       %s' % (msg1, msg2)
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'Total: 20'
+                }
+              </call>             
+           
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>
+          
+          <!--- Test Case information
+            #@TestMarker          dbtest check behavior tests
+            #@TestName            dbtest: list database containers
+            #@TestIssue           none
+            #@TestPurpose         Test dbtest with list-database-containers
+                                  option for backend userRoot and baseDN dc=com
+            #@TestPreamble        none
+            #@TestStep            Do an dbtest with list-root-containers option.
+            #@TestStep            Check the output of the command.            
+            #@TestPostamble       none
+            #@TestResult          Success if dbtest returns 0 and if the
+                                  output is correct.
+          -->
+          <testcase name="getTestCaseName('dbtest: list database containers')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'dbtest: list database containers for backend userRoot \
+                and baseDN dc=com'
+              </message>
+          
+              <call function="'dbtestWithScript'">
+                {
+                'subcommand'    : 'list-database-containers' ,
+                'dsBaseDN'      : 'dc=com' ,
+                'dsBackendID'   : 'userRoot'
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+              </script>
+
+              <script>
+                msg1 = 'dn2id                      DN2ID'
+                msg2 = 'dc_com_dn2id                      1208'
+              </script>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : '%s          %s' % (msg1, msg2)
+                }
+              </call>
+              
+              <script>
+                msg1 = 'id2entry                   ID2Entry'
+                msg2 = 'dc_com_id2entry                   1208'
+              </script>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : '%s       %s' % (msg1, msg2)
+                }
+              </call>              
+
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'Total: 24'
+                }
+              </call>
+              
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>
+
+          <!--- Test Case information
+            #@TestMarker          dbtest check behavior tests
+            #@TestName            dbtest: dump database container
+            #@TestIssue           none
+            #@TestPurpose         Test dbtest with dump database container
+                                  option for backend userRoot, baseDN dc=com
+                                  and database st.equality
+            #@TestPreamble        none
+            #@TestStep            Do an dbtest with dump database container
+                                  option for backend userRoot, baseDN dc=com
+                                  and database dn2entry.
+            #@TestStep            Check the output of the command.
+            #@TestStep            Do an dbtest with dump database container
+                                  option for backend userRoot, baseDN dc=com,
+                                  database st.equality, minSize 176
+                                  and maxSize 184.
+            #@TestStep            Check the output of the command.
+            #@TestStep            Do an dbtest with dump database container
+                                  option for backend userRoot, baseDN dc=com,
+                                  database st.equality, minKey wv 
+                                  and maxKey wy.
+            #@TestStep            Check the output of the command.            
+            #@TestPostamble       none
+            #@TestResult          Success if dbtest returns 0 and if the
+                                  output is correct.
+          -->
+          <testcase name="getTestCaseName('dbtest: dump database container')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'dbtest: dump database container for backend userRoot, \
+                baseDN dc=com and database dn2entry'
+              </message>
+          
+              <call function="'dbtestWithScript'">
+                {
+                'subcommand'     : 'dump-database-container' ,
+                'dsBaseDN'       : 'dc=com' ,
+                'dsBackendID'    : 'userRoot' ,
+                'dsDatabaseName' : 'dn2id'
+                }
+              </call>
+              
+               <script>
+                returnString = STAXResult[0][1]
+              </script>
+
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'Total Records: 1208'
+                }
+              </call>
+
+              <message>
+                'dbtest: dump database container for backend userRoot, \
+                baseDN dc=com, database st.equality, minSize 176, maxSize 184'
+              </message>
+          
+              <call function="'dbtestWithScript'">
+                {
+                'subcommand'     : 'dump-database-container' ,
+                'dsBaseDN'       : 'dc=com' ,
+                'dsBackendID'    : 'userRoot' ,
+                'dsDatabaseName' : 'st.equality' ,
+                'dsMinDataSize'  : 176 ,
+                'dsMaxDataSize'  : 184
+                }
+              </call>
+              
+               <script>
+                returnString = STAXResult[0][1]
+              </script>
+
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'Total Records: 6'
+                }
+              </call> 
+              
+              <message>
+                'dbtest: dump database container for backend userRoot, \
+                baseDN dc=com, database st.equality, minKey wv, maxKey wy'
+              </message>
+          
+              <call function="'dbtestWithScript'">
+                {
+                'subcommand'     : 'dump-database-container' ,
+                'dsBaseDN'       : 'dc=com' ,
+                'dsBackendID'    : 'userRoot' ,
+                'dsDatabaseName' : 'st.equality' ,
+                'dsMinKeyValue'  : 'wv' ,
+                'dsMaxKeyValue'  : 'wy'
+                }
+              </call>
+              
+               <script>
+                returnString = STAXResult[0][1]
+              </script>
+
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'Total Records: 2'
+                }
+              </call>         
+              
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>          
+          
+          <call function="'testSuite_Postamble'"/>
+          
+        </sequence>
+        
+      </block>
+      
+    </sequence>
+    
+  </function>
+  
+</stax>
diff --git a/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu_manage-tasks_checkbehavior.xml b/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu_manage-tasks_checkbehavior.xml
new file mode 100644
index 0000000..51347d6
--- /dev/null
+++ b/opendj-sdk/opends/tests/functional-tests/testcases/clu/clu_manage-tasks_checkbehavior.xml
@@ -0,0 +1,437 @@
+<?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 Sun Microsystems, Inc.
+ ! -->
+<stax>
+  
+  <defaultcall function="clu_manage-tasks_checkbehavior"/>
+  
+  <function name="clu_manage-tasks_checkbehavior">
+    
+    <sequence>
+      
+      <block name="'clu_manage-tasks_checkbehavior'">
+        
+        <sequence>
+          
+          <!--- Test Suite information
+            #@TestSuiteName     manage-tasks check behavior tests
+            #@TestSuitePurpose  Test the results of the manage-tasks command.
+            #@TestSuiteGroup    manage-tasks check behavior tests
+            #@TestScript        clu_manage-tasks_checkbehavior.xml
+          -->
+          
+          <script>
+            if not CurrentTestPath.has_key('group'):
+              CurrentTestPath['group'] = 'clu'              
+            CurrentTestPath['suite'] = STAXCurrentBlock
+          </script>
+          
+          <call function="'testSuite_Preamble'"/>
+          
+          <!--- Define default value for template -->
+          <script>
+            task = '%s/clu/disconnect.ldif' % logsRemoteDataDir
+          </script>
+          
+          <!--- Test Case information
+            #@TestMarker          manage-tasks check behavior tests
+            #@TestName            manage-tasks: summary of tasks
+            #@TestIssue           none
+            #@TestPurpose         Test manage-tasks with summary option
+            #@TestPreamble        none
+            #@TestStep            Do an manage-tasks with -s option.
+            #@TestStep            Check that task 125 and 126 are displayed.            
+            #@TestPostamble       none
+            #@TestResult          Success if manage-tasks returns 0 and if the
+                                  output is correct.
+          -->
+          <testcase name="getTestCaseName
+          ('manage-tasks: get summary of tasks')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'manage-tasks: create two tasks with taskID 125 and 126'
+              </message>
+              
+              <call function="'ldapModifyWithScript'">
+                {
+                'dsInstanceHost'    : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'    : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'      : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'    : DIRECTORY_INSTANCE_PSWD ,
+                'dsAdd'             : 'True' ,
+                'dsFilename'        : task
+                }
+              </call>
+              
+              <message>
+                'manage-tasks: check that these tasks appear in the summary'
+              </message>
+              
+              <call function="'manage-tasks'">
+                {
+                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsSummary'        : 'True' ,
+                'dsQuiet'          : 'True'
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+                msg1 = '125  Disconnect Client  Completed with errors'
+                msg2 = '126  Disconnect Client  Waiting on start time'
+              </script>
+                             
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg1
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg2
+                }
+              </call>
+              
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>
+          
+          <!--- Test Case information
+            #@TestMarker          manage-tasks check behavior tests
+            #@TestName            manage-tasks: info option
+            #@TestIssue           none
+            #@TestPurpose         Test manage-tasks with info option
+            #@TestPreamble        none
+            #@TestStep            Do an manage-tasks with -i option on task 125.
+            #@TestStep            Check some information for task 125.
+            #@TestStep            Do an manage-tasks with -i option on task 126.
+            #@TestStep            Check some information for task 126.            
+            #@TestPostamble       none
+            #@TestResult          Success if manage-tasks returns 0 and if the
+                                  outputs are correct.
+          -->
+          <testcase name="getTestCaseName
+          ('manage-tasks: get task information')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'manage-tasks: get information for task 125'
+              </message>
+              
+              <call function="'manage-tasks'">
+                {
+                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsInfo'           : 125 ,
+                'dsQuiet'          : 'True'
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+                msg1 = 'ID                        125'
+                msg2 = 'Type                      Disconnect Client'
+                msg3 = 'Status                    Completed with errors'
+                msg4 = 'Scheduled Start Time      Immediate execution'              
+              </script>
+                             
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg1
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg2
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg3
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg4
+                }
+              </call>    
+              
+              <message>
+                'manage-tasks: get information for task 126'
+              </message>
+              
+              <call function="'manage-tasks'">
+                {
+                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsInfo'           : 126 ,
+                'dsQuiet'          : 'True'
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+                msg1 = 'ID                        126'
+                msg2 = 'Type                      Disconnect Client'
+                msg3 = 'Status                    Waiting on start time'
+                msg4 = 'Scheduled Start Time      Dec 12, 2048 12:00:00 AM MET'
+              </script>
+                             
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg1
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg2
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg3
+                }
+              </call>
+              
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : msg4
+                }
+              </call>   
+              
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>
+          
+          <!--- Test Case information
+            #@TestMarker          manage-tasks check behavior tests
+            #@TestName            manage-tasks: cancel option
+            #@TestIssue           none
+            #@TestPurpose         Test manage-tasks with cancel option
+                                  with seed 0
+            #@TestPreamble        none
+            #@TestStep            Do an manage-tasks with -c option on task 125.
+            #@TestStep            Check the output of the previous command.
+            #@TestStep            Do an manage-tasks with -c option on task 126.
+            #@TestStep            Check the output of the previous command.           
+            #@TestPostamble       none
+            #@TestResult          Success if manage-tasks return 1 for task 125,
+                                  0 for task 126 and if the outputs are correct.
+          -->
+          <testcase name="getTestCaseName('manage-tasks: cancel task')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'manage-tasks: cancel the task 125'
+              </message>
+          
+              <call function="'manage-tasks'">
+                {
+                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsCancel'         : 125 ,
+                'dsQuiet'          : 'True' ,
+                'expectedRC'       : 1
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+              </script>
+                             
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'task 125 is not in a cancelable state'
+                }
+              </call>
+              
+              <message>
+                'manage-tasks: cancel the task 126'
+              </message>
+              
+              <call function="'manage-tasks'">
+                {
+                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsCancel'         : 126 ,
+                'dsQuiet'          : 'True'
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+              </script>
+                             
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : 'Task 126 canceled'
+                }
+              </call>
+              
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>
+
+          <!--- Test Case information
+            #@TestMarker          manage-tasks check behavior tests
+            #@TestName            manage-tasks: invalid task
+            #@TestIssue           none
+            #@TestPurpose         Test manage-tasks with an invalid task
+            #@TestPreamble        none
+            #@TestStep            Do an manage-tasks with -c option and an
+                                  invalid task.
+            #@TestStep            Check the output of the previous command.
+            #@TestStep            Do an manage-tasks with -i option and an
+                                  invalid task.
+            #@TestStep            Check the output of the previous command.
+            #@TestPostamble       none
+            #@TestResult          Success if manage-tasks return 1 and if
+                                  the outputs are correct.
+          -->
+          <testcase name="getTestCaseName('manage-tasks: invalid task')">
+            
+            <sequence>
+              
+              <call function="'testCase_Preamble'"/>
+              
+              <message>
+                'manage-tasks: information for an invalid task'
+              </message>
+          
+              <call function="'manage-tasks'">
+                {
+                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsCancel'         : 124 ,
+                'dsQuiet'          : 'True' ,
+                'expectedRC'       : 1
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+                msg1 = 'Error canceling task \'124\': There are no tasks'
+                msg2 = 'defined with ID \'124\''
+              </script>
+                             
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : '%s %s' % (msg1, msg2)
+                }
+              </call>
+              
+              <message>
+                'manage-tasks: information on an invalid task'
+              </message>
+              
+              <call function="'manage-tasks'">
+                {
+                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
+                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
+                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
+                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
+                'dsCancel'         : 124 ,
+                'dsQuiet'          : 'True' ,
+                'expectedRC'       : 1
+                }
+              </call>
+              
+              <script>
+                returnString = STAXResult[0][1]
+              </script>
+                             
+              <call function="'checktestString'">
+                { 
+                'returnString'   : returnString ,
+                'expectedString' : '%s %s' % (msg1, msg2)
+                }
+              </call>
+              
+              <call function="'testCase_Postamble'"/>
+              
+            </sequence>
+            
+          </testcase>          
+          <call function="'testSuite_Postamble'"/>
+          
+        </sequence>
+        
+      </block>
+      
+    </sequence>
+    
+  </function>
+  
+</stax>
diff --git a/opendj-sdk/opends/tests/shared/functions/dsadm.xml b/opendj-sdk/opends/tests/shared/functions/dsadm.xml
index ec8d1c6..73b3386 100755
--- a/opendj-sdk/opends/tests/shared/functions/dsadm.xml
+++ b/opendj-sdk/opends/tests/shared/functions/dsadm.xml
@@ -4552,7 +4552,7 @@
           STAFCmdParamsList.append('-k %s' % dsMinKeyValue)
           
         if dsMaxKeyValue:
-          STAFCmdParamsList.append('-K %s' % dsMinKeyValue)
+          STAFCmdParamsList.append('-K %s' % dsMaxKeyValue)
           
         if dsSkipDecode:
           STAFCmdParamsList.append('-p')

--
Gitblit v1.10.0