CR-2055 Use "useCompareResultCode" option for ldif-diff and ldapcompare tools
| | |
| | | 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD , |
| | | 'dsDn' : ['postalCode:63792' , |
| | | '%s' % dsdn] , |
| | | 'useCmpRC' : 'True' , |
| | | 'expectedRC' : 6 |
| | | } |
| | | </call> |
| | |
| | | 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD , |
| | | 'dsDn' : ['postalCode:00000' , |
| | | '%s' % dsdn] , |
| | | 'useCmpRC' : 'True' , |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | |
| | | 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD , |
| | | 'dsDn' : ['postalCode:63792' , |
| | | '%s' % dsdn] , |
| | | 'useCmpRC' : 'False' , |
| | | 'expectedRC' : 0 |
| | | } |
| | | </call> |
| | |
| | | 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD , |
| | | 'dsDn' : ['postalCode:00000' , |
| | | '%s' % dsdn] , |
| | | 'useCmpRC' : 'False' , |
| | | 'expectedRC' : 0 |
| | | } |
| | | </call> |
| | |
| | | 'dsDn' : ['st:NY' , |
| | | '%s' % dn1 , |
| | | '%s' % dn2] , |
| | | 'useCmpRC' : 'True' , |
| | | 'expectedRC' : 6 |
| | | } |
| | | </call> |
| | |
| | | 'dsDn' : ['postalCode:89759' , |
| | | '%s' % dn1 , |
| | | '%s' % dn2] , |
| | | 'useCmpRC' : 'True' , |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checktestRC'"> |
| | | { |
| | | 'returncode' : STAXResult , |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <message> |
| | | 'ldapsearch: check output with simplePageSize of 1' |
| | | </message> |
| | |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checktestRC'"> |
| | | { |
| | | 'returncode' : STAXResult , |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <call function="'testCase_Postamble'"/> |
| | | |
| | | </sequence> |
| | |
| | | 'ldif-diff: compare ldif files with no diffs' |
| | | </message> |
| | | |
| | | <call function="'LdifDiffWithScript-new'"> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { |
| | | 'sourceLdif' : sourceldif , |
| | | 'targetLdif' : sourceldif , |
| | | 'outputLdif' : '%s/clu/ldif-diff_nodiffs_rc.out' % remote.temp , |
| | | 'useCmpRC' : 'True' , |
| | | 'expectedRC' : 6 |
| | | 'outputLdif' : '%s/clu/ldif-diff_nodiffs_rc.out' % remote.temp |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'ldif-diff: compare ldif files with diffs' |
| | | </message> |
| | | |
| | | <call function="'LdifDiffWithScript-new'"> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { |
| | | 'sourceLdif' : sourceldif , |
| | | 'targetLdif' : targetldif , |
| | | 'outputLdif' : '%s/clu/ldif-diff_nodiffs_rc.out' % remote.temp , |
| | | 'useCmpRC' : 'True' , |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | |
| | | 'ldif-diff: compare ldif files with no diffs' |
| | | </message> |
| | | |
| | | <call function="'LdifDiffWithScript-new'"> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { |
| | | 'sourceLdif' : sourceldif , |
| | | 'targetLdif' : sourceldif , |
| | | 'outputLdif' : '%s/clu/ldif-diff_nodiffs.out' % remote.temp |
| | | 'outputLdif' : '%s/clu/ldif-diff_nodiffs.out' % remote.temp , |
| | | 'useCmpRC' : 'False' , |
| | | 'expectedRC' : 0 |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'ldif-diff: compare ldif files with diffs' |
| | | </message> |
| | | |
| | | <call function="'LdifDiffWithScript-new'"> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { |
| | | 'sourceLdif' : sourceldif , |
| | | 'targetLdif' : targetldif , |
| | | 'outputLdif' : '%s/clu/ldif-diff_withdiffs.out' % remote.temp |
| | | 'outputLdif' : '%s/clu/ldif-diff_withdiffs.out' % remote.temp , |
| | | 'useCmpRC' : 'False' , |
| | | 'expectedRC' : 0 |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'ldif-diff: check diff file' |
| | | </message> |
| | | |
| | | <call function="'LdifDiffWithScript-new'"> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { |
| | | 'sourceLdif' : sourceldif , |
| | | 'targetLdif' : targetldif , |
| | | 'outputLdif' : '%s/clu/ldif-diff.out' % remote.temp |
| | | 'outputLdif' : '%s/clu/ldif-diff.out' % remote.temp , |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'ldif-diff: check diff file with single value changes' |
| | | </message> |
| | | |
| | | <call function="'LdifDiffWithScript-new'"> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { |
| | | 'sourceLdif' : sourceldif , |
| | | 'targetLdif' : targetldif , |
| | | 'outputLdif' : '%s/clu/ldif-diff_singlevalue.out' \ |
| | | % remote.temp , |
| | | 'singleValueChanges' : 'True' |
| | | 'singleValueChanges' : 'True' , |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2008-2009 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2013 ForgeRock AS |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | 'outputLdif' : '%s/clu/ldifmodify.diff' % remote.temp |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checktestRC'"> |
| | | { |
| | | 'returncode' : STAXResult , |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <call function="'testCase_Postamble'"/> |
| | | |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Portions Copyright 2008-2009 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2013 ForgeRock AS |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | 'targetLdif' : '%s/ldapsearch.out' % remote.temp , |
| | | 'outputLdif' : '%s/ldifsearch.diff' % remote.temp |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checktestRC'"> |
| | | { |
| | | 'returncode' : STAXResult , |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | </call> |
| | | |
| | | <call function="'testCase_Postamble'"/> |
| | | |
| | |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checktestRC'"> |
| | | { |
| | | 'returncode' : STAXResult , |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <call function="'testCase_Postamble'"/> |
| | | |
| | | </sequence> |
| | |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checktestRC'"> |
| | | { |
| | | 'returncode' : STAXResult , |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <call function="'testCase_Postamble'"/> |
| | | |
| | | </sequence> |
| | |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checktestRC'"> |
| | | { |
| | | 'returncode' : STAXResult , |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <message> |
| | | 'ldifsearch: @inetorgperson as attribute' |
| | | </message> |
| | |
| | | } |
| | | </call> |
| | | |
| | | <call function="'checktestRC'"> |
| | | { |
| | | 'returncode' : STAXResult , |
| | | 'result' : STAXResult |
| | | } |
| | | </call> |
| | | |
| | | <call function="'testCase_Postamble'"/> |
| | | |
| | | </sequence> |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2008-2009 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2013 ForgeRock AS |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | { |
| | | 'templateFile' : template , |
| | | 'ldifFile' : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp , |
| | | 'randomSeed' : 0 |
| | | 'randomSeed' : "0" |
| | | } |
| | | </call> |
| | | |
| | |
| | | { |
| | | 'templateFile' : template , |
| | | 'ldifFile' : '%s/clu/make-ldif_seed0_2.ldif' % remote.temp , |
| | | 'randomSeed' : 0 |
| | | 'randomSeed' : "0" |
| | | } |
| | | </call> |
| | | |
| | |
| | | { |
| | | 'sourceLdif' : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp , |
| | | 'targetLdif' : '%s/clu/make-ldif_noseed_1.ldif' % remote.temp , |
| | | 'outputLdif' : '%s/clu/make-ldif_noseed_1.diff' % remote.temp |
| | | 'outputLdif' : '%s/clu/make-ldif_noseed_1.diff' % remote.temp , |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | { |
| | | 'sourceLdif' : '%s/clu/make-ldif_noseed_1.ldif' % remote.temp , |
| | | 'targetLdif' : '%s/clu/make-ldif_noseed_2.ldif' % remote.temp , |
| | | 'outputLdif' : '%s/clu/make-ldif_noseed_2.diff' % remote.temp |
| | | 'outputLdif' : '%s/clu/make-ldif_noseed_2.diff' % remote.temp , |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | { |
| | | 'sourceLdif' : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp , |
| | | 'targetLdif' : '%s/clu/make-ldif_seed5.ldif' % remote.temp , |
| | | 'outputLdif' : '%s/clu/make-ldif_seed5.diff' % remote.temp |
| | | 'outputLdif' : '%s/clu/make-ldif_seed5.diff' % remote.temp , |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'dsCertNickname' : 'client-250-cert', |
| | | 'dsDn' : ['street: 0901 Chestnut Street' ,'%s' \ |
| | | %dncompare], |
| | | 'expectedRC' : 0 |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'dsKeyStorePassword' : 'clientkeystorepass', |
| | | 'dsCertNickname' : 'client-250-cert', |
| | | 'dsDn' : ['street: 30901 Chestnut Street' ,'%s' \ |
| | | %dncompare] , |
| | | 'expectedRC' : 0 |
| | | %dncompare] |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'dsCertNickname' : 'client-250-cert', |
| | | 'dsDn' : ['street: 3001 Chestnut Street' ,'%s' \ |
| | | %dncompare], |
| | | 'expectedRC' : 0 |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'dsKeyStorePassword' : 'clientkeystorepass', |
| | | 'dsCertNickname' : 'client-250-cert', |
| | | 'dsDn' : ['street: 30901 Chestnut Street' ,'%s' \ |
| | | %dncompare] , |
| | | 'expectedRC' : 0 |
| | | %dncompare] |
| | | } |
| | | </call> |
| | | |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2010 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2013 ForgeRock AS |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | 'dsUseSSL' : ' ' , |
| | | 'dsTrustAll' : ' ' , |
| | | 'dsDn' : ['postalCode:21700' ,'%s' %dncompare], |
| | | 'expectedRC' : 'noCheck' |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'dsInstancePort' : DIRECTORY_INSTANCE_SSL_PORT , |
| | | 'dsUseSSL' : ' ' , |
| | | 'dsTrustAll' : ' ' , |
| | | 'dsDn' : ['postalCode:01700' ,'%s' %dncompare], |
| | | 'expectedRC' : 'noCheck' |
| | | 'dsDn' : ['postalCode:01700' ,'%s' %dncompare] |
| | | } |
| | | </call> |
| | | |
| | |
| | | %InstanceInstallDir, |
| | | 'dsTrustStorePassword': 'clientruststorepass', |
| | | 'dsDn' : ['street: 50303 Sunset' ,'%s' %dncompare2], |
| | | 'expectedRC' : 'noCheck' |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | %InstanceInstallDir, |
| | | 'dsTrustStorePassword': 'clientruststorepass', |
| | | 'dsDn' : ['street: 50303 Sunset Street' ,'%s' \ |
| | | %dncompare2] , |
| | | 'expectedRC' : 'noCheck' |
| | | %dncompare2] |
| | | } |
| | | </call> |
| | | |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2010 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2013 ForgeRock AS |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | 'dsUseStartTLS' : ' ' , |
| | | 'dsTrustAll' : ' ' , |
| | | 'dsDn' : ['postalCode:6728' ,'%s' %dncompare], |
| | | 'expectedRC' : 'noCheck' |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'dsUseStartTLS' : ' ' , |
| | | 'dsTrustAll' : ' ' , |
| | | 'dsDn' : ['postalCode:67258' ,'%s' %dncompare], |
| | | 'expectedRC' : 'noCheck' |
| | | } |
| | | </call> |
| | | |
| | |
| | | 'dsTrustStorePassword': 'clientruststorepass', |
| | | 'dsDn' : ['description: This is for Amber Arbuckle.',\ |
| | | '%s' %dncompare2] , |
| | | 'expectedRC' : 'noCheck' |
| | | 'expectedRC' : 5 |
| | | } |
| | | </call> |
| | | |
| | |
| | | % InstanceInstallDir, |
| | | 'dsTrustStorePassword': 'clientruststorepass', |
| | | 'dsDn' : ['description: This is the description for \ |
| | | Amber Arbuckle.' ,'%s' %dncompare2] , |
| | | 'expectedRC' : 'noCheck' |
| | | Amber Arbuckle.' ,'%s' %dncompare2] |
| | | } |
| | | </call> |
| | | |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2010 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2011 ForgeRock AS. |
| | | ! Portions Copyright 2011-2013 ForgeRock AS. |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | 'outputLdif' : '%s/psearch-delete-diffs.out' % remote.temp |
| | | } |
| | | </call> |
| | | <if expr="STAXResult != 0"> |
| | | <tcstatus result="'fail'"/> |
| | | </if> |
| | | |
| | | </sequence> |
| | | </parallel> |
| | |
| | | 'outputLdif' : '%s/psearch-modify-diffs.out' % remote.temp |
| | | } |
| | | </call> |
| | | <if expr="STAXResult != 0"> |
| | | <tcstatus result="'fail'"/> |
| | | </if> |
| | | |
| | | </sequence> |
| | | </parallel> |
| | |
| | | 'outputLdif' : '%s/psearch-moddn-diffs.out' % remote.temp |
| | | } |
| | | </call> |
| | | <if expr="STAXResult != 0"> |
| | | <tcstatus result="'fail'"/> |
| | | </if> |
| | | |
| | | </sequence> |
| | | </parallel> |
| | |
| | | 'outputLdif' : '%s/psearch-add-diffs.out' % remote.temp |
| | | } |
| | | </call> |
| | | <if expr="STAXResult != 0"> |
| | | <tcstatus result="'fail'"/> |
| | | </if> |
| | | |
| | | </sequence> |
| | | </parallel> |
| | |
| | | </if> |
| | | <if expr="RC == 0"> |
| | | <sequence> |
| | | <call function="'LdifDiffWithScript-new'"> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { 'location' : dsMaster.getHostname(), |
| | | 'dsPath' : dsMasterPath, |
| | | 'sourceLdif' : '%s/%s' % (remote.temp, filteredRefTree), |
| | |
| | | 'outputLdif' : '%s/%s' % (remote.temp,treeDiffs) |
| | | } |
| | | </call> |
| | | <if expr="STAXResult == 0"> |
| | | <if expr="STAXResult == 6"> |
| | | <sequence> |
| | | <return>0, None</return> |
| | | </sequence> |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2007-2009 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2013 ForgeRock AS |
| | | ! --> |
| | | |
| | | <stax> |
| | |
| | | RefFile = '%s/i18n/8-bit/base64/Data_Comparison.Ref.base64.ldif' % remote.data |
| | | </script> |
| | | |
| | | <call function="'LdifDiffWithScript-new'"> |
| | | <call function="'LdifDiffWithScript'"> |
| | | { |
| | | 'sourceLdif' : RefFile , |
| | | 'targetLdif' : '%s/ldapsearch.out' % remote.temp , |
| | |
| | | ! CDDL HEADER END |
| | | ! |
| | | ! Copyright 2010 Sun Microsystems, Inc. |
| | | ! Portions Copyright 2011-2012 ForgeRock AS. |
| | | ! Portions Copyright 2011-2013 ForgeRock AS. |
| | | ! --> |
| | | <stax> |
| | | |
| | |
| | | 'dsInstanceDn' : myEntry.getDn(), |
| | | 'dsInstancePswd' : myUserpassword, |
| | | 'dsDn' : ['telephonenumber:%s' % \ |
| | | myTelephonenumber, myTargetEntryDn], |
| | | 'expectedRC' : 0 |
| | | myTelephonenumber, myTargetEntryDn] |
| | | } |
| | | </call> |
| | | </sequence> |
| | |
| | | 'dsInstanceDn' : myEntry.getDn(), |
| | | 'dsInstancePswd' : myUserpassword, |
| | | 'dsDn' : ['telephonenumber:%s' % \ |
| | | myTelephonenumber, myTargetEntryDn], |
| | | 'expectedRC' : 0 |
| | | myTelephonenumber, myTargetEntryDn] |
| | | } |
| | | </call> |
| | | </sequence> |
| | |
| | | 'dsInstanceDn' : myEntry.getDn(), |
| | | 'dsInstancePswd' : myUserpassword, |
| | | 'dsDn' : ['telephonenumber:%s' % \ |
| | | myTelephonenumber, myTargetEntryDn], |
| | | 'expectedRC' : 0 |
| | | myTelephonenumber, myTargetEntryDn] |
| | | } |
| | | </call> |
| | | </sequence> |
| | |
| | | 'dsInstanceDn' : myEntry.getDn(), |
| | | 'dsInstancePswd' : myUserpassword, |
| | | 'dsDn' : ['telephonenumber:%s' % \ |
| | | myTelephonenumber, myTargetEntryDn], |
| | | 'expectedRC' : 0 |
| | | myTelephonenumber, myTargetEntryDn] |
| | | } |
| | | </call> |
| | | </sequence> |
| | |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="dn"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="useCmpRC" type="optional"> |
| | | <function-arg-def name="useCmpRC" type="optional" default="'True'"> |
| | | <function-arg-description> |
| | | Use an exit code that indicates whether comparison is successful. |
| | | Results are an exit code of 6 (COMPARE_TRUE) or |
| | |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="option"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="expectedRC" type="optional" default="0"> |
| | | <function-arg-def name="expectedRC" type="optional" default="6"> |
| | | <function-arg-description> |
| | | Expected return code value. Default value is 0 |
| | | Expected return code value. Default value is 6 (COMPARE_TRUE). |
| | | Wildcard 'noCheck' to not check the RC |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="integer"/> |
| | |
| | | if dsUseSSL: |
| | | STAFCmdParamsList.append('-Z') |
| | | |
| | | if useCmpRC: |
| | | if useCmpRC == 'True': |
| | | STAFCmdParamsList.append('--useCompareResultCode') |
| | | |
| | | if dsDn: |
| | |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="string"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="expectedRC" type="optional" default="0"> |
| | | <function-arg-def name="useCmpRC" type="optional" default="'True'"> |
| | | <function-arg-description> |
| | | Expected return code value. Default value is 0 |
| | | Use an exit code that indicates whether comparison is successful. |
| | | Results are an exit code of 6 (COMPARE_TRUE) or |
| | | an exit code of 5 (COMPARE_FALSE). |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="option"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="expectedRC" type="optional" default="6"> |
| | | <function-arg-description> |
| | | Expected return code value. Default value is 6 (COMPARE_TRUE). |
| | | Wildcard 'noCheck' to not check the RC |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="integer"/> |
| | |
| | | |
| | | <!-- Set common ldap arguments --> |
| | | <call function="'_ldapCommonArgs'"/> |
| | | <script> |
| | | <script> |
| | | if useCmpRC == 'True': |
| | | STAFCmdParamsList.append('--useCompareResultCode') |
| | | |
| | | if extraParams: |
| | | STAFCmdParamsList.append('%s' % extraParams) |
| | | |
| | |
| | | </function> |
| | | |
| | | <!-- This function compares two LDIF files using the ldif-diff script --> |
| | | <function name="LdifDiffWithScript"> |
| | | <function name="LdifDiffWithScript-old"> |
| | | <function-prolog> |
| | | This function compares two LDIF files and reports the differences in LDIF format |
| | | </function-prolog> |
| | |
| | | 'ignoreAttrsFile' : ignoreAttrsFile |
| | | } |
| | | </call> |
| | | <if expr="STAXResult != 0"> |
| | | <if expr="STAXResult != 6"> |
| | | <sequence> |
| | | <script> |
| | | failedServers.append('%s:%s' % \ |
| | |
| | | } |
| | | </call> |
| | | <script> |
| | | if STAXResult != 0 : |
| | | if STAXResult != 6: |
| | | failedServers.append('%s:%s' % (server.getHostname(), server.getPort())) |
| | | </script> |
| | | </sequence> |
| | |
| | | </function> |
| | | |
| | | <!-- This function compares two LDIF files using the ldif-diff script --> |
| | | <function name="LdifDiffWithScript-new" scope="local"> |
| | | <function name="LdifDiffWithScript" scope="local"> |
| | | <function-prolog> |
| | | This function compares two LDIF files and reports the differences |
| | | in LDIF format |
| | |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="option"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="useCmpRC" type="optional"> |
| | | <function-arg-def name="useCmpRC" type="optional" default="'True'"> |
| | | <function-arg-description> |
| | | Use an exit code that indicates whether difference were not found. |
| | | Results are an exit code of 6 (COMPARE_TRUE) or |
| | |
| | | </function-arg-description> |
| | | <function-arg-property name="help" value="option"/> |
| | | </function-arg-def> |
| | | <function-arg-def name="expectedRC" type="optional" default="0"> |
| | | <function-arg-def name="expectedRC" type="optional" default="6"> |
| | | <function-arg-description> |
| | | Expected return code value. Default value is 0. |
| | | Expected return code value. Default value is 6 (COMPARE_TRUE). |
| | | Wildcard 'noCheck' to not check the RC |
| | | </function-arg-description> |
| | | <function-arg-property name="type" value="integer"/> |
| | |
| | | foldersToCreate.append(os.path.dirname(outputLdif)) |
| | | STAFCmdParamsList.append('-o %s' % outputLdif) |
| | | |
| | | if useCmpRC: |
| | | if useCmpRC == 'True': |
| | | STAFCmdParamsList.append('-r') |
| | | |
| | | if overwriteExisting: |
| | |
| | | } |
| | | </call> |
| | | |
| | | <if expr="RC == 5 and expectedRC != 5"> |
| | | <sequence> |
| | | <!-- Check the size of the diff file, and avoid reading its |
| | | content with getFile if the file is too big to prevent |
| | | the staf process from running out of memory --> |
| | | <call function="'GetEntry'"> |
| | | { |
| | | 'location' : location, |
| | | 'entry' : outputLdif, |
| | | 'attribute' : 'SIZE' |
| | | } |
| | | </call> |
| | | <script> |
| | | # GetEntry returns: STAXResult = [cmdRC, cmdResult] |
| | | if RC == 0: |
| | | diffsFileSize = int(STAXResult[1]['lowerSize']) |
| | | msg = 'File: %s Size (bytes): %s' % (outputLdif, diffsFileSize) |
| | | else: |
| | | diffsFileSize = MAX_READABLE_SIZE |
| | | msg = 'Could not retrieve the size of file %s' % outputLdif |
| | | </script> |
| | | <message log="1"> 'LdifDiffWithScript: %s' % msg </message> |
| | | <if expr="diffsFileSize < MAX_READABLE_SIZE"> |
| | | <sequence> |
| | | <call function="'getFile'"> |
| | | { 'location' : location, |
| | | 'filename' : outputLdif |
| | | } |
| | | </call> |
| | | <script> |
| | | # getFile returns: STAXResult = [cmdRC, cmdResult] |
| | | diffsFileContent = STAXResult[1] |
| | | </script> |
| | | </sequence> |
| | | <else> |
| | | <script> |
| | | # diffs file to big to be read |
| | | diffsFileContent = 'File too big to be read.' |
| | | </script> |
| | | </else> |
| | | </if> |
| | | |
| | | <message log="1" level="'Error'"> |
| | | 'Source and target LDIF files are DIFFERENT: \n\n%s' % \ |
| | | diffsFileContent |
| | | </message> |
| | | </sequence> |
| | | <else> |
| | | <sequence> |
| | | <message> |
| | | 'NO DIFFERENCES were detected between the source and the target \ |
| | | LDIF files.' |
| | | </message> |
| | | </sequence> |
| | | </else> |
| | | </if> |
| | | |
| | | <return>STAXResult</return> |
| | | </sequence> |
| | | </function> |