mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Christophe Sovant
01.26.2013 c290d5625d37f096d6d97e4ff9a6f48742c7a218
CR-1344 Update ldif-diff testcases following fix for issue OPENDJ-778 (part2)
2 files modified
257 ■■■■ changed files
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldapsearch_checkoptions.xml 52 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml 205 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldapsearch_checkoptions.xml
@@ -24,6 +24,7 @@
 ! CDDL HEADER END
 !
 !      Copyright 2008-2009 Sun Microsystems, Inc.
 !      Portions Copyright 2013 ForgeRock AS
 ! -->
<stax>
@@ -112,7 +113,7 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: empty hostname
              #@TestIssue           2619
              #@TestIssue           none
              #@TestPurpose         Verify a parameter error doing an ldapsearch.
              #@TestPreamble        none
              #@TestStep            Do an ldapsearch with an empty hostname.
@@ -137,8 +138,7 @@
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsBaseDN'         : basedn ,
                  'dsFilter'         : dsfilter ,
                  'expectedRC'       : 89 ,
                  'knownIssue'       : '2619'
                  'expectedRC'       : 89
                  }
                </call>
  
@@ -189,12 +189,14 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: no port and no basedn
              #@TestIssue           2619
              #@TestPurpose         Verify a parameter error doing an ldapsearch.
              #@TestIssue           none
              #@TestPurpose         Verify a connection error doing an
                                    ldapsearch without the port option (default
                                    port is 389)
              #@TestPreamble        none
              #@TestStep            Do an ldapsearch with no port and no basedn.
              #@TestPostamble       none
              #@TestResult          Success if ldapsearch returns 89.
              #@TestResult          Success if ldapsearch returns 91.
            -->
            <testcase name="getTestCaseName('ldapsearch: no port and no basedn')">
  
@@ -212,8 +214,7 @@
                  'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsFilter'         : dsfilter ,
                  'expectedRC'       : 89 ,
                  'knownIssue'       : '2619'
                  'expectedRC'       : 91
                  }
                </call>
  
@@ -226,7 +227,7 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: invalid port number and no basedn
              #@TestIssue           2619
              #@TestIssue           none
              #@TestPurpose         Verify a parameter error doing an ldapsearch.
              #@TestPreamble        none
              #@TestStep            Do an ldapsearch with invalid port number 
@@ -252,8 +253,7 @@
                  'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsFilter'         : dsfilter ,
                  'expectedRC'       : 89 ,
                  'knownIssue'       : '2619'
                  'expectedRC'       : 89
                  }
                </call>
  
@@ -386,7 +386,7 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: scope with no option-argument
              #@TestIssue           2619
              #@TestIssue           none
              #@TestPurpose         Verify an invalid credentials error 
                                    doing an ldapsearch.
              #@TestPreamble        none
@@ -414,8 +414,7 @@
                  'dsScope'          : ' ' ,
                  'dsBaseDN'         : basedn ,
                  'dsFilter'         : dsfilter ,
                  'expectedRC'       : 89 ,
                  'knownIssue'       : '2619'
                  'expectedRC'       : 89
                  }
                </call>
  
@@ -428,7 +427,7 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: invalid scope
              #@TestIssue           2619
              #@TestIssue           none
              #@TestPurpose         Verify a parameter error doing an ldapsearch.
              #@TestPreamble        none
              #@TestStep            Do an ldapsearch with an invalid scope.
@@ -454,8 +453,7 @@
                  'dsScope'          : 'bad_scope' ,
                  'dsBaseDN'         : basedn ,
                  'dsFilter'         : dsfilter ,
                  'expectedRC'       : 89 ,
                  'knownIssue'       : '2619'
                  'expectedRC'       : 89
                  }
                </call>
  
@@ -544,7 +542,7 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: no filter
              #@TestIssue           2619
              #@TestIssue           none
              #@TestPurpose         Verify a parameter error doing an ldapsearch.
              #@TestPreamble        none
              #@TestStep            Do an ldapsearch without a filter.
@@ -568,8 +566,7 @@
                  'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsBaseDN'         : basedn ,
                  'expectedRC'       : 89 ,
                  'knownIssue'       : '2619'
                  'expectedRC'       : 89
                  }
                </call>
  
@@ -976,7 +973,7 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: sort order option of bad
              #@TestIssue           2623
              #@TestIssue           none
              #@TestPurpose         Verify a parameter doing an ldapsearch.
              #@TestPreamble        none
              #@TestStep            Do an ldapsearch with the a sort order of bad.
@@ -1002,8 +999,7 @@
                  'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                  'dsSortOrder'      : 'bad_sort' ,
                  'dsBaseDN'         : basedn ,
                  'dsFilter'         : dsfilter ,
                  'knownIssue'       : '2623'
                  'dsFilter'         : dsfilter
                  }
                </call>
  
@@ -1056,7 +1052,7 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: dereference policy of bad
              #@TestIssue           2619
              #@TestIssue           none
              #@TestPurpose         Verify a parameter doing an ldapsearch.
              #@TestPreamble        none
              #@TestStep            Do an ldapsearch with the a dereference 
@@ -1084,8 +1080,7 @@
                  'dsDereferencePolicy' : 'bad_ref' ,
                  'dsBaseDN'            : basedn ,
                  'dsFilter'            : dsfilter ,
                  'expectedRC'          : 89 ,
                  'knownIssue'          : '2619'
                  'expectedRC'          : 89
                  }
                </call>
  
@@ -1137,7 +1132,7 @@
            <!--- Test Case information
              #@TestMarker          ldapsearch check options tests
              #@TestName            ldapsearch: simple page size of 0
              #@TestIssue           2619
              #@TestIssue           none
              #@TestPurpose         Verify a parameter doing an ldapsearch.
              #@TestPreamble        none
              #@TestStep            Do an ldapsearch with the a simple page size
@@ -1165,8 +1160,7 @@
                  'dsSimplePageSize'    : '0' ,             
                  'dsBaseDN'            : basedn ,
                  'dsFilter'            : 'objectclass=*' ,
                  'expectedRC'          : 89 ,
                  'knownIssue'          : '2619'
                  'expectedRC'          : 89
                  }
                </call>
                
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/clu/clu_ldif-diff_checkbehavior.xml
@@ -24,6 +24,7 @@
 ! CDDL HEADER END
 !
 !      Copyright 2008-2009 Sun Microsystems, Inc.
 !      Portions Copyright 2013 ForgeRock AS
 ! -->
<stax>
  
@@ -71,11 +72,112 @@
              targetldif = '%s/clu/ldif-diff_checkbehavior.ldif' \
                           % remote.data
            </script>
            <!--- Test Case information
              #@TestMarker          ldif-diff check behavior tests
              #@TestName            ldif-diff: compare ldif files with no diffs
              #@TestIssue           none
              #@TestPurpose         Test ldif-diff to compare ldif files with
                                    no diffs with useCompareResultCode option
              #@TestPreamble        none
              #@TestStep            Do an ldif-diff to compare ldif files with
                                    no diffs with useCompareResultCode option
              #@TestPostamble       none
              #@TestResult          Success if ldif-diff returns 6.
            -->
            <testcase name="getTestCaseName
            ('ldif-diff: compare ldif files with no diffs and with useCompareResultCode option')">
              <sequence>
                <call function="'testCase_Preamble'"/>
                <message>
                  'ldif-diff: compare ldif files with no diffs'
                </message>
                <call function="'LdifDiffWithScript-new'">
                  {
                  'sourceLdif' : sourceldif ,
                  'targetLdif' : sourceldif ,
                  'outputLdif' : '%s/clu/ldif-diff_nodiffs_rc.out' % remote.temp ,
                  'useCmpRC'   : 'True' ,
                  'expectedRC' : 6
                  }
                </call>
                <script>
                  msg1 = '# No differences were detected between the source'
                  msg2 = 'and target LDIF files'
                </script>
                <call function="'grep'">
                  {
                  'location'  : STAF_REMOTE_HOSTNAME ,
                  'filename'  : '%s/clu/ldif-diff_nodiffs_rc.out' % remote.temp ,
                  'testString': '%s %s' % (msg1, msg2)
                  }
                </call>
                <call function="'testCase_Postamble'"/>
              </sequence>
            </testcase>
            <!--- Test Case information
              #@TestMarker          ldif-diff check behavior tests
              #@TestName            ldif-diff: compare ldif files with diffs
              #@TestIssue           none
              #@TestPurpose         Test ldif-diff to compare ldif files with
                                    diffs with useCompareResultCode option
              #@TestPreamble        none
              #@TestStep            Do an ldif-diff to compare ldif files with
                                    diffs with useCompareResultCode option
              #@TestPostamble       none
              #@TestResult          Success if ldif-diff returns 5.
            -->
            <testcase name="getTestCaseName
            ('ldif-diff: compare ldif files with diffs with useCompareResultCode option')">
              <sequence>
                <call function="'testCase_Preamble'"/>
                <message>
                  'ldif-diff: compare ldif files with diffs'
                </message>
                <call function="'LdifDiffWithScript-new'">
                  {
                  'sourceLdif' : sourceldif ,
                  'targetLdif' : targetldif ,
                  'outputLdif' : '%s/clu/ldif-diff_nodiffs_rc.out' % remote.temp ,
                  'useCmpRC'   : 'True' ,
                  'expectedRC' : 5
                  }
                </call>
                <script>
                  msg = 'dn: uid=user.10,ou=ldapdelete,o=clu tests,dc=example,dc=com'
                </script>
                <call function="'grep'">
                  {
                  'location'  : STAF_REMOTE_HOSTNAME ,
                  'filename'  : '%s/clu/ldif-diff_nodiffs_rc.out' % remote.temp ,
                  'testString': msg
                  }
                </call>
                <call function="'testCase_Postamble'"/>
              </sequence>
            </testcase>
            
            <!--- Test Case information
              #@TestMarker          ldif-diff check behavior tests
              #@TestName            ldif-diff: compare ldif files with no diffs
              #@TestIssue           3111
              #@TestIssue           none
              #@TestPurpose         Test ldif-diff to compare ldif files with 
                                    no diffs
              #@TestPreamble        none
@@ -102,6 +204,18 @@
                  'outputLdif' : '%s/clu/ldif-diff_nodiffs.out' % remote.temp
                  }
                </call>
                <script>
                  msg1 = '# No differences were detected between the source'
                  msg2 = 'and target LDIF files'
                </script>
                <call function="'grep'">
                  {
                  'location'  : STAF_REMOTE_HOSTNAME ,
                  'filename'  : '%s/clu/ldif-diff_nodiffs.out' % remote.temp ,
                  'testString': '%s %s' % (msg1, msg2)
                  }
                </call>
                
                <call function="'testCase_Postamble'"/>
                
@@ -112,14 +226,14 @@
            <!--- Test Case information
              #@TestMarker          ldif-diff check behavior tests
              #@TestName            ldif-diff: compare ldif files with diffs
              #@TestIssue           2641
              #@TestIssue           none
              #@TestPurpose         Test ldif-diff to compare ldif files with 
                                    diffs
              #@TestPreamble        none
              #@TestStep            Do an ldif-diff to compare ldif files with
                                    diffs
              #@TestPostamble       none
              #@TestResult          Success if ldif-diff returns 1.
              #@TestResult          Success if ldif-diff returns 0.
            -->
            <testcase name="getTestCaseName
            ('ldif-diff: compare ldif files with diffs')">
@@ -136,9 +250,18 @@
                  {
                  'sourceLdif' : sourceldif ,
                  'targetLdif' : targetldif ,
                  'outputLdif' : '%s/clu/ldif-diff_withdiffs.out' % remote.temp ,
                  'expectedRC' : 1 ,
                  'knownIssue' : '2641'
                  'outputLdif' : '%s/clu/ldif-diff_withdiffs.out' % remote.temp
                  }
                </call>
                <script>
                  msg = 'dn: uid=user.10,ou=ldapdelete,o=clu tests,dc=example,dc=com'
                </script>
                <call function="'grep'">
                  {
                  'location'  : STAF_REMOTE_HOSTNAME ,
                  'filename'  : '%s/clu/ldif-diff_withdiffs.out' % remote.temp ,
                  'testString': msg
                  }
                </call>
                
@@ -151,7 +274,7 @@
            <!--- Test Case information
              #@TestMarker          ldif-diff check behavior tests
              #@TestName            ldif-diff: check diff file
              #@TestIssue           3111
              #@TestIssue           none
              #@TestPurpose         Check ldif file generated by ldif-diff
              #@TestPreamble        none
              #@TestStep            Do an ldif-diff to compare ldif files with
@@ -174,17 +297,40 @@
                  {
                  'sourceLdif' : sourceldif ,
                  'targetLdif' : targetldif ,
                  'outputLdif' : '%s/clu/ldif-diff.out' % remote.temp ,
                  'expectedRC' : 'noCheck'
                  '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.out' ,
                  'outputFile' : 'ldif-diff_sort.out' ,
                  'outputPath' : '%s/clu' % remote.temp ,
                  'refFile'    : 'ldif-diff.ref',
                  'knownIssue' : '3111'
                  'refFile'    : 'ldif-diff_sort.ref' ,
                  'refPath'    : '%s/clu' % remote.temp ,
                  }
                </call>
  
@@ -197,7 +343,7 @@
            <!--- Test Case information
              #@TestMarker          ldif-diff check behavior tests
              #@TestName            ldif-diff: check diff file
              #@TestIssue           3111
              #@TestIssue           none
              #@TestPurpose         Check ldif file generated by ldif-diff
              #@TestPreamble        none
              #@TestStep            Do an ldif-diff to compare ldif files with
@@ -223,17 +369,40 @@
                  'targetLdif'         : targetldif ,
                  'outputLdif'         : '%s/clu/ldif-diff_singlevalue.out' \
                                         % remote.temp ,
                  'singleValueChanges' : 'True' ,
                  'expectedRC'         : 'noCheck'
                  'singleValueChanges' : 'True'
                  }
                </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.out' ,
                  'outputFile' : 'ldif-diff_singlevalue_sort.out' ,
                  'outputPath' : '%s/clu' % remote.temp ,
                  'refFile'    : 'ldif-diff_singlevalue.ref' ,
                  'knownIssue' : '3111'
                  'refFile'    : 'ldif-diff_singlevalue_sort.ref' ,
                  'refPath'    : '%s/clu' % remote.temp ,
                  }
                </call>