core_ctrls_assertion.xml revision d81978a0815d5b8a75633c35e3e1f8708d36f017
<?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, include this CDDL HEADER in each
! file and include 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 2007-2008 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="core_ctrls_assertion"/>
<function name="core_ctrls_assertion">
<sequence>
<block name="'ctrls_assertion'">
<sequence>
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group']='core'
CurrentTestPath['suite']=STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/core/core_setup.xml' % (TESTS_DIR)" />
<call function="'core_setup'" />
<!--- Test Suite information
#@TestSuiteName Core Controls assertion
#@TestSuitePurpose Verify that the controls functionality is
working in the Directory Server.
#@TestSuiteGroup Core: Controls: assertion
#@TestScript core_ctrls_assertion.xml
-->
<!-- Global variables -->
<script>
peopleDn = 'ou=North America,o=core tests,dc=example,dc=com'
currentAci = '(targetcontrol = "1.3.6.1.1.12")(version 3.0; acl\
"all for user.1"; allow (all) userdn="\
ldap:///uid=user.1,%s";)' % peopleDn
</script>
<!--- Test Case information
#@TestMarker Core Controls assertion Tests
#@TestName Search with directory manager user
#@TestPurpose Check reportAuthzID option with dir manager
#@TestPreamble
#@TestSteps Do a search and check the outputs
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Search with Directory Manager')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=user.1,%s' % peopleDn ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '--assertionFilter "(objectclass=top)"' ,
'dsAttributes' : 'uid'
}
</call>
<call function="'CheckMatches'">
{
'string2find' : 'uid=user.1,%s' % peopleDn ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1 ,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Core Controls assertion Tests
#@TestName Search with a user entry without aci
#@TestPurpose Check reportAuthzID option with a user
#@TestPreamble
#@TestSteps Do a search and check the outputs
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Search with a user without aci')">
<sequence>
<call function="'testCase_Preamble'"/>
<!-- ========== -->
<message>'++ Search with user without aci,should fail'</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=user.1,%s' % peopleDn ,
'dsInstancePswd' : 'password' ,
'dsBaseDN' : 'uid=user.1,%s' % peopleDn ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '--assertionFilter "(objectclass=top)"' ,
'dsAttributes' : 'uid' ,
'expectedRC' : 50
}
</call>
<!-- ========== -->
<message>'++ Check assertion control id is displayed'</message>
<call function="'CheckMatches'">
{
'string2find' : '1.3.6.1.1.12' ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Core Controls assertion Tests
#@TestName Add aci for the assertion control
#@TestPurpose Check aci is accepted by the server
#@TestPreamble
#@TestSteps Add the aci
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Add aci')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
ldifFile = '%s/core/ldifs/ctrls_assertion_add_aci.ldif'\
% remote.data
</script>
<message>
'++ add aci for user.1 to be able to use assertion control'
</message>
<message>
'aci : %s' % currentAci
</message>
<call function="'ldapModifyWithScript'">
{
'dsAdd' : 'True' ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsFilename' : ldifFile
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Core Controls assertion Tests
#@TestName Search with a user entry with aci
#@TestPurpose Check reportAuthzID option with a user
#@TestPreamble
#@TestSteps Do a search and check the outputs
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Search with a user with aci')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'++ Search with user with aci, should pass'</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=user.1,%s' % peopleDn ,
'dsInstancePswd' : 'password' ,
'dsBaseDN' : 'uid=user.1,%s' % peopleDn ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '--assertionFilter "(objectclass=top)"' ,
'dsAttributes' : 'uid'
}
</call>
<call function="'CheckMatches'">
{
'string2find' : 'uid=user.1,%s' % peopleDn ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1 ,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Core Controls assertion Tests
#@TestName Search with bad assertion value
#@TestPurpose Set bad assertion control value
#@TestPreamble
#@TestSteps Do a search and check the outputs
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName
('Search with bad assertion control value')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'Do a search with bad assertion control value'</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : 'uid=user.1,%s' % peopleDn ,
'dsInstancePswd' : 'password' ,
'dsBaseDN' : 'uid=user.1,%s' % peopleDn ,
'dsFilter' : 'objectclass=*' ,
'extraParams' : '--assertionFilter "(objectclass=hello)"',
'dsAttributes' : 'uid' ,
'expectedRC' : 122
}
</call>
<call function="'CheckMatches'">
{
'string2find' : 'Assertion Failed' ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1 ,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Core Controls assertion Tests
#@TestName Delete aci for the assertion control
#@TestPurpose Check aci is deleted by the server
#@TestPreamble
#@TestSteps Delete the aci
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Delete aci')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
ldifFile='%s/core/ldifs/ctrls_assertion_delete_aci.ldif'\
% remote.data
</script>
<message>
'++ Delete aci which allow user.1 to use assertion control'
</message>
<message>
'aci : %s' % currentAci
</message>
<call function="'ldapModifyWithScript'">
{
'dsAdd' : 'True' ,
'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsFilename' : ldifFile
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/core/core_cleanup.xml' % (TESTS_DIR)" />
<call function="'core_cleanup'" />
<call function="'testSuite_Postamble'"/>
</sequence>
</block>
</sequence>
</function>
</stax>