From 1dac7215f624c61cedb69eb4b28ddec3836890bb Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Mon, 04 Mar 2013 16:35:21 +0000
Subject: [PATCH] CR-1363 Fix ldif-diff testcases and cleanup known issue in clu testsuite

---
 opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml     |   60 +-------------
 opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml                     |   30 +++++++
 opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml         |   35 ++------
 opends/tests/staf-tests/shared/functions/utils.xml                                         |   41 ++++++++++
 opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml |    8 -
 opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml                     |    8 +-
 6 files changed, 91 insertions(+), 91 deletions(-)

diff --git a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml
index 49707d9..ab4cf70 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml
@@ -300,37 +300,13 @@
                   'outputLdif' : '%s/clu/ldif-diff.out' % remote.temp
                   }
                 </call>
-
-                <script>
-                  # Output file
-                  sourceFile = open('%s/clu/ldif-diff.out' % remote.temp,"r")
-                  sortFile = open('%s/clu/ldif-diff_sort.out' % remote.temp,"w")
-
-                  lines = sourceFile.readlines()
-                  lines.sort()
-                  sortFile.writelines(lines)
-
-                  sourceFile.close()
-                  sortFile.close()
-
-                  # Reference file
-                  sourceFile = open('%s/clu/ldif-diff.ref' % local.data,"r")
-                  sortFile = open('%s/clu/ldif-diff_sort.ref' % remote.temp,"w")
-
-                  lines = sourceFile.readlines()
-                  lines.sort()
-                  sortFile.writelines(lines)
-
-                  sourceFile.close()
-                  sortFile.close()
-                </script>
                 
                 <call function="'compareFile'">
                   {
-                  'outputFile' : 'ldif-diff_sort.out' ,
+                  'outputFile' : 'ldif-diff.out' ,
                   'outputPath' : '%s/clu' % remote.temp ,
-                  'refFile'    : 'ldif-diff_sort.ref' ,
-                  'refPath'    : '%s/clu' % remote.temp ,
+                  'refFile'    : 'ldif-diff.ref' ,
+                  'sortFile'   : True
                   }
                 </call>
   
@@ -373,36 +349,12 @@
                   }
                 </call>
                 
-                <script>
-                  # Output file
-                  sourceFile = open('%s/clu/ldif-diff_singlevalue.out' % remote.temp,"r")
-                  sortFile = open('%s/clu/ldif-diff_singlevalue_sort.out' % remote.temp,"w")
-
-                  lines = sourceFile.readlines()
-                  lines.sort()
-                  sortFile.writelines(lines)
-
-                  sourceFile.close()
-                  sortFile.close()
-
-                  # Reference file
-                  sourceFile = open('%s/clu/ldif-diff_singlevalue.ref' % local.data,"r")
-                  sortFile = open('%s/clu/ldif-diff_singlevalue_sort.ref' % remote.temp,"w")
-
-                  lines = sourceFile.readlines()
-                  lines.sort()
-                  sortFile.writelines(lines)
-                    
-                  sourceFile.close()
-                  sortFile.close()
-                </script>
-                
                 <call function="'compareFile'">
                   { 
-                  'outputFile' : 'ldif-diff_singlevalue_sort.out' ,
+                  'outputFile' : 'ldif-diff_singlevalue.out' ,
                   'outputPath' : '%s/clu' % remote.temp ,
-                  'refFile'    : 'ldif-diff_singlevalue_sort.ref' ,
-                  'refPath'    : '%s/clu' % remote.temp ,
+                  'refFile'    : 'ldif-diff_singlevalue.ref' ,
+                  'sortFile'   : True
                   }
                 </call>
   
diff --git a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml
index aff5f5e..23eb875 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/clu/clu_rebuild-index_checkbehavior.xml
@@ -1120,7 +1120,7 @@
               #@TestMarker          rebuild-index check behavior tests
               #@TestName            rebuild-index: clearDegradedState option in 
                                     online mode
-              #@TestIssue           OPENDJ-770 OPENDJ-769
+              #@TestIssue           OPENDJ-770
               #@TestPurpose         Verify that rebuild-index command succeeds
                                     and that the output is correct.
               #@TestPreamble        none
@@ -1272,8 +1272,7 @@
                 <call function="'searchString'">
                   {
                   'returnString'   : returnString ,
-                  'expectedString' : msg ,
-                  'knownIssue'     : 'OPENDJ-769'
+                  'expectedString' : msg
                   }
                 </call>
 
@@ -1308,8 +1307,7 @@
                 <call function="'searchString'">
                   { 
                   'returnString'   : returnString ,
-                  'expectedString' : 'Checked 1048 entries and found 1040 error' ,
-                  'knownIssue'     : 'OPENDJ-769'
+                  'expectedString' : 'Checked 1048 entries and found 1040 error'
                   }
                 </call>
 
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
index 24b88c3..d706989 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/basic/snmp_basic_tests.xml
@@ -88,7 +88,7 @@
   <!--- Test Case information
     #@TestMarker          SNMP MIB values
     #@TestName            snmp_mibvalues: TODO
-    #@TestIssue           OPENDJ-750
+    #@TestIssue           none
     #@TestPurpose         TODO.
     #@TestPreamble        none
     #@TestStep            TODO.
@@ -115,8 +115,7 @@
               'snmpCommunity' : community ,
               'snmpOIDs'      : '' ,
               'snmpStatus'    : 'noError' ,
-              'snmpWalk'      : 'True' ,
-              'knownIssue'    : 'OPENDJ-750'
+              'snmpWalk'      : 'True'
               }
             </call>
 
@@ -373,7 +372,7 @@
   <!--- Test Case information
     #@TestMarker          SNMP MIB values
     #@TestName            snmp_mibvalues: TODO
-    #@TestIssue           3862 OPENDJ-750
+    #@TestIssue           3862
     #@TestPurpose         TODO.
     #@TestPreamble        none
     #@TestStep            TODO.
@@ -435,9 +434,6 @@
                 str(int(DEFAULT_VALUES[key]) + nbLoop)
               
             </script>
-            <call function="'setKnownIssue'">
-              { 'issueId' : 'OPENDJ-750' }
-            </call>
               
             <call function="'testStep'">
               { 'stepMessage' : 'Check value of dsApplIfSearchOps entry' }
@@ -496,7 +492,7 @@
   <!--- Test Case information
     #@TestMarker          SNMP MIB values
     #@TestName            snmp_mibvalues: TODO
-    #@TestIssue           3862 OPENDJ-750
+    #@TestIssue           3862
     #@TestPurpose         TODO.
     #@TestPreamble        none
     #@TestStep            TODO.
@@ -568,9 +564,6 @@
               DEFAULT_VALUES['dsMasterEntries.1'] = \
                 str(int(DEFAULT_VALUES['dsMasterEntries.1']) + nbLoop)
             </script>
-            <call function="'setKnownIssue'">
-              { 'issueId' : 'OPENDJ-750' }
-            </call>
             
             <call function="'testStep'">
               { 'stepMessage' : 'Check value of dsApplIfAddEntryOps entry' }
@@ -629,7 +622,7 @@
    <!--- Test Case information
     #@TestMarker          SNMP MIB values
     #@TestName            snmp_mibvalues: TODO
-    #@TestIssue           3862 OPENDJ-750
+    #@TestIssue           3862
     #@TestPurpose         TODO.
     #@TestPreamble        none
     #@TestStep            TODO.
@@ -690,9 +683,6 @@
               DEFAULT_VALUES['dsMasterEntries.1'] = \
                 str(int(DEFAULT_VALUES['dsMasterEntries.1']) - nbLoop)
             </script>
-            <call function="'setKnownIssue'">
-              { 'issueId' : 'OPENDJ-750' }
-            </call>
             
             <call function="'testStep'">
               { 'stepMessage' : 'Check value of dsApplIfRemoveEntryOps entry' }
@@ -751,7 +741,7 @@
   <!--- Test Case information
     #@TestMarker          SNMP MIB values
     #@TestName            snmp_mibvalues: TODO
-    #@TestIssue           3862 OPENDJ-750
+    #@TestIssue           3862
     #@TestPurpose         TODO.
     #@TestPreamble        none
     #@TestStep            TODO.
@@ -811,9 +801,6 @@
               DEFAULT_VALUES[key] = \
                 str(int(DEFAULT_VALUES[key]) + nbLoop)
             </script>
-            <call function="'setKnownIssue'">
-              { 'issueId' : 'OPENDJ-750' }
-            </call>
             
             <call function="'testStep'">
               { 'stepMessage' : 'Check value of dsApplIfCompareOps entry' }
@@ -872,7 +859,7 @@
   <!--- Test Case information
     #@TestMarker          SNMP MIB values
     #@TestName            snmp_mibvalues: TODO
-    #@TestIssue           3862 OPENDJ-750
+    #@TestIssue           3862
     #@TestPurpose         TODO.
     #@TestPreamble        none
     #@TestStep            TODO.
@@ -934,9 +921,6 @@
               DEFAULT_VALUES[key] = \
                 str(int(DEFAULT_VALUES[key]) + nbLoop)
             </script>
-            <call function="'setKnownIssue'">
-              { 'issueId' : 'OPENDJ-750' }
-            </call>
             
             <call function="'testStep'">
               { 'stepMessage' : 'Check value of dsApplIfModifyEntryOps entry' }
@@ -995,7 +979,7 @@
   <!--- Test Case information
     #@TestMarker          SNMP MIB values
     #@TestName            snmp_mibvalues: TODO
-    #@TestIssue           3862 OPENDJ-750
+    #@TestIssue           3862
     #@TestPurpose         TODO.
     #@TestPreamble        none
     #@TestStep            TODO.
@@ -1105,9 +1089,6 @@
               DEFAULT_VALUES[key] = \
                 str(int(DEFAULT_VALUES[key]) + nbLoop)
             </script>
-            <call function="'setKnownIssue'">
-              { 'issueId' : 'OPENDJ-750' }
-            </call>
             
             <call function="'testStep'">
               { 'stepMessage' : 'Check value of dsApplIfModifyRDNOps entry' }
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
index 14e6136..602ff1b 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/snmp_setup.xml
@@ -464,7 +464,7 @@
                   </try>
                 </sequence>
 
-              </testcase>
+              </testcase>   
 
               <!--- Test Case information
                 #@TestMarker          setup
@@ -487,6 +487,34 @@
                       <call function="'testCase_Preamble'"/>
 
                       <call function="'testStep'">
+                        { 'stepMessage' : 'Copy snmp files to the remote host' }
+                      </call>
+                      <message>
+                        'Copy file %s/snmp/agent.security (on %s) to %s/agent.security (on %s)' % \
+                        (local.data, STAXServiceMachine, remote.temp, STAF_REMOTE_HOSTNAME) 
+                      </message>      
+                      <call function="'copyFile'">
+                        { 
+                        'location'   : STAXServiceMachine ,
+                        'srcfile'    : '%s/snmp/agent.security' % local.data ,
+                        'destfile'   : '%s/agent.security' % remote.temp ,
+                        'remotehost' : STAF_REMOTE_HOSTNAME
+                        }
+                      </call>
+                      <message>
+                        'Copy file %s/snmp/manager.security (on %s) to %s/manager.security (on %s)' % \
+                        (local.data, STAXServiceMachine, remote.temp, STAF_REMOTE_HOSTNAME) 
+                      </message>      
+                      <call function="'copyFile'">
+                        { 
+                        'location'   : STAXServiceMachine ,
+                        'srcfile'    : '%s/snmp/manager.security' % local.data ,
+                        'destfile'   : '%s/manager.security' % remote.temp ,
+                        'remotehost' : STAF_REMOTE_HOSTNAME
+                        }
+                      </call>
+                      
+                      <call function="'testStep'">
                         { 'stepMessage' : 'Get SNMP Connection Handler properties' }
                       </call>
     
diff --git a/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml b/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml
index 0afdc0b..4578e6c 100644
--- a/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml
+++ b/opends/tests/staf-tests/functional-tests/testcases/snmp/v3/snmp_v3.xml
@@ -63,12 +63,12 @@
                 <iterate var="__import" in="importList">
                   <import machine="STAF_LOCAL_HOSTNAME"
                     file="'%s/%s.xml' % (__groupdir,__import)"/>
-                </iterate>                                                                       
+                </iterate>
 
                 <!-- Specific to v3 SNMP tests -->
                 <script>
                    # Default
-                  securityFile = '%s/snmp/manager.security' % remote.data
+                  securityFile = '%s/manager.security' % remote.temp
                   securityLevel = SNMP_PROPERTIES['security-level']    
                   context = SNMP_PROPERTIES['community']
                   oid = 'dsServerType.1'
@@ -79,7 +79,7 @@
                   defSecurityFileProp = SNMP_PROPERTIES['security-agent-file']
                   defSecurityLevelProp = SNMP_PROPERTIES['security-level']
                   newContextProp = 'myContext'
-                  newSecurityFileProp = '%s/snmp/agent.security' % remote.data
+                  newSecurityFileProp = '%s/agent.security' % remote.temp
                   lowUser = 'myUser1'
                   defUser = 'myUser2'
                   highUser = 'myUser3'
@@ -87,7 +87,7 @@
                   lowSecurityLevelProp = 'noauthnopriv'
                   highSecurityLevelProp = 'authpriv'
                   wrongSecurityLevelProp = 'mySecurityLevel'
-                  mySecurityFile = '%s/snmp/manager.security' % remote.data
+                  mySecurityFile = '%s/manager.security' % remote.temp
                   oid = 'dsServerType.1'
                 </script>
                                                     
diff --git a/opends/tests/staf-tests/shared/functions/utils.xml b/opends/tests/staf-tests/shared/functions/utils.xml
index 1702a78..4fda224 100755
--- a/opends/tests/staf-tests/shared/functions/utils.xml
+++ b/opends/tests/staf-tests/shared/functions/utils.xml
@@ -2406,6 +2406,12 @@
         </function-arg-description>
         <function-arg-property name="type" value="filepath"/>
       </function-arg-def>
+      <function-arg-def name="sortFile" type="optional" default="False">
+        <function-arg-description>
+          sort files before diff
+        </function-arg-description>
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
       <function-arg-def name="knownIssue" type="optional" default="None">
         <function-arg-description>
           Known issue. Corresponds to an issue number.
@@ -2503,6 +2509,41 @@
         refRC=RC
       </script>
       
+      <!-- Sort files before diff -->
+      <if expr="sortFile == True" >
+        <sequence>
+          <script>
+            outputFileSorted = '%s_sorted' % outputFile
+            refFileSorted = '%s_sorted' % refFile
+            
+            # Output file
+            sourceFile = open('%s/%s' % (diffPath, outputFile), "r")
+            sortFile = open('%s/%s' % (diffPath, outputFileSorted), "w")
+
+            lines = sourceFile.readlines()
+            lines.sort()
+            sortFile.writelines(lines)
+
+            sourceFile.close()
+            sortFile.close()
+
+            # Reference file
+            sourceFile = open('%s/%s' % (refPath, refFile), "r")
+            sortFile = open('%s/%s' % (diffPath, refFileSorted), "w")
+
+            lines = sourceFile.readlines()
+            lines.sort()
+            sortFile.writelines(lines)
+
+            sourceFile.close()
+            sortFile.close()
+            
+            outputFile = outputFileSorted
+            refFile = refFileSorted
+          </script>
+        </sequence>
+      </if>
+
       <!-- If the copy of 'outputFile' and 'refFile' succeed 
              then compare these files -->
       <if expr="outputRC == 0 and refRC == 0">

--
Gitblit v1.10.0