3361N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
3361N/A ! The contents of this file are subject to the terms of the 3361N/A ! Common Development and Distribution License, Version 1.0 only 3361N/A ! (the "License"). You may not use this file except in compliance 3361N/A ! You can obtain a copy of the license at 3361N/A ! See the License for the specific language governing permissions 3361N/A ! and limitations under the License. 3361N/A ! When distributing Covered Code, include this CDDL HEADER in each 3361N/A ! file and include the License file at 3361N/A ! add the following below this CDDL HEADER, with the fields enclosed 3361N/A ! by brackets "[]" replaced with your own identifying information: 3361N/A ! Portions Copyright [yyyy] [name of copyright owner] 3361N/A ! Copyright 2007-2009 Sun Microsystems, Inc. <
defaultcall function="main_virtualAttributes_cos"/>
<
function name="main_virtualAttributes_cos">
<
block name="'virtualAttributes_cos'">
CurrentTestPath['group']='virtualAttributes'
CurrentTestPath['suite']=STAXCurrentBlock
<!-- GLOBAL VARIABLES --> applicationDn='uid=my_application,dc=virtualAttributes,dc=com'
applicationPswd='pw_my_application'
staticGroupDn='cn=my_staticgroup,dc=virtualAttributes,dc=com'
virtualAttributesDn='dc=virtualAttributes,dc=com'
people1Dn='ou=people1,%s' % virtualAttributesDn
user1Dn='uid=%s,%s' % (user1,people1Dn)
people2Dn='ou=people2,%s' % virtualAttributesDn
user4Dn='uid=%s,%s' % (user4,people2Dn)
<
call function="'testSuite_Preamble'"/>
<!--- Test Suite information #@TestSuiteName virtual attributes test suite #@TestSuitePurpose COS (user defined virtual attributes) Tests #@TestSuiteGroup COS (user defined virtual attributes) <
call function="'common_setup'">
<!--- Test Case information #@TestMarker virtual attributes test suite #@TestName virtualAttributes: COS for all the DIT #@TestPurpose check cos defined in top on the tree #@TestPreamble create a cos #@TestSteps check it is available on entry #@TestPostamble delete the cos <
testcase name="getTestCaseName('cos for all the DIT')">
<
call function="'testCase_Preamble'"/>
cosName = 'userDefinedVirtualAttr1'
attributeName = 'manager'
attributeValue = 'John Doe'
<!-- ========================================= --> '++++ Create user defined virtual attribute'
arg1 = '--type user-defined --name %s' % cosName
arg2 = '--set enabled:true'
arg3 = '--set attribute-type:%s' % attributeName
arg4 = '--set value:"%s"' % attributeValue
arg5 = '--set base-dn:%s' % virtualAttributesDn
myOptions = '%s %s %s %s %s' % (arg1,arg2,arg3,arg4,arg5)
<
call function="'dsconfig'">
'subcommand' : 'create-virtual-attribute',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ check user defined virtual attribute created \
<
call function="'dsconfig'">
'subcommand' : 'list-virtual-attributes',
<
call function="'CheckMatches'">
{ 'string2find' : cosName,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Application do a search on user entry which \
should have now %s attribute' % attributeName
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check the search return value : %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ change user defined virtual attribute value'
attributeValue2 = 'Elvis'
arg1 = '--name %s' % cosName
arg2 = '--set value:"%s"' % attributeValue2
myOptions = '%s %s' % (arg1,arg2)
<
call function="'dsconfig'">
'subcommand' : 'set-virtual-attribute-prop',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ Application do a search on user entry which \
should have new value for %s attribute' % attributeName
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check the search return value : %s' % attributeValue2
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue2,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Delete user defined virtual attribute'
<
call function="'dsconfig'">
'subcommand' : 'delete-virtual-attribute',
'optionsString' : '--name %s' % cosName,
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker virtual attributes test suite #@TestName virtualAttributes: COS for a subtree #@TestPurpose check cos defined in a subtree on the tree #@TestPreamble create a cos #@TestSteps check it is available under the subtree #@TestPostamble delete the cos <
testcase name="getTestCaseName('cos for a subtree')">
<
call function="'testCase_Preamble'"/>
cosName = 'userDefinedVirtualAttr2'
attributeName = 'carLicense'
attributeValue = '1234XZ38'
<!-- ========================================= --> '++++ Create user defined virtual attribute'
arg1 = '--type user-defined --name %s' % cosName
arg2 = '--set enabled:true'
arg3 = '--set attribute-type:%s' % attributeName
arg4 = '--set value:"%s"' % attributeValue
arg5 = '--set base-dn:%s' % people1Dn
myOptions = '%s %s %s %s %s' % (arg1,arg2,arg3,arg4,arg5)
<
call function="'dsconfig'">
'subcommand' : 'create-virtual-attribute',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ check user defined virtual attribute created \
<
call function="'dsconfig'">
'subcommand' : 'list-virtual-attributes',
<
call function="'CheckMatches'">
{ 'string2find' : cosName,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Application do a search on user entry which \
should have now %s attribute (entry under the subtree %s)'\
% (attributeName,people1Dn)
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check the search return value : %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Application do a search on user entry which \
should NOT have %s attribute (entry under the subtree %s)'\
% (attributeName,people2Dn)
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check search do not return value : %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Delete user defined virtual attribute'
<
call function="'dsconfig'">
'subcommand' : 'delete-virtual-attribute',
'optionsString' : '--name %s' % cosName,
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker virtual attributes test suite #@TestName virtualAttributes: should be readonly attribute #@TestPurpose check cos attribute can not be modified by #@TestPreamble create a cos #@TestSteps check it is in readonly #@TestPostamble delete the cos <
testcase name="getTestCaseName('cos should be readonly attribute')">
<
call function="'testCase_Preamble'"/>
cosName = 'userDefinedVirtualAttr3'
attributeName = 'telexNumber'
attributeValue = '987654321'
<!-- ========================================= --> '++++ Create user defined virtual attribute'
arg1 = '--type user-defined --name %s' % cosName
arg2 = '--set enabled:true'
arg3 = '--set attribute-type:%s' % attributeName
arg4 = '--set value:"%s"' % attributeValue
arg5 = '--set base-dn:%s' % virtualAttributesDn
myOptions = '%s %s %s %s %s' % (arg1,arg2,arg3,arg4,arg5)
<
call function="'dsconfig'">
'subcommand' : 'create-virtual-attribute',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ Application do a search on user entry which \
should NOT have %s attribute (entry under the subtree %s)'\
% (attributeName,people2Dn)
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check the search return value %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Application do a modify on user entry which \
should have now %s attribute (should fail)' % attributeName
<
call function="'ldapModifyWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
<!-- ========================================= --> '++++ Delete user defined virtual attribute'
<
call function="'dsconfig'">
'subcommand' : 'delete-virtual-attribute',
'optionsString' : '--name %s' % cosName
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker virtual attributes test suite #@TestPurpose check cos enable property #@TestPreamble create a cos #@TestPostamble delete the cos <
call function="'testCase_Preamble'"/>
cosName = 'userDefinedVirtualAttr4'
attributeName = 'carLicense'
attributeValue = '6541RT38'
<!-- ========================================= --> '++++ Create user defined virtual attribute (disabled)'
arg1 = '--type user-defined --name %s' % cosName
arg2 = '--set enabled:false'
arg3 = '--set attribute-type:%s' % attributeName
arg4 = '--set value:"%s"' % attributeValue
arg5 = '--set base-dn:%s' % virtualAttributesDn
myOptions = '%s %s %s %s %s' % (arg1,arg2,arg3,arg4,arg5)
<
call function="'dsconfig'">
'subcommand' : 'create-virtual-attribute',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ Application do a search on user'
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check the search do not return %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Enable user defined virtual attribute'
myOptions = '--name %s --set enabled:true' % cosName
<
call function="'dsconfig'">
'subcommand' : 'set-virtual-attribute-prop',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ Application do a search on user'
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check the search return %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Delete user defined virtual attribute'
<
call function="'dsconfig'">
'subcommand' : 'delete-virtual-attribute',
'optionsString' : '--name %s' % cosName,
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker virtual attributes test suite #@TestName virtualAttributes: virtual-overrides-real #@TestPurpose check cos conflict-behavior property #@TestPreamble create a cos #@TestSteps check conflict-behavior=virtual-overrides-real #@TestPostamble delete the cos <
testcase name="getTestCaseName('cos virtual-overrides-real')">
<
call function="'testCase_Preamble'"/>
cosName = 'userDefinedVirtualAttr5'
attributeName = 'description'
attributeValue = 'new_desc_for_testcase'
descDefaultValue = 'this is the description of'
<!-- ========================================= --> '++++ Create user defined virtual attribute with \
conflict-behavior prop set to virtual-overrides-real'
arg1 = '--type user-defined --name %s' % cosName
arg2 = '--set enabled:true'
arg3 = '--set attribute-type:%s' % attributeName
arg4 = '--set value:"%s"' % attributeValue
arg5 = '--set base-dn:%s' % virtualAttributesDn
arg6 = '--set conflict-behavior:virtual-overrides-real'
myOptions='%s %s %s %s %s %s'%(arg1,arg2,arg3,arg4,arg5,arg6)
<
call function="'dsconfig'">
'subcommand' : 'create-virtual-attribute',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ Application do a search on user'
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
ldapsearchReturn = STAXResult[0][1]
<!-- ========================================= --> '++++ Check search do not return %s' % descDefaultValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % descDefaultValue,
'mainString' : ldapsearchReturn,
<!-- ========================================= --> '++++ Check search return virtualattribute %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : ldapsearchReturn,
<!-- ========================================= --> '++++ Delete user defined virtual attribute'
<
call function="'dsconfig'">
'subcommand' : 'delete-virtual-attribute',
'optionsString' : '--name %s' % cosName,
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker virtual attributes test suite #@TestName virtualAttributes: real-overrides-virtual #@TestPurpose check cos conflict-behavior property #@TestPreamble create a cos #@TestSteps check conflict-behavior=real-overrides-virtual #@TestPostamble delete the cos <
testcase name="getTestCaseName('cos real-overrides-virtual')">
<
call function="'testCase_Preamble'"/>
cosName = 'userDefinedVirtualAttr6'
attributeName = 'description'
attributeValue = 'new_desc_for_testcase'
descDefaultValue = 'this is the description of'
<!-- ========================================= --> '++++ Create user defined virtual attribute with \
conflict-behavior prop set to virtual-overrides-real'
arg1 = '--type user-defined --name %s' % cosName
arg2 = '--set enabled:true'
arg3 = '--set attribute-type:%s' % attributeName
arg4 = '--set value:"%s"' % attributeValue
arg5 = '--set base-dn:%s' % virtualAttributesDn
arg6 = '--set conflict-behavior:real-overrides-virtual'
myOptions='%s %s %s %s %s %s'%(arg1,arg2,arg3,arg4,arg5,arg6)
<
call function="'dsconfig'">
'subcommand' : 'create-virtual-attribute',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ Application do a search on user'
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
ldapsearchReturn = STAXResult[0][1]
<!-- ========================================= --> '++++ Check search return %s' % descDefaultValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % descDefaultValue,
'mainString' : ldapsearchReturn,
<!-- ========================================= --> '++++ Check search do not return %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : ldapsearchReturn,
<!-- ========================================= --> '++++ Delete user defined virtual attribute'
<
call function="'dsconfig'">
'subcommand' : 'delete-virtual-attribute',
'optionsString' : '--name %s' % cosName,
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker virtual attributes test suite #@TestName virtualAttributes: merge-real-and-virtual #@TestPurpose check cos conflict-behavior property #@TestPreamble create a cos #@TestSteps check conflict-behavior=merge-real-and-virtual #@TestPostamble delete the cos <
testcase name="getTestCaseName('cos merge-real-and-virtual')">
<
call function="'testCase_Preamble'"/>
cosName = 'userDefinedVirtualAttr7'
attributeName = 'description'
attributeValue = 'new_desc_for_testcase'
descDefaultValue = 'this is the description of'
<!-- ========================================= --> '++++ Create user defined virtual attribute with \
conflict-behavior prop set to virtual-overrides-real'
arg1 = '--type user-defined --name %s' % cosName
arg2 = '--set enabled:true'
arg3 = '--set attribute-type:%s' % attributeName
arg4 = '--set value:"%s"' % attributeValue
arg5 = '--set base-dn:%s' % virtualAttributesDn
arg6 = '--set conflict-behavior:merge-real-and-virtual'
myOptions='%s %s %s %s %s %s'%(arg1,arg2,arg3,arg4,arg5,arg6)
<
call function="'dsconfig'">
'subcommand' : 'create-virtual-attribute',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ Application do a search on user'
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
ldapsearchReturn = STAXResult[0][1]
<!-- ========================================= --> '++++ Check search return %s' % descDefaultValue
<
call function="'searchString'">
'expectedString' : '%s' % descDefaultValue ,
'returnString' : ldapsearchReturn ,
<!-- ========================================= --> '++++ Check search return %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : ldapsearchReturn,
<!-- ========================================= --> '++++ Delete user defined virtual attribute'
<
call function="'dsconfig'">
'subcommand' : 'delete-virtual-attribute',
'optionsString' : '--name %s' % cosName,
<
call function="'testCase_Postamble'"/>
<!--- Test Case information #@TestMarker virtual attributes test suite #@TestName virtualAttributes: filter for COS #@TestPurpose check cos filter property #@TestPreamble create a cos #@TestSteps filter=person should only apply the cos to #@TestPostamble delete the cos <
testcase name="getTestCaseName('cos filter')">
<
call function="'testCase_Preamble'"/>
cosName = 'userDefinedVirtualAttr8'
attributeName = 'manager'
<!-- ========================================= --> '++++ Create user defined virtual attribute (disabled)'
arg1 = '--type user-defined --name %s' % cosName
arg2 = '--set enabled:true'
arg3 = '--set attribute-type:%s' % attributeName
arg4 = '--set value:"%s"' % attributeValue
arg5 = '--set base-dn:%s' % virtualAttributesDn
arg6 = '--set filter:objectClass=person'
myOptions = '%s %s %s %s %s %s'%(arg1,arg2,arg3,arg4,arg5,arg6)
<
call function="'dsconfig'">
'subcommand' : 'create-virtual-attribute',
'optionsString' : myOptions,
<!-- ========================================= --> '++++ Application do a search on person entry'
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check the search return %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Application do a search on organization entry'
<
call function="'ldapSearchWithScript'">
'dsInstanceDn' : applicationDn,
'dsInstancePswd' : applicationPswd,
'dsFilter' : 'objectclass=*',
'dsAttributes' : '%s' % attributeName }
<!-- ========================================= --> '++++ Check the search do not return %s' % attributeValue
<
call function="'CheckMatches'">
{ 'string2find' : '%s' % attributeValue,
'mainString' : STAXResult[0][1],
<!-- ========================================= --> '++++ Delete user defined virtual attribute'
<
call function="'dsconfig'">
'subcommand' : 'delete-virtual-attribute',
'optionsString' : '--name %s' % cosName,
<
call function="'testCase_Postamble'"/>
<!-- *********************************************** --> <
import machine="STAF_LOCAL_HOSTNAME" <
call function="'virtualAttributes_cleanup'">
<!-- Test Suite Cleanup --> <
message>'Finally: Global ACI Cleanup.'</
message>
<
call function="'common_cleanup'" />
<
catch exception="'STAFException'">
<
message log="1" level="'fatal'">'Cleanup of test suite failed.'</
message>
<
call function="'testSuite_Postamble'"/>