<?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-2009 Sun Microsystems, Inc.
! Portions Copyright 2013 ForgeRock AS
! -->
<stax>
<defaultcall function="clu_ldif-diff_checkbehavior"/>
<function name="clu_ldif-diff_checkbehavior">
<sequence>
<block name="'clu_ldif-diff_checkbehavior'">
<try>
<sequence>
<!--- Test Suite information
#@TestSuiteName ldif-diff check behavior tests
#@TestSuitePurpose Test the results of the ldif-diff command.
#@TestSuiteGroup ldif-diff check behavior tests
#@TestScript clu_ldif-diff_checkbehavior.xml
-->
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group'] = 'clu'
CurrentTestPath['suite'] = STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<call function="'common_setup'">
{
'quickStart' : False ,
'loadData' : True ,
'ldifFile' : '%s/clu/clu_start.ldif' % remote.data ,
'startServer' : True ,
'stopServer' : False ,
'allowPreEncodePassword' : True
}
</call>
<!--- Define default value for sourceldif -->
<script>
sourceldif = '%s/clu/clu_start.ldif' % remote.data
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 none
#@TestPurpose Test ldif-diff to compare ldif files with
no diffs
#@TestPreamble none
#@TestStep Do an ldif-diff to compare ldif files with
no diffs
#@TestPostamble none
#@TestResult Success if ldif-diff returns 0.
-->
<testcase name="getTestCaseName
('ldif-diff: compare ldif files with no diffs')">
<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.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'"/>
</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
#@TestPreamble none
#@TestStep Do an ldif-diff to compare ldif files with
diffs
#@TestPostamble none
#@TestResult Success if ldif-diff returns 0.
-->
<testcase name="getTestCaseName
('ldif-diff: compare ldif files with diffs')">
<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_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>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker ldif-diff check behavior tests
#@TestName ldif-diff: check diff file
#@TestIssue none
#@TestPurpose Check ldif file generated by ldif-diff
#@TestPreamble none
#@TestStep Do an ldif-diff to compare ldif files with
diffs
#@TestStep Check this ldif file using compareFile
#@TestPostamble none
#@TestResult Success if compareFile returns 0.
-->
<testcase name="getTestCaseName('ldif-diff: check diff file')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'ldif-diff: check diff file'
</message>
<call function="'LdifDiffWithScript-new'">
{
'sourceLdif' : sourceldif ,
'targetLdif' : targetldif ,
'outputLdif' : '%s/clu/ldif-diff.out' % remote.temp
}
</call>
<call function="'compareFile'">
{
'outputFile' : 'ldif-diff.out' ,
'outputPath' : '%s/clu' % remote.temp ,
'refFile' : 'ldif-diff.ref' ,
'sortFile' : True
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker ldif-diff check behavior tests
#@TestName ldif-diff: check diff file
#@TestIssue none
#@TestPurpose Check ldif file generated by ldif-diff
#@TestPreamble none
#@TestStep Do an ldif-diff to compare ldif files with
diffs
#@TestStep Check this ldif file using compareFile
#@TestPostamble none
#@TestResult Success if compareFile returns 0.
-->
<testcase name="getTestCaseName
('ldif-diff: check diff files with single value changes')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'ldif-diff: check diff file with single value changes'
</message>
<call function="'LdifDiffWithScript-new'">
{
'sourceLdif' : sourceldif ,
'targetLdif' : targetldif ,
'outputLdif' : '%s/clu/ldif-diff_singlevalue.out' \
% remote.temp ,
'singleValueChanges' : 'True'
}
</call>
<call function="'compareFile'">
{
'outputFile' : 'ldif-diff_singlevalue.out' ,
'outputPath' : '%s/clu' % remote.temp ,
'refFile' : 'ldif-diff_singlevalue.ref' ,
'sortFile' : True
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global CLU Cleanup.'</message>
<try>
<call function="'common_cleanup'" />
<catch exception="'STAFException'">
<sequence>
<message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
</sequence>
</catch>
<finally>
<call function="'testSuite_Postamble'"/>
</finally>
</try>
</sequence>
</finally>
</try>
</block>
</sequence>
</function>
</stax>