| New file |
| | |
| | | <?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 2010 Sun Microsystems, Inc. |
| | | ! --> |
| | | <stax> |
| | | |
| | | <!-- Definition of Test Cases --> |
| | | |
| | | <!--- Test Case : Core : Collective Attributes : core_collectiveattr_001 --> |
| | | <!--- Test Case information |
| | | #@TestMarker Schema |
| | | #@TestName Core : Collective Attributes |
| | | #@TestID core_collectiveattr_001 |
| | | #@TestPurpose Create and add a collective attribute |
| | | #@TestPreamble |
| | | #@TestSteps add collective attribute with attributename;collective |
| | | #@TestSteps (with secretary) verify in the entries that |
| | | #@TestSteps attribute has been added |
| | | #@TestPostamble |
| | | #@TestResult Test is successful if the result code is 0 |
| | | --> |
| | | <function name="core_collectiveattr_001" scope="local"> |
| | | <testcase name="getTestCaseName('Create and add a Collective Attribute')"> |
| | | <sequence> |
| | | <try> |
| | | <sequence> |
| | | <call function="'testCase_Preamble'"/> |
| | | <message> |
| | | 'Test Name = %s' % STAXCurrentTestcase |
| | | </message> |
| | | |
| | | <script> |
| | | coreattrLdif='%s/core/ldifs/collectiveattr-1.ldif' % remote.data |
| | | baseDN='ou=People,o=collectiveattr tests,dc=example,dc=com' |
| | | targetDN='uid=kwinters,ou=North,ou=America,%s' % baseDN |
| | | </script> |
| | | |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'ldapModifyWithScript' , |
| | | 'functionMessage' : 'Add ldif with secretary;collective', |
| | | 'functionException' : 'LDAP.AddException' , |
| | | 'functionArguments' : { 'location' : server.location , |
| | | 'dsInstanceHost': server.host , |
| | | 'dsInstancePort': server.port , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd': server.password , |
| | | 'dsAdd' : 'TRUE' , |
| | | 'dsFilename' : coreattrLdif } |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | | _functionResult=parse_stax_result(STAXResult) |
| | | </script> |
| | | |
| | | <!-- Search for the secretary attributes--> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'ldapSearchWithScript' , |
| | | 'functionMessage' : 'Search for the secretary entry.' , |
| | | 'functionException' : 'LDAP.SearchException' , |
| | | 'functionArguments' : { 'dsInstanceHost' : server.host , |
| | | 'dsInstancePort' : server.port , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'dsBaseDN' : targetDN , |
| | | 'dsFilter' : 'objectclass=*' , |
| | | 'dsAttributes' : 'secretary' } |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | | _functionResult=parse_stax_result(STAXResult) |
| | | </script> |
| | | |
| | | <!-- Check that secretary is returned in search result --> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'checktestString' , |
| | | 'functionMessage' : 'Check secretary attribute is returned.' , |
| | | 'functionException' : 'Utils.CheckStringException' , |
| | | 'functionArguments' : { 'expectedString' : 'secretary' , |
| | | 'returnString' : _functionResult } |
| | | } |
| | | </call> |
| | | |
| | | </sequence> |
| | | <catch exception="'STAXException.LDAP.AddException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: LdapAdd failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <catch exception="'STAXException.LDAP.SearchException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: LDAPSearch failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <catch exception="'STAXException.Utils.CheckStringException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: UtilsCheck failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <finally> |
| | | <call function="'testCase_Postamble'"/> |
| | | </finally> |
| | | </try> |
| | | </sequence> |
| | | </testcase> |
| | | </function> |
| | | |
| | | <!--- Test Case : Core : Collective Attributes : Import Collective Attributes from File --> |
| | | <!--- Test Case information |
| | | #@TestMarker Schema |
| | | #@TestName Core : Collective Attributes |
| | | #@TestID Import Collective Attributes from File |
| | | #@TestPurpose Test import of ldif containing collective transfer option |
| | | #@TestPreamble |
| | | #@TestSteps Import ldif containing collective attributes |
| | | #@TestPostamble |
| | | #@TestResult Test is successful if the result code is 0 |
| | | --> |
| | | <function name="core_binaryattr_002" scope="local"> |
| | | <testcase name="getTestCaseName('Import Collective Attributes from File.')"> |
| | | <sequence> |
| | | <try> |
| | | <sequence> |
| | | <call function="'testCase_Preamble'"/> |
| | | <message> |
| | | 'Test Name = %s' % STAXCurrentTestcase |
| | | </message> |
| | | |
| | | <script> |
| | | binaryattrLdif='%s/binaryattr.ldif' % remote.temp |
| | | templateName='binaryattr.template' |
| | | </script> |
| | | |
| | | <!-- On line import of ldif file containing collective attribute --> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'ImportLdifWithScript' , |
| | | 'functionMessage' : 'Import ldif file with collective entries' , |
| | | 'functionException' : 'Admin.ImportException' , |
| | | 'functionArguments' : { 'location' : server.location , |
| | | 'dsInstanceHost' : server.host , |
| | | 'dsInstanceAdminPort' : server.adminport , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'dsBackEnd' : server.backend , |
| | | 'dsLdifFile' : binaryattrLdif , |
| | | 'dsRejectFile' : '%s/rejects.txt' % remote.temp } |
| | | } |
| | | </call> |
| | | |
| | | <!-- Check that the import task is complete--> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'manage-tasks' , |
| | | 'functionMessage' : 'Manage the online import task' , |
| | | 'functionException' : 'Admin.ManageTaskException' , |
| | | 'functionArguments' : { 'location' : server.location , |
| | | 'dsInstanceHost' : server.host , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'dsQuiet' : ' ' } |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | | _functionResult=parse_stax_result(STAXResult) |
| | | </script> |
| | | |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'searchStringForSubstring' , |
| | | 'functionMessage' : 'Check import is completed successfully.' , |
| | | 'functionException' : 'Utils.CheckStringException' , |
| | | 'functionArguments' : { 'returnString' : _functionResult , |
| | | 'testString' : 'Completed successfully' , |
| | | 'expectedResult' : '1' } |
| | | } |
| | | </call> |
| | | |
| | | <!-- Count the number of entries in backend --> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'ldapSearchWithScript' , |
| | | 'functionMessage' : 'Count number of imported entries.' , |
| | | 'functionException' : 'LDAP.SearchException' , |
| | | 'functionArguments' : { 'dsInstanceHost' : server.host , |
| | | 'dsInstancePort' : server.port , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'dsBaseDN' : __baseDN , |
| | | 'dsFilter' : 'objectclass=*' , |
| | | 'dsAttributes' : 'dn' , |
| | | 'dsCountEntries' : 'True' , |
| | | 'expectedRC' : 0 } |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | | _functionResult=parse_stax_result(STAXResult) |
| | | </script> |
| | | |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'searchStringForSubstring' , |
| | | 'functionMessage' : 'Check import is completed successfully.' , |
| | | 'functionException' : 'Utils.CheckStringException' , |
| | | 'functionArguments' : { 'returnString' : _functionResult , |
| | | 'testString' : 'Total number of matching entries: 304' , |
| | | 'expectedResult' : '1' } |
| | | } |
| | | </call> |
| | | |
| | | <!-- Search for the usercertificate attributes--> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'ldapSearchWithScript' , |
| | | 'functionMessage' : 'Search for the usercertificate entry.' , |
| | | 'functionException' : 'LDAP.SearchException' , |
| | | 'functionArguments' : { 'dsInstanceHost' : server.host , |
| | | 'dsInstancePort' : server.port , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'dsBaseDN' : __baseDN , |
| | | 'dsFilter' : 'objectclass=*' , |
| | | 'dsAttributes' : 'usercertificate' } |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | | _functionResult=parse_stax_result(STAXResult) |
| | | </script> |
| | | |
| | | <!-- Check that usercertificate;collective is returned in search result --> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'checktestString' , |
| | | 'functionMessage' : 'Check usercertificate attribute is returned.' , |
| | | 'functionException' : 'Utils.CheckStringException' , |
| | | 'functionArguments' : { 'expectedString' : 'usercertificate;collective' , |
| | | 'returnString' : _functionResult } |
| | | } |
| | | </call> |
| | | </sequence> |
| | | <catch exception="'STAXException.Admin.ImportException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: Import failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <catch exception="'STAXException.Admin.ManageTaskException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: ManageTask failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <catch exception="'STAXException.LDAP.SearchException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: LDAPSearch failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <catch exception="'STAXException.Utils.CheckStringException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: UtilsCheck failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <finally> |
| | | <call function="'testCase_Postamble'"/> |
| | | </finally> |
| | | </try> |
| | | </sequence> |
| | | </testcase> |
| | | </function> |
| | | |
| | | <function name="core_binaryattr_003" scope="local"> |
| | | <testcase name="getTestCaseName('Add userCertificate no collective option.')"> |
| | | <sequence> |
| | | <try> |
| | | <sequence> |
| | | <call function="'testCase_Preamble'"/> |
| | | <message> |
| | | 'Test Name = %s' % STAXCurrentTestcase |
| | | </message> |
| | | |
| | | <script> |
| | | ldifFile='%s/userCertificate.ldif' % remote.temp |
| | | templateName='userCertificate.template' |
| | | targetDN='ou=core binaryattr 003,ou=people,%s' % __baseDN |
| | | </script> |
| | | |
| | | <!-- MakeLDIF template --> |
| | | <message>'Generating template (%s).' % templateName</message> |
| | | <script> |
| | | ldifEntry=[] |
| | | ldifEntry.append('branch: %s' % targetDN) |
| | | ldifEntry.append('subordinateTemplate: certificatePerson:5') |
| | | ldifEntry.append('') |
| | | ldifEntry.append('template: person') |
| | | ldifEntry.append('rdnAttr: uid') |
| | | ldifEntry.append('objectClass: top') |
| | | ldifEntry.append('objectClass: person') |
| | | ldifEntry.append('objectClass: organizationalPerson') |
| | | ldifEntry.append('objectClass: inetOrgPerson') |
| | | ldifEntry.append('givenName: <first>') |
| | | ldifEntry.append('sn: <last>') |
| | | ldifEntry.append('cn: {givenName} {sn}') |
| | | ldifEntry.append('employeeNumber: <sequential:0>') |
| | | ldifEntry.append('uid: stronguser.{employeeNumber}') |
| | | ldifEntry.append('') |
| | | ldifEntry.append('template: certificatePerson') |
| | | ldifEntry.append('rdnAttr: uid') |
| | | ldifEntry.append('extends: person') |
| | | ldifEntry.append('objectclass: strongauthenticationUser') |
| | | ldifEntry.append('userCertificate: <random:base64:1000>') |
| | | ldifEntry.append('') |
| | | </script> |
| | | |
| | | <!-- Write template to file --> |
| | | <script> |
| | | ftemplate=open('%s/%s' % (local.temp,templateName),'w') |
| | | for line in ldifEntry: |
| | | ftemplate.write('%s\n' % line) |
| | | ftemplate.close() |
| | | </script> |
| | | |
| | | <!-- Copy template to SUT --> |
| | | <call function="'copyFile'"> |
| | | { |
| | | 'srcfile' : '%s/%s' % (local.temp,templateName), |
| | | 'destfile' : '%s/%s' % (remote.temp,templateName), |
| | | 'remotehost' : server.location |
| | | } |
| | | </call> |
| | | |
| | | <!-- Generate an ldif file containing collective attributes --> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'MakeLdifWithScript' , |
| | | 'functionMessage' : 'Generate LDIF file.' , |
| | | 'functionException' : 'Tools.MakeLdifException' , |
| | | 'functionArguments' : { 'location' : server.location , |
| | | 'templateFile' : '%s/%s' % |
| | | (remote.temp,templateName) , |
| | | 'ldifFile' : ldifFile } |
| | | } |
| | | </call> |
| | | |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'ldapModifyWithScript' , |
| | | 'functionMessage' : 'Add ldif with userCertificate;binary entry' , |
| | | 'functionException' : 'LDAP.AddException' , |
| | | 'functionArguments' : { 'location' : server.location , |
| | | 'dsInstanceHost': server.host , |
| | | 'dsInstancePort': server.port , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd': server.password , |
| | | 'dsAdd' : 'TRUE' , |
| | | 'dsFilename' : ldifFile } |
| | | } |
| | | </call> |
| | | |
| | | <!-- Search for the usercertificate attributes--> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'ldapSearchWithScript' , |
| | | 'functionMessage' : 'Search for the userCertificate entry.' , |
| | | 'functionException' : 'LDAP.SearchException' , |
| | | 'functionArguments' : { 'dsInstanceHost' : server.host , |
| | | 'dsInstancePort' : server.port , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'dsBaseDN' : targetDN , |
| | | 'dsFilter' : 'objectclass=*' , |
| | | 'dsAttributes' : 'usercertificate' } |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | | _functionResult=parse_stax_result(STAXResult) |
| | | </script> |
| | | |
| | | <!-- Check that usercertificate;collective is returned in search result --> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'checktestString' , |
| | | 'functionMessage' : 'Check userCertificate attribute is returned.' , |
| | | 'functionException' : 'Utils.CheckStringException' , |
| | | 'functionArguments' : { 'expectedString' : 'usercertificate;binary' , |
| | | 'returnString' : _functionResult } |
| | | } |
| | | </call> |
| | | |
| | | <!-- Search for the usercertificate attributes--> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'ldapSearchWithScript' , |
| | | 'functionMessage' : 'Search for the userCertificate entry.' , |
| | | 'functionException' : 'LDAP.SearchException' , |
| | | 'functionArguments' : { 'dsInstanceHost' : server.host , |
| | | 'dsInstancePort' : server.port , |
| | | 'dsInstanceDn' : server.dn , |
| | | 'dsInstancePswd' : server.password , |
| | | 'dsBaseDN' : targetDN , |
| | | 'dsFilter' : 'objectclass=*' , |
| | | 'dsAttributes' : 'usercertificate;binary' } |
| | | } |
| | | </call> |
| | | |
| | | <script> |
| | | _functionResult=parse_stax_result(STAXResult) |
| | | </script> |
| | | |
| | | <!-- Check that usercertificate;binary is returned in search result --> |
| | | <call function="'runFunction'"> |
| | | { 'functionName' : 'checktestString' , |
| | | 'functionMessage' : 'Check userCertificate attribute is returned.' , |
| | | 'functionException' : 'Utils.CheckStringException' , |
| | | 'functionArguments' : { 'expectedString' : 'usercertificate;binary' , |
| | | 'returnString' : _functionResult } |
| | | } |
| | | </call> |
| | | |
| | | </sequence> |
| | | <catch exception="'STAXException.Tools.MakeLdifException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: MakeLdif failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <catch exception="'STAXException.LDAP.AddException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: LdapAdd failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <catch exception="'STAXException.LDAP.SearchException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: LDAPSearch failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <catch exception="'STAXException.Utils.CheckStringException'" typevar="eType" var="eInfo"> |
| | | <message log="1" level="'fatal'"> |
| | | '%s: UtilsCheck failed. eInfo(%s)' % (eType,eInfo) |
| | | </message> |
| | | </catch> |
| | | <finally> |
| | | <call function="'testCase_Postamble'"/> |
| | | </finally> |
| | | </try> |
| | | </sequence> |
| | | </testcase> |
| | | </function> |
| | | |
| | | |
| | | </stax> |