<?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
!
! Portions Copyright 2008-2009 Sun Microsystems, Inc.
! Portions Copyright 2013 ForgeRock AS
! -->
<stax>
<defaultcall function="clu_ldifsearch_checkbehavior"/>
<function name="clu_ldifsearch_checkbehavior">
<sequence>
<block name="'clu_ldifsearch_checkbehavior'">
<try>
<sequence>
<!--- Test Suite information
#@TestSuiteName ldifsearch check behavior tests
#@TestSuitePurpose Test the results of ldifsearch command.
#@TestSuiteGroup ldifsearch check behavior tests
#@TestScript clu_ldifsearch_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 basedn, dsfilename, filter files -->
<script>
basedn = 'ou=ldapsearch,o=clu tests,dc=example,dc=com'
dsfilename = '%s/clu/clu_start.ldif' % remote.data
filterfile = '%s/clu/filters.ldif' % remote.data
mfilterfile = '%s/clu/multiple_filters.ldif' % remote.data
</script>
<!--- Test Case information
#@TestMarker ldifsearch check behavior tests
#@TestName ldifsearch: check with standard options
#@TestIssue none
#@TestPurpose Verify that the entries returned by ldifseach
are the same than the entries returned by
ldapsearch
#@TestPreamble none
#@TestStep Do an ldapsearch with standard options.
#@TestStep Do an ldifsearch with the same options.
#@TestStep Do an ldif-dif to check the differences.
#@TestPostamble none
#@TestResult Success if ldifdiff returns no differences.
-->
<testcase name="getTestCaseName('ldifsearch: standard options')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'ldifsearch: standard options'
</message>
<call function="'ldapSearchWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : basedn ,
'dsFilter' : 'uid=user.1*' ,
'outputFile' : 'ldapsearch.out' ,
'outputPath' : remote.temp
}
</call>
<call function="'ldifSearchWithScript'">
{
'dsLdifFile' : dsfilename ,
'dsBaseDN' : basedn ,
'dsFilter' : 'uid=user.1*' ,
'dsOutputFile' : '%s/ldifsearch.out' % remote.temp
}
</call>
<call function="'LdifDiffWithScript'">
{
'sourceLdif' : '%s/ldifsearch.out' % remote.temp ,
'targetLdif' : '%s/ldapsearch.out' % remote.temp ,
'outputLdif' : '%s/ldifsearch.diff' % remote.temp
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker ldifsearch check behavior tests
#@TestName ldifsearch: check with scope option
#@TestIssue none
#@TestPurpose Verify that the entries returned by ldifseach
are the same than the entries returned by
ldapsearch
#@TestPreamble none
#@TestStep Do an ldapsearch with scope option.
#@TestStep Do an ldifsearch with the same option.
#@TestStep Do an ldif-dif to check the differences.
#@TestPostamble none
#@TestResult Success if ldifdiff returns no differences.
-->
<testcase name="getTestCaseName('ldifsearch: scope option')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'ldifsearch: scope option'
</message>
<call function="'ldapSearchWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsScope' : 'base' ,
'dsBaseDN' : 'dc=com' ,
'dsFilter' : 'objectclass=*' ,
'outputFile' : 'scope_ldapsearch.out' ,
'outputPath' : remote.temp
}
</call>
<call function="'ldifSearchWithScript'">
{
'dsLdifFile' : dsfilename ,
'dsSearchScope' : 'base' ,
'dsBaseDN' : 'dc=com' ,
'dsFilter' : 'objectclass=*' ,
'dsOutputFile' : '%s/scope_ldifsearch.out' % remote.temp
}
</call>
<call function="'LdifDiffWithScript'">
{
'sourceLdif' : '%s/scope_ldifsearch.out' % remote.temp ,
'targetLdif' : '%s/scope_ldapsearch.out' % remote.temp ,
'outputLdif' : '%s/scope_ldifsearch.diff' % remote.temp
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker ldifsearch check behavior tests
#@TestName ldifsearch: check with sizeLimit option
#@TestIssue none
#@TestPurpose Verify that the entries returned by ldifseach
are the same than the entries returned by
ldapsearch
#@TestPreamble none
#@TestStep Do an ldapsearch with sizeLimit option.
#@TestStep Do an ldifsearch with the same option.
#@TestStep Do an ldif-dif to check the differences.
#@TestPostamble none
#@TestResult Success if ldifdiff returns no differences.
-->
<testcase name="getTestCaseName('ldifsearch: sizeLimit option')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'ldifsearch: sizeLimit option'
</message>
<call function="'ldifSearchWithScript'">
{
'dsLdifFile' : dsfilename ,
'dsSizeLimit' : '50' ,
'dsBaseDN' : basedn ,
'dsFilter' : 'uid=user.1*' ,
'expectedRC' : 4
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'CheckMatches'">
{
'string2find' : 'dn: ' ,
'mainString' : returnString ,
'nbExpected' : 50
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker ldifsearch check behavior tests
#@TestName ldifsearch: check behavior with a filter file
(containing one filter) and search attribute
#@TestIssue none
#@TestPurpose Verify the output of ldifsearch with
filter option.
#@TestPreamble none
#@TestStep Do an ldifsearch with filter file option and
a search attribute, and check that the number
of entries is correct
#@TestStep Compare the output of the previous command to
a reference file
#@TestPostamble none
#@TestResult Success if the outputs for ldifsearch matche
the refenrence outputs.
-->
<testcase name="getTestCaseName
('ldifsearch: check output using --filename and a search attribute')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'ldifsearch: check output using --filename and a \
search attribute'
</message>
<call function="'ldifSearchWithScript'">
{
'dsLdifFile' : dsfilename ,
'dsBaseDN' : basedn ,
'dsFilterFile' : filterfile ,
'dsAttributes' : 'dn' ,
'dsOutputFile' : '%s/ldifsearch_filterfile_and_attribute.out' \
% remote.temp
}
</call>
<call function="'LdifDiffWithScript'">
{
'sourceLdif' : '%s/ldifsearch_filterfile_and_attribute.out' \
% remote.temp ,
'targetLdif' : '%s/clu/ldapsearch_filterfile_and_attribute.ref'\
% remote.data ,
'outputLdif' : '%s/ldifmodify.diff' % remote.temp
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker ldifsearch check behavior tests
#@TestName ldifsearch: check behavior with a filter file
containing multiple filters
#@TestIssue none
#@TestPurpose Verify the output of ldifsearch with
filter option.
#@TestPreamble none
#@TestStep Do an ldifsearch with filter file option and
check that the number of entries is correct
#@TestPostamble none
#@TestResult Success if the number of entries is 222.
-->
<testcase name="getTestCaseName
('ldifsearch: check with a filter file containing multiple filters')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'ldifsearch: check with a filter file containing multiple\
filters'
</message>
<call function="'ldifSearchWithScript'">
{
'dsLdifFile' : dsfilename ,
'dsBaseDN' : basedn ,
'dsFilterFile' : mfilterfile
}
</call>
<script>
returnString = STAXResult[0][1]
</script>
<call function="'CheckMatches'">
{
'string2find' : 'dn: ' ,
'mainString' : returnString ,
'nbExpected' : 222
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker ldifsearch check behavior tests
#@TestName ldifsearch: check behavior with @ocname as
attribute
#@TestIssue none
#@TestPurpose Verify the output of ldifsearch with @ocname
in the list of requested attributes.
#@TestPreamble none
#@TestStep Do an ldapsearch using @person as attribute
#@TestStep Do an ldifsearch with the same option.
#@TestStep Do an ldif-dif to check the differences.
#@TestStep Do an ldapsearch using @inetorgperson as
attribute
#@TestStep Do an ldifsearch with the same option.
#@TestStep Do an ldif-dif to check the differences.
#@TestPostamble none
#@TestResult Success if ldifdiff returns no differences.
-->
<testcase name="getTestCaseName
('ldifsearch: check with @ocname as attribute')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'ldifsearch: @person as attribute'
</message>
<call function="'ldapSearchWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : basedn ,
'dsFilter' : 'uid=user.1*' ,
'dsAttributes' : '@person' ,
'outputFile' : 'ocname1_ldapsearch.out' ,
'outputPath' : remote.temp
}
</call>
<call function="'ldifSearchWithScript'">
{
'dsLdifFile' : dsfilename ,
'dsBaseDN' : basedn ,
'dsFilter' : 'uid=user.1*' ,
'dsAttributes' : '@person' ,
'dsOutputFile' : '%s/ocname1_ldifsearch.out' % remote.temp
}
</call>
<call function="'LdifDiffWithScript'">
{
'sourceLdif' : '%s/ocname1_ldifsearch.out' % remote.temp ,
'targetLdif' : '%s/ocname1_ldapsearch.out' % remote.temp ,
'outputLdif' : '%s/ocname1_ldifsearch.diff' % remote.temp
}
</call>
<message>
'ldifsearch: @inetorgperson as attribute'
</message>
<call function="'ldapSearchWithScript'">
{
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : basedn ,
'dsFilter' : 'uid=user.1*' ,
'dsAttributes' : '@inetorgperson' ,
'outputFile' : 'ocname2_ldapsearch.out' ,
'outputPath' : remote.temp
}
</call>
<call function="'ldifSearchWithScript'">
{
'dsLdifFile' : dsfilename ,
'dsBaseDN' : basedn ,
'dsFilter' : 'uid=user.1*' ,
'dsAttributes' : '@inetorgperson' ,
'dsOutputFile' : '%s/ocname2_ldifsearch.out' % remote.temp
}
</call>
<call function="'LdifDiffWithScript'">
{
'sourceLdif' : '%s/ocname2_ldifsearch.out' % remote.temp ,
'targetLdif' : '%s/ocname2_ldapsearch.out' % remote.temp ,
'outputLdif' : '%s/ocname2_ldifsearch.diff' % remote.temp
}
</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>