<?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-2009 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="virtual_static"/>
<function name="virtual_static">
<sequence>
<block name="'virtual_static'">
<try>
<sequence>
<script>
applicationDn='uid=my_application,dc=groups,dc=com'
applicationPswd='pw_my_application'
dynamicGroupDn='cn=my_dynamicgroup1,dc=groups,dc=com'
virtualStaticGroupDn='cn=my_virtualstaticgroup,dc=groups,dc=com'
newVirtualStaticGroup='my_newVirtualStaticGroup'
newVirtualStaticGroupDn='cn=%s,dc=groups,dc=com' % (newVirtualStaticGroup)
newVirtualStaticGroupPswd='pw_%s' % (newVirtualStaticGroup)
user2Add='user_22'
user2AddDn='uid=%s,ou=dynamic,dc=groups,dc=com' % (user2Add)
user2AddPswd='pw_22'
user2AddRenamed='%s_bis' % (user2Add)
user2AddRenamedDn='uid=%s,ou=dynamic,dc=groups,dc=com' % (user2AddRenamed)
</script>
<script>
if not CurrentTestPath.has_key('group'):
CurrentTestPath['group']='groups'
CurrentTestPath['suite']=STAXCurrentBlock
</script>
<call function="'testSuite_Preamble'"/>
<!--- Test Suite information
#@TestSuiteName Group test suite
#@TestSuitePurpose Test this feature
#@TestSuiteID Groups Tests
#@TestSuiteGroup Virtual Static Group
#@TestGroup Virtual Static Group
#@TestScript group_virtual_static.xml
#@TestHTMLLink http://opends.dev.java.net/
-->
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/groups/group_setup.xml' % (TESTS_DIR)"/>
<import machine="STAF_LOCAL_HOSTNAME"
file="'%s/testcases/groups/group_lib.xml' % (TESTS_DIR)"/>
<call function="'common_setup'">
{
'quickStart' : False ,
'startServer' : True ,
'stopServer' : False ,
'loadData' : True ,
'ldifFile' : '%s/groups/groups.ldif' % remote.data
}
</call>
<call function="'group_setup'"/>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: enable member virtual attribute
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('enable member virtual attribute')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : server.dn ,
'dsInstancePswd' : server.password ,
'DNToModify' : 'cn=Virtual Static uniqueMember,cn=Virtual Attributes,cn=config' ,
'changetype' : 'replace' ,
'attributeName' : 'ds-cfg-allow-retrieving-membership' ,
'newAttributeValue' : 'true'
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: add a Virtual Static group entry
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('add a Virtual Static group entry')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
listAttr = []
listAttr.append('cn:%s' % newVirtualStaticGroup)
listAttr.append('objectclass:top')
listAttr.append('objectclass:groupOfUniqueNames')
listAttr.append('objectclass:ds-virtual-static-group')
listAttr.append('description:this is the description of %s' % newVirtualStaticGroup)
listAttr.append('ds-target-group-dn:%s' % dynamicGroupDn)
</script>
<message>
'++++ Application add group entry %s' % newVirtualStaticGroupDn
</message>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToAdd' : newVirtualStaticGroupDn,
'listAttributes' : listAttr
}
</call>
<!-- ******************** -->
<message>
'++++ Application do a search to check the entry has been created'
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : newVirtualStaticGroupDn ,
'dsFilter' : 'objectclass=*' ,
'dsAttributes' : 'uniquemember' }
</call>
<!-- ******************** -->
<call function="'CheckIsMemberOf'">
{ 'baseDn' : 'uid=user_02,ou=dynamic,dc=groups,dc=com' ,
'string2find' : newVirtualStaticGroupDn ,
'nbExpected' : 1
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: delete a Virtual Static group entry
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('delete a Virtual Static group entry')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'++++ Delete the group entry %s' % newVirtualStaticGroupDn
</message>
<call function="'DeleteEntry'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : newVirtualStaticGroupDn,
}
</call>
<message>
'++++ Check the group entry %s no more exist' % newVirtualStaticGroup
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : newVirtualStaticGroupDn ,
'dsFilter' : 'objectclass=*' ,
'expectedRC' : 32 }
</call>
<!-- ******************** -->
<call function="'CheckIsMemberOf'">
{ 'baseDn' : 'uid=user_02,ou=dynamic,dc=groups,dc=com' ,
'string2find' : newVirtualStaticGroupDn ,
'nbExpected' : 0
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: search members of group
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('search members of group')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'++++ Search members of group %s' % virtualStaticGroupDn
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : virtualStaticGroupDn ,
'dsFilter' : 'uniquemember=*' ,
'expectedRC' : 0 }
</call>
<script>
ldapSearchResult=STAXResult[0][1]
</script>
<!-- ******************** -->
<message>
'++++ Check uid=user_01,ou=dynamic,dc=groups,dc=com is NOT a group member'
</message>
<call function="'CheckMatches'">
{ 'string2find' : 'uid=user_01,ou=dynamic,dc=groups,dc=com' ,
'mainString' : ldapSearchResult ,
'nbExpected' : 0
}
</call>
<!-- ******************** -->
<message>
'++++ Check uid=user_02,ou=dynamic,dc=groups,dc=com is a group member'
</message>
<call function="'CheckMatches'">
{ 'string2find' : 'uid=user_02,ou=dynamic,dc=groups,dc=com' ,
'mainString' : ldapSearchResult ,
'nbExpected' : 1
}
</call>
<!-- ******************** -->
<message>
'++++ Check uid=user_12,ou=dynamic,dc=groups,dc=com is a group member'
</message>
<call function="'CheckMatches'">
{ 'string2find' : 'uid=user_12,ou=dynamic,dc=groups,dc=com' ,
'mainString' : ldapSearchResult ,
'nbExpected' : 1
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: application add entry that belong to a group
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('application add entry that belong to a group')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'++++ Application add a new user %s / %s ' % (user2AddDn,user2AddPswd)
</message>
<script>
listAttr = []
listAttr.append('uid:%s' % user2Add)
listAttr.append('objectclass:top')
listAttr.append('objectclass:person')
listAttr.append('objectclass:inetOrgPerson')
listAttr.append('cn:%s' % user2Add)
listAttr.append('sn:sn of user %s' % user2Add)
listAttr.append('description:this is the description of %s' % user2Add)
listAttr.append('userPassword:%s' % user2AddPswd)
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToAdd' : user2AddDn,
'listAttributes' : listAttr
}
</call>
<!-- ******************** -->
<message>
'++++ Application search the new user %s in the virtual static group entry (should be a member)' % user2Add
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : virtualStaticGroupDn ,
'dsFilter' : 'uniquemember=*' ,
'expectedRC' : 0 }
</call>
<message>
'++++ Check the search returns the added user'
</message>
<call function="'CheckMatches'">
{ 'string2find' : user2AddDn ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1
}
</call>
<!-- ******************** -->
<call function="'CheckIsMemberOf'">
{ 'baseDn' : user2AddDn ,
'string2find' : virtualStaticGroupDn ,
'nbExpected' : 1
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: application rename entry that belong to a group
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<!--
<testcase name="getTestCaseName('application rename entry that belong to a group')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'++++ Application rename %s into %s ' % (user2Add,user2AddRenamed)
</message>
<call function="'modifyDn'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToModify' : user2AddDn ,
'newRDN' : user2AddRenamed,
'deleteOldRDN' : 1 }
</call>
-->
<!-- ******************** -->
<!--
<message>
'++++ Application search the new user %s in the virtual static group entry (should be a member)' % user2Add
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : virtualStaticGroupDn ,
'dsFilter' : 'uniquemember=*' ,
'expectedRC' : 0 }
</call>
<message>
'++++ Check the search returns the added user'
</message>
<call function="'CheckMatches'">
{ 'string2find' : user2AddRenamedDn ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1
}
</call>
-->
<!-- ******************** -->
<!--
<call function="'CheckIsMemberOf'">
{ 'baseDn' : user2AddRenamedDn ,
'string2find' : virtualStaticGroupDn ,
'nbExpected' : 1
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
-->
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: application delete entry belonging to a group
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('application delete entry belonging to a group')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'++++ Application delete user %s' % user2Add
</message>
<call function="'DeleteEntry'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : user2AddDn
}
</call>
<!-- ******************** -->
<message>
'++++ Application search the deleted user %s in the virtual static group entry (should not be in)' % user2Add
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : virtualStaticGroupDn ,
'dsFilter' : 'uniquemember=*' ,
'expectedRC' : 0 }
</call>
<message>
'++++ Check the search returns the added user'
</message>
<call function="'CheckMatches'">
{ 'string2find' : user2AddDn ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 0
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: Change ds-target-group-dn to another dynamic group
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Change ds-target-group-dn to another dynamic group')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
dynamicGroup2Dn='cn=my_dynamicgroup2,dc=groups,dc=com'
</script>
<message>
'++++ Application set a value %s to ds-target-group-dn attribute for group %s' % (dynamicGroup2Dn,virtualStaticGroupDn)
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToModify' : virtualStaticGroupDn ,
'changetype' : 'replace' ,
'attributeName' : 'ds-target-group-dn' ,
'newAttributeValue' : dynamicGroup2Dn }
</call>
<!-- ******************** -->
<message>
'++++ Application search users becoming to the updated virtual static group entry'
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : virtualStaticGroupDn ,
'dsFilter' : 'uniquemember=*' ,
'expectedRC' : 0 }
</call>
<call function="'CheckMatches'">
{ 'string2find' : 'uid=user_03,ou=dynamic,dc=groups,dc=com' ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1 }
</call>
<!-- ******************** -->
<message>
'++++ Application reset ds-target-group-dn attribute to default value %s' % (dynamicGroupDn)
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToModify' : virtualStaticGroupDn ,
'changetype' : 'replace' ,
'attributeName' : 'ds-target-group-dn' ,
'newAttributeValue' : dynamicGroupDn }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: Change ds-target-group-dn to static group (member type)
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Change ds-target-group-dn to static group (uniquemember type)')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
staticGroupDn='cn=my_staticgroup1,dc=groups,dc=com'
</script>
<message>
'++++ Application set a value %s to ds-target-group-dn attribute for group %s' % (staticGroupDn,virtualStaticGroupDn)
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToModify' : virtualStaticGroupDn ,
'changetype' : 'replace' ,
'attributeName' : 'ds-target-group-dn' ,
'newAttributeValue' : staticGroupDn }
</call>
<!-- ******************** -->
<message>
'++++ Application search users becoming to the updated virtual static group entry'
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : virtualStaticGroupDn ,
'dsFilter' : 'uniquemember=*' ,
'expectedRC' : 0 }
</call>
<call function="'CheckMatches'">
{ 'string2find' : 'uid=user_09,ou=static,dc=groups,dc=com' ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1 }
</call>
<!-- ******************** -->
<message>
'++++ Application reset ds-target-group-dn attribute to default value %s' % (dynamicGroupDn)
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToModify' : virtualStaticGroupDn ,
'changetype' : 'replace' ,
'attributeName' : 'ds-target-group-dn' ,
'newAttributeValue' : dynamicGroupDn }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: Change ds-target-group-dn to static group (member type)
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Change ds-target-group-dn to static group (member type)')">
<sequence>
<call function="'testCase_Preamble'"/>
<script>
staticGroupDn='cn=my_staticgroup2,dc=groups,dc=com'
</script>
<message>
'++++ Application set a value %s to ds-target-group-dn attribute for group %s' % (staticGroupDn,virtualStaticGroupDn)
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToModify' : virtualStaticGroupDn ,
'changetype' : 'replace' ,
'attributeName' : 'ds-target-group-dn' ,
'newAttributeValue' : staticGroupDn }
</call>
<!-- ******************** -->
<message>
'++++ Application search users becoming to the updated virtual static group entry'
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : virtualStaticGroupDn ,
'dsFilter' : 'uniquemember=*' ,
'expectedRC' : 0 }
</call>
<call function="'CheckMatches'">
{ 'string2find' : 'uid=user_09,ou=static,dc=groups,dc=com' ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1 }
</call>
<!-- ******************** -->
<message>
'++++ Application reset ds-target-group-dn attribute to default value %s' % (dynamicGroupDn)
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToModify' : virtualStaticGroupDn ,
'changetype' : 'replace' ,
'attributeName' : 'ds-target-group-dn' ,
'newAttributeValue' : dynamicGroupDn }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!--- Test Case information
#@TestMarker Virtual Static Group Tests
#@TestName Group: Virtual Static: Remove ds-target-group-dn attribute
#@TestID
#@TestPurpose
#@TestPreamble
#@TestSteps
#@TestPostamble
#@TestResult
-->
<testcase name="getTestCaseName('Remove ds-target-group-dn attribute')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>
'++++ Application remove ds-target-group-dn attribute'
</message>
<call function="'modifyAnAttribute'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'DNToModify' : virtualStaticGroupDn ,
'changetype' : 'delete' ,
'attributeName' : 'ds-target-group-dn' ,
'newAttributeValue' : dynamicGroupDn ,
'expectedRC' : 65 }
</call>
<!-- ******************** -->
<message>
'++++ Group should not be modified'
</message>
<call function="'ldapSearchWithScript'">
{ 'dsInstanceHost' : server.host ,
'dsInstancePort' : server.port ,
'dsInstanceDn' : applicationDn ,
'dsInstancePswd' : applicationPswd ,
'dsBaseDN' : virtualStaticGroupDn ,
'dsFilter' : 'uniquemember=*' ,
'expectedRC' : 0 }
</call>
<call function="'CheckMatches'">
{ 'string2find' : 'uid=user_02,ou=dynamic,dc=groups,dc=com' ,
'mainString' : STAXResult[0][1] ,
'nbExpected' : 1 }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global Groups 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>