mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

maudj
25.29.2010 c764e050406abe2631593bc719526d3e1bf2c9ce
add new core/collectiveattr testsuite - maudj
3 files added
884 ■■■■■ changed files
opends/tests/staf-tests/functional-tests/testcases/core/collectiveattr/core_collectiveattr.xml 145 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/core/collectiveattr/core_collectiveattr_tests.xml 276 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/core/collectiveattr/core_collectiveattr_tests_bk.xml 463 ●●●●● patch | view | raw | blame | history
opends/tests/staf-tests/functional-tests/testcases/core/collectiveattr/core_collectiveattr.xml
New file
@@ -0,0 +1,145 @@
<?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>
  <defaultcall function="core_collectiveattr"/>
  <function name="core_collectiveattr" scope="local">
    <sequence>
      <block name="'core_collectiveattr'">
        <try>
          <sequence>
            <script>
              CurrentTestPath['group']='core'
              CurrentTestPath['suite']='collectiveattr'
              __group=CurrentTestPath['group']
              __groupdir='%s/testcases/%s' % (TESTS_DIR,__group)
            </script>
            <!--- Test Suite information
            #@TestSuiteName       Collective attributes test suite
            #@TestSuitePurpose    Verify collective attributes
            #@TestSuiteID         Collective
            #@TestSuiteGroup      Core
            #@TestGroup           Core
            #@TestScript          core_collectiveattr.xml
            #@TestHTMLLink        http://opends.dev.java.net/
            -->
            <call function="'testSuite_Preamble'"/>
           <call function="'common_setup'">
              {
                'quickStart'  : False,
                'startServer' : True,
                'stopServer'  : False,
                'loadData'    : True,
                'ldifFile'    : '%s/core/ldifs/core_collectiveattr.ldif' % remote.data
              }
            </call>
            <try>
              <sequence>
                <!-- List of Import of Test Functions -->
                <script>
                  importList=[]
                  importList.append('collectiveattr/core_collectiveattr_tests')
                </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>
                <!-- Specific to collective attributes tests -->
                <script>
                  __baseDN='o=Collective attributes tests, dc=example,%s' % server.suffix
                </script>
                <!-- List of Test Cases -->
                <!-- Short tests: tests 001 to   -->
                <!-- Long tests: tests  -->
                <script>
                  testsList=[]
                  testsList.append('core_collectiveattr_001')
                  testsList.append('core_collectiveattr_002')
                  #testsList.append('core_collectiveattr_003')
                  #testsList.append('core_collectiveattr_004')
                  #testsList.append('core_collectiveattr_005')
                  #testsList.append('core_collectiveattr_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: Controls Cleanup.'</message>
              <try>
                <call function="'common_cleanup'" />
              <catch exception="'STAFException'">
                <sequence>
                  <message log="1" level="'fatal'">'Cleanup of test suite failed.'</message>
                </sequence>
              </catch>
              <finally>
                <call function="'testSuite_Postamble'"/>
              </finally>
              </try>
            </sequence>
          </finally>
        </try>
      </block>
    </sequence>
  </function>
</stax>
opends/tests/staf-tests/functional-tests/testcases/core/collectiveattr/core_collectiveattr_tests.xml
New file
@@ -0,0 +1,276 @@
<?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 2 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>
            coreattrLdif1='%s/core/ldifs/collectiveattr-1.ldif' % remote.data
            baseDN='ou=People,o=collectiveattr tests,dc=example,dc=com'
            targetDN1='uid=kwinters,ou=North,ou=America,%s' % baseDN
            targetDN2='uid=abergin,ou=Europe,%s' % baseDN
            </script>
            <message>'++ Add collective attribute secretary, should pass'</message>
            <call function="'ldapModifyWithScript'">
              {
                'dsAdd'            : 'True' ,
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsFilename'       : coreattrLdif1
              }
            </call>
            <message>'++ Search attribute secretary in user kwinters'</message>
            <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : targetDN1 ,
                'dsFilter'         : 'objectclass=*' ,
                'dsAttributes'     : 'secretary'
              }
            </call>
            <script>
                  returnString = STAXResult[0][1]
            </script>
            <call function="'searchString'">
              { 'expectedString' : 'secretary: uid=tmorris,ou=Asia,',
                'returnString'   : returnString ,
                'expectedRC'     : expectedRC ,
              }
            </call>
            <message>'++ Search attribute collectiveAttributeSubentries in user kwinters'</message>
            <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : targetDN1 ,
                'dsFilter'         : 'objectclass=*' ,
                'dsAttributes'     : 'collectiveAttributeSubentries'
              }
            </call>
            <script>
                returnString = STAXResult[0][1]
            </script>
            <call function="'searchString'">
              { 'expectedString' : 'collectiveAttributeSubentries: cn=Collective Secretary,',
                'returnString'   : returnString ,
                'expectedRC'     : expectedRC ,
              }
            </call>
            <message>'++ Search attribute secretary in user abergin'</message>
            <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : targetDN2 ,
                'dsFilter'         : 'objectclass=*' ,
                'dsAttributes'     : 'secretary'
              }
            </call>
            <script>
                returnString = STAXResult[0][1]
            </script>
            <call function="'searchString'">
              { 'expectedString' : 'secretary: uid=tmorris,ou=Asia,',
                'returnString'   : returnString ,
                'expectedRC'     : expectedRC ,
              }
            </call>
        </sequence>
        <catch exception="'STAXException.*'" typevar="eType" var="eInfo">
          <message log="1" level="'fatal'">
            '%s: Test failed. eInfo(%s)' % (eType,eInfo)
          </message>
        </catch>
          <finally>
            <call function="'testCase_Postamble'"/>
          </finally>
        </try>
      </sequence>
    </testcase>
  </function>
  <!--- Test Case : Core : Collective Attributes :  -->
  <!--- Test Case information
  #@TestMarker          Schema
  #@TestName            Core : Collective Attributes
  #@TestID              core_collectiveattr_002
  #@TestPurpose         Modify the value of the collective attribute
  #@TestPreamble
  #@TestSteps           Modify the value of the collective attribute secretary
  #@TestSteps           Verify in one entry the attribute value has changed.
  #@TestPostamble
  #@TestResult          Test is successful if the result code is 0
  -->
  <function name="core_collectiveattr_002" scope="local">
    <testcase name="getTestCaseName('Modify the value of the Collective Attribute ')">
      <sequence>
        <try>
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>
               'Test Name = %s' % STAXCurrentTestcase
            </message>
          <script>
            coreattrLdif2='%s/core/ldifs/collectiveattr-2.ldif' % remote.data
            baseDN='ou=People,o=collectiveattr tests,dc=example,dc=com'
            targetDN1='uid=kwinters,ou=North,ou=America,%s' % baseDN
            targetDN2='uid=abergin,ou=Europe,%s' % baseDN
          </script>
            <message>'++ Add collective attribute secretary, should pass'</message>
            <call function="'ldapModifyWithScript'">
              {
                'dsAdd'            : 'True' ,
                'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsFilename'       : coreattrLdif2
              }
            </call>
            <message>'++ Search attribute secretary in user kwinters'</message>
            <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : targetDN1 ,
                'dsFilter'         : 'objectclass=*' ,
                'dsAttributes'     : 'secretary'
              }
            </call>
            <script>
                returnString = STAXResult[0][1]
            </script>
            <call function="'searchString'">
              { 'expectedString' : 'secretary: uid=dmiller,ou=America,',
                'returnString'   : returnString ,
                'expectedRC'     : 0 ,
              }
            </call>
            <message>'++ Search attribute collectiveAttributeSubentries in user kwinters'</message>
            <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : targetDN1 ,
                'dsFilter'         : 'objectclass=*' ,
                'dsAttributes'     : 'collectiveAttributeSubentries'
              }
            </call>
            <script>
                returnString = STAXResult[0][1]
            </script>
            <call function="'searchString'">
              { 'expectedString' : 'collectiveAttributeSubentries: cn=Collective Secretary,',
                'returnString'   : returnString ,
                'expectedRC'     : 0 ,
              }
            </call>
            <message>'++ Search attribute secretary in user abergin'</message>
            <call function="'ldapSearchWithScript'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : DIRECTORY_INSTANCE_DN ,
                'dsInstancePswd'   : DIRECTORY_INSTANCE_PSWD ,
                'dsBaseDN'         : targetDN2 ,
                'dsFilter'         : 'objectclass=*' ,
                'dsAttributes'     : 'secretary'
              }
            </call>
            <script>
                returnString = STAXResult[0][1]
            </script>
            <call function="'searchString'">
              { 'expectedString' : 'secretary: uid=dmiller,ou=America,',
                'returnString'   : returnString ,
                'expectedRC'     : 0 ,
              }
            </call>
        </sequence>
        <catch exception="'STAXException.*'" typevar="eType" var="eInfo">
          <message log="1" level="'fatal'">
            '%s: Test failed. eInfo(%s)' % (eType,eInfo)
          </message>
        </catch>
          <finally>
            <call function="'testCase_Postamble'"/>
          </finally>
        </try>
      </sequence>
    </testcase>
  </function>
</stax>
opends/tests/staf-tests/functional-tests/testcases/core/collectiveattr/core_collectiveattr_tests_bk.xml
New file
@@ -0,0 +1,463 @@
<?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: &lt;first>')
              ldifEntry.append('sn: &lt;last>')
              ldifEntry.append('cn: {givenName} {sn}')
              ldifEntry.append('employeeNumber: &lt;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: &lt;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>