<?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 legal-notices/CDDLv1_0.txt
! or http://forgerock.org/license/CDDLv1.0.html.
! See the License for the specific language governing permissions
! and limitations under the License.
!
! When distributing Covered Code, include this CDDL HEADER in each
! file and include the License file at legal-notices/CDDLv1_0.txt.
! 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_make-ldif_checkbehavior"/>
<function name="clu_make-ldif_checkbehavior">
<sequence>
<block name="'clu_make-ldif_checkbehavior'">
<try>
<sequence>
<!--- Test Suite information
#@TestSuiteName make-ldif check behavior tests
#@TestSuitePurpose Test the results of the make-ldif command.
#@TestSuiteGroup make-ldif check behavior tests
#@TestScript clu_make-ldif_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 template -->
<script>
template = '%s/clu/make-ldif_template.ref' % remote.data
</script>
<!--- Test Case information
#@TestMarker make-ldif check behavior tests
#@TestName make-ldif: generate ldif file with seed 0
#@TestIssue none
#@TestPurpose Test make-ldif with to generate ldif file
with seed 0
#@TestPreamble none
#@TestStep Do an make-ldif with seed of 0.
#@TestPostamble none
#@TestResult Success if make-ldif returns 0 and if the
output is correct.
-->
<testcase name="getTestCaseName
('make-ldif: generate ldif file with seed 0')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'make-ldif: generate ldif file with seed 0'
</message>
<call function="'MakeLdifWithScript'">
{
'templateFile' : template ,
'ldifFile' : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp ,
'randomSeed' : "0"
}
</call>
<script>
returnString = STAXResult[0][1]
msg = 'LDIF processing complete. 161 entries written'
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : msg
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker make-ldif check behavior tests
#@TestName make-ldif: import generated data
#@TestIssue none
#@TestPurpose Check that data genereted witch make-ldif
are correct
#@TestPreamble none
#@TestStep Do an make-ldif with seed of 0.
#@TestStep Stop the server.
#@TestStep Import the data generated with make-ldif.
#@TestStep Start the server.
#@TestStep Search some entries using ldapsearch.
#@TestPostamble none
#@TestResult Success if ldapsearch returns the expected
number of entries.
-->
<testcase name="getTestCaseName
('make-ldif: import generated data')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'make-ldif: generate a second ldif file with seed of 0'
</message>
<call function="'MakeLdifWithScript'">
{
'templateFile' : template ,
'ldifFile' : '%s/clu/make-ldif_seed0_2.ldif' % remote.temp ,
'randomSeed' : "0"
}
</call>
<message>
'make-ldif: import the data'
</message>
<call function="'ldapModifyWithScript'">
{ 'dsAdd' : 'True',
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
'dsFilename' : '%s/clu/make-ldif_seed0_2.ldif' % remote.temp,
'dsContinueOnError' : 'true',
'expectedRC' : 0
}
</call>
<message>
'make-ldif: search some entries to check that data are imported'
</message>
<call function="'ldapSearchWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsCountEntries' : 'True' ,
'dsBaseDN' : 'ou=make-ldif,o=clu tests,dc=example,dc=com',
'dsFilter' : 'objectclass=*' ,
'expectedRC' : 'noCheck'
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'checktestString'">
{
'returnString' : returnString ,
'expectedString' : 'Total number of matching entries: 161'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker make-ldif check behavior tests
#@TestName make-ldif: compare generated data
#@TestIssue none
#@TestPurpose Check that data genereted witch make-ldif
are correct
#@TestPreamble none
#@TestStep Do an make-ldif to generate a first file
without seed.
#@TestStep Do an make-ldif to generate a second file
without seed.
#@TestStep Do an make-ldif to generate a file
with seed of 5.
#@TestStep Compare files generated with seed of 0.
#@TestStep Compare one file generated with seed of 0 and
one generated without seed.
#@TestStep Compare files generated without seed.
#@TestStep Compare one file generated with seed of 0 and
one generated with seed of 5.
#@TestPostamble none
#@TestResult Success if ldif-diff returns 0 in each cases.
-->
<testcase name="getTestCaseName
('make-ldif: compare generated data')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'make-ldif: generate a first ldif file without seed'
</message>
<call function="'MakeLdifWithScript'">
{
'templateFile' : template ,
'ldifFile' : '%s/clu/make-ldif_noseed_1.ldif' % remote.temp
}
</call>
<message>
'make-ldif: generate a second ldif file without seed'
</message>
<call function="'MakeLdifWithScript'">
{
'templateFile' : template ,
'ldifFile' : '%s/clu/make-ldif_noseed_2.ldif' % remote.temp
}
</call>
<message>
'make-ldif: generate a ldif file with seed of 5'
</message>
<call function="'MakeLdifWithScript'">
{
'templateFile' : template ,
'ldifFile' : '%s/clu/make-ldif_seed5.ldif' % remote.temp ,
'randomSeed' : 5
}
</call>
<message>
'make-ldif: ldifs with seed of 0 must be the same'
</message>
<call function="'LdifDiffWithScript'">
{
'sourceLdif' : '%s/clu/make-ldif_seed0_1.ldif' % remote.temp ,
'targetLdif' : '%s/clu/make-ldif_seed0_2.ldif' % remote.temp ,
'outputLdif' : '%s/clu/make-ldif_seed0.diff' % remote.temp
}
</call>
<message>
'make-ldif: ldifs with seed of 0 and no seed must \
be different'
</message>
<call function="'LdifDiffWithScript'">
{
'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 ,
'expectedRC' : 5
}
</call>
<message>
'make-ldif: ldifs with no seed must be different'
</message>
<call function="'LdifDiffWithScript'">
{
'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 ,
'expectedRC' : 5
}
</call>
<message>
'make-ldif: ldifs with seed of 0 and seed of 5 \
must be different'
</message>
<call function="'LdifDiffWithScript'">
{
'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 ,
'expectedRC' : 5
}
</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>