1691N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2887N/A<!DOCTYPE stax SYSTEM "/shared/stax.dtd">
1691N/A<!--
1691N/A ! CDDL HEADER START
1691N/A !
1691N/A ! The contents of this file are subject to the terms of the
1691N/A ! Common Development and Distribution License, Version 1.0 only
1691N/A ! (the "License"). You may not use this file except in compliance
1691N/A ! with the License.
1691N/A !
1691N/A ! You can obtain a copy of the license at
1691N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
1691N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
1691N/A ! See the License for the specific language governing permissions
1691N/A ! and limitations under the License.
1691N/A !
1691N/A ! When distributing Covered Code, include this CDDL HEADER in each
1691N/A ! file and include the License file at
1691N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1691N/A ! add the following below this CDDL HEADER, with the fields enclosed
1691N/A ! by brackets "[]" replaced with your own identifying information:
1691N/A ! Portions Copyright [yyyy] [name of copyright owner]
1691N/A !
1691N/A ! CDDL HEADER END
1691N/A !
4618N/A ! Copyright 2007-2009 Sun Microsystems, Inc.
1691N/A ! -->
1691N/A
1691N/A<stax>
1691N/A
4618N/A <defaultcall function="dynamic"/>
1691N/A
4618N/A <function name="dynamic">
1691N/A
1691N/A <sequence>
1691N/A
4618N/A <block name="'dynamic'">
4618N/A
4618N/A <try>
1691N/A
4618N/A <sequence>
4618N/A
4618N/A <script>
4618N/A applicationDn='uid=my_application,dc=groups,dc=com'
4618N/A applicationPswd='pw_my_application'
4618N/A dynamicGroupDn='cn=my_dynamicgroup1,dc=groups,dc=com'
4618N/A newDynamicGroup='my_newDynamicGroup'
4618N/A newDynamicGroupDn='cn=%s,dc=groups,dc=com' % (newDynamicGroup)
4618N/A newDynamicGroupPswd='pw_%s' % (newDynamicGroup)
4618N/A user0='user_00'
4618N/A user0Dn='uid=%s,ou=dynamic,dc=groups,dc=com' % (user0)
4618N/A user0Pswd='pw_00'
4618N/A user1='user_01'
4618N/A user1Dn='uid=%s,ou=dynamic,dc=groups,dc=com' % (user1)
4618N/A user1Pswd='pw_01'
4618N/A user2='user_02'
4618N/A user2Dn='uid=%s,ou=dynamic,dc=groups,dc=com' % (user2)
4618N/A user2Pswd='pw_02'
4618N/A user2Add='user_22'
4618N/A user2AddDn='uid=%s,ou=dynamic,dc=groups,dc=com' % (user2Add)
4618N/A user2AddPswd='pw_22'
4618N/A user2AddRenamed='%s_bis' % (user2Add)
4618N/A user2AddRenamedDn='uid=%s,ou=dynamic,dc=groups,dc=com' % (user2AddRenamed)
4618N/A </script>
4618N/A
4618N/A <script>
4618N/A if not CurrentTestPath.has_key('group'):
4618N/A CurrentTestPath['group']='groups'
4618N/A CurrentTestPath['suite']=STAXCurrentBlock
4618N/A </script>
4618N/A
4618N/A <call function="'testSuite_Preamble'"/>
4618N/A
4618N/A <!--- Test Suite information
4618N/A #@TestSuiteName Group test suite
4618N/A #@TestSuitePurpose Test this feature
4618N/A #@TestSuiteID Groups Tests
4618N/A #@TestSuiteGroup Dynamic Group
4618N/A #@TestGroup Dynamic Group
4618N/A #@TestScript group_dynamic.xml
4618N/A #@TestHTMLLink http://opends.dev.java.net/
4618N/A -->
4618N/A
4618N/A <import machine="STAF_LOCAL_HOSTNAME"
4618N/A file="'%s/testcases/groups/group_setup.xml' % (TESTS_DIR)"/>
4618N/A <import machine="STAF_LOCAL_HOSTNAME"
4618N/A file="'%s/testcases/groups/group_lib.xml' % (TESTS_DIR)"/>
4618N/A
4618N/A <call function="'common_setup'">
4618N/A {
4618N/A 'quickStart' : False ,
4618N/A 'startServer' : True ,
4618N/A 'stopServer' : False ,
4618N/A 'loadData' : True ,
4618N/A 'ldifFile' : '%s/groups/groups.ldif' % remote.data
4618N/A }
4618N/A </call>
1691N/A
4618N/A <call function="'group_setup'"/>
1691N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Dynamic Group Tests
4618N/A #@TestName Group: Dynamic: add a dynamic group entry
4618N/A #@TestID
4618N/A #@TestPurpose
4618N/A #@TestPreamble
4618N/A #@TestSteps
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A <testcase name="getTestCaseName('add a dynamic group entry')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A
4618N/A <script>
4618N/A listAttr = []
4618N/A listAttr.append('cn:%s' % newDynamicGroup)
4618N/A listAttr.append('objectclass:top')
4618N/A listAttr.append('objectclass:groupofurls')
4618N/A listAttr.append('description:this is the description of %s' % newDynamicGroup)
4618N/A listAttr.append('memberurl:ldap:///ou=dynamic,dc=groups,dc=com??sub?(uid=*0*)')
4618N/A </script>
4618N/A <message>
4618N/A '++++ Application add group entry %s' % newDynamicGroupDn
4618N/A </message>
4618N/A <call function="'addAnEntry'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : applicationDn ,
4618N/A 'dsInstancePswd' : applicationPswd ,
4618N/A 'DNToAdd' : newDynamicGroupDn,
4618N/A 'listAttributes' : listAttr
4618N/A }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <message>
4618N/A '++++ Application do a search to check the entry has been created'
4618N/A </message>
4618N/A <call function="'ldapSearchWithScript'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : applicationDn ,
4618N/A 'dsInstancePswd' : applicationPswd ,
4618N/A 'dsBaseDN' : newDynamicGroupDn ,
4618N/A 'dsFilter' : 'objectclass=*' ,
4618N/A 'dsAttributes' : 'uniquemember' }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <call function="'CheckIsMemberOf'">
4618N/A { 'baseDn' : user0Dn ,
4618N/A 'string2find' : newDynamicGroupDn ,
4618N/A 'nbExpected' : 1
4618N/A }
4618N/A </call>
4618N/A
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Dynamic Group Tests
4618N/A #@TestName Group: Dynamic: delete a dynamic group entry
4618N/A #@TestID
4618N/A #@TestPurpose
4618N/A #@TestPreamble
4618N/A #@TestSteps
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A <testcase name="getTestCaseName('delete a dynamic group entry')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A <message>
4618N/A '++++ Delete the group entry %s' % newDynamicGroupDn
4618N/A </message>
4618N/A <call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : applicationDn ,
4618N/A 'dsInstancePswd' : applicationPswd ,
4618N/A 'dsBaseDN' : newDynamicGroupDn,
4618N/A }
4618N/A </call>
4618N/A <message>
4618N/A '++++ Check the group entry %s no more exist' % newDynamicGroup
4618N/A </message>
4618N/A <call function="'ldapSearchWithScript'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : applicationDn ,
4618N/A 'dsInstancePswd' : applicationPswd ,
4618N/A 'dsBaseDN' : newDynamicGroupDn ,
4618N/A 'dsFilter' : 'objectclass=*' ,
4618N/A 'expectedRC' : 32 }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <call function="'CheckIsMemberOf'">
4618N/A { 'baseDn' : user0Dn ,
4618N/A 'string2find' : newDynamicGroupDn ,
4618N/A 'nbExpected' : 0
4618N/A }
4618N/A </call>
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Dynamic Group Tests
4618N/A #@TestName Group: Dynamic: no group user do a search
4618N/A #@TestID
4618N/A #@TestPurpose
4618N/A #@TestPreamble
4618N/A #@TestSteps
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A <testcase name="getTestCaseName('no group user do a search')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A <message>
4618N/A '++++ %s search itself (should PASS as not a member of dynamic group)' % user1
4618N/A </message>
4618N/A <call function="'ldapSearchWithScript'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : user1Dn ,
4618N/A 'dsInstancePswd' : user1Pswd ,
4618N/A 'dsBaseDN' : user1Dn ,
4618N/A 'dsFilter' : 'objectclass=*' ,
4618N/A 'expectedRC' : 0 }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <call function="'CheckIsMemberOf'">
4618N/A { 'baseDn' : user1Dn ,
4618N/A 'string2find' : dynamicGroupDn ,
4618N/A 'nbExpected' : 0
4618N/A }
4618N/A </call>
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Dynamic Group Tests
4618N/A #@TestName Group: Dynamic: group user do a search
4618N/A #@TestID
4618N/A #@TestPurpose
4618N/A #@TestPreamble
4618N/A #@TestSteps
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A <testcase name="getTestCaseName('group user do a search')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A <message>
4618N/A '++++ %s search itself (should be refused as dynamic group does not have the permission)' % user2
4618N/A </message>
4618N/A <call function="'ldapSearchWithScript'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : user2Dn ,
4618N/A 'dsInstancePswd' : user2Pswd ,
4618N/A 'dsBaseDN' : user2Dn ,
4618N/A 'dsFilter' : 'objectclass=*' ,
4618N/A 'expectedRC' : 0 }
4618N/A </call>
4618N/A <message>
4618N/A '++++ Check the search returns nothing'
4618N/A </message>
4618N/A <call function="'CheckMatches'">
4618N/A { 'string2find' : 'dn' ,
4618N/A 'mainString' : STAXResult[0][1] ,
4618N/A 'nbExpected' : 0
4618N/A }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <call function="'CheckIsMemberOf'">
4618N/A { 'baseDn' : user2Dn ,
4618N/A 'string2find' : dynamicGroupDn ,
4618N/A 'nbExpected' : 1
4618N/A }
4618N/A </call>
4618N/A
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Dynamic Group Tests
4618N/A #@TestName Group: Dynamic: application add entry that belong to a group
4618N/A #@TestID
4618N/A #@TestPurpose
4618N/A #@TestPreamble
4618N/A #@TestSteps
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A <testcase name="getTestCaseName('application add entry that belong to a group')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A <message>
4618N/A '++++ Application add a new user %s / %s ' % (user2AddDn,user2AddPswd)
4618N/A </message>
4618N/A <script>
4618N/A listAttr = []
4618N/A listAttr.append('uid:%s' % user2Add)
4618N/A listAttr.append('objectclass:top')
4618N/A listAttr.append('objectclass:person')
4618N/A listAttr.append('objectclass:inetOrgPerson')
4618N/A listAttr.append('cn:%s' % user2Add)
4618N/A listAttr.append('sn:sn of user %s' % user2Add)
4618N/A listAttr.append('description:this is the description of %s' % user2Add)
4618N/A listAttr.append('userPassword:%s' % user2AddPswd)
4618N/A </script>
4618N/A <call function="'addAnEntry'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : applicationDn ,
4618N/A 'dsInstancePswd' : applicationPswd ,
4618N/A 'DNToAdd' : user2AddDn,
4618N/A 'listAttributes' : listAttr
4618N/A }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <message>
4618N/A '++++ %s search itself (should be refused as dynamic group does not have permission)' % user2Add
4618N/A </message>
4618N/A <call function="'ldapSearchWithScript'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : user2AddDn ,
4618N/A 'dsInstancePswd' : user2AddPswd ,
4618N/A 'dsBaseDN' : user2AddDn ,
4618N/A 'dsFilter' : 'objectclass=*' ,
4618N/A 'expectedRC' : 0 }
4618N/A </call>
4618N/A <message>
4618N/A '++++ Check the search returns nothing'
4618N/A </message>
4618N/A <call function="'CheckMatches'">
4618N/A { 'string2find' : 'dn' ,
4618N/A 'mainString' : STAXResult[0][1] ,
4618N/A 'nbExpected' : 0
4618N/A }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <call function="'CheckIsMemberOf'">
4618N/A { 'baseDn' : user2AddDn ,
4618N/A 'string2find' : dynamicGroupDn ,
4618N/A 'nbExpected' : 1
4618N/A }
4618N/A </call>
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Dynamic Group Tests
4618N/A #@TestName Group: Dynamic: application rename entry that belong to a group
4618N/A #@TestID
4618N/A #@TestPurpose
4618N/A #@TestPreamble
4618N/A #@TestSteps
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A <!---
4618N/A <testcase name="getTestCaseName('application rename entry that belong to a group')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A <message>
4618N/A '++++ Application rename %s into %s ' % (user2Add,user2AddRenamed)
4618N/A </message>
4618N/A
4618N/A <call function="'modifyDn'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : applicationDn ,
4618N/A 'dsInstancePswd' : applicationPswd ,
4618N/A 'DNToModify' : user2AddDn ,
4618N/A 'newRDN' : user2AddRenamed,
4618N/A 'deleteOldRDN' : 1 }
4618N/A </call>
4618N/A -->
4618N/A <!-- ******************** -->
4618N/A <!--
4618N/A <message>
4618N/A '++++ %s search itself (should be refused as dynamic group does not have permission)' % user2AddRenamed
4618N/A </message>
4618N/A <call function="'ldapSearchWithScript'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : user2AddRenamedDn ,
4618N/A 'dsInstancePswd' : user2AddPswd ,
4618N/A 'dsBaseDN' : user2AddRenamedDn ,
4618N/A 'dsFilter' : 'objectclass=*' ,
4618N/A 'expectedRC' : 0 }
4618N/A </call>
4618N/A <message>
4618N/A '++++ Check the search returns nothing'
4618N/A </message>
4618N/A <call function="'CheckMatches'">
4618N/A { 'string2find' : 'dn' ,
4618N/A 'mainString' : STAXResult[0][1] ,
4618N/A 'nbExpected' : 0
4618N/A }
4618N/A </call>
4618N/A -->
4618N/A <!-- ******************** -->
4618N/A <!--
4618N/A <call function="'CheckIsMemberOf'">
4618N/A { 'baseDn' : user2AddRenamedDn ,
4618N/A 'string2find' : dynamicGroupDn ,
4618N/A 'nbExpected' : 1
4618N/A }
4618N/A </call>
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A -->
4618N/A
4618N/A <!--- Test Case information
4618N/A #@TestMarker Dynamic Group Tests
4618N/A #@TestName Group: Dynamic: application delete entry belonging to a group
4618N/A #@TestID
4618N/A #@TestPurpose
4618N/A #@TestPreamble
4618N/A #@TestSteps
4618N/A #@TestPostamble
4618N/A #@TestResult
4618N/A -->
4618N/A <testcase name="getTestCaseName('application delete entry belonging to a group')">
4618N/A <sequence>
4618N/A <call function="'testCase_Preamble'"/>
4618N/A <message>
4618N/A '++++ Application delete user %s' % user2Add
4618N/A </message>
4618N/A <call function="'DeleteEntry'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : applicationDn ,
4618N/A 'dsInstancePswd' : applicationPswd ,
4618N/A 'dsBaseDN' : user2AddDn
4618N/A }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <message>
4618N/A '++++ Check the entry %s no more exist' % user2Add
4618N/A </message>
4618N/A <call function="'ldapSearchWithScript'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : applicationDn ,
4618N/A 'dsInstancePswd' : applicationPswd ,
4618N/A 'dsBaseDN' : user2AddDn ,
4618N/A 'dsFilter' : 'objectclass=*' ,
4618N/A 'dsAttributes' : 'dn',
4618N/A 'expectedRC' : 32 }
4618N/A </call>
4618N/A <!-- ******************** -->
4618N/A <message>
4618N/A '++++ %s do a search (should fail)' % user2Add
4618N/A </message>
4618N/A <call function="'ldapSearchWithScript'">
4618N/A { 'dsInstanceHost' : server.host ,
4618N/A 'dsInstancePort' : server.port ,
4618N/A 'dsInstanceDn' : user2AddDn ,
4618N/A 'dsInstancePswd' : user2AddPswd ,
4618N/A 'dsBaseDN' : user2AddDn ,
4618N/A 'dsFilter' : 'objectclass=*' ,
4618N/A 'expectedRC' : 49 }
4618N/A </call>
4618N/A <call function="'testCase_Postamble'"/>
4618N/A </sequence>
4618N/A </testcase>
4618N/A
4618N/A </sequence>
1691N/A
4618N/A <finally>
1691N/A <sequence>
4618N/A <!-- Test Suite Cleanup -->
4618N/A <message>'Finally: Global Groups Cleanup.'</message>
4618N/A <try>
4618N/A <call function="'common_cleanup'" />
4618N/A <catch exception="'STAFException'">
4618N/A <sequence>
4618N/A <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
4618N/A </sequence>
4618N/A </catch>
4618N/A <finally>
4618N/A <call function="'testSuite_Postamble'"/>
4618N/A </finally>
4618N/A </try>
1691N/A </sequence>
4618N/A </finally>
4618N/A
4618N/A </try>
4618N/A
1691N/A </block>
1691N/A
1691N/A </sequence>
1691N/A
1691N/A </function>
1691N/A
1691N/A</stax>