<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
! 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
! 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
!
! Copyright 2007-2009 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="plugins_uniqueness"/>
<function name="plugins_uniqueness" scope="local">
<block name="STAXCurrentFunction">
<try>
<sequence>
<script>
CurrentTestPath['suite']=STAXCurrentFunction
</script>
<call function="'testSuite_Preamble'" />
<call function="'common_setup'">
{
'quickStart' : True ,
'startServer' : True ,
'stopServer' : False
}
</call>
<!--- Test Suite information
#@TestSuiteName Plugin uniqueness
#@TestSuitePurpose Validate the plugin uniqueness
#@TestSuiteID Plugins
#@TestSuiteGroup Plugins
#@TestGroup Plugins
#@TestScript plugins_uniqueness.xml
#@TestHTMLLink http://opends.dev.java.net/
-->
<!---
#@TestMarker Plugin uniqueness
#@TestName Plugin uniqueness setup
#@TestPurpose Setup
#@TestPreamble none
#@TestStep Create the user entries
#@TestStep the user entries contain the attributes mail and description
#@TestStep Enable the uniqueness plugin
#@TestPostamble none
#@TestResult The test is passed if the creation is done
-->
<testcase name="getTestCaseName('Setup')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'###### Add an user entry ###### '</message>
<message>' '</message>
<!-- This entry is used as a reference -->
<!-- Add an entry -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:testuser_uniqueness')
listAttr.append('sn:testuser_uniqueness')
listAttr.append('cn:testuser_uniqueness')
listAttr.append('mail:testuser_uniqueness@sun')
listAttr.append('description:mydescription1')
listAttr.append('description:mydescription2')
listAttr.append('telephoneNumber:1 2 3 4')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=testuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<call function="'SearchObject'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=testuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
'dsFilter' : 'objectclass=*' ,
'dsScope' : 'base',
'expectedRC' : 0 }
</call>
<message>'###### Activate the uniqueness plugin. ###### '</message>
<message>' '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'optionsString' : '--set enabled:true',
'expectedRC' : 0 }
</call>
<message>'###### Get the UID Unique Attributes ###### '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'expectedRC' : 0 }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
#@TestMarker Plugin uniqueness
#@TestName Plugin uniqueness with the type uid
#@TestPurpose Check the plugin uniqueness matchs against the default attribute names uid
#@TestPreamble none
#@TestStep Keep the default type uid
#@TestStep Check we can't add an entry with the same uid as the user entry reference
#@TestPostamble none
#@TestResult The test is passed if the creation is refused
-->
<testcase name="getTestCaseName('Plugin uniqueness with the type uid')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'###### Add an entry with an uid already present in the DIT ######'</message>
<message>'--- The creation must be refused to ensure the uniqueness of the attributes uid '</message>
<message>' '</message>
<!-- Add an entry -->
<!--The uid testuser_uniqueness already exist in the DIT. the Add must be refused with the error 19 -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:testuser_uniqueness')
listAttr.append('sn:testuser_uniqueness')
listAttr.append('cn:testuser_uniqueness')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=testuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 19
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
#@TestMarker Plugin uniqueness
#@TestName Plugin uniqueness with the type mail
#@TestPurpose Check the plugin uniqueness matchs against the attribute names mail
#@TestPreamble none
#@TestStep Change the type of the UID Unique Attribute to mail
#@TestStep Check we can't add an entry with the same mail as the user entry reference
#@TestPostamble none
#@TestResult The test is passed if the creation is refused
-->
<testcase name="getTestCaseName('Plugin uniqueness with the type mail')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'###### Set the type to mail ###### '</message>
<message>' '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'optionsString' : '--set type:mail',
'expectedRC' : 0 }
</call>
<message>'###### Get the UID Unique Attributes ###### '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'expectedRC' : 0 }
</call>
<message>'###### Add an entry containing a mail already present in the DIT ###### '</message>
<!-- Add an entry -->
<!-- the Add must be refused with the error 19 -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness')
listAttr.append('cn:newtestuser_uniqueness')
listAttr.append('mail:testuser_uniqueness@sun')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 19
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
#@TestMarker Plugin uniqueness
#@TestName Plugin uniqueness with several type
#@TestPurpose Check the plugin uniqueness with several types
#@TestPreamble none
#@TestStep Set the type of the UID Unique Attribute to mail and telephonenumber
#@TestStep Check we can't add an entry with the same mail as the user entry reference
#@TestStep Check we can't add an entry with the same telephonenumber as the user entry reference
#@TestPostamble none
#@TestResult The test is passed if the creation is refused
-->
<testcase name="getTestCaseName('Plugin uniqueness with several type')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'###### Set the type to mail and telephoneNumber ###### '</message>
<message>' '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'optionsString' : '--set type:mail',
'expectedRC' : 0 }
</call>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'optionsString' : '--add type:telephoneNumber',
'expectedRC' : 0 }
</call>
<message>'###### Get the UID Unique Attributes ###### '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'expectedRC' : 0 }
</call>
<message>'###### Add an entry containing a mail already present in the DIT ###### '</message>
<!-- Add an entry -->
<!-- the Add must be refused with the error 19 -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness')
listAttr.append('cn:newtestuser_uniqueness')
listAttr.append('mail:testuser_uniqueness@sun')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 19
}
</call>
<message>'###### Add an entry containing a telephoneNumber already present in the DIT ###### '</message>
<!-- Add an entry -->
<!-- the Add must be refused with the error 19 -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness')
listAttr.append('cn:newtestuser_uniqueness')
listAttr.append('telephoneNumber:1 2 3 4')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 19
}
</call>
<message>'###### Add an entry containing a telephoneNumber not present in the DIT ###### '</message>
<!-- Add an entry -->
<!-- the Add must be accepted -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness')
listAttr.append('cn:newtestuser_uniqueness')
listAttr.append('telephoneNumber:1 2 3 4 5')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<!-- cleanup -->
<message>'###### Cleanup ###### '</message>
<message>' '</message>
<call function="'DeleteEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
#@TestMarker Plugin uniqueness
#@TestName Plugin uniqueness with multi valued attributes
#@TestPurpose Check the plugin ensures the uniqueness of the attributes multi valued
#@TestPreamble none
#@TestStep Change the type of the UID Unique Attribute to telephoneNumber
#@TestStep Check we can't add an entry with the same telephoneNumber as the user entry reference
#@TestStep the attribute telephoneNumber is multi-valued
#@TestPostamble none
#@TestResult The test is passed if the creation is refused
-->
<testcase name="getTestCaseName('Check uniqueness of attributes mutil-valued')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'###### Set the type to telephoneNumber ###### '</message>
<message>' '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'optionsString' : '--set type:telephoneNumber',
'expectedRC' : 0 }
</call>
<message>'###### Get the UID Unique Attributes ###### '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'expectedRC' : 0 }
</call>
<message>'###### Add an entry containing a telephoneNumber already present in the DIT ###### '</message>
<!-- Add an entry -->
<!-- the Add must be refused with the error 19 -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness')
listAttr.append('cn:newtestuser_uniqueness')
listAttr.append('telephoneNumber:1 2 3 4')
listAttr.append('telephoneNumber:1 2 3 4 6')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 19
}
</call>
<message>'###### Add an entry containing a telephoneNumber not present in the DIT ###### '</message>
<!-- Add an entry -->
<!-- the Add must be accepted -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness')
listAttr.append('cn:newtestuser_uniqueness')
listAttr.append('telephoneNumber:1 2 3 4 5')
listAttr.append('telephoneNumber:1 2 3 4 6')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<!-- cleanup -->
<message>'###### Cleanup ###### '</message>
<message>' '</message>
<call function="'DeleteEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
#@TestMarker Plugin uniqueness
#@TestName Plugin uniqueness with scope
#@TestPurpose Check the plugin uniqueness matchs the scope configured
#@TestPreamble none
#@TestStep Set the type of the UID Unique Attribute to description
#@TestStep Set the base-dn of the plugin to dc=example,dc=com
#@TestStep Check we can't add an entry under the restricted scope
#@TestStep Check we can add an entry outside the restricted scope
#@TestPostamble none
#@TestResult The test is passed is the plugin respectes the restricted scope
-->
<testcase name="getTestCaseName('Restrict the scope of the plugin')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'###### Set the base-dn to dc=example,%s ###### ' % DIRECTORY_INSTANCE_SFX</message>
<message>' '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'optionsString' : '--set type:telephoneNumber --set base-dn:dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'expectedRC' : 0 }
</call>
<message>'###### Get the UID Unique Attributes ###### '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'expectedRC' : 0 }
</call>
<message>'###### Add an entry under dc=example,%s ###### ' % DIRECTORY_INSTANCE_SFX</message>
<!-- Add an entry -->
<!-- the Add must be added -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness1')
listAttr.append('cn:newtestuser_uniqueness1')
listAttr.append('telephoneNumber:1 2 3 4')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness1,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<message>'###### Add an entry under dc=example,%s ###### ' % DIRECTORY_INSTANCE_SFX</message>
<message>'this operation must be rejected because of the unique attribute conflict'</message>
<!-- Add an entry -->
<!-- the Add must be refused with the error 19 -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness')
listAttr.append('cn:newtestuser_uniqueness')
listAttr.append('telephoneNumber:1 2 3 4')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 19
}
</call>
<message>'###### Add an entry under %s ###### ' % DIRECTORY_INSTANCE_SFX</message>
<!-- Add an entry -->
<!-- the Add must be accepted -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:newtestuser_uniqueness')
listAttr.append('sn:newtestuser_uniqueness')
listAttr.append('cn:newtestuser_uniqueness')
listAttr.append('telephoneNumber:1 2 3 4')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=newtestuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<!-- cleanup -->
<message>'###### Cleanup ###### '</message>
<message>' '</message>
<call function="'DeleteEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=newtestuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
}
</call>
<call function="'DeleteEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=newtestuser_uniqueness1,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
#@TestMarker Plugin uniqueness
#@TestName Disable Plugin uniqueness
#@TestPurpose Disable the plugin uniqueness
#@TestStep Disable the plugin uniqueness
#@TestStep Keep the default configuration ( ie, type = uid )
#@TestStep Add an entry containing a uid value already present in the DIT
#@TestPostamble none
#@TestResult The test is passed if the creation is accepted
-->
<testcase name="getTestCaseName('Disabled with type defined to uid')">
<sequence>
<call function="'testCase_Preamble'"/>
<message>'###### Disable the uniqueness plugin ###### '</message>
<message>' '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'optionsString' : '--set enabled:false',
'expectedRC' : 0 }
</call>
<message>'###### Get the UID Unique Attributes ###### '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'expectedRC' : 0 }
</call>
<message>'###### Add an entry ###### '</message>
<message>'-- The creation must be accepted '</message>
<!-- Add an entry -->
<!-- The add must be accepted -->
<script>
listAttr = []
listAttr.append('objectclass:top')
listAttr.append('objectclass:organizationalperson')
listAttr.append('objectclass:inetorgperson')
listAttr.append('objectclass:person')
listAttr.append('givenname:testuser_uniqueness')
listAttr.append('sn:testuser_uniqueness')
listAttr.append('cn:testuser_uniqueness')
listAttr.append('uid:testuser_uniqueness')
</script>
<call function="'addAnEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'DNToAdd' : 'uid=testuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
'listAttributes' : listAttr,
'expectedRC' : 0
}
</call>
<!-- cleanup -->
<message>'###### Cleanup ###### '</message>
<message>' '</message>
<call function="'DeleteEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=testuser_uniqueness,dc=example,%s' % DIRECTORY_INSTANCE_SFX,
}
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
<!---
#@TestMarker Plugin uniqueness
#@TestName Plugin uniqueness cleanup
#@TestPurpose Cleanup
#@TestPreamble none
#@TestStep delete the user entries
#@TestPostamble none
#@TestResult The test is passed if the delete are done
-->
<testcase name="getTestCaseName('Cleanup')">
<sequence>
<call function="'testCase_Preamble'"/>
<call function="'DeleteEntry'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST ,
'dsInstancePort' : DIRECTORY_INSTANCE_PORT ,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'dsBaseDN' : 'uid=testuser_uniqueness,%s' % DIRECTORY_INSTANCE_SFX,
}
</call>
<message>'###### Desactivate the uniqueness plugin. ###### '</message>
<message>' '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'set-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'optionsString' : '--set enabled:false',
'expectedRC' : 0 }
</call>
<message>'###### Get the UID Unique Attributes ###### '</message>
<call function="'dsconfig'">
{ 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
'dsInstanceDn' : DIRECTORY_INSTANCE_DN ,
'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD ,
'subcommand' : 'get-plugin-prop' ,
'objectType' : 'plugin-name' ,
'objectName' : 'UID Unique Attribute',
'expectedRC' : 0 }
</call>
<call function="'testCase_Postamble'"/>
</sequence>
</testcase>
</sequence>
<finally>
<sequence>
<!-- Test Suite Cleanup -->
<message>'Finally: Global Uniqueness Plugin 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>
</function>
</stax>