From 875df723561099110573d35ada24376c8a15524a Mon Sep 17 00:00:00 2001
From: gary_williams <gary_williams@localhost>
Date: Thu, 29 Jan 2009 14:19:03 +0000
Subject: [PATCH] Test suite for binary transfer option
---
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core.xml | 15
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml | 18
opendj-sdk/opends/tests/staf-tests/shared/python/common.py | 43 +
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/binaryattr/core_binaryattr.xml | 141 ++++++
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/binaryattr/core_binaryattr_tests.xml | 1047 +++++++++++++++++++++++++++++++++++++++++++++
opendj-sdk/opends/tests/staf-tests/shared/functions/environment.xml | 7
opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_setup.xml | 92 ++-
7 files changed, 1,300 insertions(+), 63 deletions(-)
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/binaryattr/core_binaryattr.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/binaryattr/core_binaryattr.xml
new file mode 100644
index 0000000..08ea6bc
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/binaryattr/core_binaryattr.xml
@@ -0,0 +1,141 @@
+<?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 2009 Sun Microsystems, Inc.
+ ! -->
+<stax>
+ <defaultcall function="core_binaryattr"/>
+ <function name="core_binaryattr" scope="local">
+ <sequence>
+ <block name="'core_binaryattr'">
+ <try>
+ <sequence>
+ <script>
+ CurrentTestPath['group']='core'
+ CurrentTestPath['suite']='binaryattr'
+
+ __group=CurrentTestPath['group']
+ __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
+ </script>
+
+ <!--- Test Suite information
+ #@TestSuiteName Binary attributes test suite
+ #@TestSuitePurpose Verify binary attributes
+ #@TestSuiteID Binary
+ #@TestSuiteGroup Core
+ #@TestGroup Core
+ #@TestScript core_binaryattr.xml
+ #@TestHTMLLink http://opends.dev.java.net/
+ -->
+ <call function="'testSuite_Preamble'"/>
+
+ <try>
+ <sequence>
+
+ <!-- List of Import of Test Functions -->
+ <script>
+ importList=[]
+ importList.append('core_setup')
+ importList.append('binaryattr/core_binaryattr_tests')
+ importList.append('core_cleanup')
+ </script>
+
+ <!-- Import the files for this test suite -->
+ <iterate var="__import" in="importList">
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/%s.xml' % (__groupdir,__import)"/>
+ </iterate>
+
+ <!-- Test Suite Setup -->
+ <call function="'%s_setup' % __group">
+ { 'initData' : False ,
+ 'loadData' : False }
+ </call>
+
+ <!-- Specific to binary attributes tests -->
+ <script>
+ server=directory_server()
+ server.location = STAF_REMOTE_HOSTNAME
+ server.host = DIRECTORY_INSTANCE_HOST
+ server.port = DIRECTORY_INSTANCE_PORT
+ server.adminport = DIRECTORY_INSTANCE_ADMIN_PORT
+ server.dn = DIRECTORY_INSTANCE_DN
+ server.password = DIRECTORY_INSTANCE_PSWD
+ server.suffix = DIRECTORY_INSTANCE_SFX
+ server.backend = DIRECTORY_INSTANCE_BE
+
+ __baseDN='o=Binary attributes tests, dc=example,%s' % server.suffix
+ </script>
+
+ <!-- List of Test Cases -->
+ <script>
+ testsList=[]
+ testsList.append('core_binaryattr_001')
+ testsList.append('core_binaryattr_002')
+ testsList.append('core_binaryattr_003')
+ testsList.append('core_binaryattr_004')
+ testsList.append('core_binaryattr_005')
+ testsList.append('core_binaryattr_006')
+ </script>
+
+ <!-- Execute the Tests -->
+ <iterate var="__test" in="testsList">
+ <sequence>
+ <call function="'%s' % (__test)" />
+ </sequence>
+ </iterate>
+
+ </sequence>
+ <catch exception="'STAFException.TestSuite.SetupException'">
+ <sequence>
+ <message log="1" level="'fatal'">
+ 'Setup of test suite failed.'
+ </message>
+ <rethrow/>
+ </sequence>
+ </catch>
+
+ <finally>
+ <message>'Test Cases Completed.'</message>
+ </finally>
+
+ </try>
+
+ </sequence>
+
+ <finally>
+ <sequence>
+ <!-- Test Suite Cleanup -->
+ <message>'Finally: Solaris Schema Cleanup.'</message>
+ <call function="'%s_cleanup' % __group"/>
+ <call function="'testSuite_Postamble'"/>
+ </sequence>
+ </finally>
+
+ </try>
+ </block>
+ </sequence>
+ </function>
+</stax>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/binaryattr/core_binaryattr_tests.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/binaryattr/core_binaryattr_tests.xml
new file mode 100644
index 0000000..a672b03
--- /dev/null
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/binaryattr/core_binaryattr_tests.xml
@@ -0,0 +1,1047 @@
+<?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 2009 Sun Microsystems, Inc.
+ ! -->
+<stax>
+
+ <!-- Definition of Test Cases -->
+
+ <!--- Test Case : Core : Binary Attributes : Makeldif-->
+ <!--- Test Case information
+ #@TestMarker Schema
+ #@TestName Core : Binary Attributes
+ #@TestID Makeldif
+ #@TestPurpose Test create of ldif using binary attributes
+ #@TestPreamble
+ #@TestSteps Make an ldif containing binary attributes
+ #@TestPostamble
+ #@TestResult Test is successful if the result code is 0
+ -->
+ <function name="core_binaryattr_001" scope="local">
+ <testcase name="getTestCaseName('Makeldif Binary Attributes.')">
+ <sequence>
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Test Name = %s' % STAXCurrentTestcase
+ </message>
+
+ <script>
+ binaryattrLdif='%s/binaryattr.ldif' % remote.temp
+ templateName='binaryattr.template'
+
+ dnList=dn2list(__baseDN)
+ dnList.reverse()
+ </script>
+
+ <!-- MakeLDIF template -->
+ <message>'Generating template (%s).' % templateName</message>
+ <script>
+ template=[]
+ template.append('define suffix=%s' % __baseDN)
+ template.append('define maildomain=%s' % dn2rfcmailaddr(server.suffix))
+ template.append('')
+
+ dnRelList=[]
+ for rdn in dnList:
+ dnRelList.insert(0,rdn.strip())
+ template.append('')
+ template.append('branch: %s' % list2dn(dnRelList))
+
+ template.append('')
+ template.append('branch: ou=people,[suffix]')
+ template.append('subordinateTemplate: certificationAuthority:1')
+ template.append('subordinateTemplate: cRLDistributionPoint:1')
+ template.append('subordinateTemplate: person:100')
+ template.append('subordinateTemplate: certificatePerson:100')
+ template.append('subordinateTemplate: photoPerson:100')
+ template.append('')
+ template.append('template: certificationAuthority')
+ template.append('rdnAttr: cn')
+ template.append('objectclass: applicationProcess')
+ template.append('objectclass: certificationAuthority')
+ template.append('cn: myCA')
+ template.append('description: The authority on certificates.')
+ template.append('cACertificate;binary:: <random:base64:20>')
+ template.append('certificateRevocationList;binary:: <random:base64:20>')
+ template.append('authorityRevocationList;binary:: <random:base64:20>')
+ template.append('crossCertificatePair;binary:: <random:base64:20>')
+ template.append('')
+ template.append('template: cRLDistributionPoint')
+ template.append('rdnAttr: cn')
+ template.append('objectclass: cRLDistributionPoint')
+ template.append('cn: myCRLDP')
+ template.append('certificateRevocationList;binary:: <random:base64:20>')
+ template.append('authorityRevocationList;binary:: <random:base64:20>')
+ template.append('deltaRevocationList;binary:: <random:base64:20>')
+ template.append('')
+ template.append('template: person')
+ template.append('rdnAttr: uid')
+ template.append('objectClass: top')
+ template.append('objectClass: person')
+ template.append('objectClass: organizationalPerson')
+ template.append('objectClass: inetOrgPerson')
+ template.append('givenName: <first>')
+ template.append('sn: <last>')
+ template.append('cn: {givenName} {sn}')
+ template.append('initials: {givenName:1}<random:chars:ABCDEFGHIJKLMNOPQRSTUVWXYZ:1>{sn:1}')
+ template.append('employeeNumber: <sequential:0>')
+ template.append('uid: user.{employeeNumber}')
+ template.append('mail: {uid}@[maildomain]')
+ template.append('userPassword: password')
+ template.append('telephoneNumber: <random:telephone>')
+ template.append('homePhone: <random:telephone>')
+ template.append('pager: <random:telephone>')
+ template.append('mobile: <random:telephone>')
+ template.append('street: <random:numeric:5> <file:streets> Street')
+ template.append('l: <file:cities>')
+ template.append('st: <file:states>')
+ template.append('postalCode: <random:numeric:5>')
+ template.append('postalAddress: {cn}${street}${l}, {st} {postalCode}')
+ template.append('description: This is the description for {cn}.')
+ template.append('')
+ template.append('template: certificatePerson')
+ template.append('rdnAttr: uid')
+ template.append('extends: person')
+ template.append('objectclass: strongauthenticationUser')
+ template.append('objectclass: userSecurityInformation')
+ template.append('userCertificate;binary:: <random:base64:1000>')
+ template.append('supportedAlgorithms;binary:: <random:base64:20>')
+ template.append('')
+ template.append('template: photoPerson')
+ template.append('rdnAttr: uid')
+ template.append('extends: person')
+ template.append('jpegPhoto:: <random:base64:2000>')
+ template.append('')
+ </script>
+
+ <!-- Write template to file -->
+ <script>
+ ftemplate=open('%s/%s' % (local.temp,templateName),'w')
+ for line in template:
+ 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 binary attributes -->
+ <call function="'runFunction'">
+ { 'functionName' : 'MakeLdifWithScript' ,
+ 'functionMessage' : 'Generate LDIF file.' ,
+ 'functionException' : 'Tools.MakeLdifException' ,
+ 'functionArguments' : { 'location' : server.location ,
+ 'templateFile' : '%s/%s' %
+ (remote.temp,templateName) ,
+ 'ldifFile' : binaryattrLdif }
+ }
+ </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>
+ <finally>
+ <call function="'testCase_Postamble'"/>
+ </finally>
+ </try>
+ </sequence>
+ </testcase>
+ </function>
+
+ <!--- Test Case : Core : Binary Attributes : Import Binary Attributes from File -->
+ <!--- Test Case information
+ #@TestMarker Schema
+ #@TestName Core : Binary Attributes
+ #@TestID Import Binary Attributes from File
+ #@TestPurpose Test import of ldif containing binary transfer option
+ #@TestPreamble
+ #@TestSteps Import ldif containing binary attributes
+ #@TestPostamble
+ #@TestResult Test is successful if the result code is 0
+ -->
+ <function name="core_binaryattr_002" scope="local">
+ <testcase name="getTestCaseName('Import Binary 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 binary attribute -->
+ <call function="'runFunction'">
+ { 'functionName' : 'ImportLdifWithScript' ,
+ 'functionMessage' : 'Import ldif file with binary 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' : 255 }
+ }
+ </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;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 ,
+ 'case' : 'ignorecase' }
+ }
+ </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 binary 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 binary 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;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>
+
+ <!-- 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>
+
+ <function name="core_binaryattr_004" scope="local">
+ <testcase name="getTestCaseName('Add userCertificate with binary transfer 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 004,ou=people,%s' % __baseDN
+ </script>
+
+ <!-- MakeLDIF template -->
+ <message>'Generating template (%s).' % templateName</message>
+ <script>
+ ldifEntry=[]
+ ldifEntry.append('branch: %s' % targetDN)
+ ldifEntry.append('subordinateTemplate: certificatePerson:10')
+ 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:10>')
+ 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;binary:: <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 binary 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;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>
+
+ <!-- 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>
+
+ <function name="core_binaryattr_005" scope="local">
+ <testcase name="getTestCaseName('Add file based userCertificate with no binary transfer option')">
+ <sequence>
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Test Name = %s' % STAXCurrentTestcase
+ </message>
+
+ <script>
+ ldifFile='userCertificate.ldif'
+ pemFile='user-cert.pem'
+ templateName='userCertificate.template'
+ orgUnit='core binaryattr 005'
+ targetDN='ou=%s,ou=people,%s' % (orgUnit,__baseDN)
+ </script>
+
+ <!-- Generate Ldif file -->
+ <message>'Generating ldif (%s).' % ldifFile</message>
+ <script>
+ ldifEntry=[]
+ ldifEntry.append('dn: %s' % targetDN)
+ ldifEntry.append('objectClass: top')
+ ldifEntry.append('objectClass: organizationalUnit')
+ ldifEntry.append('ou: %s' % orgUnit)
+ ldifEntry.append('')
+ ldifEntry.append('dn: cn=Johnny Strong, %s' % targetDN)
+ ldifEntry.append('objectClass: top')
+ ldifEntry.append('objectClass: person')
+ ldifEntry.append('objectclass: strongauthenticationUser')
+ ldifEntry.append('cn: Johnny Strong')
+ ldifEntry.append('sn: Strong')
+ ldifEntry.append('userCertificate:< file:///%s/%s' % (remote.temp,pemFile))
+ ldifEntry.append('')
+ </script>
+
+ <!-- Write template to file -->
+ <script>
+ fldif=open('%s/%s' % (local.temp,ldifFile),'w')
+ for line in ldifEntry:
+ fldif.write('%s\n' % line)
+ fldif.close()
+ </script>
+
+ <!-- Copy ldif to SUT -->
+ <call function="'copyFile'">
+ {
+ 'srcfile' : '%s/%s' % (local.temp,ldifFile),
+ 'destfile' : '%s/%s' % (remote.temp,ldifFile),
+ 'remotehost' : server.location
+ }
+ </call>
+
+ <!-- Generate PEM file -->
+ <message>'Generating ldif (%s).' % ldifFile</message>
+ <script>
+ pemEntry=[]
+ pemEntry.append('OiBzTzJVNW12Rk1weG5pL2pXV3pzcmJ2MnBPZEM')
+ </script>
+
+ <!-- Write template to file -->
+ <script>
+ fpem=open('%s/%s' % (local.temp,pemFile),'w')
+ for line in pemEntry:
+ fpem.write('%s\n' % line)
+ fpem.close()
+ </script>
+
+ <!-- Copy PEM to SUT -->
+ <call function="'copyFile'">
+ {
+ 'srcfile' : '%s/%s' % (local.temp,pemFile),
+ 'destfile' : '%s/%s' % (remote.temp,pemFile),
+ 'remotehost' : server.location
+ }
+ </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' : '%s/%s' % (remote.temp,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;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>
+
+ <!-- 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>
+
+ <function name="core_binaryattr_006" scope="local">
+ <testcase name="getTestCaseName('Add file based userCertificate with binary transfer option')">
+ <sequence>
+ <try>
+ <sequence>
+ <call function="'testCase_Preamble'"/>
+ <message>
+ 'Test Name = %s' % STAXCurrentTestcase
+ </message>
+
+ <script>
+ ldifFile='userCertificate.ldif'
+ pemFile='user-cert.pem'
+ templateName='userCertificate.template'
+ orgUnit='core binaryattr 006'
+ targetDN='ou=%s,ou=people,%s' % (orgUnit,__baseDN)
+ </script>
+
+ <!-- Generate Ldif file -->
+ <message>'Generating ldif (%s).' % ldifFile</message>
+ <script>
+ ldifEntry=[]
+ ldifEntry.append('dn: %s' % targetDN)
+ ldifEntry.append('objectClass: top')
+ ldifEntry.append('objectClass: organizationalUnit')
+ ldifEntry.append('ou: %s' % orgUnit)
+ ldifEntry.append('')
+ ldifEntry.append('dn: cn=Jeff Grapes, %s' % targetDN)
+ ldifEntry.append('objectClass: top')
+ ldifEntry.append('objectClass: person')
+ ldifEntry.append('objectclass: strongauthenticationUser')
+ ldifEntry.append('cn: Jeff Grapes')
+ ldifEntry.append('sn: Grapes')
+ ldifEntry.append('userCertificate;binary:< file:///%s/%s' % (remote.temp,pemFile))
+ ldifEntry.append('')
+ </script>
+
+ <!-- Write template to file -->
+ <script>
+ fldif=open('%s/%s' % (local.temp,ldifFile),'w')
+ for line in ldifEntry:
+ fldif.write('%s\n' % line)
+ fldif.close()
+ </script>
+
+ <!-- Copy ldif to SUT -->
+ <call function="'copyFile'">
+ {
+ 'srcfile' : '%s/%s' % (local.temp,ldifFile),
+ 'destfile' : '%s/%s' % (remote.temp,ldifFile),
+ 'remotehost' : server.location
+ }
+ </call>
+
+ <!-- Generate PEM file -->
+ <message>'Generating ldif (%s).' % ldifFile</message>
+ <script>
+ pemEntry=[]
+ pemEntry.append('OiBzTzJVNW12Rk1weG5pL2pXV3pzcmJ2MnBPZEM')
+ </script>
+
+ <!-- Write template to file -->
+ <script>
+ fpem=open('%s/%s' % (local.temp,pemFile),'w')
+ for line in pemEntry:
+ fpem.write('%s\n' % line)
+ fpem.close()
+ </script>
+
+ <!-- Copy PEM to SUT -->
+ <call function="'copyFile'">
+ {
+ 'srcfile' : '%s/%s' % (local.temp,pemFile),
+ 'destfile' : '%s/%s' % (remote.temp,pemFile),
+ 'remotehost' : server.location
+ }
+ </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' : '%s/%s' % (remote.temp,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;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>
+
+ <!-- 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>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core.xml
index 63425d0..d25a2e8 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core.xml
@@ -23,7 +23,7 @@
!
! CDDL HEADER END
!
- ! Copyright 2006-2008 Sun Microsystems, Inc.
+ ! Copyright 2006-2009 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="main_core" />
@@ -33,12 +33,12 @@
</function-list-args>
<block name="'core'">
<sequence>
- <!--- Load the job environment for the test group execution -->
- <import machine="STAF_LOCAL_HOSTNAME"
- file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
- <call function="'loadJobEnvironment'">
- { 'parent' : STAXParentID }
- </call>
+ <!--- Load the job environment for the test group execution -->
+ <import machine="STAF_LOCAL_HOSTNAME"
+ file="'%s/environment.xml' % TESTS_FUNCTIONS_DIR" />
+ <call function="'loadJobEnvironment'">
+ { 'parent' : STAXParentID }
+ </call>
<script>
CurrentTestPath['group']='core'
</script>
@@ -53,6 +53,7 @@
testList.append(['controls','core_ctrls_authorization_id'])
testList.append(['controls','core_ctrls_assertion'])
testList.append(['controls','core_ctrls_matched_values'])
+ testList.append(['binaryattr','core_binaryattr'])
</script>
<iterate var="_test" in="testList">
<sequence>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_setup.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_setup.xml
index 70dd842..856871b 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_setup.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/core/core_setup.xml
@@ -23,11 +23,29 @@
!
! CDDL HEADER END
!
- ! Copyright 2006-2008 Sun Microsystems, Inc.
+ ! Copyright 2006-2009 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="core_setup" />
<function name="core_setup">
+ <function-prolog>
+ Set up the core test group
+ </function-prolog>
+ <function-map-args>
+ <function-arg-def name="initData" type="optional" default="True">
+ <function-arg-description>
+ Initialize the data for the core test group
+ </function-arg-description>
+ <function-arg-property name="type" value="integer"/>
+ </function-arg-def>
+ <function-arg-def name="loadData" type="optional" default="True">
+ <function-arg-description>
+ Load the data for the core test group
+ </function-arg-description>
+ <function-arg-property name="type" value="integer"/>
+ </function-arg-def>
+ </function-map-args>
+
<sequence>
<block name="'setup'">
<sequence>
@@ -38,7 +56,7 @@
'Create DS topology as described in config.py'
</message>
<call function="'createTopology'">
- { 'initialiseInstance' : True }
+ { 'initialiseInstance' : initData }
</call>
<call function="'checkRC'">
{ 'returncode' : RC ,
@@ -68,40 +86,42 @@
</sequence>
<!--- End Block DS Process Active -->
</block>
-
- <block name="'Block DS Load Data'">
- <!-- Load the data needed by the test suite -->
- <sequence>
- <message>
- 'Add entries that are required for the Core Tests'
- </message>
- <call function="'addEntry'">
- { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
- 'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
- 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
- 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
- 'entryToBeAdded' : '%s/core/ldifs/core_start.ldif'
- % remote.data,
- 'verbose' : False
- }
- </call>
- <message>
- 'Add 1000 extra entries that are required for some of the \
- Core Tests'
- </message>
- <call function="'addEntry'">
- { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
- 'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
- 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
- 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
- 'entryToBeAdded' : '%s/core/ldifs/core_test_1K.ldif'
- % remote.data,
- 'verbose' : False
- }
- </call>
- </sequence>
- <!-- End Block DS Load Data -->
- </block>
+
+ <if expr='loadData == True'>
+ <block name="'Block DS Load Data'">
+ <!-- Load the data needed by the test suite -->
+ <sequence>
+ <message>
+ 'Add entries that are required for the Core Tests'
+ </message>
+ <call function="'addEntry'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'entryToBeAdded' : '%s/core/ldifs/core_start.ldif'
+ % remote.data,
+ 'verbose' : False
+ }
+ </call>
+ <message>
+ 'Add 1000 extra entries that are required for some of the \
+ Core Tests'
+ </message>
+ <call function="'addEntry'">
+ { 'dsInstanceHost' : DIRECTORY_INSTANCE_HOST,
+ 'dsInstancePort' : DIRECTORY_INSTANCE_PORT,
+ 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
+ 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
+ 'entryToBeAdded' : '%s/core/ldifs/core_test_1K.ldif'
+ % remote.data,
+ 'verbose' : False
+ }
+ </call>
+ </sequence>
+ <!-- End Block DS Load Data -->
+ </block>
+ </if>
</sequence>
</block>
</sequence>
diff --git a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml
index ae9a155..6b64f5a 100644
--- a/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml
+++ b/opendj-sdk/opends/tests/staf-tests/functional-tests/testcases/schema/schema.xml
@@ -23,7 +23,7 @@
!
! CDDL HEADER END
!
- ! Copyright 2006-2008 Sun Microsystems, Inc.
+ ! Copyright 2006-2009 Sun Microsystems, Inc.
! -->
<stax>
<defaultcall function="main_schema"/>
@@ -77,22 +77,6 @@
server.dn = DIRECTORY_INSTANCE_DN
server.password = DIRECTORY_INSTANCE_PSWD
server.suffix = DIRECTORY_INSTANCE_SFX
-
- def parse_stax_result(result):
-
- if result.__class__ is org.python.core.PyList:
- _unwrapResult=result[1][0]
-
- try:
- _functionString=_unwrapResult[1]
- except AttributeError:
- _functionString='Unable to parse result.'
- elif result.__class__ is org.python.core.PyString:
- _functionString=STAXResult
- else:
- _functionString='Unable to parse result.'
-
- return _functionString
</script>
<!-- Run the test suites -->
diff --git a/opendj-sdk/opends/tests/staf-tests/shared/functions/environment.xml b/opendj-sdk/opends/tests/staf-tests/shared/functions/environment.xml
index dc3e333..8203c65 100755
--- a/opendj-sdk/opends/tests/staf-tests/shared/functions/environment.xml
+++ b/opendj-sdk/opends/tests/staf-tests/shared/functions/environment.xml
@@ -23,7 +23,7 @@
!
! CDDL HEADER END
!
- ! Copyright 2007-2008 Sun Microsystems, Inc.
+ ! Copyright 2007-2009 Sun Microsystems, Inc.
! -->
<stax>
@@ -461,6 +461,11 @@
<message>
'Load environment for test suite execution.'
</message>
+
+ <!-- All exceptions are logged to user log -->
+ <script>
+ STAXLogMessage = 1
+ </script>
<call function="'importSharedLibraries'"/>
diff --git a/opendj-sdk/opends/tests/staf-tests/shared/python/common.py b/opendj-sdk/opends/tests/staf-tests/shared/python/common.py
index afa72c0..5fd0ff0 100644
--- a/opendj-sdk/opends/tests/staf-tests/shared/python/common.py
+++ b/opendj-sdk/opends/tests/staf-tests/shared/python/common.py
@@ -23,7 +23,7 @@
# CDDL HEADER END
#
#
-# Copyright 2007-2008 Sun Microsystems, Inc.
+# Copyright 2007-2009 Sun Microsystems, Inc.
__version__ = "$Revision$"
# $Source$
@@ -41,7 +41,11 @@
"directory_server",
"test_env",
"staf_service",
- "get_test_name" ]
+ "get_test_name",
+ "parse_stax_result",
+ "dn2list",
+ "list2dn",
+ "dn2rfcmailaddr" ]
class format_testcase:
'Format the Test name objects'
@@ -247,6 +251,7 @@
self.port=''
self.dn=''
self.password=''
+ self.backend=''
def location(self,location):
return location
@@ -269,6 +274,9 @@
def suffix(self,sfx):
return sfx
+ def backend(self,be):
+ return be
+
class staf_service:
'Container to hold staf service instance objects'
def __init__(self,host,name):
@@ -547,5 +555,36 @@
i=i+1
return __name[0:-1].strip()
+def parse_stax_result(result):
+ import org.python.core
+
+ if result.__class__ is org.python.core.PyList:
+ _unwrapResult=result[1][0]
+
+ try:
+ _functionString=_unwrapResult[1]
+ except AttributeError:
+ _functionString='Unable to parse result.'
+ elif result.__class__ is org.python.core.PyString:
+ _functionString=STAXResult
+ else:
+ _functionString='Unable to parse result.'
+
+ return _functionString
+
+def dn2list(dn):
+ __list=dn.split(',')
+ return __list
+
+def list2dn(list):
+ return ",".join(list)
+
+def dn2rfcmailaddr(dn):
+ __addr=[]
+ __list=dn.split(',')
+ for __rdn in __list:
+ __rhside=__rdn.split('=')[1]
+ __addr.append(__rhside)
+ return ".".join(__addr).lower()
--
Gitblit v1.10.0